summaryrefslogtreecommitdiff
path: root/firmware/target/sh/system-sh.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/sh/system-sh.c')
-rw-r--r--firmware/target/sh/system-sh.c74
1 files changed, 42 insertions, 32 deletions
diff --git a/firmware/target/sh/system-sh.c b/firmware/target/sh/system-sh.c
index 63703ab786..02af40282f 100644
--- a/firmware/target/sh/system-sh.c
+++ b/firmware/target/sh/system-sh.c
@@ -283,10 +283,6 @@ extern void UIE4(void); /* needed for calculating the UIE number */
283void UIE (unsigned int pc) __attribute__((section(".text"))); 283void UIE (unsigned int pc) __attribute__((section(".text")));
284void UIE (unsigned int pc) /* Unexpected Interrupt or Exception */ 284void UIE (unsigned int pc) /* Unexpected Interrupt or Exception */
285{ 285{
286#if CONFIG_LED == LED_REAL
287 bool state = false;
288 int i = 0;
289#endif
290 unsigned int n; 286 unsigned int n;
291 char str[32]; 287 char str[32];
292 288
@@ -305,35 +301,13 @@ void UIE (unsigned int pc) /* Unexpected Interrupt or Exception */
305 lcd_puts(0,1,str); 301 lcd_puts(0,1,str);
306 lcd_update (); 302 lcd_update ();
307 303
308 while (1) 304 /* try to restart firmware if ON is pressed */
309 { 305 system_exception_wait();
310#if CONFIG_LED == LED_REAL
311 if (--i <= 0)
312 {
313 state = !state;
314 led(state);
315 i = 240000;
316 }
317#endif
318 306
319 /* try to restart firmware if ON is pressed */ 307 /* enable the watchguard timer, but don't service it */
320#if CONFIG_KEYPAD == PLAYER_PAD 308 RSTCSR_W = 0x5a40; /* Reset enabled, power-on reset */
321 if (!(PADRL & 0x20)) 309 TCSR_W = 0xa560; /* Watchdog timer mode, timer enabled, sysclk/2 */
322#elif CONFIG_KEYPAD == RECORDER_PAD 310 while (1);
323#ifdef HAVE_FMADC
324 if (!(PCDR & 0x0008))
325#else
326 if (!(PBDRH & 0x01))
327#endif
328#elif CONFIG_KEYPAD == ONDIO_PAD
329 if (!(PCDR & 0x0008))
330#endif
331 {
332 /* enable the watchguard timer, but don't service it */
333 RSTCSR_W = 0x5a40; /* Reset enabled, power-on reset */
334 TCSR_W = 0xa560; /* Watchdog timer mode, timer enabled, sysclk/2 */
335 }
336 }
337} 311}
338 312
339void system_init(void) 313void system_init(void)
@@ -378,6 +352,42 @@ void system_reboot (void)
378 "r"(*(int*)0),"r"(4)); 352 "r"(*(int*)0),"r"(4));
379} 353}
380 354
355void system_exception_wait(void)
356{
357#if (CONFIG_LED == LED_REAL)
358 bool state = false;
359 int i = 0;
360#endif
361
362 while (1)
363 {
364#if (CONFIG_LED == LED_REAL)
365 if (--i <= 0)
366 {
367 state = !state;
368 led(state);
369 i = 240000;
370 }
371#endif
372
373#if CONFIG_KEYPAD == PLAYER_PAD
374 /* Player */
375 if (!(PADRL & 0x20))
376#elif CONFIG_KEYPAD == RECORDER_PAD
377 /* Recorder */
378#ifdef HAVE_FMADC
379 if (!(PCDR & 0x0008))
380#else
381 if (!(PBDRH & 0x01))
382#endif
383#elif CONFIG_KEYPAD == ONDIO_PAD
384 /* Ondio */
385 if (!(PCDR & 0x0008))
386#endif /* CONFIG_KEYPAD */
387 return;
388 }
389}
390
381/* Utilise the user break controller to catch invalid memory accesses. */ 391/* Utilise the user break controller to catch invalid memory accesses. */
382int system_memory_guard(int newmode) 392int system_memory_guard(int newmode)
383{ 393{