stm32: Discard usbotg tx data until usb is ready
If the usb interface is not ready, just discard messages. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
@@ -160,8 +160,8 @@ usb_send_bulk_in(void *data, uint_fast8_t len)
|
||||
{
|
||||
uint32_t ctl = EPIN(USB_CDC_EP_BULK_IN)->DIEPCTL;
|
||||
if (!(ctl & USB_OTG_DIEPCTL_USBAEP))
|
||||
// Controller not enabled
|
||||
return -2;
|
||||
// Controller not enabled - discard data
|
||||
return len;
|
||||
if (ctl & USB_OTG_DIEPCTL_EPENA) {
|
||||
// Wait for space to transmit
|
||||
OTGD->DIEPEMPMSK |= (1 << USB_CDC_EP_BULK_IN);
|
||||
|
Reference in New Issue
Block a user