summaryrefslogtreecommitdiffstats
path: root/firmware/target/arm/imx233/icoll-imx233.c
diff options
context:
space:
mode:
authorAmaury Pouly <amaury.pouly@gmail.com>2014-02-02 04:31:54 +0100
committerAmaury Pouly <amaury.pouly@gmail.com>2014-02-10 23:14:24 +0100
commit6d64111b3c2f772cfc3539bb13851f78d4b55870 (patch)
treef08fb564cdafb53e20b797646426d862fb115cc2 /firmware/target/arm/imx233/icoll-imx233.c
parent1a06292e418ceb765121e5792b305e17d39b9618 (diff)
downloadrockbox-6d64111b3c2f772cfc3539bb13851f78d4b55870.tar.gz
rockbox-6d64111b3c2f772cfc3539bb13851f78d4b55870.tar.bz2
rockbox-6d64111b3c2f772cfc3539bb13851f78d4b55870.zip
imx233: add hardware and software watchdog
The hardware watchdog automatically shutdown the device after 10s of inactivity, being defined as 10s without the tick IRQ fired (aka braindead device). The software IRQ mechanism is more interesting: it uses a very high priority timer setup as one-shot to trigger after 5s of inactivity (but IRQ still enabled). When detected, it patches the running code to insert a SWI instruction so that on interrupt return it will trigger a SWI and produce a meaningfull backtrace to debug the deadlock. This should allow to debug freezes in IRQ context. Change-Id: Ic55dad01201676bfb6dd79e78e535c6707cb88e6
Diffstat (limited to 'firmware/target/arm/imx233/icoll-imx233.c')
-rw-r--r--firmware/target/arm/imx233/icoll-imx233.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/firmware/target/arm/imx233/icoll-imx233.c b/firmware/target/arm/imx233/icoll-imx233.c
index e42e0f3291..e23af602db 100644
--- a/firmware/target/arm/imx233/icoll-imx233.c
+++ b/firmware/target/arm/imx233/icoll-imx233.c
@@ -146,6 +146,7 @@ struct imx233_icoll_irq_info_t imx233_icoll_get_irq_info(int src)
static void do_irq_stat(void)
{
+ imx233_keep_alive();
static unsigned counter = 0;
if(counter++ >= HZ)
{
@@ -180,6 +181,8 @@ void irq_handler(void)
asm volatile(
"sub lr, lr, #4 \n" /* Create return address */
"stmfd sp!, { r0-r5, r12, lr } \n" /* Save what gets clobbered */
+ "ldr r5, =0x8001c290 \n" /* Save pointer to instruction */
+ "str lr, [r5] \n" /* in HW_DIGCTL_SCRATCH0 */
"ldr r4, =0x80000000 \n" /* Read HW_ICOLL_VECTOR */
"ldr r0, [r4] \n" /* and notify as side-effect */
"mrs lr, spsr \n" /* Save SPSR_irq */