-#if HAS_AO_USB_WRITE
-void *
-ao_usb_alloc(uint16_t len)
-{
- return ao_usb_alloc_sram(len);
-}
-
-void
-ao_usb_write(void *block, int len)
-{
- uint8_t *b = block;
- int this_time;
-
- if (!ao_usb_running)
- return;
-
- if (!ao_usb_in_flushed)
- ao_usb_flush();
-
- while (len) {
- ao_usb_in_flushed = 0;
- this_time = AO_USB_IN_SIZE;
- if (this_time > len)
- this_time = len;
-
- ao_arch_block_interrupts();
- while (ao_usb_in_pending)
- ao_sleep(&ao_usb_in_pending);
- ao_usb_in_pending = 1;
- if (this_time != AO_USB_IN_SIZE)
- ao_usb_in_flushed = 1;
- ao_usb_set_ep(ao_usb_epn_in(AO_USB_IN_EP), b, this_time);
- ao_arch_release_interrupts();
- b += this_time;
- len -= this_time;
- }
-}
-#endif
-