summaryrefslogtreecommitdiff
path: root/src/ao_usb.c
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2009-11-04 21:32:07 -0800
committerKeith Packard <keithp@keithp.com>2009-11-04 21:32:07 -0800
commit3ece984f4d72b4f720a5efdfaad7cff77a93d676 (patch)
tree9c351576c0e3f295461bc9a81867998dc38cc401 /src/ao_usb.c
parentbc62bb254085cc705203b57260c04ac5e14c6611 (diff)
In USB pollchar, wait for packet before re-checking USB out len
This probably wouldn't actually cause a problem, but it seems more reliable to wait for a packet interrupt before re-reading the packet OUT len register. This could avoid spinning while waiting for a USB packet, which seems like a good thing. Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src/ao_usb.c')
-rw-r--r--src/ao_usb.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/ao_usb.c b/src/ao_usb.c
index daca71a7..527e9b30 100644
--- a/src/ao_usb.c
+++ b/src/ao_usb.c
@@ -377,11 +377,13 @@ char
ao_usb_pollchar(void) __critical
{
char c;
- while (ao_usb_out_bytes == 0) {
+ if (ao_usb_out_bytes == 0) {
USBINDEX = AO_USB_OUT_EP;
if ((USBCSOL & USBCSOL_OUTPKT_RDY) == 0)
return AO_READ_AGAIN;
ao_usb_out_bytes = (USBCNTH << 8) | USBCNTL;
+ if (ao_usb_out_bytes == 0)
+ return AO_READ_AGAIN;
}
--ao_usb_out_bytes;
c = USBFIFO[AO_USB_OUT_EP << 1];