From: Keith Packard Date: Thu, 5 Nov 2009 05:32:07 +0000 (-0800) Subject: In USB pollchar, wait for packet before re-checking USB out len X-Git-Tag: debian/0.6+27+gb0d7e3f~17 X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=commitdiff_plain;h=3ece984f4d72b4f720a5efdfaad7cff77a93d676 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 --- 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];