16 #ifndef __EM_USBTYPES_H
17 #define __EM_USBTYPES_H
20 #if defined( USB_PRESENT ) && ( USB_COUNT == 1 )
22 #if defined( USB_DEVICE ) || defined( USB_HOST )
31 #define NP_RX_QUE_DEPTH 8
32 #define HP_RX_QUE_DEPTH 8
33 #define MAX_XFER_LEN 524287L
34 #define MAX_PACKETS_PR_XFER 1023
35 #if defined( _USB_DIEPTXF6_MASK )
36 #define MAX_NUM_TX_FIFOS 6
37 #define MAX_NUM_IN_EPS 6
38 #define MAX_NUM_OUT_EPS 6
39 #define MAX_DEVICE_FIFO_SIZE_INWORDS 512U
41 #define MAX_NUM_TX_FIFOS 3
42 #define MAX_NUM_IN_EPS 3
43 #define MAX_NUM_OUT_EPS 3
44 #define MAX_DEVICE_FIFO_SIZE_INWORDS 384U
46 #define MIN_EP_FIFO_SIZE_INWORDS 16U
47 #define MIN_EP_FIFO_SIZE_INBYTES 64U
50 #if !defined( USB_ROUTE_VBUSENPEN )
51 #define USB_VBUS_SWITCH_NOT_PRESENT
55 #define MAX_USB_EP_NUM 15
57 #if defined( USB_DEVICE )
59 #ifndef USB_PWRSAVE_MODE
61 #define USB_PWRSAVE_MODE USB_PWRSAVE_MODE_OFF
63 #if ( USB_PWRSAVE_MODE & \
64 ~( USB_PWRSAVE_MODE_ONSUSPEND | USB_PWRSAVE_MODE_ONVBUSOFF | \
65 USB_PWRSAVE_MODE_ENTEREM2 ) )
66 #error "Illegal USB powersave mode."
71 #ifndef USB_USBC_32kHz_CLK
73 #define USB_USBC_32kHz_CLK USB_USBC_32kHz_CLK_LFXO
75 #if ( ( USB_USBC_32kHz_CLK != USB_USBC_32kHz_CLK_LFXO ) && \
76 ( USB_USBC_32kHz_CLK != USB_USBC_32kHz_CLK_LFRCO ) )
77 #error "Illegal USB 32kHz powersave clock selection."
82 #if defined( USB_HOST )
84 #ifndef USB_VBUSOVRCUR_PORT
85 #define USB_VBUSOVRCUR_PORT gpioPortE
86 #define USB_VBUSOVRCUR_PIN 2
87 #define USB_VBUSOVRCUR_POLARITY USB_VBUSOVRCUR_POLARITY_LOW
92 #if defined( DEBUG_USB_INT_LO )
93 #define DEBUG_USB_INT_LO_PUTS( s ) USB_PUTS( s )
94 #define DEBUG_USB_INT_LO_PUTCHAR( c ) USB_PUTCHAR( c )
96 #define DEBUG_USB_INT_LO_PUTS( s )
97 #define DEBUG_USB_INT_LO_PUTCHAR( c )
100 #if defined( DEBUG_USB_INT_HI )
101 #define DEBUG_USB_INT_HI_PUTS( s ) USB_PUTS( s )
102 #define DEBUG_USB_INT_HI_PUTCHAR( c ) USB_PUTCHAR( c )
104 #define DEBUG_USB_INT_HI_PUTS( s )
105 #define DEBUG_USB_INT_HI_PUTCHAR( c )
108 #if defined( USB_HOST )
109 #if defined( NUM_APP_TIMERS )
110 #define HOSTPORT_TIMER_INDEX (NUM_APP_TIMERS)
112 #define HOSTPORT_TIMER_INDEX (0)
114 #define HOSTCH_TIMER_INDEX (HOSTPORT_TIMER_INDEX + 1 )
123 #if defined( USB_HOST )
125 #define HCS_STALL 0x02
126 #define HCS_XACT 0x04
127 #define HCS_TGLERR 0x08
128 #define HCS_BABBLE 0x10
129 #define HCS_TIMEOUT 0x20
130 #define HCS_COMPLETED 0x40
131 #define HCS_RETRY 0x80
134 #if defined( USB_DEVICE )
138 D_EP_TRANSMITTING = 1,
142 } USBD_EpState_TypeDef;
159 USBD_EpState_TypeDef state;
167 uint8_t configurationValue;
168 bool remoteWakeupEnabled;
169 uint8_t numberOfStrings;
170 uint8_t numberOfInterfaces;
176 const void *
const *stringDescriptors;
178 USBD_Ep_TypeDef ep[ NUM_EP_USED + 1 ];
179 uint8_t inEpAddr2EpIndex[ MAX_USB_EP_NUM + 1 ];
180 uint8_t outEpAddr2EpIndex[ MAX_USB_EP_NUM + 1 ];
182 } USBD_Device_TypeDef;
185 #if defined( USB_HOST )
188 H_PORT_DISCONNECTED = 0,
189 H_PORT_CONNECTED_DEBOUNCING = 1,
190 H_PORT_CONNECTED_RESETTING = 2,
191 H_PORT_CONNECTED = 3,
192 H_PORT_OVERCURRENT = 4
193 } USBH_PortState_TypeDef;
199 } USBH_AttachTiming_TypeDef;
CMSIS Cortex-M Peripheral Access Layer for Silicon Laboratories microcontroller devices.
USB Setup request package.
USBD_State_TypeDef
USB device state enumerator.
int(* USB_XferCompleteCb_TypeDef)(USB_Status_TypeDef status, uint32_t xferred, uint32_t remaining)
USB transfer callback function.
USB Device stack callback structure.
USB protocol stack library API for EFM32/EZR32.
USB Configuration Descriptor.
USB HOST endpoint status data.