summaryrefslogtreecommitdiffstats
path: root/firmware
diff options
context:
space:
mode:
authorTobias Diedrich <ranma+coreboot@tdiedrich.de>2010-06-24 19:14:47 +0000
committerTobias Diedrich <ranma+coreboot@tdiedrich.de>2010-06-24 19:14:47 +0000
commitc9bbff571b726c30d19aff824872f6193d7ae5d2 (patch)
tree5991c9c13a85e3b437e4078c28824b8ad54aa5ab /firmware
parenta035ed4cb0848e07dbc4df82ca560aeb5a3935c3 (diff)
downloadrockbox-c9bbff571b726c30d19aff824872f6193d7ae5d2.tar.gz
rockbox-c9bbff571b726c30d19aff824872f6193d7ae5d2.tar.bz2
rockbox-c9bbff571b726c30d19aff824872f6193d7ae5d2.zip
Add transfer timeout, remove unused buf field
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27115 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware')
-rw-r--r--firmware/target/arm/as3525/usb-drv-as3525.c21
-rw-r--r--firmware/target/arm/as3525/usb-drv-as3525.h2
2 files changed, 21 insertions, 2 deletions
diff --git a/firmware/target/arm/as3525/usb-drv-as3525.c b/firmware/target/arm/as3525/usb-drv-as3525.c
index 90a1c931f7..09a680476d 100644
--- a/firmware/target/arm/as3525/usb-drv-as3525.c
+++ b/firmware/target/arm/as3525/usb-drv-as3525.c
@@ -413,7 +413,7 @@ int usb_drv_recv(int ep, void *ptr, int len)
endpoints[ep][1].state |= EP_STATE_BUSY;
endpoints[ep][1].len = len;
endpoints[ep][1].rc = -1;
- endpoints[ep][1].buf = ptr;
+ endpoints[ep][1].timeout = current_tick + HZ;
/* remove data buffer from cache */
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].len = len;
endpoints[ep][0].rc = -1;
+ endpoints[ep][0].timeout = current_tick + HZ;
/* Make sure data is committed to memory */
clean_dcache_range(ptr, len);
@@ -673,6 +674,24 @@ static void usb_tick(void)
{
static int rde_timer = 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)
return;
diff --git a/firmware/target/arm/as3525/usb-drv-as3525.h b/firmware/target/arm/as3525/usb-drv-as3525.h
index d4ec8067ac..ee3b4fcd03 100644
--- a/firmware/target/arm/as3525/usb-drv-as3525.h
+++ b/firmware/target/arm/as3525/usb-drv-as3525.h
@@ -307,8 +307,8 @@ struct usb_dev_setup_buf {
struct usb_endpoint
{
- void *buf;
unsigned int len;
+ unsigned int timeout;
volatile unsigned int state;
int rc;
struct wakeup complete;