diff options
| author | Rafaël Carré <rafael.carre@gmail.com> | 2011-12-14 06:30:16 +0000 |
|---|---|---|
| committer | Rafaël Carré <rafael.carre@gmail.com> | 2011-12-14 06:30:16 +0000 |
| commit | 26b31f1a17319f6d40f80287d4ca26473362d7d9 (patch) | |
| tree | 49ccdb6424ed72915c7ea100410ebabd7ceab90d | |
| parent | 845cd59e3f86bd80547da1f5eb51b43002e94ca6 (diff) | |
| download | rockbox-26b31f1a17319f6d40f80287d4ca26473362d7d9.zip rockbox-26b31f1a17319f6d40f80287d4ca26473362d7d9.tar.gz rockbox-26b31f1a17319f6d40f80287d4ca26473362d7d9.tar.bz2 rockbox-26b31f1a17319f6d40f80287d4ca26473362d7d9.tar.xz | |
usb-s3c6400: make isr more clear
DIEPINT_timeout and DOEPINT_setup are the same bit
Use separate cases so the code is more clear
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31242 a1c6a512-1295-4272-9138-f99709370657
| -rw-r--r-- | firmware/target/arm/usb-s3c6400x.c | 51 |
1 files changed, 25 insertions, 26 deletions
diff --git a/firmware/target/arm/usb-s3c6400x.c b/firmware/target/arm/usb-s3c6400x.c index b1252b8..018694a 100644 --- a/firmware/target/arm/usb-s3c6400x.c +++ b/firmware/target/arm/usb-s3c6400x.c @@ -163,7 +163,7 @@ static void usb_reset(void) reset_endpoints(1); } -static void handle_ep_int(int out) +static void handle_ep_int(bool out) { static const uint8_t eps[2][3] = { /* IN */ {0, 1, 3}, /* OUT */ {0, 2, 4}}; for (int i = 0; i < 3; i++) @@ -186,37 +186,36 @@ static void handle_ep_int(int out) semaphore_release(&endpoints[ep].complete); } } + if (epints & DEPINT_ahberr) panicf("USB: AHB error on EP%d (dir %d)", ep, out); - if (epints & DIEPINT_timeout) + + if (!out && (epints & DIEPINT_timeout)) { - if (!out) + if (endpoints[ep].busy) { - if (endpoints[ep].busy) - { - endpoints[ep].busy = false; - endpoints[ep].rc = 1; - endpoints[ep].done = true; - semaphore_release(&endpoints[ep].complete); - } - } - else - { /* DOEPINT_setup */ - invalidate_dcache(); - if (ep == 0) - { - if (ctrlreq.header.bRequest == 5) - { - /* Already set the new address here, - before passing the packet to the core. - See below (usb_drv_set_address) for details. */ - DCFG = (DCFG & ~(DCFG_devadr_bits << DCFG_devadr_bitp)) | (ctrlreq.header.wValue << DCFG_devadr_bitp); - } - usb_core_control_request(&ctrlreq.header); - } - else panicf("USB: SETUP done on OUT EP%d!?", ep); + endpoints[ep].busy = false; + endpoints[ep].rc = 1; + endpoints[ep].done = true; + semaphore_release(&endpoints[ep].complete); } } + + if (out && (epints & DOEPINT_setup)) + { + invalidate_dcache(); + if (ep != 0) + panicf("USB: SETUP done on OUT EP%d!?", ep); + + /* Set the new address here, before passing the packet to the core. + See usb_drv_set_address() for details. */ + if (ctrlreq.header.bRequest == USB_REQ_SET_ADDRESS) + DCFG = (DCFG & ~(DCFG_devadr_bits << DCFG_devadr_bitp)) + | (ctrlreq.header.wValue << DCFG_devadr_bitp); + + usb_core_control_request(&ctrlreq.header); + } + /* Make sure EP0 OUT is set up to accept the next request */ if (out && ep == 0) { |