diff options
Diffstat (limited to 'firmware/target/arm/system-pp502x.c')
-rw-r--r-- | firmware/target/arm/system-pp502x.c | 100 |
1 files changed, 80 insertions, 20 deletions
diff --git a/firmware/target/arm/system-pp502x.c b/firmware/target/arm/system-pp502x.c index ed4c028ff4..d4c07f10eb 100644 --- a/firmware/target/arm/system-pp502x.c +++ b/firmware/target/arm/system-pp502x.c | |||
@@ -25,9 +25,8 @@ | |||
25 | #include "as3514.h" | 25 | #include "as3514.h" |
26 | #include "ata-sd-target.h" | 26 | #include "ata-sd-target.h" |
27 | #include "button-target.h" | 27 | #include "button-target.h" |
28 | #ifdef HAVE_USBSTACK | 28 | #include "usb-target.h" |
29 | #include "usb_drv.h" | 29 | #include "usb_drv.h" |
30 | #endif | ||
31 | 30 | ||
32 | #ifndef BOOTLOADER | 31 | #ifndef BOOTLOADER |
33 | extern void TIMER1(void); | 32 | extern void TIMER1(void); |
@@ -42,51 +41,108 @@ void __attribute__((interrupt("IRQ"))) irq_handler(void) | |||
42 | { | 41 | { |
43 | if (CPU_INT_STAT & TIMER1_MASK) { | 42 | if (CPU_INT_STAT & TIMER1_MASK) { |
44 | TIMER1(); | 43 | TIMER1(); |
45 | } else if (CPU_INT_STAT & TIMER2_MASK) | 44 | } |
45 | else if (CPU_INT_STAT & TIMER2_MASK) { | ||
46 | TIMER2(); | 46 | TIMER2(); |
47 | } | ||
48 | #ifdef HAVE_USBSTACK | ||
49 | /* Rather high priority - place near front */ | ||
50 | else if (CPU_INT_STAT & USB_MASK) { | ||
51 | usb_drv_int(); | ||
52 | } | ||
53 | #endif | ||
47 | #if defined(IPOD_MINI) /* Mini 1st gen only, mini 2nd gen uses iPod 4G code */ | 54 | #if defined(IPOD_MINI) /* Mini 1st gen only, mini 2nd gen uses iPod 4G code */ |
48 | else if (CPU_HI_INT_STAT & GPIO0_MASK) | 55 | else if (CPU_HI_INT_STAT & GPIO0_MASK) { |
49 | ipod_mini_button_int(); | 56 | if ((GPIOA_INT_STAT & 0x3f) || (GPIOB_INT_STAT & 0x30)) |
57 | ipod_mini_button_int(); | ||
58 | if (GPIOC_INT_STAT & 0x02) | ||
59 | firewire_insert_int(); | ||
60 | if (GPIOD_INT_STAT & 0x08) | ||
61 | usb_insert_int(); | ||
62 | } | ||
63 | /* end IPOD_MINI */ | ||
50 | #elif CONFIG_KEYPAD == IPOD_4G_PAD /* except Mini 1st gen, handled above */ | 64 | #elif CONFIG_KEYPAD == IPOD_4G_PAD /* except Mini 1st gen, handled above */ |
51 | else if (CPU_HI_INT_STAT & I2C_MASK) | 65 | else if (CPU_HI_INT_STAT & I2C_MASK) { |
52 | ipod_4g_button_int(); | 66 | ipod_4g_button_int(); |
67 | } | ||
68 | #if defined(IPOD_COLOR) || defined(IPOD_MINI2G) || defined(IPOD_4G) | ||
69 | else if (CPU_HI_INT_STAT & GPIO0_MASK) { | ||
70 | if (GPIOC_INT_STAT & 0x02) | ||
71 | firewire_insert_int(); | ||
72 | if (GPIOD_INT_STAT & 0x08) | ||
73 | usb_insert_int(); | ||
74 | } | ||
75 | #elif defined(IPOD_NANO) || defined(IPOD_VIDEO) | ||
76 | else if (CPU_HI_INT_STAT & GPIO2_MASK) { | ||
77 | if (GPIOL_INT_STAT & 0x10) | ||
78 | usb_insert_int(); | ||
79 | } | ||
80 | #endif | ||
81 | /* end CONFIG_KEYPAD == IPOD_4G_PAD */ | ||
82 | #elif defined(IRIVER_H10) || defined(IRIVER_H10_5GB) | ||
83 | else if (CPU_HI_INT_STAT & GPIO2_MASK) { | ||
84 | if (GPIOL_INT_STAT & 0x04) | ||
85 | usb_insert_int(); | ||
86 | } | ||
87 | /* end IRIVER_H10 || IRIVER_H10_5GB */ | ||
53 | #elif defined(SANSA_E200) | 88 | #elif defined(SANSA_E200) |
54 | #ifdef HAVE_HOTSWAP | ||
55 | else if (CPU_HI_INT_STAT & GPIO0_MASK) { | 89 | else if (CPU_HI_INT_STAT & GPIO0_MASK) { |
90 | #ifdef HAVE_HOTSWAP | ||
56 | if (GPIOA_INT_STAT & 0x80) | 91 | if (GPIOA_INT_STAT & 0x80) |
57 | microsd_int(); | 92 | microsd_int(); |
58 | } | ||
59 | #endif | 93 | #endif |
94 | if (GPIOB_INT_STAT & 0x10) | ||
95 | usb_insert_int(); | ||
96 | } | ||
60 | else if (CPU_HI_INT_STAT & GPIO1_MASK) { | 97 | else if (CPU_HI_INT_STAT & GPIO1_MASK) { |
61 | if (GPIOF_INT_STAT & 0xff) | 98 | if (GPIOF_INT_STAT & 0xff) |
62 | button_int(); | 99 | button_int(); |
63 | if (GPIOH_INT_STAT & 0xc0) | 100 | if (GPIOH_INT_STAT & 0xc0) |
64 | clickwheel_int(); | 101 | clickwheel_int(); |
65 | } | 102 | } |
66 | #elif defined(SANSA_C200) && defined(HAVE_HOTSWAP) | 103 | /* end SANSA_E200 */ |
104 | #elif defined(SANSA_C200) | ||
105 | else if (CPU_HI_INT_STAT & GPIO1_MASK) { | ||
106 | if (GPIOH_INT_STAT & 0x02) | ||
107 | usb_insert_int(); | ||
108 | } | ||
109 | #ifdef HAVE_HOTSWAP | ||
67 | else if (CPU_HI_INT_STAT & GPIO2_MASK) { | 110 | else if (CPU_HI_INT_STAT & GPIO2_MASK) { |
68 | if (GPIOL_INT_STAT & 0x08) | 111 | if (GPIOL_INT_STAT & 0x08) |
69 | microsd_int(); | 112 | microsd_int(); |
70 | } | 113 | } |
114 | #endif | ||
115 | /* end SANSA_C200 */ | ||
71 | #elif defined(MROBE_100) | 116 | #elif defined(MROBE_100) |
72 | else if (CPU_HI_INT_STAT & GPIO0_MASK) { | 117 | else if (CPU_HI_INT_STAT & GPIO0_MASK) { |
73 | if (GPIOD_INT_STAT & 0x2) | 118 | if (GPIOD_INT_STAT & 0x02) |
74 | button_int(); | 119 | button_int(); |
75 | } | 120 | } |
121 | else if (CPU_HI_INT_STAT & GPIO2_MASK) { | ||
122 | if (GPIOL_INT_STAT & 0x04) | ||
123 | usb_insert_int(); | ||
124 | } | ||
125 | /* end MROBE_100 */ | ||
126 | #elif defined(PHILIPS_SA9200) | ||
127 | else if (CPU_HI_INT_STAT & GPIO1_MASK) { | ||
128 | if (GPIOF_INT_STAT & 0x80) | ||
129 | usb_insert_int(); | ||
130 | } | ||
131 | /* end PHILIPS_SA9200 */ | ||
76 | #elif defined(PHILIPS_HDD1630) | 132 | #elif defined(PHILIPS_HDD1630) |
77 | else if (CPU_HI_INT_STAT & GPIO0_MASK) { | 133 | else if (CPU_HI_INT_STAT & GPIO0_MASK) { |
78 | if (GPIOA_INT_STAT & 0x20) | 134 | if (GPIOA_INT_STAT & 0x20) |
79 | button_int(); | 135 | button_int(); |
80 | } | 136 | } |
137 | else if (CPU_HI_INT_STAT & GPIO1_MASK) { | ||
138 | if (GPIOE_INT_STAT & 0x04) | ||
139 | usb_insert_int(); | ||
140 | } | ||
141 | /* end PHILIPS_HDD1630 */ | ||
81 | #endif | 142 | #endif |
82 | #ifdef IPOD_ACCESSORY_PROTOCOL | 143 | #ifdef IPOD_ACCESSORY_PROTOCOL |
83 | else if (CPU_HI_INT_STAT & SER0_MASK) { | 144 | else if (CPU_HI_INT_STAT & SER0_MASK) { |
84 | SERIAL0(); | 145 | SERIAL0(); |
85 | } | ||
86 | #endif | ||
87 | #ifdef HAVE_USBSTACK | ||
88 | else if (CPU_INT_STAT & USB_MASK) { | ||
89 | usb_drv_int(); | ||
90 | } | 146 | } |
91 | #endif | 147 | #endif |
92 | } else { | 148 | } else { |
@@ -437,8 +493,12 @@ void system_init(void) | |||
437 | #endif /* BOOTLOADER */ | 493 | #endif /* BOOTLOADER */ |
438 | } | 494 | } |
439 | 495 | ||
440 | void system_reboot(void) | 496 | void ICODE_ATTR system_reboot(void) |
441 | { | 497 | { |
498 | disable_interrupt(IRQ_FIQ_STATUS); | ||
499 | CPU_INT_DIS = -1; | ||
500 | COP_INT_DIS = -1; | ||
501 | |||
442 | /* Reboot */ | 502 | /* Reboot */ |
443 | #if defined(SANSA_E200) || defined(SANSA_C200) || defined(PHILIPS_SA9200) | 503 | #if defined(SANSA_E200) || defined(SANSA_C200) || defined(PHILIPS_SA9200) |
444 | CACHE_CTL &= ~CACHE_CTL_VECT_REMAP; | 504 | CACHE_CTL &= ~CACHE_CTL_VECT_REMAP; |