diff options
author | Michael Sevakis <jethead71@rockbox.org> | 2009-01-29 01:28:34 +0000 |
---|---|---|
committer | Michael Sevakis <jethead71@rockbox.org> | 2009-01-29 01:28:34 +0000 |
commit | bf1cddf3e890944e0108913b4271e403c094375c (patch) | |
tree | 8863c0a8ea2ccd187a922ade3170389db6d0ebc0 /firmware/target/arm/usb-fw-pp502x.c | |
parent | 077ce00fdda0cec473973e5d63696cd634e3a21d (diff) | |
download | rockbox-bf1cddf3e890944e0108913b4271e403c094375c.tar.gz rockbox-bf1cddf3e890944e0108913b4271e403c094375c.zip |
Hopefully make some progress against FS#9831. iPod Video seems fine now under XP at least. Move false reset detection to the USB target code. Gigabeat S works using the OTG module upon bus reset. Portal Player targets verify that the USB pin detect is ok upon bus reset.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19874 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/arm/usb-fw-pp502x.c')
-rw-r--r-- | firmware/target/arm/usb-fw-pp502x.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/firmware/target/arm/usb-fw-pp502x.c b/firmware/target/arm/usb-fw-pp502x.c index 883ca1e8e2..cf5a82f37c 100644 --- a/firmware/target/arm/usb-fw-pp502x.c +++ b/firmware/target/arm/usb-fw-pp502x.c | |||
@@ -177,6 +177,11 @@ void usb_attach(void) | |||
177 | usb_drv_attach(); | 177 | usb_drv_attach(); |
178 | } | 178 | } |
179 | 179 | ||
180 | static bool usb_pin_state(void) | ||
181 | { | ||
182 | return (USB_GPIO_INPUT_VAL & USB_GPIO_MASK) == USB_GPIO_VAL; | ||
183 | } | ||
184 | |||
180 | #ifdef USB_STATUS_BY_EVENT | 185 | #ifdef USB_STATUS_BY_EVENT |
181 | /* Cannot always tell power pin from USB pin */ | 186 | /* Cannot always tell power pin from USB pin */ |
182 | static int usb_status = USB_EXTRACTED; | 187 | static int usb_status = USB_EXTRACTED; |
@@ -197,10 +202,13 @@ void usb_insert_int(void) | |||
197 | timeout_register(&usb_oneshot, usb_timeout_event, HZ/5, val); | 202 | timeout_register(&usb_oneshot, usb_timeout_event, HZ/5, val); |
198 | } | 203 | } |
199 | 204 | ||
200 | /* Called during the bus reset interrupt when in detect mode */ | 205 | /* Called during the bus reset interrupt when in detect mode - filter for |
206 | * invalid bus reset when unplugging by checking the pin state. */ | ||
201 | void usb_drv_usb_detect_event(void) | 207 | void usb_drv_usb_detect_event(void) |
202 | { | 208 | { |
203 | usb_status_event(USB_INSERTED); | 209 | if(usb_pin_state()) { |
210 | usb_status_event(USB_INSERTED); | ||
211 | } | ||
204 | } | 212 | } |
205 | #endif /* USB_STATUS_BY_EVENT */ | 213 | #endif /* USB_STATUS_BY_EVENT */ |
206 | 214 | ||
@@ -221,8 +229,7 @@ int usb_detect(void) | |||
221 | #ifdef USB_STATUS_BY_EVENT | 229 | #ifdef USB_STATUS_BY_EVENT |
222 | return usb_status; | 230 | return usb_status; |
223 | #else | 231 | #else |
224 | return ((USB_GPIO_INPUT_VAL & USB_GPIO_MASK) == USB_GPIO_VAL) ? | 232 | return usb_pin_state() ? USB_INSERTED : USB_EXTRACTED; |
225 | USB_INSERTED : USB_EXTRACTED; | ||
226 | #endif | 233 | #endif |
227 | } | 234 | } |
228 | 235 | ||