summaryrefslogtreecommitdiffstats
path: root/firmware
diff options
context:
space:
mode:
authorRafaël Carré <rafael.carre@gmail.com>2010-09-08 03:31:18 +0000
committerRafaël Carré <rafael.carre@gmail.com>2010-09-08 03:31:18 +0000
commite526681c6312c3d1236b078702183870ba43cd9f (patch)
tree5055a26e56bb4c49868f537c3e83a700923a561f /firmware
parentd2871ff8531a0da3124c9201ceccb56e5cb38d03 (diff)
downloadrockbox-e526681c6312c3d1236b078702183870ba43cd9f.tar.gz
rockbox-e526681c6312c3d1236b078702183870ba43cd9f.tar.bz2
rockbox-e526681c6312c3d1236b078702183870ba43cd9f.zip
USB AMSv2: use status == -1 to signal errors
set status to failure before signaling usb_drv_send_nonblocking() in reset_endpoints() git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28037 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware')
-rw-r--r--firmware/target/arm/as3525/usb-drv-as3525v2.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/firmware/target/arm/as3525/usb-drv-as3525v2.c b/firmware/target/arm/as3525/usb-drv-as3525v2.c
index df85994c5c..1d21ca7d5d 100644
--- a/firmware/target/arm/as3525/usb-drv-as3525v2.c
+++ b/firmware/target/arm/as3525/usb-drv-as3525v2.c
@@ -285,6 +285,7 @@ static void reset_endpoints(void)
{
endpoints[ep][DIR_IN].active = false;
endpoints[ep][DIR_IN].busy = false;
+ endpoints[ep][DIR_IN].status = -1;
if(endpoints[ep][DIR_IN].wait)
wakeup_signal(&endpoints[ep][DIR_IN].complete);
endpoints[ep][DIR_IN].wait = false;
@@ -298,6 +299,7 @@ static void reset_endpoints(void)
{
endpoints[ep][DIR_OUT].active = false;
endpoints[ep][DIR_OUT].busy = false;
+ endpoints[ep][DIR_OUT].status = -1;
if(endpoints[ep][DIR_OUT].wait)
wakeup_signal(&endpoints[ep][DIR_OUT].complete);
endpoints[ep][DIR_OUT].wait = false;
@@ -324,7 +326,7 @@ static void cancel_all_transfers(bool cancel_ep0)
unsigned i, ep;
FOR_EACH_IN_EP_EX(cancel_ep0, i, ep)
{
- endpoints[ep][DIR_IN].status = 1;
+ endpoints[ep][DIR_IN].status = -1;
endpoints[ep][DIR_IN].wait = false;
endpoints[ep][DIR_IN].busy = false;
wakeup_signal(&endpoints[ep][DIR_IN].complete);
@@ -332,7 +334,7 @@ static void cancel_all_transfers(bool cancel_ep0)
}
FOR_EACH_OUT_EP_EX(cancel_ep0, i, ep)
{
- endpoints[ep][DIR_OUT].status = 1;
+ endpoints[ep][DIR_OUT].status = -1;
endpoints[ep][DIR_OUT].wait = false;
endpoints[ep][DIR_OUT].busy = false;
wakeup_signal(&endpoints[ep][DIR_OUT].complete);
@@ -498,7 +500,7 @@ static void handle_ep_int(int ep, bool dir_in)
if(endpoint->busy)
{
endpoint->busy = false;
- endpoint->status = 1;
+ endpoint->status = -1;
/* for safety, act as if no bytes as been transfered */
endpoint->len = 0;
usb_core_transfer_complete(ep, USB_DIR_IN, 1, 0);
@@ -746,7 +748,7 @@ static int usb_drv_transfer(int ep, void *ptr, int len, bool dir_in, bool blocki
endpoint->busy = true;
endpoint->len = len;
endpoint->wait = blocking;
- endpoint->status = 0;
+ endpoint->status = -1;
DEPCTL &= ~DEPCTL_stall;
DEPCTL |= DEPCTL_usbactep;
@@ -774,9 +776,11 @@ static int usb_drv_transfer(int ep, void *ptr, int len, bool dir_in, bool blocki
DEPCTL |= DEPCTL_epena | DEPCTL_cnak;
if(blocking)
+ {
wakeup_wait(&endpoint->complete, TIMEOUT_BLOCK);
- if(endpoint->status != 0)
- return -1;
+ return endpoint->status;
+ }
+
return 0;
#undef DEPCTL
@@ -831,4 +835,3 @@ bool usb_drv_stalled(int ep, bool in)
{
return (in ? DIEPCTL(ep) : DOEPCTL(ep)) & DEPCTL_stall;
}
-