mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-14 02:27:39 -04:00
Move AMSv1 USB to the USB_DETECT_BY_DRV model, so connecting to a dumb charger works without interrupting playback
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28819 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
a47c04f0c8
commit
ecd80d888e
3 changed files with 22 additions and 5 deletions
|
@ -724,8 +724,11 @@ Lyre prototype 1 */
|
||||||
#if CONFIG_CPU != IMX31L
|
#if CONFIG_CPU != IMX31L
|
||||||
#define INCLUDE_TIMEOUT_API
|
#define INCLUDE_TIMEOUT_API
|
||||||
#endif
|
#endif
|
||||||
#endif /* HAVE_USBSTACK */
|
#endif /* HAVE_USBSTACK && USBOTG_ARC */
|
||||||
|
|
||||||
|
#if defined(HAVE_USBSTACK) && CONFIG_USBOTG == USBOTG_AS3525
|
||||||
|
#define USB_DETECT_BY_DRV
|
||||||
|
#endif /* HAVE_USBSTACK && USBOTG_AS3525 */
|
||||||
|
|
||||||
#endif /* BOOTLOADER */
|
#endif /* BOOTLOADER */
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,8 @@
|
||||||
#include "power.h"
|
#include "power.h"
|
||||||
#include "as3525.h"
|
#include "as3525.h"
|
||||||
|
|
||||||
static int usb_status = USB_EXTRACTED;
|
static bool bus_activity = 0;
|
||||||
|
static bool connected = 0;
|
||||||
|
|
||||||
void usb_enable(bool on)
|
void usb_enable(bool on)
|
||||||
{
|
{
|
||||||
|
@ -45,12 +46,19 @@ void usb_enable(bool on)
|
||||||
|
|
||||||
void usb_insert_int(void)
|
void usb_insert_int(void)
|
||||||
{
|
{
|
||||||
usb_status = USB_INSERTED;
|
connected = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void usb_remove_int(void)
|
void usb_remove_int(void)
|
||||||
{
|
{
|
||||||
usb_status = USB_EXTRACTED;
|
connected = 0;
|
||||||
|
bus_activity = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void usb_drv_usb_detect_event(void)
|
||||||
|
{
|
||||||
|
/* Bus activity seen */
|
||||||
|
bus_activity = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int usb_detect(void)
|
int usb_detect(void)
|
||||||
|
@ -61,5 +69,10 @@ int usb_detect(void)
|
||||||
* TODO: Implement USB in rockbox for these players */
|
* TODO: Implement USB in rockbox for these players */
|
||||||
return USB_EXTRACTED;
|
return USB_EXTRACTED;
|
||||||
#endif
|
#endif
|
||||||
return usb_status;
|
if(bus_activity && connected)
|
||||||
|
return USB_INSERTED;
|
||||||
|
else if(connected)
|
||||||
|
return USB_POWERED;
|
||||||
|
else
|
||||||
|
return USB_EXTRACTED;
|
||||||
}
|
}
|
||||||
|
|
|
@ -754,6 +754,7 @@ void INT_USB(void)
|
||||||
}
|
}
|
||||||
if (intr & USB_DEV_INTR_USB_RESET) {/* usb reset from host? */
|
if (intr & USB_DEV_INTR_USB_RESET) {/* usb reset from host? */
|
||||||
logf("usb reset\n");
|
logf("usb reset\n");
|
||||||
|
usb_drv_usb_detect_event();
|
||||||
reset_endpoints(1);
|
reset_endpoints(1);
|
||||||
usb_core_bus_reset();
|
usb_core_bus_reset();
|
||||||
intr &= ~USB_DEV_INTR_USB_RESET;
|
intr &= ~USB_DEV_INTR_USB_RESET;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue