mirror of https://github.com/ARMmbed/mbed-os.git
Silicon Labs USB device support - Wonder, Leopard, Happy
USB device support for Wonder, Leopard and Happy Gecko. See details on configuration etc on the previous commit. Known issue: USBAudio does not work reliably on Happy Gecko.pull/1287/head
parent
8054366915
commit
957d7bd942
|
|
@ -234,6 +234,33 @@ void USBDEP_Ep0Handler( USBD_Device_TypeDef *device )
|
|||
static uint32_t xferred;
|
||||
static USB_XferCompleteCb_TypeDef callback;
|
||||
|
||||
#ifdef __MBED__
|
||||
|
||||
(void)xferred;
|
||||
(void)status;
|
||||
|
||||
ep = &device->ep[ 0 ];
|
||||
|
||||
if ( ( ep->state == D_EP_TRANSMITTING ) || ( ep->state == D_EP_RECEIVING ) )
|
||||
{
|
||||
ep->state = D_EP_IDLE;
|
||||
|
||||
if ( ep->xferCompleteCb )
|
||||
{
|
||||
callback = ep->xferCompleteCb;
|
||||
ep->xferCompleteCb = NULL;
|
||||
callback( USB_STATUS_OK, ep->xferred, ep->remaining );
|
||||
}
|
||||
|
||||
USBDHAL_ReenableEp0Setup(device);
|
||||
}
|
||||
else
|
||||
{
|
||||
device->callbacks->setupCmd(device->setup);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
ep = &device->ep[ 0 ];
|
||||
|
||||
switch ( ep->state )
|
||||
|
|
@ -376,6 +403,7 @@ void USBDEP_Ep0Handler( USBD_Device_TypeDef *device )
|
|||
ep->in = false; /* OUT for next SETUP */
|
||||
break;
|
||||
}
|
||||
#endif /* __MBED__ */
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -846,6 +846,32 @@ retry:
|
|||
}
|
||||
else /* ep0state != EP0_IDLE */
|
||||
{
|
||||
#ifdef __MBED__
|
||||
if ( ep->state == D_EP_RECEIVING )
|
||||
{
|
||||
int xfer_size = ep->packetSize - (( USB->DOEP0TSIZ & _USB_DOEP0TSIZ_XFERSIZE_MASK )
|
||||
>> _USB_DOEP0TSIZ_XFERSIZE_SHIFT);
|
||||
int setup_pkt_received = status & USB_DOEP0INT_SETUP;
|
||||
|
||||
if ( (!setup_pkt_received && xfer_size == 0) ||
|
||||
(setup_pkt_received && xfer_size == 8) )
|
||||
{
|
||||
/* Higher levels need to see the correct transfer amount for ZLPs */
|
||||
ep->remaining = 0;
|
||||
ep->xferred = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* FIXME - does not work if actual read size > 56 */
|
||||
if ( setup_pkt_received ) xfer_size -= 8;
|
||||
|
||||
ep->xferred = xfer_size;
|
||||
ep->remaining -= xfer_size;
|
||||
}
|
||||
|
||||
USBDEP_Ep0Handler( dev );
|
||||
}
|
||||
#else
|
||||
if ( ep->state == D_EP_RECEIVING )
|
||||
{
|
||||
if ( ep->remaining > ep->packetSize )
|
||||
|
|
@ -864,6 +890,7 @@ retry:
|
|||
{
|
||||
USBDEP_Ep0Handler( dev );
|
||||
}
|
||||
#endif
|
||||
}
|
||||
} /* if ( status & USB_DOEP0INT_XFERCOMPL ) */
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue