mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-12-09 13:15:18 -05:00
Simplify and neaten-up usb.c a bit. USB_INSERTED and USB_EXTRACTED are always used as events to indicate cable state. USB_HOSTED is posted to indicated that a host was detected.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31263 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
911a355d76
commit
47bade1437
6 changed files with 88 additions and 109 deletions
|
|
@ -46,7 +46,7 @@ void usb_insert_int(void)
|
|||
{
|
||||
usb_status = USB_INSERTED;
|
||||
#ifdef USB_STATUS_BY_EVENT
|
||||
usb_status_event(USB_POWERED);
|
||||
usb_status_event(USB_INSERTED);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
@ -54,7 +54,7 @@ void usb_remove_int(void)
|
|||
{
|
||||
usb_status = USB_EXTRACTED;
|
||||
#ifdef USB_STATUS_BY_EVENT
|
||||
usb_status_event(USB_UNPOWERED);
|
||||
usb_status_event(USB_EXTRACTED);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
@ -68,7 +68,7 @@ void usb_drv_usb_detect_event(void)
|
|||
int oldstatus = disable_irq_save(); /* May come via USB thread */
|
||||
|
||||
if (usb_status == USB_INSERTED)
|
||||
usb_status_event(USB_INSERTED);
|
||||
usb_status_event(USB_HOSTED);
|
||||
|
||||
restore_irq(oldstatus);
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -33,17 +33,17 @@
|
|||
|
||||
void usb_insert_int(void)
|
||||
{
|
||||
usb_status_event(USB_POWERED);
|
||||
usb_status_event(USB_INSERTED);
|
||||
}
|
||||
|
||||
void usb_remove_int(void)
|
||||
{
|
||||
usb_status_event(USB_UNPOWERED);
|
||||
usb_status_event(USB_EXTRACTED);
|
||||
}
|
||||
|
||||
void usb_drv_usb_detect_event()
|
||||
{
|
||||
usb_status_event(USB_INSERTED);
|
||||
usb_status_event(USB_HOSTED);
|
||||
}
|
||||
|
||||
void usb_attach(void)
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ void usb_connect_event(void)
|
|||
usb_status = status;
|
||||
/* Notify power that USB charging is potentially available */
|
||||
charger_usb_detect_event(status);
|
||||
usb_status_event((status == USB_INSERTED) ? USB_POWERED : USB_UNPOWERED);
|
||||
usb_status_event(status);
|
||||
}
|
||||
|
||||
int usb_detect(void)
|
||||
|
|
@ -138,11 +138,11 @@ void usb_drv_int_enable(bool enable)
|
|||
}
|
||||
}
|
||||
|
||||
/* Called during the bus reset interrupt when in detect mode */
|
||||
/* Called during the setup packet request by the host */
|
||||
void usb_drv_usb_detect_event(void)
|
||||
{
|
||||
if (usb_drv_powered())
|
||||
usb_status_event(USB_INSERTED);
|
||||
usb_status_event(USB_HOSTED);
|
||||
}
|
||||
|
||||
/* Called when reading the MBR */
|
||||
|
|
|
|||
|
|
@ -212,7 +212,7 @@ static int usb_status = USB_EXTRACTED;
|
|||
|
||||
static int usb_timeout_event(struct timeout *tmo)
|
||||
{
|
||||
usb_status_event(tmo->data == USB_GPIO_VAL ? USB_POWERED : USB_UNPOWERED);
|
||||
usb_status_event(tmo->data == USB_GPIO_VAL ? USB_INSERTED : USB_EXTRACTED);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -231,7 +231,7 @@ void usb_drv_usb_detect_event(void)
|
|||
{
|
||||
/* Filter for invalid bus reset when unplugging by checking the pin state. */
|
||||
if(usb_plugged()) {
|
||||
usb_status_event(USB_INSERTED);
|
||||
usb_status_event(USB_HOSTED);
|
||||
}
|
||||
}
|
||||
#endif /* USB_STATUS_BY_EVENT */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue