+ } else if (ao_usb_ep0_out_len) {
+
+ /* Receiving data from the host
+ */
+ ao_usb_ep0_state = AO_USB_EP0_DATA_OUT;
+ USBCS0 = USBCS0_CLR_OUTPKT_RDY;
+ } else if (ao_usb_setup.length) {
+
+ /* Uh-oh, the host expected to send or receive data
+ * and we don't know what to do.
+ */
+ ao_usb_ep0_state = AO_USB_EP0_STALL;
+ USBCS0 = USBCS0_CLR_OUTPKT_RDY | USBCS0_SEND_STALL;
+ } else {
+
+ /* Simple setup packet with no data
+ */
+ ao_usb_ep0_state = AO_USB_EP0_IDLE;
+ USBCS0 = USBCS0_CLR_OUTPKT_RDY | USBCS0_DATA_END;