mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-12-10 13:45:10 -05:00
Add transfer timeout, remove unused buf field
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27115 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
a035ed4cb0
commit
c9bbff571b
2 changed files with 21 additions and 2 deletions
|
|
@ -413,7 +413,7 @@ int usb_drv_recv(int ep, void *ptr, int len)
|
||||||
endpoints[ep][1].state |= EP_STATE_BUSY;
|
endpoints[ep][1].state |= EP_STATE_BUSY;
|
||||||
endpoints[ep][1].len = len;
|
endpoints[ep][1].len = len;
|
||||||
endpoints[ep][1].rc = -1;
|
endpoints[ep][1].rc = -1;
|
||||||
endpoints[ep][1].buf = ptr;
|
endpoints[ep][1].timeout = current_tick + HZ;
|
||||||
|
|
||||||
/* remove data buffer from cache */
|
/* remove data buffer from cache */
|
||||||
invalidate_dcache_range(ptr, len);
|
invalidate_dcache_range(ptr, len);
|
||||||
|
|
@ -483,6 +483,7 @@ void ep_send(int ep, void *ptr, int len)
|
||||||
endpoints[ep][0].state |= EP_STATE_BUSY;
|
endpoints[ep][0].state |= EP_STATE_BUSY;
|
||||||
endpoints[ep][0].len = len;
|
endpoints[ep][0].len = len;
|
||||||
endpoints[ep][0].rc = -1;
|
endpoints[ep][0].rc = -1;
|
||||||
|
endpoints[ep][0].timeout = current_tick + HZ;
|
||||||
|
|
||||||
/* Make sure data is committed to memory */
|
/* Make sure data is committed to memory */
|
||||||
clean_dcache_range(ptr, len);
|
clean_dcache_range(ptr, len);
|
||||||
|
|
@ -673,6 +674,24 @@ static void usb_tick(void)
|
||||||
{
|
{
|
||||||
static int rde_timer = 0;
|
static int rde_timer = 0;
|
||||||
static int rde_fails = 0;
|
static int rde_fails = 0;
|
||||||
|
struct usb_endpoint *eps = &endpoints[0][0];
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i=0; i<2*USB_NUM_EPS; i++) {
|
||||||
|
if (!(eps[i].state & EP_STATE_BUSY) ||
|
||||||
|
!TIME_AFTER(current_tick, endpoints[i]))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
/* recv or send timed out */
|
||||||
|
if (eps[i].state & EP_STATE_ASYNC) {
|
||||||
|
eps[i].rc = -1;
|
||||||
|
wakeup_signal(&eps[i].complete);
|
||||||
|
} else {
|
||||||
|
usb_core_transfer_complete(i/2, i&1 ? USB_DIR_OUT : USB_DIR_IN,
|
||||||
|
-1, 0);
|
||||||
|
}
|
||||||
|
eps[i].state &= ~(EP_STATE_BUSY|EP_STATE_ASYNC);
|
||||||
|
}
|
||||||
|
|
||||||
if (USB_DEV_CTRL & USB_DEV_CTRL_RDE)
|
if (USB_DEV_CTRL & USB_DEV_CTRL_RDE)
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -307,8 +307,8 @@ struct usb_dev_setup_buf {
|
||||||
|
|
||||||
struct usb_endpoint
|
struct usb_endpoint
|
||||||
{
|
{
|
||||||
void *buf;
|
|
||||||
unsigned int len;
|
unsigned int len;
|
||||||
|
unsigned int timeout;
|
||||||
volatile unsigned int state;
|
volatile unsigned int state;
|
||||||
int rc;
|
int rc;
|
||||||
struct wakeup complete;
|
struct wakeup complete;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue