1
0
Fork 0
forked from len0rd/rockbox

More tweak to ColdFire default exception handler. iRiver reboots on power press but x5 just shuts down. Haven't yet thought much about why or how to make it reboot on x5 if it's possible.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11422 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Michael Sevakis 2006-11-03 10:19:04 +00:00
parent 46925b32a7
commit 0fb67cd475

View file

@ -136,17 +136,24 @@ default_interrupt (CDROMNOSYNC); /* CD-ROM No sync */
default_interrupt (CDROMILSYNC); /* CD-ROM Illegal sync */ default_interrupt (CDROMILSYNC); /* CD-ROM Illegal sync */
default_interrupt (CDROMNEWBLK); /* CD-ROM New block */ default_interrupt (CDROMNEWBLK); /* CD-ROM New block */
static struct #ifdef IAUDIO_X5
{ #define EXCP_BUTTON_GPIO_READ GPIO_READ
unsigned long format; #define EXCP_BUTTON_MASK 0x0c000000
unsigned long pc; #define EXCP_BUTTON_VALUE 0x08000000 /* On button and !hold */
} __attribute__ ((packed)) system_exception_info; #define EXCP_PLLCR 0x10400000
#else
#define EXCP_BUTTON_GPIO_READ GPIO1_READ
#define EXCP_BUTTON_MASK 0x00000022
#define EXCP_BUTTON_VALUE 0x00000000
#define EXCP_PLLCR 0x10800000
#endif
static void system_display_exception_info(void) __attribute__ ((noreturn)); static void system_display_exception_info(unsigned long format,
static void system_display_exception_info(void) unsigned long pc) __attribute__ ((noreturn));
static void system_display_exception_info(unsigned long format,
unsigned long pc)
{ {
int pc = system_exception_info.pc; int vector = (format >> 18) & 0xff;
int vector = (system_exception_info.format >> 18) & 0xff;
char str[32]; char str[32];
/* clear screen */ /* clear screen */
@ -160,25 +167,15 @@ static void system_display_exception_info(void)
lcd_update(); lcd_update();
/* set cpu frequency to 11mhz (to prevent overheating) */ /* set cpu frequency to 11mhz (to prevent overheating) */
DCR = (DCR & ~0x01ff) | 1; DCR = (DCR & ~0x01ff) | 1;
PLLCR = EXCP_PLLCR;
#ifdef IAUDIO_X5
PLLCR = 0x10400000;
/* on key for 1s will shut down */
asm("halt");
while (1); /* loop to silence 'noreturn' function does return */
#else
PLLCR = 0x10800000;
while (1) while (1)
{ {
/* check for the ON button (and !hold) */ if ((EXCP_BUTTON_GPIO_READ & EXCP_BUTTON_MASK) == EXCP_BUTTON_VALUE)
if ((GPIO1_READ & 0x22) == 0)
SYPCR = 0xc0; SYPCR = 0xc0;
/* Start watchdog timer with 512 cycles timeout. Don't service it. */ /* Start watchdog timer with 512 cycles timeout. Don't service it. */
} }
#endif
/* We need a reset method that works in all cases. Calling system_reboot() /* We need a reset method that works in all cases. Calling system_reboot()
doesn't work when we're called from the debug interrupt, because then doesn't work when we're called from the debug interrupt, because then
@ -191,15 +188,9 @@ static void system_display_exception_info(void)
static void UIE(void) __attribute__ ((noreturn)); static void UIE(void) __attribute__ ((noreturn));
static void UIE(void) static void UIE(void)
{ {
asm volatile ( asm volatile("subq.l #4,%sp"); /* phony return address - never used */
"movem.l (%%sp),%%d0-%%d1 \n" /* Copy exception frame */ asm volatile("jmp system_display_exception_info");
"lea.l %[info],%%a0 \n" while (1); /* loop to silence 'noreturn' function does return */
"movem.l %%d0-%%d1,(%%a0) \n"
:
: [info] "m" (system_exception_info)
);
system_display_exception_info();
} }
/* reset vectors are handled in crt0.S */ /* reset vectors are handled in crt0.S */