summaryrefslogtreecommitdiff
path: root/firmware/target/arm/as3525/usb-drv-as3525v2.c
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2011-03-02 08:49:38 +0000
committerMichael Sevakis <jethead71@rockbox.org>2011-03-02 08:49:38 +0000
commit12375d1d3aa41f7d277a9af584c7b810b636ec95 (patch)
treefc9ce8029a6910a8dac71b3bf60c71155a01eea4 /firmware/target/arm/as3525/usb-drv-as3525v2.c
parent05e180a1308a095d51d51d0e047fcd44425ea88f (diff)
downloadrockbox-12375d1d3aa41f7d277a9af584c7b810b636ec95.tar.gz
rockbox-12375d1d3aa41f7d277a9af584c7b810b636ec95.zip
Merge functionality of wakeups and semaphores-- fewer APIs and object types. semaphore_wait takes a timeout now so codecs and plugins have to be made incompatible. Don't make semaphores for targets not using them.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29492 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/arm/as3525/usb-drv-as3525v2.c')
-rw-r--r--firmware/target/arm/as3525/usb-drv-as3525v2.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/firmware/target/arm/as3525/usb-drv-as3525v2.c b/firmware/target/arm/as3525/usb-drv-as3525v2.c
index 78dc2a603f..24548f30c5 100644
--- a/firmware/target/arm/as3525/usb-drv-as3525v2.c
+++ b/firmware/target/arm/as3525/usb-drv-as3525v2.c
@@ -61,7 +61,7 @@ static const uint8_t out_ep_list[NUM_OUT_EP + 1] = {0, OUT_EP_LIST};
61struct usb_endpoint 61struct usb_endpoint
62{ 62{
63 unsigned int len; /* length of the data buffer */ 63 unsigned int len; /* length of the data buffer */
64 struct wakeup complete; /* wait object */ 64 struct semaphore complete; /* wait object */
65 int8_t status; /* completion status (0 for success) */ 65 int8_t status; /* completion status (0 for success) */
66 bool active; /* true is endpoint has been requested (true for EP0) */ 66 bool active; /* true is endpoint has been requested (true for EP0) */
67 bool wait; /* true if usb thread is blocked on completion */ 67 bool wait; /* true if usb thread is blocked on completion */
@@ -281,7 +281,7 @@ static void reset_endpoints(void)
281 if(endpoints[ep][DIR_IN].wait) 281 if(endpoints[ep][DIR_IN].wait)
282 { 282 {
283 endpoints[ep][DIR_IN].wait = false; 283 endpoints[ep][DIR_IN].wait = false;
284 wakeup_signal(&endpoints[ep][DIR_IN].complete); 284 semaphore_release(&endpoints[ep][DIR_IN].complete);
285 } 285 }
286 if(DIEPCTL(ep) & DEPCTL_epena) 286 if(DIEPCTL(ep) & DEPCTL_epena)
287 DIEPCTL(ep) = DEPCTL_snak; 287 DIEPCTL(ep) = DEPCTL_snak;
@@ -297,7 +297,7 @@ static void reset_endpoints(void)
297 if(endpoints[ep][DIR_OUT].wait) 297 if(endpoints[ep][DIR_OUT].wait)
298 { 298 {
299 endpoints[ep][DIR_OUT].wait = false; 299 endpoints[ep][DIR_OUT].wait = false;
300 wakeup_signal(&endpoints[ep][DIR_OUT].complete); 300 semaphore_release(&endpoints[ep][DIR_OUT].complete);
301 } 301 }
302 if(DOEPCTL(ep) & DEPCTL_epena) 302 if(DOEPCTL(ep) & DEPCTL_epena)
303 DOEPCTL(ep) = DEPCTL_snak; 303 DOEPCTL(ep) = DEPCTL_snak;
@@ -329,7 +329,7 @@ static void cancel_all_transfers(bool cancel_ep0)
329 if(endpoints[ep][DIR_IN].wait) 329 if(endpoints[ep][DIR_IN].wait)
330 { 330 {
331 endpoints[ep][DIR_IN].wait = false; 331 endpoints[ep][DIR_IN].wait = false;
332 wakeup_signal(&endpoints[ep][DIR_IN].complete); 332 semaphore_release(&endpoints[ep][DIR_IN].complete);
333 } 333 }
334 DIEPCTL(ep) = (DIEPCTL(ep) & ~DEPCTL_usbactep) | DEPCTL_snak; 334 DIEPCTL(ep) = (DIEPCTL(ep) & ~DEPCTL_usbactep) | DEPCTL_snak;
335 } 335 }
@@ -340,7 +340,7 @@ static void cancel_all_transfers(bool cancel_ep0)
340 if(endpoints[ep][DIR_OUT].wait) 340 if(endpoints[ep][DIR_OUT].wait)
341 { 341 {
342 endpoints[ep][DIR_OUT].wait = false; 342 endpoints[ep][DIR_OUT].wait = false;
343 wakeup_signal(&endpoints[ep][DIR_OUT].complete); 343 semaphore_release(&endpoints[ep][DIR_OUT].complete);
344 } 344 }
345 DOEPCTL(ep) = (DOEPCTL(ep) & ~DEPCTL_usbactep) | DEPCTL_snak; 345 DOEPCTL(ep) = (DOEPCTL(ep) & ~DEPCTL_usbactep) | DEPCTL_snak;
346 } 346 }
@@ -457,9 +457,9 @@ void usb_drv_init(void)
457 /* Core init */ 457 /* Core init */
458 core_init(); 458 core_init();
459 FOR_EACH_IN_EP_AND_EP0(i, ep) 459 FOR_EACH_IN_EP_AND_EP0(i, ep)
460 wakeup_init(&endpoints[ep][DIR_IN].complete); 460 semaphore_init(&endpoints[ep][DIR_IN].complete, 1, 0);
461 FOR_EACH_OUT_EP_AND_EP0(i, ep) 461 FOR_EACH_OUT_EP_AND_EP0(i, ep)
462 wakeup_init(&endpoints[ep][DIR_OUT].complete); 462 semaphore_init(&endpoints[ep][DIR_OUT].complete, 1, 0);
463 /* Enable global interrupts */ 463 /* Enable global interrupts */
464 enable_global_interrupts(); 464 enable_global_interrupts();
465} 465}
@@ -498,7 +498,7 @@ static void handle_ep_in_int(int ep)
498 if(endpoint->wait) 498 if(endpoint->wait)
499 { 499 {
500 endpoint->wait = false; 500 endpoint->wait = false;
501 wakeup_signal(&endpoint->complete); 501 semaphore_release(&endpoint->complete);
502 } 502 }
503 } 503 }
504 } 504 }
@@ -515,7 +515,7 @@ static void handle_ep_in_int(int ep)
515 if(endpoint->wait) 515 if(endpoint->wait)
516 { 516 {
517 endpoint->wait = false; 517 endpoint->wait = false;
518 wakeup_signal(&endpoint->complete); 518 semaphore_release(&endpoint->complete);
519 } 519 }
520 } 520 }
521 } 521 }
@@ -549,7 +549,7 @@ static void handle_ep_out_int(int ep)
549 if(endpoint->wait) 549 if(endpoint->wait)
550 { 550 {
551 endpoint->wait = false; 551 endpoint->wait = false;
552 wakeup_signal(&endpoint->complete); 552 semaphore_release(&endpoint->complete);
553 } 553 }
554 } 554 }
555 } 555 }
@@ -798,7 +798,7 @@ static int usb_drv_transfer(int ep, void *ptr, int len, bool dir_in, bool blocki
798 798
799 if(blocking) 799 if(blocking)
800 { 800 {
801 wakeup_wait(&endpoint->complete, TIMEOUT_BLOCK); 801 semaphore_wait(&endpoint->complete, TIMEOUT_BLOCK);
802 return endpoint->status; 802 return endpoint->status;
803 } 803 }
804 804