Rockbox open source high quality audio player as a Music Player Daemon
mpris rockbox mpd libadwaita audio rust zig deno
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

imx233: use tick insteaf of msec to collect statistics

The current code uses the msec irq to collect statistics and
detect irq storms (debug). But this irq is triggered 1000 times
per sec and we don't need that accuracy. This commit removes the
msec irq and use the tick timer instead which is triggered only
100 times per second.

Change-Id: If14b9503c89a3af370ef322678f10e35fafb4b8a

+18 -18
+8 -8
firmware/target/arm/imx233/icoll-imx233.c
··· 21 21 22 22 #include "icoll-imx233.h" 23 23 #include "rtc-imx233.h" 24 + #include "kernel-imx233.h" 24 25 #include "string.h" 25 26 26 27 #define default_interrupt(name) \ ··· 61 62 default_interrupt(INT_ADC_ERROR); 62 63 default_interrupt(INT_DCP); 63 64 default_interrupt(INT_TOUCH_DETECT); 65 + default_interrupt(INT_RTC_1MSEC); 64 66 65 67 void INT_RTC_1MSEC(void); 66 68 ··· 102 104 [INT_SRC_RTC_1MSEC] = INT_RTC_1MSEC, 103 105 }; 104 106 105 - #define IRQ_STORM_DELAY 1000 /* ms */ 106 - #define IRQ_STORM_THRESHOLD 100000 /* allows irq / delay */ 107 + #define IRQ_STORM_DELAY 100 /* ms */ 108 + #define IRQ_STORM_THRESHOLD 10000 /* allows irq / delay */ 107 109 108 110 static uint32_t irq_count_old[INT_SRC_NR_SOURCES]; 109 111 static uint32_t irq_count[INT_SRC_NR_SOURCES]; ··· 116 118 return info; 117 119 } 118 120 119 - void INT_RTC_1MSEC(void) 121 + static void do_irq_stat(void) 120 122 { 121 123 static unsigned counter = 0; 122 - if(counter++ >= IRQ_STORM_DELAY) 124 + if(counter++ >= HZ) 123 125 { 124 126 counter = 0; 125 127 memcpy(irq_count_old, irq_count, sizeof(irq_count)); 126 128 memset(irq_count, 0, sizeof(irq_count)); 127 129 } 128 - imx233_rtc_clear_msec_irq(); 129 130 } 130 131 131 132 static void UIRQ(void) ··· 140 141 int irq_nr = (HW_ICOLL_VECTOR - HW_ICOLL_VBASE) / 4; 141 142 if(irq_count[irq_nr]++ > IRQ_STORM_THRESHOLD) 142 143 panicf("IRQ %d: storm detected", irq_nr); 144 + if(irq_nr == INT_SRC_TIMER(TICK_TIMER_NR)) 145 + do_irq_stat(); 143 146 (*(isr_t *)HW_ICOLL_VECTOR)(); 144 147 /* acknowledge completion of IRQ (all use the same priority 0) */ 145 148 HW_ICOLL_LEVELACK = HW_ICOLL_LEVELACK__LEVEL0; ··· 170 173 HW_ICOLL_VBASE = (uint32_t)&isr_table; 171 174 /* enable final irq bit */ 172 175 __REG_SET(HW_ICOLL_CTRL) = HW_ICOLL_CTRL__IRQ_FINAL_ENABLE; 173 - 174 - imx233_rtc_enable_msec_irq(true); 175 - imx233_icoll_enable_interrupt(INT_SRC_RTC_1MSEC, true); 176 176 } 177 177
-10
firmware/target/arm/imx233/kernel-imx233.c
··· 23 23 #include "clkctrl-imx233.h" 24 24 #include "kernel-imx233.h" 25 25 26 - #ifdef SANSA_FUZEPLUS 27 - #define TICK_TIMER_NR 0 28 - #elif defined(CREATIVE_ZENXFI2) 29 - #define TICK_TIMER_NR 0 30 - #elif defined(CREATIVE_ZENXFI3) 31 - #define TICK_TIMER_NR 0 32 - #else 33 - #error Select tick timer ! 34 - #endif 35 - 36 26 static void tick_timer(void) 37 27 { 38 28 /* Run through the list of tick tasks */
+10
firmware/target/arm/imx233/kernel-imx233.h
··· 23 23 24 24 #include "kernel.h" 25 25 26 + #ifdef SANSA_FUZEPLUS 27 + #define TICK_TIMER_NR 0 28 + #elif defined(CREATIVE_ZENXFI2) 29 + #define TICK_TIMER_NR 0 30 + #elif defined(CREATIVE_ZENXFI3) 31 + #define TICK_TIMER_NR 0 32 + #else 33 + #error Select tick timer ! 34 + #endif 35 + 26 36 /* The i.MX233 uses in several places virtual channels to multiplex the work. 27 37 * To arbiter the use of the different channels, we use a simple channel arbiter 28 38 * based on a semaphore to count the number of channels in use, and a bitmask