1
0
Fork 0
forked from len0rd/rockbox

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
This commit is contained in:
Michael Sevakis 2009-01-29 01:28:34 +00:00
parent 077ce00fdd
commit bf1cddf3e8
3 changed files with 14 additions and 9 deletions

View file

@ -125,5 +125,6 @@ void usb_drv_int_enable(bool enable)
/* Called during the bus reset interrupt when in detect mode */
void usb_drv_usb_detect_event(void)
{
if (usb_drv_powered())
usb_status_event(USB_INSERTED);
}

View file

@ -509,9 +509,6 @@ void usb_drv_int(void)
if (UNLIKELY(usbintr == USBINTR_RESET_EN)) {
/* USB detected - detach and inform */
usb_drv_stop();
/* A false reset may occur upon unplugging, be sure VBUS is above
* the 4V4 threshold. */
if (usb_drv_powered())
usb_drv_usb_detect_event();
}
else

View file

@ -177,6 +177,11 @@ void usb_attach(void)
usb_drv_attach();
}
static bool usb_pin_state(void)
{
return (USB_GPIO_INPUT_VAL & USB_GPIO_MASK) == USB_GPIO_VAL;
}
#ifdef USB_STATUS_BY_EVENT
/* Cannot always tell power pin from USB pin */
static int usb_status = USB_EXTRACTED;
@ -197,10 +202,13 @@ void usb_insert_int(void)
timeout_register(&usb_oneshot, usb_timeout_event, HZ/5, val);
}
/* Called during the bus reset interrupt when in detect mode */
/* Called during the bus reset interrupt when in detect mode - filter for
* invalid bus reset when unplugging by checking the pin state. */
void usb_drv_usb_detect_event(void)
{
if(usb_pin_state()) {
usb_status_event(USB_INSERTED);
}
}
#endif /* USB_STATUS_BY_EVENT */
@ -221,8 +229,7 @@ int usb_detect(void)
#ifdef USB_STATUS_BY_EVENT
return usb_status;
#else
return ((USB_GPIO_INPUT_VAL & USB_GPIO_MASK) == USB_GPIO_VAL) ?
USB_INSERTED : USB_EXTRACTED;
return usb_pin_state() ? USB_INSERTED : USB_EXTRACTED;
#endif
}