SH1: Changed UIE() to use the same reset method as on coldfire, using the watchdog timer. Should be more reliable this way. Disabled LED handling and added reboot-with-on for Ondio. * All: #ifdef cleanup in panicf(), added reboot-with-on for Ondio.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7799 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Jens Arnold 2005-11-09 00:54:43 +00:00
parent 219944f6a3
commit 0b00108c3e
3 changed files with 35 additions and 21 deletions

View file

@ -294,9 +294,12 @@
#define RTCNT (*((volatile unsigned short*)RTCNT_ADDR)) #define RTCNT (*((volatile unsigned short*)RTCNT_ADDR))
#define RTCOR (*((volatile unsigned short*)RTCOR_ADDR)) #define RTCOR (*((volatile unsigned short*)RTCOR_ADDR))
#define TCSR (*((volatile unsigned char*)TCSR_ADDR)) #define TCSR_R (*((volatile unsigned char*)TCSR_ADDR))
#define TCNT (*((volatile unsigned char*)TCNT_ADDR)) #define TCSR_W (*((volatile unsigned short*)(TCSR_ADDR & ~1)))
#define RSTCSR (*((volatile unsigned char*)RSTCSR_ADDR)) #define TCNT_R (*((volatile unsigned char*)TCNT_ADDR))
#define TCNT_W (*((volatile unsigned short*)(TCNT_ADDR & ~1)))
#define RSTCSR_R (*((volatile unsigned char*)RSTCSR_ADDR))
#define RSTCSR_W (*((volatile unsigned short*)(RSTCSR_ADDR & ~1)))
#define SBYCR (*((volatile unsigned char*)SBYCR_ADDR)) #define SBYCR (*((volatile unsigned char*)SBYCR_ADDR))

View file

@ -40,7 +40,7 @@ void panicf( const char *fmt, ...)
#ifndef SIMULATOR #ifndef SIMULATOR
#if CONFIG_LED == LED_REAL #if CONFIG_LED == LED_REAL
bool state = false; bool state = true;
#endif #endif
/* Disable interrupts */ /* Disable interrupts */
@ -88,31 +88,32 @@ void panicf( const char *fmt, ...)
while (1) while (1)
{ {
#if (CONFIG_LED == LED_REAL) && !defined(SIMULATOR) #ifndef SIMULATOR
#if CONFIG_LED == LED_REAL
volatile long i; volatile long i;
led (state); led (state);
state = state?false:true; state = !state;
for (i = 0; i < 240000; ++i); for (i = 0; i < 240000; ++i);
#endif #endif
#ifndef SIMULATOR
#ifdef IRIVER_H100_SERIES
/* check for the ON button (and !hold) */
if ((GPIO1_READ & 0x22) == 0)
system_reboot();
#elif CONFIG_CPU == SH7034
/* try to restart firmware if ON is pressed */ /* try to restart firmware if ON is pressed */
#ifdef IRIVER_H100_SERIES
if ((GPIO1_READ & 0x22) == 0) /* check for ON button and !hold */
#elif CONFIG_CPU == SH7034
#if CONFIG_KEYPAD == PLAYER_PAD #if CONFIG_KEYPAD == PLAYER_PAD
if (!(PADR & 0x0020)) if (!(PADRL & 0x20))
#elif CONFIG_KEYPAD == RECORDER_PAD #elif CONFIG_KEYPAD == RECORDER_PAD
#ifdef HAVE_FMADC #ifdef HAVE_FMADC
if (!(PCDR & 0x0008)) if (!(PCDR & 0x0008))
#else #else
if (!(PBDR & 0x0100)) if (!(PBDRH & 0x01))
#endif
#endif #endif
#elif CONFIG_KEYPAD == ONDIO_PAD
if (!(PCDR & 0x0008))
#endif /* CONFIG_KEYPAD */
#endif /* CPU */
system_reboot(); system_reboot();
#endif #endif /* !SIMULATOR */
#endif
} }
} }

View file

@ -852,7 +852,9 @@ void (*vbr[]) (void) __attribute__ ((section (".vectors"))) =
void UIE (unsigned int pc) /* Unexpected Interrupt or Exception */ void UIE (unsigned int pc) /* Unexpected Interrupt or Exception */
{ {
#if CONFIG_LED == LED_REAL
bool state = true; bool state = true;
#endif
unsigned int n; unsigned int n;
char str[32]; char str[32];
@ -876,23 +878,31 @@ void UIE (unsigned int pc) /* Unexpected Interrupt or Exception */
while (1) while (1)
{ {
#if CONFIG_LED == LED_REAL
volatile int i; volatile int i;
led (state); led (state);
state = state?false:true; state = !state;
for (i = 0; i < 240000; ++i); for (i = 0; i < 240000; ++i);
#endif
/* try to restart firmware if ON is pressed */ /* try to restart firmware if ON is pressed */
#if CONFIG_KEYPAD == PLAYER_PAD #if CONFIG_KEYPAD == PLAYER_PAD
if (!(PADR & 0x0020)) if (!(PADRL & 0x20))
#elif CONFIG_KEYPAD == RECORDER_PAD #elif CONFIG_KEYPAD == RECORDER_PAD
#ifdef HAVE_FMADC #ifdef HAVE_FMADC
if (!(PCDR & 0x0008)) if (!(PCDR & 0x0008))
#else #else
if (!(PBDR & 0x0100)) if (!(PBDRH & 0x01))
#endif #endif
#elif CONFIG_KEYPAD == ONDIO_PAD
if (!(PCDR & 0x0008))
#endif #endif
system_reboot(); {
/* enable the watchguard timer, but don't service it */
RSTCSR_W = 0x5a40; /* Reset enabled, power-on reset */
TCSR_W = 0xa560; /* Watchdog timer mode, timer enabled, sysclk/2 */
}
} }
} }