Robster
Dodgy hardware mod maker
Hey all,
This will reboot the GP2X (rather than just resetting it):
Seems OK to me, using the watchdog timer is a bit crusty but I couldn't see any better ways. And I think it beats keeping some part of U-Boot in memory so an app can return to it.
Thoughts?
Damn, I've got to start putting this stuff up on cobbleware :/
This will reboot the GP2X (rather than just resetting it):
Code:
/* Mask ALL interrupts */
MSP_INTMASK = 0xFF8FFFE7;
/* Disable the clock into the timer module */
MSP_SYSCLKENREG &= (~0x80);
/* Set reboot behaviour when watchdog reset occurs */
MSP_BOOTCTRLREG = 4;
/* Clear any timer interrupts that may be pending, and enable the
* interrupt in the timer module */
MSP_TSTATUS = 8;
MSP_TINTEN = 8;
MSP_SRCPEND = 32;
MSP_INTPEND = 32;
/* Enable the watchdog reset */
MSP_RSTCTRLREG = 0x100;
/* Enable the Timer module interrupt */
MSP_INTMASK &= (~0x20);
/* Set the watchdog compare to fire in 50 counts, or 6.78us at 7.3728MHz */
MSP_TMATCH3 = MSP_TCOUNT + 50;
/* Set match 3 to be watchdog reset rather than an interrupt */
MSP_TCONTROL = 3;
/* Enable the clock into the timer module */
MSP_SYSCLKENREG |= 0x80;
/* Idle, waiting for reset */
while (1);
Thoughts?
Damn, I've got to start putting this stuff up on cobbleware :/