summaryrefslogtreecommitdiffstats
path: root/firmware/target/arm/imx233/icoll-imx233.c
diff options
context:
space:
mode:
authorAmaury Pouly <amaury.pouly@gmail.com>2012-12-26 21:23:59 +0100
committerAmaury Pouly <amaury.pouly@gmail.com>2012-12-26 21:26:33 +0100
commit8ecbcad3d13d41ef9cff6d20149df1645f63aae0 (patch)
tree6fae782c63811ae1bf5882e9768b23fa12dd1556 /firmware/target/arm/imx233/icoll-imx233.c
parente3fbced28323e21c8826adaf66521111e754d017 (diff)
downloadrockbox-8ecbcad3d13d41ef9cff6d20149df1645f63aae0.tar.gz
rockbox-8ecbcad3d13d41ef9cff6d20149df1645f63aae0.tar.bz2
rockbox-8ecbcad3d13d41ef9cff6d20149df1645f63aae0.zip
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
Diffstat (limited to 'firmware/target/arm/imx233/icoll-imx233.c')
-rw-r--r--firmware/target/arm/imx233/icoll-imx233.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/firmware/target/arm/imx233/icoll-imx233.c b/firmware/target/arm/imx233/icoll-imx233.c
index 4e0d525da3..8f8e3c0c9a 100644
--- a/firmware/target/arm/imx233/icoll-imx233.c
+++ b/firmware/target/arm/imx233/icoll-imx233.c
@@ -21,6 +21,7 @@
#include "icoll-imx233.h"
#include "rtc-imx233.h"
+#include "kernel-imx233.h"
#include "string.h"
#define default_interrupt(name) \
@@ -61,6 +62,7 @@ default_interrupt(INT_ADC_DMA);
default_interrupt(INT_ADC_ERROR);
default_interrupt(INT_DCP);
default_interrupt(INT_TOUCH_DETECT);
+default_interrupt(INT_RTC_1MSEC);
void INT_RTC_1MSEC(void);
@@ -102,8 +104,8 @@ static isr_t isr_table[INT_SRC_NR_SOURCES] =
[INT_SRC_RTC_1MSEC] = INT_RTC_1MSEC,
};
-#define IRQ_STORM_DELAY 1000 /* ms */
-#define IRQ_STORM_THRESHOLD 100000 /* allows irq / delay */
+#define IRQ_STORM_DELAY 100 /* ms */
+#define IRQ_STORM_THRESHOLD 10000 /* allows irq / delay */
static uint32_t irq_count_old[INT_SRC_NR_SOURCES];
static uint32_t irq_count[INT_SRC_NR_SOURCES];
@@ -116,16 +118,15 @@ struct imx233_icoll_irq_info_t imx233_icoll_get_irq_info(int src)
return info;
}
-void INT_RTC_1MSEC(void)
+static void do_irq_stat(void)
{
static unsigned counter = 0;
- if(counter++ >= IRQ_STORM_DELAY)
+ if(counter++ >= HZ)
{
counter = 0;
memcpy(irq_count_old, irq_count, sizeof(irq_count));
memset(irq_count, 0, sizeof(irq_count));
}
- imx233_rtc_clear_msec_irq();
}
static void UIRQ(void)
@@ -140,6 +141,8 @@ void irq_handler(void)
int irq_nr = (HW_ICOLL_VECTOR - HW_ICOLL_VBASE) / 4;
if(irq_count[irq_nr]++ > IRQ_STORM_THRESHOLD)
panicf("IRQ %d: storm detected", irq_nr);
+ if(irq_nr == INT_SRC_TIMER(TICK_TIMER_NR))
+ do_irq_stat();
(*(isr_t *)HW_ICOLL_VECTOR)();
/* acknowledge completion of IRQ (all use the same priority 0) */
HW_ICOLL_LEVELACK = HW_ICOLL_LEVELACK__LEVEL0;
@@ -170,8 +173,5 @@ void imx233_icoll_init(void)
HW_ICOLL_VBASE = (uint32_t)&isr_table;
/* enable final irq bit */
__REG_SET(HW_ICOLL_CTRL) = HW_ICOLL_CTRL__IRQ_FINAL_ENABLE;
-
- imx233_rtc_enable_msec_irq(true);
- imx233_icoll_enable_interrupt(INT_SRC_RTC_1MSEC, true);
}