forked from len0rd/rockbox
Red fix: USB power check implemented in driver instead
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15761 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
f2815ff32f
commit
7af22e1a86
3 changed files with 10 additions and 2 deletions
|
@ -40,7 +40,7 @@
|
||||||
#endif
|
#endif
|
||||||
#if defined(SANSA_E200) || defined(SANSA_C200)
|
#if defined(SANSA_E200) || defined(SANSA_C200)
|
||||||
#include "usb.h"
|
#include "usb.h"
|
||||||
#include "arcotg_udc.h"
|
#include "usb_drv.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -460,7 +460,7 @@ void* main(void)
|
||||||
btn = button_read_device();
|
btn = button_read_device();
|
||||||
#if defined(SANSA_E200) || defined(SANSA_C200)
|
#if defined(SANSA_E200) || defined(SANSA_C200)
|
||||||
usb_init();
|
usb_init();
|
||||||
while ((UDC_OTGSC&0x800) && usb_retry < 5 && !usb)
|
while (usb_drv_powered() && usb_retry < 5 && !usb)
|
||||||
{
|
{
|
||||||
usb_retry++;
|
usb_retry++;
|
||||||
sleep(HZ/4);
|
sleep(HZ/4);
|
||||||
|
|
|
@ -31,5 +31,6 @@ void usb_drv_ack(struct usb_ctrlrequest* req);
|
||||||
void usb_drv_set_address(int address);
|
void usb_drv_set_address(int address);
|
||||||
void usb_drv_reset_endpoint(int endpoint, bool send);
|
void usb_drv_reset_endpoint(int endpoint, bool send);
|
||||||
void usb_drv_wait(int endpoint, bool send);
|
void usb_drv_wait(int endpoint, bool send);
|
||||||
|
bool usb_drv_powered(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -247,6 +247,9 @@
|
||||||
#define USB_CTRL_IOENB (0x00000004)
|
#define USB_CTRL_IOENB (0x00000004)
|
||||||
#define USB_CTRL_ULPI_INT0EN (0x00000001)
|
#define USB_CTRL_ULPI_INT0EN (0x00000001)
|
||||||
|
|
||||||
|
/* OTGSC Register Bit Masks */
|
||||||
|
#define OTGSC_B_SESSION_VALID (0x00000800)
|
||||||
|
|
||||||
#define QH_MULT_POS (30)
|
#define QH_MULT_POS (30)
|
||||||
#define QH_ZLT_SEL (0x20000000)
|
#define QH_ZLT_SEL (0x20000000)
|
||||||
#define QH_MAX_PKT_LEN_POS (16)
|
#define QH_MAX_PKT_LEN_POS (16)
|
||||||
|
@ -322,6 +325,10 @@ static void init_queue_heads(void);
|
||||||
static void init_endpoints(void);
|
static void init_endpoints(void);
|
||||||
/*-------------------------------------------------------------------------*/
|
/*-------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
bool usb_drv_powered(void)
|
||||||
|
{
|
||||||
|
return (REG_OTGSC & OTGSC_B_SESSION_VALID) ? true : false;
|
||||||
|
}
|
||||||
|
|
||||||
/* manual: 32.14.1 Device Controller Initialization */
|
/* manual: 32.14.1 Device Controller Initialization */
|
||||||
void usb_drv_init(void)
|
void usb_drv_init(void)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue