17 #if defined( USB_PRESENT ) && ( USB_COUNT == 1 )
19 #if defined( USB_DEVICE )
33 #if !defined( USB_DOEP0INT_STUPPKTRCVD )
34 void USBDEP_Ep0Handler( USBD_Device_TypeDef *device )
39 static uint32_t xferred;
42 ep = &device->ep[ 0 ];
51 status = USBDCH9_SetupCmd( device );
56 USBDHAL_StallEp( ep );
58 USBDHAL_StallEp( ep );
59 USBDHAL_ReenableEp0Setup( device );
63 if ( (ep->state == D_EP_RECEIVING) || (ep->state == D_EP_TRANSMITTING) )
65 callback = ep->xferCompleteCb;
68 if ( ep->state != D_EP_RECEIVING )
73 if ( ( ep->remaining < device->setup->wLength ) &&
74 ( ep->remaining % ep->packetSize == 0 ) )
82 USBDHAL_ReenableEp0Setup( device );
90 ep->state = D_EP0_IN_STATUS;
94 ep->state = D_EP_IDLE;
111 if ( callback != NULL )
120 USBDHAL_StallEp( ep );
122 USBDHAL_StallEp( ep );
123 USBDHAL_ReenableEp0Setup( device );
124 ep->state = D_EP_IDLE;
128 USBDHAL_ReenableEp0Setup( device );
130 ep->state = D_EP_IDLE;
133 ep->state = D_EP0_IN_STATUS;
138 case D_EP_TRANSMITTING:
149 xferred = ep->xferred;
150 ep->state = D_EP_IDLE;
159 xferred = ep->xferred;
162 ep->state = D_EP_IDLE;
165 ep->state = D_EP0_OUT_STATUS;
170 case D_EP0_IN_STATUS:
171 case D_EP0_OUT_STATUS:
174 USBDHAL_ReenableEp0Setup( device );
177 if ( callback != NULL )
182 ep->state = D_EP_IDLE;
193 #if defined( USB_DOEP0INT_STUPPKTRCVD )
194 void USBDEP_Ep0Handler( USBD_Device_TypeDef *device )
198 static uint32_t xferred;
201 ep = &device->ep[ 0 ];
210 status = USBDCH9_SetupCmd( device );
215 USBDHAL_StallEp( ep );
217 USBDHAL_StallEp( ep );
218 USBDHAL_StartEp0Setup( dev );
222 if ( (ep->state == D_EP_RECEIVING) || (ep->state == D_EP_TRANSMITTING) )
224 callback = ep->xferCompleteCb;
227 if ( ep->state != D_EP_RECEIVING )
232 if ( ( ep->remaining < device->setup->wLength ) &&
233 ( ep->remaining % ep->packetSize == 0 ) )
244 ep->state = D_EP_IDLE;
246 ep->state = D_EP0_IN_STATUS;
262 if ( callback != NULL )
271 USBDHAL_StallEp( ep );
273 USBDHAL_StallEp( ep );
274 USBDHAL_StartEp0Setup( dev );
275 ep->state = D_EP_IDLE;
280 USBDHAL_StartEp0Setup( dev );
281 ep->state = D_EP_IDLE;
284 ep->state = D_EP0_IN_STATUS;
289 case D_EP_TRANSMITTING:
299 xferred = ep->xferred;
300 ep->state = D_EP_IDLE;
309 xferred = ep->xferred;
312 ep->state = D_EP_IDLE;
314 ep->state = D_EP0_OUT_STATUS;
319 case D_EP0_IN_STATUS:
323 USBDHAL_StartEp0Setup( dev );
325 if ( callback != NULL )
329 ep->state = D_EP_IDLE;
333 case D_EP0_OUT_STATUS:
334 USBDHAL_StartEp0Setup( dev );
335 if ( callback != NULL )
339 ep->state = D_EP_IDLE;
350 void USBDEP_EpHandler( uint8_t epAddr )
353 USBD_Ep_TypeDef *ep = USBD_GetEpFromAddr( epAddr );
355 if ( ( ep->state == D_EP_TRANSMITTING ) || ( ep->state == D_EP_RECEIVING ) )
357 ep->state = D_EP_IDLE;
358 if ( ep->xferCompleteCb )
360 callback = ep->xferCompleteCb;
361 ep->xferCompleteCb = NULL;
USB protocol stack library API for EFM32/EZR32.
CMSIS Cortex-M Peripheral Access Layer for Silicon Laboratories microcontroller devices.
int(* USB_XferCompleteCb_TypeDef)(USB_Status_TypeDef status, uint32_t xferred, uint32_t remaining)
USB transfer callback function.
#define USB_DOEP0CTL_EPENA
USB protocol stack library API for EFM32/EZR32.
int USBD_Write(int epAddr, void *data, int byteCount, USB_XferCompleteCb_TypeDef callback)
Start a write (IN) transfer on an endpoint.
USB protocol stack library, low level USB peripheral access.
USB protocol stack library, internal type definitions.
int USBD_Read(int epAddr, void *data, int byteCount, USB_XferCompleteCb_TypeDef callback)
Start a read (OUT) transfer on an endpoint.