diff options
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/export/sh7034.h | 9 | ||||
-rw-r--r-- | firmware/panic.c | 27 | ||||
-rw-r--r-- | firmware/system.c | 18 |
3 files changed, 34 insertions, 20 deletions
diff --git a/firmware/export/sh7034.h b/firmware/export/sh7034.h index c15ee2a88f..242e5687f1 100644 --- a/firmware/export/sh7034.h +++ b/firmware/export/sh7034.h | |||
@@ -294,9 +294,12 @@ | |||
294 | #define RTCNT (*((volatile unsigned short*)RTCNT_ADDR)) | 294 | #define RTCNT (*((volatile unsigned short*)RTCNT_ADDR)) |
295 | #define RTCOR (*((volatile unsigned short*)RTCOR_ADDR)) | 295 | #define RTCOR (*((volatile unsigned short*)RTCOR_ADDR)) |
296 | 296 | ||
297 | #define TCSR (*((volatile unsigned char*)TCSR_ADDR)) | 297 | #define TCSR_R (*((volatile unsigned char*)TCSR_ADDR)) |
298 | #define TCNT (*((volatile unsigned char*)TCNT_ADDR)) | 298 | #define TCSR_W (*((volatile unsigned short*)(TCSR_ADDR & ~1))) |
299 | #define RSTCSR (*((volatile unsigned char*)RSTCSR_ADDR)) | 299 | #define TCNT_R (*((volatile unsigned char*)TCNT_ADDR)) |
300 | #define TCNT_W (*((volatile unsigned short*)(TCNT_ADDR & ~1))) | ||
301 | #define RSTCSR_R (*((volatile unsigned char*)RSTCSR_ADDR)) | ||
302 | #define RSTCSR_W (*((volatile unsigned short*)(RSTCSR_ADDR & ~1))) | ||
300 | 303 | ||
301 | #define SBYCR (*((volatile unsigned char*)SBYCR_ADDR)) | 304 | #define SBYCR (*((volatile unsigned char*)SBYCR_ADDR)) |
302 | 305 | ||
diff --git a/firmware/panic.c b/firmware/panic.c index 2132402254..9226146a48 100644 --- a/firmware/panic.c +++ b/firmware/panic.c | |||
@@ -40,7 +40,7 @@ void panicf( const char *fmt, ...) | |||
40 | 40 | ||
41 | #ifndef SIMULATOR | 41 | #ifndef SIMULATOR |
42 | #if CONFIG_LED == LED_REAL | 42 | #if CONFIG_LED == LED_REAL |
43 | bool state = false; | 43 | bool state = true; |
44 | #endif | 44 | #endif |
45 | 45 | ||
46 | /* Disable interrupts */ | 46 | /* Disable interrupts */ |
@@ -88,31 +88,32 @@ void panicf( const char *fmt, ...) | |||
88 | 88 | ||
89 | while (1) | 89 | while (1) |
90 | { | 90 | { |
91 | #if (CONFIG_LED == LED_REAL) && !defined(SIMULATOR) | 91 | #ifndef SIMULATOR |
92 | #if CONFIG_LED == LED_REAL | ||
92 | volatile long i; | 93 | volatile long i; |
93 | led (state); | 94 | led (state); |
94 | state = state?false:true; | 95 | state = !state; |
95 | 96 | ||
96 | for (i = 0; i < 240000; ++i); | 97 | for (i = 0; i < 240000; ++i); |
97 | #endif | 98 | #endif |
98 | #ifndef SIMULATOR | 99 | |
100 | /* try to restart firmware if ON is pressed */ | ||
99 | #ifdef IRIVER_H100_SERIES | 101 | #ifdef IRIVER_H100_SERIES |
100 | /* check for the ON button (and !hold) */ | 102 | if ((GPIO1_READ & 0x22) == 0) /* check for ON button and !hold */ |
101 | if ((GPIO1_READ & 0x22) == 0) | ||
102 | system_reboot(); | ||
103 | #elif CONFIG_CPU == SH7034 | 103 | #elif CONFIG_CPU == SH7034 |
104 | /* try to restart firmware if ON is pressed */ | ||
105 | #if CONFIG_KEYPAD == PLAYER_PAD | 104 | #if CONFIG_KEYPAD == PLAYER_PAD |
106 | if (!(PADR & 0x0020)) | 105 | if (!(PADRL & 0x20)) |
107 | #elif CONFIG_KEYPAD == RECORDER_PAD | 106 | #elif CONFIG_KEYPAD == RECORDER_PAD |
108 | #ifdef HAVE_FMADC | 107 | #ifdef HAVE_FMADC |
109 | if (!(PCDR & 0x0008)) | 108 | if (!(PCDR & 0x0008)) |
110 | #else | 109 | #else |
111 | if (!(PBDR & 0x0100)) | 110 | if (!(PBDRH & 0x01)) |
112 | #endif | ||
113 | #endif | 111 | #endif |
112 | #elif CONFIG_KEYPAD == ONDIO_PAD | ||
113 | if (!(PCDR & 0x0008)) | ||
114 | #endif /* CONFIG_KEYPAD */ | ||
115 | #endif /* CPU */ | ||
114 | system_reboot(); | 116 | system_reboot(); |
115 | #endif | 117 | #endif /* !SIMULATOR */ |
116 | #endif | ||
117 | } | 118 | } |
118 | } | 119 | } |
diff --git a/firmware/system.c b/firmware/system.c index 7da1034739..cc4a5f0c85 100644 --- a/firmware/system.c +++ b/firmware/system.c | |||
@@ -852,7 +852,9 @@ void (*vbr[]) (void) __attribute__ ((section (".vectors"))) = | |||
852 | 852 | ||
853 | void UIE (unsigned int pc) /* Unexpected Interrupt or Exception */ | 853 | void UIE (unsigned int pc) /* Unexpected Interrupt or Exception */ |
854 | { | 854 | { |
855 | #if CONFIG_LED == LED_REAL | ||
855 | bool state = true; | 856 | bool state = true; |
857 | #endif | ||
856 | unsigned int n; | 858 | unsigned int n; |
857 | char str[32]; | 859 | char str[32]; |
858 | 860 | ||
@@ -876,23 +878,31 @@ void UIE (unsigned int pc) /* Unexpected Interrupt or Exception */ | |||
876 | 878 | ||
877 | while (1) | 879 | while (1) |
878 | { | 880 | { |
881 | #if CONFIG_LED == LED_REAL | ||
879 | volatile int i; | 882 | volatile int i; |
880 | led (state); | 883 | led (state); |
881 | state = state?false:true; | 884 | state = !state; |
882 | 885 | ||
883 | for (i = 0; i < 240000; ++i); | 886 | for (i = 0; i < 240000; ++i); |
887 | #endif | ||
884 | 888 | ||
885 | /* try to restart firmware if ON is pressed */ | 889 | /* try to restart firmware if ON is pressed */ |
886 | #if CONFIG_KEYPAD == PLAYER_PAD | 890 | #if CONFIG_KEYPAD == PLAYER_PAD |
887 | if (!(PADR & 0x0020)) | 891 | if (!(PADRL & 0x20)) |
888 | #elif CONFIG_KEYPAD == RECORDER_PAD | 892 | #elif CONFIG_KEYPAD == RECORDER_PAD |
889 | #ifdef HAVE_FMADC | 893 | #ifdef HAVE_FMADC |
890 | if (!(PCDR & 0x0008)) | 894 | if (!(PCDR & 0x0008)) |
891 | #else | 895 | #else |
892 | if (!(PBDR & 0x0100)) | 896 | if (!(PBDRH & 0x01)) |
893 | #endif | 897 | #endif |
898 | #elif CONFIG_KEYPAD == ONDIO_PAD | ||
899 | if (!(PCDR & 0x0008)) | ||
894 | #endif | 900 | #endif |
895 | system_reboot(); | 901 | { |
902 | /* enable the watchguard timer, but don't service it */ | ||
903 | RSTCSR_W = 0x5a40; /* Reset enabled, power-on reset */ | ||
904 | TCSR_W = 0xa560; /* Watchdog timer mode, timer enabled, sysclk/2 */ | ||
905 | } | ||
896 | } | 906 | } |
897 | } | 907 | } |
898 | 908 | ||