+/* Wait for a free IN buffer */
+static void
+ao_usb_in_wait(void)
+{
+ for (;;) {
+ USBINDEX = AO_USB_IN_EP;
+ if ((USBCSIL & USBCSIL_INPKT_RDY) == 0)
+ break;
+ ao_sleep(&ao_usb_in_bytes);
+ }
+}
+
+/* Send the current IN packet */
+static void
+ao_usb_in_send(void)
+{
+ USBINDEX = AO_USB_IN_EP;
+ USBCSIL |= USBCSIL_INPKT_RDY;
+ ao_usb_in_bytes_last = ao_usb_in_bytes;
+ ao_usb_in_bytes = 0;
+}
+