EZR32 Wonder Gecko Software Documentation  ezr32wg-doc-5.1.2

Detailed Description

Common parts for both HOST and DEVICE USB stacks, see USB device stack library and USB host stack library pages for device and host library documentation.

Data Structures

struct  USB_ConfigurationDescriptor_TypeDef
 USB Configuration Descriptor. More...
 
struct  USB_DeviceDescriptor_TypeDef
 USB Device Descriptor. More...
 
struct  USB_EndpointDescriptor_TypeDef
 USB Endpoint Descriptor. More...
 
struct  USB_InterfaceDescriptor_TypeDef
 USB Interface Descriptor. More...
 
struct  USB_Setup_TypeDef
 USB Setup request package. More...
 
struct  USB_StringDescriptor_TypeDef
 USB String Descriptor. More...
 

Macros

#define CLEAR_FEATURE   1
 
#define CONFIG_DESC_BM_REMOTEWAKEUP   0x20
 
#define CONFIG_DESC_BM_RESERVED_D7   0x80
 
#define CONFIG_DESC_BM_SELFPOWERED   0x40
 
#define CONFIG_DESC_BM_TRANSFERTYPE   0x03
 
#define CONFIG_DESC_MAXPOWER_mA(x)   (((x)+1)/2)
 
#define DEVICE_IS_SELFPOWERED   0x0001
 
#define GET_CONFIGURATION   8
 
#define GET_DESCRIPTOR   6
 
#define GET_INTERFACE   10
 
#define GET_STATUS   0
 
#define HUB_FEATURE_C_PORT_CONNECTION   16
 
#define HUB_FEATURE_C_PORT_RESET   20
 
#define HUB_FEATURE_PORT_INDICATOR   22
 
#define HUB_FEATURE_PORT_POWER   8
 
#define HUB_FEATURE_PORT_RESET   4
 
#define PORT_FULL_SPEED   1
 
#define PORT_LOW_SPEED   2
 
#define REMOTE_WAKEUP_ENABLED   0x0002
 
#define SET_ADDRESS   5
 
#define SET_CONFIGURATION   9
 
#define SET_DESCRIPTOR   7
 
#define SET_FEATURE   3
 
#define SET_INTERFACE   11
 
#define SILABS_USB_VID   0x10C4
 
#define STATIC_CONST_STRING_DESC(_name, ...)
 
#define STATIC_CONST_STRING_DESC_LANGID(_name, x, y)
 
#define STATIC_UBUF(x, y)   SL_ALIGN(4) static uint8_t x[((y)+3)&~3] SL_ATTRIBUTE_ALIGN(4)
 
#define SYNCH_FRAME   12
 
#define UBUF(x, y)   SL_ALIGN(4) uint8_t x[((y)+3)&~3] SL_ATTRIBUTE_ALIGN(4)
 
#define USB_AUDIO_GET_CUR   0x81
 
#define USB_AUDIO_GET_CUR   0x81
 
#define USB_AUDIO_GET_MAX   0x83
 
#define USB_AUDIO_GET_MEM   0x85
 
#define USB_AUDIO_GET_MIN   0x82
 
#define USB_AUDIO_GET_RES   0x84
 
#define USB_AUDIO_GET_STAT   0xFF
 
#define USB_AUDIO_SET_CUR   0x01
 
#define USB_AUDIO_SET_MAX   0x03
 
#define USB_AUDIO_SET_MEM   0x05
 
#define USB_AUDIO_SET_MIN   0x02
 
#define USB_AUDIO_SET_RES   0x04
 
#define USB_CA_AS_GENERAL_DESCRIPTOR   1
 
#define USB_CA_AS_GENERAL_DESCSIZE   7
 
#define USB_CA_EP_GENERAL_DESCRIPTOR   1
 
#define USB_CA_EP_GENERAL_DESCSIZE   7
 
#define USB_CA_EXTENSION_UNIT_DESCRIPTOR   8
 
#define USB_CA_FEATURE_UNIT_DESCRIPTOR   6
 
#define USB_CA_FORMAT_TYPE_DESCRIPTOR   2
 
#define USB_CA_HEADER_DESCRIPTOR   1
 
#define USB_CA_INPUT_TERMINAL_DESCRIPTOR   2
 
#define USB_CA_INPUT_TERMINAL_DESCSIZE   12
 
#define USB_CA_MIXER_UNIT_DESCRIPTOR   4
 
#define USB_CA_OUTPUT_TERMINAL_DESCRIPTOR   3
 
#define USB_CA_OUTPUT_TERMINAL_DESCSIZE   9
 
#define USB_CA_PROCESSING_UNIT_DESCRIPTOR   7
 
#define USB_CA_SELECTOR_UNIT_DESCRIPTOR   5
 
#define USB_CA_STD_AS_ENDPOINT_DESCSZIE   9
 
#define USB_CDC_ACM_FND_DESCSIZE   4
 
#define USB_CDC_CALLMNG_FND_DESCSIZE   5
 
#define USB_CDC_GETLINECODING   0x21
 
#define USB_CDC_HEADER_FND_DESCSIZE   5
 
#define USB_CDC_SETCTRLLINESTATE   0x22
 
#define USB_CDC_SETLINECODING   0x20
 
#define USB_CLASS_AUDIO   1
 
#define USB_CLASS_AUDIO_CONTROL   1
 
#define USB_CLASS_AUDIO_MIDISTREAMING   3
 
#define USB_CLASS_AUDIO_STREAMING   2
 
#define USB_CLASS_CDC   2
 
#define USB_CLASS_CDC_ACM   2
 
#define USB_CLASS_CDC_ACMFN   2
 
#define USB_CLASS_CDC_CMNGFN   1
 
#define USB_CLASS_CDC_DATA   0x0A
 
#define USB_CLASS_CDC_HFN   0
 
#define USB_CLASS_CDC_UNIONFN   6
 
#define USB_CLASS_HID   3
 
#define USB_CLASS_HID_KEYBOARD   1
 
#define USB_CLASS_HID_MOUSE   2
 
#define USB_CLASS_HUB   9
 
#define USB_CLASS_MISC_COMMON_SUBCLASS   2
 
#define USB_CLASS_MISC_IAD_PROTOCOL   1
 
#define USB_CLASS_MISCELLANEOUS   0xEF
 
#define USB_CLASS_MSD   8
 
#define USB_CLASS_MSD_BOT_TRANSPORT   0x50
 
#define USB_CLASS_MSD_CSW_CMDFAILED   1
 
#define USB_CLASS_MSD_CSW_CMDPASSED   0
 
#define USB_CLASS_MSD_CSW_PHASEERROR   2
 
#define USB_CLASS_MSD_SCSI_CMDSET   6
 
#define USB_CONFIG_DESCRIPTOR   2
 
#define USB_CONFIG_DESCSIZE   9
 
#define USB_CS_ENDPOINT_DESCRIPTOR   0x25
 
#define USB_CS_INTERFACE_DESCRIPTOR   0x24
 
#define USB_DEVICE_DESCRIPTOR   1
 
#define USB_DEVICE_DESCSIZE   18
 
#define USB_DEVICE_QUALIFIER_DESCRIPTOR   6
 
#define USB_DEVICE_QUALIFIER_DESCSIZE   10
 
#define USB_ENDPOINT_DESCRIPTOR   5
 
#define USB_ENDPOINT_DESCSIZE   7
 
#define USB_EP_DIR_IN   0x80
 
#define USB_EPNUM_MASK   0x0F
 
#define USB_EPSYNC_ADAPTIVE   (2 << 2)
 
#define USB_EPSYNC_ASYNC   (1 << 2)
 
#define USB_EPSYNC_NO   (0 << 2)
 
#define USB_EPSYNC_SYNC   (3 << 2)
 
#define USB_EPTYPE_BULK   2
 
#define USB_EPTYPE_CTRL   0
 
#define USB_EPTYPE_INTR   3
 
#define USB_EPTYPE_ISOC   1
 
#define USB_FEATURE_DEVICE_REMOTE_WAKEUP   1
 
#define USB_FEATURE_ENDPOINT_HALT   0
 
#define USB_FS_BULK_EP_MAXSIZE   64
 
#define USB_FS_CTRL_EP_MAXSIZE   64
 
#define USB_FS_INTR_EP_MAXSIZE   64
 
#define USB_FS_ISOC_EP_MAXSIZE   1023
 
#define USB_HID_DESCRIPTOR   0x21
 
#define USB_HID_DESCSIZE   9
 
#define USB_HID_GET_IDLE   0x02
 
#define USB_HID_GET_REPORT   0x01
 
#define USB_HID_REPORT_DESCRIPTOR   0x22
 
#define USB_HID_SET_IDLE   0x0A
 
#define USB_HID_SET_PROTOCOL   0x0B
 
#define USB_HID_SET_REPORT   0x09
 
#define USB_HUB_DESCRIPTOR   0x29
 
#define USB_INTERFACE_ASSOCIATION_DESCRIPTOR   11
 
#define USB_INTERFACE_ASSOCIATION_DESCSIZE   8
 
#define USB_INTERFACE_DESCRIPTOR   4
 
#define USB_INTERFACE_DESCSIZE   9
 
#define USB_INTERFACE_POWER_DESCRIPTOR   8
 
#define USB_LANGID_ENUS   0x0409
 
#define USB_LS_CTRL_EP_MAXSIZE   8
 
#define USB_LS_INTR_EP_MAXSIZE   8
 
#define USB_MAX_DEVICE_ADDRESS   127
 
#define USB_MAX_STRING_DESCRIPTOR_CHARS   126
 
#define USB_MSD_BOTRESET   0xFF
 
#define USB_MSD_GETMAXLUN   0xFE
 
#define USB_OTHER_SPEED_CONFIG_DESCRIPTOR   7
 
#define USB_OTHER_SPEED_CONFIG_DESCSIZE   9
 
#define USB_SETUP_DIR_D2H   0x80
 
#define USB_SETUP_DIR_H2D   0x00
 
#define USB_SETUP_DIR_IN   1
 
#define USB_SETUP_DIR_MASK   0x80
 
#define USB_SETUP_DIR_OUT   0
 
#define USB_SETUP_PKT_SIZE   8
 
#define USB_SETUP_RECIPIENT_DEVICE   0
 
#define USB_SETUP_RECIPIENT_ENDPOINT   2
 
#define USB_SETUP_RECIPIENT_INTERFACE   1
 
#define USB_SETUP_RECIPIENT_OTHER   3
 
#define USB_SETUP_TYPE_CLASS   1
 
#define USB_SETUP_TYPE_CLASS_MASK   0x20
 
#define USB_SETUP_TYPE_STANDARD   0
 
#define USB_SETUP_TYPE_STANDARD_MASK   0x00
 
#define USB_SETUP_TYPE_VENDOR   2
 
#define USB_SETUP_TYPE_VENDOR_MASK   0x40
 
#define USB_SMARTCARD_DESCRIPTOR   0x21
 
#define USB_SMARTCARD_DESCSIZE   54
 
#define USB_STRING_DESCRIPTOR   3
 

Typedefs

typedef unsigned short char16_t
 
typedef int(* USB_XferCompleteCb_TypeDef) (USB_Status_TypeDef status, uint32_t xferred, uint32_t remaining)
 USB transfer callback function. More...
 
typedef void(* USBTIMER_Callback_TypeDef) (void)
 USBTIMER callback function. More...
 

Enumerations

enum  USB_Status_TypeDef {
  USB_STATUS_OK = 0,
  USB_STATUS_REQ_ERR = -1,
  USB_STATUS_EP_BUSY = -2,
  USB_STATUS_REQ_UNHANDLED = -3,
  USB_STATUS_ILLEGAL = -4,
  USB_STATUS_EP_STALLED = -5,
  USB_STATUS_EP_ABORTED = -6,
  USB_STATUS_EP_ERROR = -7,
  USB_STATUS_EP_NAK = -8,
  USB_STATUS_DEVICE_UNCONFIGURED = -9,
  USB_STATUS_DEVICE_SUSPENDED = -10,
  USB_STATUS_DEVICE_RESET = -11,
  USB_STATUS_TIMEOUT = -12,
  USB_STATUS_DEVICE_REMOVED = -13,
  USB_STATUS_HC_BUSY = -14,
  USB_STATUS_DEVICE_MALFUNCTION = -15,
  USB_STATUS_PORT_OVERCURRENT = -16
}
 USB transfer status enumerator. More...
 

Functions

char * USB_GetErrorMsgString (int error)
 Return an error message string for a given error code. More...
 
void USB_PrintErrorMsgString (char *pre, int error)
 Format and print a text string given an error code, prepends an optional user supplied leader string. More...
 
int USB_PRINTF (const char *format,...)
 Transmit "printf" formated data on the debug serial port. More...
 
int USB_PUTCHAR (char c)
 Transmit a single char on the debug serial port. More...
 
void USB_PUTS (const char *p)
 Transmit a zero terminated string on the debug serial port. More...
 
void USBTIMER_DelayMs (uint32_t msec)
 Active wait millisecond delay function. Can also be used inside interrupt handlers. More...
 
void USBTIMER_DelayUs (uint32_t usec)
 Active wait microsecond delay function. Can also be used inside interrupt handlers. More...
 
void USBTIMER_Init (void)
 Activate the hardware timer used to pace the 1 millisecond timer system. More...
 
void USBTIMER_Start (uint32_t id, uint32_t timeout, USBTIMER_Callback_TypeDef callback)
 Start a timer. More...
 
void USBTIMER_Stop (uint32_t id)
 Stop a timer. More...
 

Macro Definition Documentation

#define CLEAR_FEATURE   1

Standard setup request CLEAR_FEATURE.

Definition at line 88 of file em_usb.h.

Referenced by MSDD_SetupCmd(), and USBH_UnStallEpB().

#define CONFIG_DESC_BM_REMOTEWAKEUP   0x20

Configuration descriptor attribute macro.

Definition at line 191 of file em_usb.h.

#define CONFIG_DESC_BM_RESERVED_D7   0x80

Configuration descriptor attribute macro.

Definition at line 193 of file em_usb.h.

#define CONFIG_DESC_BM_SELFPOWERED   0x40

Configuration descriptor attribute macro.

Definition at line 192 of file em_usb.h.

#define CONFIG_DESC_BM_TRANSFERTYPE   0x03

Configuration descriptor transfer type bitmask.

Definition at line 194 of file em_usb.h.

Referenced by USBD_Init(), and USBH_AssignHostChannel().

#define CONFIG_DESC_MAXPOWER_mA (   x)    (((x)+1)/2)

Configuration descriptor power macro.

Definition at line 195 of file em_usb.h.

#define DEVICE_IS_SELFPOWERED   0x0001

Standard request GET_STATUS bitmask.

Definition at line 197 of file em_usb.h.

#define GET_CONFIGURATION   8

Standard setup request GET_CONFIGURATION.

Definition at line 93 of file em_usb.h.

#define GET_DESCRIPTOR   6

Standard setup request GET_DESCRIPTOR.

Definition at line 91 of file em_usb.h.

Referenced by HIDKBD_SetupCmd(), USBH_GetConfigurationDescriptorB(), USBH_GetDeviceDescriptorB(), USBH_GetStringB(), and USBX_SetupCmdCb().

#define GET_INTERFACE   10

Standard setup request GET_INTERFACE.

Definition at line 95 of file em_usb.h.

#define GET_STATUS   0

Standard setup request GET_STATUS.

Definition at line 87 of file em_usb.h.

#define HUB_FEATURE_C_PORT_CONNECTION   16

HUB class request CLEAR/SET_PORT_FEATURE feature selector.

Definition at line 204 of file em_usb.h.

#define HUB_FEATURE_C_PORT_RESET   20

HUB class request CLEAR/SET_PORT_FEATURE feature selector.

Definition at line 205 of file em_usb.h.

#define HUB_FEATURE_PORT_INDICATOR   22

HUB class request CLEAR/SET_PORT_FEATURE feature selector.

Definition at line 206 of file em_usb.h.

#define HUB_FEATURE_PORT_POWER   8

HUB class request CLEAR/SET_PORT_FEATURE feature selector.

Definition at line 203 of file em_usb.h.

#define HUB_FEATURE_PORT_RESET   4

HUB class request CLEAR/SET_PORT_FEATURE feature selector.

Definition at line 202 of file em_usb.h.

#define PORT_FULL_SPEED   1

Full speed return value for USBH_GetPortSpeed().

Definition at line 239 of file em_usb.h.

Referenced by MSDBOT_Init().

#define PORT_LOW_SPEED   2

Low speed return value for USBH_GetPortSpeed().

Definition at line 240 of file em_usb.h.

#define REMOTE_WAKEUP_ENABLED   0x0002

Standard request GET_STATUS bitmask.

Definition at line 198 of file em_usb.h.

#define SET_ADDRESS   5

Standard setup request SET_ADDRESS.

Definition at line 90 of file em_usb.h.

Referenced by USBH_SetAddressB().

#define SET_CONFIGURATION   9

Standard setup request SET_CONFIGURATION.

Definition at line 94 of file em_usb.h.

Referenced by USBH_SetConfigurationB().

#define SET_DESCRIPTOR   7

Standard setup request SET_DESCRIPTOR.

Definition at line 92 of file em_usb.h.

#define SET_FEATURE   3

Standard setup request SET_FEATURE.

Definition at line 89 of file em_usb.h.

Referenced by USBH_StallEpB().

#define SET_INTERFACE   11

Standard setup request SET_INTERFACE.

Definition at line 96 of file em_usb.h.

Referenced by USBH_SetAltInterfaceB().

#define SILABS_USB_VID   0x10C4

Silicon Labs Vendor ID, supplied by USB-IF.

Definition at line 63 of file em_usb.h.

#define STATIC_CONST_STRING_DESC (   _name,
  ... 
)
Value:
typedef struct \
{ \
uint8_t len; \
uint8_t type; \
char16_t name[ 1 + sizeof((char16_t[]){__VA_ARGS__}) / 2]; \
static const _##_name _name SL_ATTRIBUTE_ALIGN(4)= \
{ \
.len = sizeof(_##_name) - 2, \
.name = {__VA_ARGS__}, \
.name[((sizeof(_##_name) - 2) / 2) - 1] = '\0' \
} \
#define SL_PACK_END()
Macro for handling packed structs. Use this macro after the struct definition. With GCC...
Definition: em_common.h:157
#define USB_STRING_DESCRIPTOR
Definition: em_usb.h:126
#define SL_ALIGN(X)
Macro for aligning a variable. Use this macro before the variable definition. X denotes the stora...
Definition: em_common.h:168
#define SL_PACK_START(x)
Macro for handling packed structs. Use this macro before the struct definition. X denotes the max...
Definition: em_common.h:150
unsigned short char16_t
Definition: em_usb.h:246
#define SL_ATTRIBUTE_ALIGN(X)
GCC style macro for aligning a variable.
Definition: em_common.h:160
#define SL_ATTRIBUTE_PACKED
GCC style macro for handling packed structs.
Definition: em_common.h:143

Macro for creating USB compliant UTF-16LE UNICODE string descriptors.
Example: STATIC_CONST_STRING_DESC(iManufacturer, 'E','n','e','r','g','y',' ','M','i','c','r','o',' ','A','S');

Note
The size of the resulting struct will be two byte larger than a USB string descriptor. This is to accommodate a terminating null char for the string. The value assigned to the 'len' member does not take this into account and is therefore correct usb wise.

Definition at line 263 of file em_usb.h.

#define STATIC_CONST_STRING_DESC_LANGID (   _name,
  x,
 
)
Value:
typedef struct \
{ \
uint8_t len; \
uint8_t type; \
uint8_t name[ 2 ]; \
static const _##_name _name SL_ATTRIBUTE_ALIGN(4)= \
{ \
.len = 4, \
.name = { y, x } \
} \
#define SL_PACK_END()
Macro for handling packed structs. Use this macro after the struct definition. With GCC...
Definition: em_common.h:157
#define USB_STRING_DESCRIPTOR
Definition: em_usb.h:126
#define SL_ALIGN(X)
Macro for aligning a variable. Use this macro before the variable definition. X denotes the stora...
Definition: em_common.h:168
#define SL_PACK_START(x)
Macro for handling packed structs. Use this macro before the struct definition. X denotes the max...
Definition: em_common.h:150
#define SL_ATTRIBUTE_ALIGN(X)
GCC style macro for aligning a variable.
Definition: em_common.h:160
#define SL_ATTRIBUTE_PACKED
GCC style macro for handling packed structs.
Definition: em_common.h:143

Macro for creating USB compliant language string descriptors.
Example: STATIC_CONST_STRING_DESC_LANGID(langID, 0x04, 0x09);

Definition at line 286 of file em_usb.h.

#define STATIC_UBUF (   x,
 
)    SL_ALIGN(4) static uint8_t x[((y)+3)&~3] SL_ATTRIBUTE_ALIGN(4)

Macro for creating WORD (4 byte) aligned static uint8_t arrays with size which is a multiple of WORD size.
Example:
STATIC_UBUF(rxBuffer, 37); => static uint8_t rxBuffer[40];

Definition at line 315 of file em_usb.h.

Referenced by HIDKBD_SetupCmd().

#define SYNCH_FRAME   12

Standard setup request SYNCH_FRAME.

Definition at line 97 of file em_usb.h.

#define UBUF (   x,
 
)    SL_ALIGN(4) uint8_t x[((y)+3)&~3] SL_ATTRIBUTE_ALIGN(4)

Macro for creating WORD (4 byte) aligned uint8_t array with size which is a multiple of WORD size.
Example:
UBUF(rxBuffer, 37); => uint8_t rxBuffer[40];

Definition at line 309 of file em_usb.h.

#define USB_AUDIO_GET_CUR   0x81

Audio class setup request GET_CUR.

Definition at line 112 of file em_usb.h.

#define USB_AUDIO_GET_CUR   0x81

Audio class setup request GET_CUR.

Definition at line 112 of file em_usb.h.

#define USB_AUDIO_GET_MAX   0x83

Audio class setup request GET_MAX.

Definition at line 116 of file em_usb.h.

#define USB_AUDIO_GET_MEM   0x85

Audio class setup request GET_MEM.

Definition at line 120 of file em_usb.h.

#define USB_AUDIO_GET_MIN   0x82

Audio class setup request GET_MIN.

Definition at line 114 of file em_usb.h.

#define USB_AUDIO_GET_RES   0x84

Audio class setup request GET_RES.

Definition at line 118 of file em_usb.h.

#define USB_AUDIO_GET_STAT   0xFF

Audio class setup request GET_STAT.

Definition at line 121 of file em_usb.h.

#define USB_AUDIO_SET_CUR   0x01

Audio class setup request SET_CUR.

Definition at line 111 of file em_usb.h.

#define USB_AUDIO_SET_MAX   0x03

Audio class setup request SET_MAX.

Definition at line 115 of file em_usb.h.

#define USB_AUDIO_SET_MEM   0x05

Audio class setup request SET_MEM.

Definition at line 119 of file em_usb.h.

#define USB_AUDIO_SET_MIN   0x02

Audio class setup request SET_MIN.

Definition at line 113 of file em_usb.h.

#define USB_AUDIO_SET_RES   0x04

Audio class setup request SET_RES.

Definition at line 117 of file em_usb.h.

#define USB_CA_AS_GENERAL_DESCRIPTOR   1

Audio Class-Specific AS Interface General descriptor.

Definition at line 149 of file em_usb.h.

#define USB_CA_AS_GENERAL_DESCSIZE   7

Audio Class-Specific AS Interface General desc size.

Definition at line 167 of file em_usb.h.

#define USB_CA_EP_GENERAL_DESCRIPTOR   1

Audio Class-Specific general descriptor subtype code.

Definition at line 148 of file em_usb.h.

#define USB_CA_EP_GENERAL_DESCSIZE   7

Audio Class-Specific general descriptor subtype size.

Definition at line 166 of file em_usb.h.

#define USB_CA_EXTENSION_UNIT_DESCRIPTOR   8

Audio Class-Specific AC Interface Extension desc.

Definition at line 147 of file em_usb.h.

#define USB_CA_FEATURE_UNIT_DESCRIPTOR   6

Audio Class-Specific AC Interface Feature desc.

Definition at line 145 of file em_usb.h.

#define USB_CA_FORMAT_TYPE_DESCRIPTOR   2

Audio Class-Specific AS Interface Format Type desc.

Definition at line 150 of file em_usb.h.

#define USB_CA_HEADER_DESCRIPTOR   1

Audio Class-Specific AC Interface Header descriptor.

Definition at line 140 of file em_usb.h.

#define USB_CA_INPUT_TERMINAL_DESCRIPTOR   2

Audio Class-Specific AC Interface Input Terminal desc.

Definition at line 141 of file em_usb.h.

#define USB_CA_INPUT_TERMINAL_DESCSIZE   12

Audio Input Terminal descriptor size.

Definition at line 164 of file em_usb.h.

#define USB_CA_MIXER_UNIT_DESCRIPTOR   4

Audio Class-Specific AC Interface Mixer descriptor.

Definition at line 143 of file em_usb.h.

#define USB_CA_OUTPUT_TERMINAL_DESCRIPTOR   3

Audio Class-Specific AC Interface Output Terminal desc.

Definition at line 142 of file em_usb.h.

#define USB_CA_OUTPUT_TERMINAL_DESCSIZE   9

Audio Output Terminal descriptor size.

Definition at line 165 of file em_usb.h.

#define USB_CA_PROCESSING_UNIT_DESCRIPTOR   7

Audio Class-Specific AC Interface Processing desc.

Definition at line 146 of file em_usb.h.

#define USB_CA_SELECTOR_UNIT_DESCRIPTOR   5

Audio Class-Specific AC Interface Selector desc.

Definition at line 144 of file em_usb.h.

#define USB_CA_STD_AS_ENDPOINT_DESCSZIE   9

Audio-class standard audio stream descriptor size.

Definition at line 168 of file em_usb.h.

#define USB_CDC_ACM_FND_DESCSIZE   4

CDC Abstract Control Management functional descriptor size.

Definition at line 163 of file em_usb.h.

#define USB_CDC_CALLMNG_FND_DESCSIZE   5

CDC Call Management functional descriptor size.

Definition at line 162 of file em_usb.h.

#define USB_CDC_GETLINECODING   0x21

CDC class setup request GET_LINE_CODING.

Definition at line 106 of file em_usb.h.

Referenced by CDC_SetupCmd().

#define USB_CDC_HEADER_FND_DESCSIZE   5

CDC Header functional descriptor size.

Definition at line 161 of file em_usb.h.

#define USB_CDC_SETCTRLLINESTATE   0x22

CDC class setup request SET_CONTROL_LINE_STATE.

Definition at line 107 of file em_usb.h.

Referenced by CDC_SetupCmd().

#define USB_CDC_SETLINECODING   0x20

CDC class setup request SET_LINE_CODING.

Definition at line 105 of file em_usb.h.

Referenced by CDC_SetupCmd().

#define USB_CLASS_AUDIO   1

Audio interface class code.

Definition at line 229 of file em_usb.h.

#define USB_CLASS_AUDIO_CONTROL   1

Audio subclass code for control interface.

Definition at line 230 of file em_usb.h.

#define USB_CLASS_AUDIO_MIDISTREAMING   3

Audio subclass code for midi streaming interface.

Definition at line 232 of file em_usb.h.

#define USB_CLASS_AUDIO_STREAMING   2

Audio subclass code for streaming interface.

Definition at line 231 of file em_usb.h.

#define USB_CLASS_CDC   2

CDC device/interface class code.

Definition at line 208 of file em_usb.h.

#define USB_CLASS_CDC_ACM   2

CDC Abstract Control Model interface subclass code.

Definition at line 210 of file em_usb.h.

#define USB_CLASS_CDC_ACMFN   2

CDC class Abstract Control Management Functional Descriptor subtype.

Definition at line 213 of file em_usb.h.

#define USB_CLASS_CDC_CMNGFN   1

CDC class Call Management Functional Descriptor subtype.

Definition at line 212 of file em_usb.h.

#define USB_CLASS_CDC_DATA   0x0A

CDC Data interface class code.

Definition at line 209 of file em_usb.h.

#define USB_CLASS_CDC_HFN   0

CDC class Header Functional Descriptor subtype.

Definition at line 211 of file em_usb.h.

#define USB_CLASS_CDC_UNIONFN   6

CDC class Union Functional Descriptor subtype.

Definition at line 214 of file em_usb.h.

#define USB_CLASS_HID   3

HID device/interface class code.

Definition at line 216 of file em_usb.h.

#define USB_CLASS_HID_KEYBOARD   1

HID keyboard interface protocol code.

Definition at line 217 of file em_usb.h.

#define USB_CLASS_HID_MOUSE   2

HID mouse interface protocol code.

Definition at line 218 of file em_usb.h.

#define USB_CLASS_HUB   9

HUB device/interface class code.

Definition at line 220 of file em_usb.h.

#define USB_CLASS_MISC_COMMON_SUBCLASS   2

MISCELLANEOUS Common sub class code.

Definition at line 236 of file em_usb.h.

#define USB_CLASS_MISC_IAD_PROTOCOL   1

MISCELLANEOUS Interface Association Descriptor protocol code.

Definition at line 237 of file em_usb.h.

#define USB_CLASS_MISCELLANEOUS   0xEF

MISCELLANEOUS device class code.

Definition at line 235 of file em_usb.h.

#define USB_CLASS_MSD   8

MSD device/interface class code.

Definition at line 222 of file em_usb.h.

#define USB_CLASS_MSD_BOT_TRANSPORT   0x50

MSD Bulk Only Transport protocol.

Definition at line 223 of file em_usb.h.

#define USB_CLASS_MSD_CSW_CMDFAILED   1

MSD BOT Command status wrapper command failed code.

Definition at line 226 of file em_usb.h.

#define USB_CLASS_MSD_CSW_CMDPASSED   0

MSD BOT Command status wrapper command passed code.

Definition at line 225 of file em_usb.h.

Referenced by MSDBOT_Xfer().

#define USB_CLASS_MSD_CSW_PHASEERROR   2

MSD BOT Command status wrapper cmd phase error code.

Definition at line 227 of file em_usb.h.

#define USB_CLASS_MSD_SCSI_CMDSET   6

MSD Subclass SCSI transparent command set.

Definition at line 224 of file em_usb.h.

#define USB_CONFIG_DESCRIPTOR   2

CONFIGURATION descriptor value.

Definition at line 125 of file em_usb.h.

Referenced by USBH_GetConfigurationDescriptorB(), and USBH_QGetConfigurationDescriptor().

#define USB_CONFIG_DESCSIZE   9

Configuration descriptor size.

Definition at line 153 of file em_usb.h.

Referenced by USBH_InitDeviceData(), USBH_QGetConfigurationDescriptor(), USBH_QGetInterfaceDescriptor(), and USBH_QueryDeviceB().

#define USB_CS_ENDPOINT_DESCRIPTOR   0x25

Audio Class-specific endpoint Descriptor Type.

Definition at line 138 of file em_usb.h.

#define USB_CS_INTERFACE_DESCRIPTOR   0x24

Audio Class-specific interface Descriptor Type.

Definition at line 137 of file em_usb.h.

#define USB_DEVICE_DESCRIPTOR   1

DEVICE descriptor value.

Definition at line 124 of file em_usb.h.

Referenced by USBH_GetDeviceDescriptorB(), and USBH_QGetDeviceDescriptor().

#define USB_DEVICE_DESCSIZE   18

Device descriptor size.

Definition at line 152 of file em_usb.h.

Referenced by USBH_InitDeviceData(), USBH_QGetDeviceDescriptor(), and USBH_QueryDeviceB().

#define USB_DEVICE_QUALIFIER_DESCRIPTOR   6

DEVICE_QUALIFIER descriptor value.

Definition at line 130 of file em_usb.h.

#define USB_DEVICE_QUALIFIER_DESCSIZE   10

Device qualifier descriptor size.

Definition at line 156 of file em_usb.h.

#define USB_ENDPOINT_DESCRIPTOR   5

ENDPOINT descriptor value.

Definition at line 129 of file em_usb.h.

Referenced by USBD_Init(), and USBH_QGetEndpointDescriptor().

#define USB_ENDPOINT_DESCSIZE   7

Endpoint descriptor size.

Definition at line 155 of file em_usb.h.

Referenced by USBH_InitDeviceData(), and USBH_QGetEndpointDescriptor().

#define USB_EP_DIR_IN   0x80

Endpoint direction mask.

Definition at line 185 of file em_usb.h.

#define USB_EPNUM_MASK   0x0F

Endpoint number mask.

Definition at line 187 of file em_usb.h.

Referenced by USBD_Init().

#define USB_EPSYNC_ADAPTIVE   (2 << 2)

Endpoint synchronization type, adaptive.

Definition at line 183 of file em_usb.h.

#define USB_EPSYNC_ASYNC   (1 << 2)

Endpoint synchronization type, asynchronous.

Definition at line 182 of file em_usb.h.

#define USB_EPSYNC_NO   (0 << 2)

Endpoint synchronization type, none.

Definition at line 181 of file em_usb.h.

#define USB_EPSYNC_SYNC   (3 << 2)

Endpoint synchronization type, synchronous.

Definition at line 184 of file em_usb.h.

#define USB_EPTYPE_BULK   2

Endpoint type bulk.

Definition at line 179 of file em_usb.h.

#define USB_EPTYPE_CTRL   0

Endpoint type control.

Definition at line 177 of file em_usb.h.

Referenced by USBD_Init(), and USBH_InitDeviceData().

#define USB_EPTYPE_INTR   3

Endpoint type interrupt.

Definition at line 180 of file em_usb.h.

Referenced by USBH_Read(), and USBH_Write().

#define USB_EPTYPE_ISOC   1

Endpoint type isochron.

Definition at line 178 of file em_usb.h.

#define USB_FEATURE_DEVICE_REMOTE_WAKEUP   1

Standard request CLEAR/SET_FEATURE bitmask.

Definition at line 200 of file em_usb.h.

#define USB_FEATURE_ENDPOINT_HALT   0

Standard request CLEAR/SET_FEATURE bitmask.

Definition at line 199 of file em_usb.h.

Referenced by MSDD_SetupCmd(), USBH_StallEpB(), and USBH_UnStallEpB().

#define USB_FS_BULK_EP_MAXSIZE   64

The max size of full speed bulk endpoints.

Definition at line 175 of file em_usb.h.

Referenced by USBX_inXferCompleteCb().

#define USB_FS_CTRL_EP_MAXSIZE   64

The max size of full speed control endpoints.

Definition at line 173 of file em_usb.h.

#define USB_FS_INTR_EP_MAXSIZE   64

The max size of full speed interrupt endpoints.

Definition at line 174 of file em_usb.h.

#define USB_FS_ISOC_EP_MAXSIZE   1023

The max size of full speed isochronous endpoints.

Definition at line 176 of file em_usb.h.

#define USB_HID_DESCRIPTOR   0x21

HID descriptor value.

Definition at line 134 of file em_usb.h.

Referenced by HIDKBD_SetupCmd().

#define USB_HID_DESCSIZE   9

HID descriptor size.

Definition at line 159 of file em_usb.h.

Referenced by HIDKBD_SetupCmd().

#define USB_HID_GET_IDLE   0x02

HID class setup request GET_IDLE.

Definition at line 101 of file em_usb.h.

Referenced by HIDKBD_SetupCmd().

#define USB_HID_GET_REPORT   0x01

HID class setup request GET_REPORT.

Definition at line 100 of file em_usb.h.

Referenced by HIDKBD_SetupCmd().

#define USB_HID_REPORT_DESCRIPTOR   0x22

HID REPORT descriptor value.

Definition at line 136 of file em_usb.h.

Referenced by HIDKBD_SetupCmd().

#define USB_HID_SET_IDLE   0x0A

HID class setup request SET_IDLE.

Definition at line 103 of file em_usb.h.

Referenced by HIDKBD_SetupCmd().

#define USB_HID_SET_PROTOCOL   0x0B

HID class setup request SET_PROTOCOL.

Definition at line 104 of file em_usb.h.

#define USB_HID_SET_REPORT   0x09

HID class setup request SET_REPORT.

Definition at line 102 of file em_usb.h.

Referenced by HIDKBD_SetupCmd().

#define USB_HUB_DESCRIPTOR   0x29

HUB descriptor value.

Definition at line 139 of file em_usb.h.

#define USB_INTERFACE_ASSOCIATION_DESCRIPTOR   11

INTERFACE_ASSOCIATION descriptor value.

Definition at line 133 of file em_usb.h.

#define USB_INTERFACE_ASSOCIATION_DESCSIZE   8

INTERFACE_ASSOCIATION descriptor size.

Definition at line 158 of file em_usb.h.

#define USB_INTERFACE_DESCRIPTOR   4

INTERFACE descriptor value.

Definition at line 128 of file em_usb.h.

Referenced by USBD_Init(), and USBH_QGetInterfaceDescriptor().

#define USB_INTERFACE_DESCSIZE   9

Interface descriptor size.

Definition at line 154 of file em_usb.h.

Referenced by USBH_InitDeviceData(), USBH_QGetEndpointDescriptor(), USBH_QGetInterfaceDescriptor(), and USBH_QueryDeviceB().

#define USB_INTERFACE_POWER_DESCRIPTOR   8

INTERFACE_POWER descriptor value.

Definition at line 132 of file em_usb.h.

#define USB_LANGID_ENUS   0x0409

English-United States language id.

Definition at line 188 of file em_usb.h.

#define USB_LS_CTRL_EP_MAXSIZE   8

The max size of low speed control endpoints.

Definition at line 171 of file em_usb.h.

#define USB_LS_INTR_EP_MAXSIZE   8

The max size of low speed interrupt endpoints.

Definition at line 172 of file em_usb.h.

#define USB_MAX_DEVICE_ADDRESS   127

Maximum allowable device address.

Definition at line 189 of file em_usb.h.

Referenced by USBH_SetAddressB().

#define USB_MAX_STRING_DESCRIPTOR_CHARS   126

Maximum STRING descriptor bString length.

Definition at line 127 of file em_usb.h.

#define USB_MSD_BOTRESET   0xFF

MSD class setup request Bulk only transfer reset.

Definition at line 108 of file em_usb.h.

Referenced by MSDD_SetupCmd().

#define USB_MSD_GETMAXLUN   0xFE

MSD class setup request Get Max LUN.

Definition at line 109 of file em_usb.h.

Referenced by MSDD_SetupCmd().

#define USB_OTHER_SPEED_CONFIG_DESCRIPTOR   7

OTHER_SPEED_CONFIGURATION descriptor value.

Definition at line 131 of file em_usb.h.

#define USB_OTHER_SPEED_CONFIG_DESCSIZE   9

Device other speed configuration descriptor size.

Definition at line 157 of file em_usb.h.

#define USB_SETUP_DIR_D2H   0x80

Setup request data stage IN direction mask.

Definition at line 69 of file em_usb.h.

Referenced by USBH_GetConfigurationDescriptorB(), USBH_GetDeviceDescriptorB(), USBH_GetStringB(), and USBX_SetupCmdCb().

#define USB_SETUP_DIR_H2D   0x00

Setup request data stage OUT direction mask.

Definition at line 70 of file em_usb.h.

Referenced by USBH_SetAddressB(), USBH_SetAltInterfaceB(), USBH_SetConfigurationB(), USBH_StallEpB(), and USBH_UnStallEpB().

#define USB_SETUP_DIR_IN   1

Setup request data stage IN direction value.

Definition at line 67 of file em_usb.h.

Referenced by CDC_SetupCmd(), HIDKBD_SetupCmd(), and MSDD_SetupCmd().

#define USB_SETUP_DIR_MASK   0x80

Setup request data stage direction mask.

Definition at line 68 of file em_usb.h.

Referenced by USBD_Init(), and USBH_AssignHostChannel().

#define USB_SETUP_DIR_OUT   0

Setup request data stage OUT direction value.

Definition at line 66 of file em_usb.h.

Referenced by MSDD_SetupCmd().

#define USB_SETUP_PKT_SIZE   8

Setup request packet size.

Definition at line 186 of file em_usb.h.

#define USB_SETUP_RECIPIENT_DEVICE   0

Setup request device recipient value.

Definition at line 81 of file em_usb.h.

Referenced by USBH_GetConfigurationDescriptorB(), USBH_GetDeviceDescriptorB(), USBH_GetStringB(), USBH_SetAddressB(), USBH_SetConfigurationB(), and USBX_SetupCmdCb().

#define USB_SETUP_RECIPIENT_ENDPOINT   2

Setup request endpoint recipient value.

Definition at line 83 of file em_usb.h.

Referenced by MSDD_SetupCmd(), USBH_StallEpB(), and USBH_UnStallEpB().

#define USB_SETUP_RECIPIENT_INTERFACE   1

Setup request interface recipient value.

Definition at line 82 of file em_usb.h.

Referenced by CDC_SetupCmd(), HIDKBD_SetupCmd(), MSDD_SetupCmd(), USBH_SetAltInterfaceB(), and USBX_SetupCmdCb().

#define USB_SETUP_RECIPIENT_OTHER   3

Setup request other recipient value.

Definition at line 84 of file em_usb.h.

#define USB_SETUP_TYPE_CLASS   1

Class setup request value.

Definition at line 74 of file em_usb.h.

Referenced by CDC_SetupCmd(), HIDKBD_SetupCmd(), and MSDD_SetupCmd().

#define USB_SETUP_TYPE_CLASS_MASK   0x20

Class setup request mask.

Definition at line 77 of file em_usb.h.

#define USB_SETUP_TYPE_STANDARD   0

Standard setup request value.

Definition at line 73 of file em_usb.h.

Referenced by HIDKBD_SetupCmd(), MSDD_SetupCmd(), and USBX_SetupCmdCb().

#define USB_SETUP_TYPE_STANDARD_MASK   0x00
#define USB_SETUP_TYPE_VENDOR   2

Vendor setup request value.

Definition at line 75 of file em_usb.h.

Referenced by USBX_SetupCmdCb().

#define USB_SETUP_TYPE_VENDOR_MASK   0x40

Vendor setup request mask.

Definition at line 78 of file em_usb.h.

Referenced by USBX_SetupCmdCb().

#define USB_SMARTCARD_DESCRIPTOR   0x21

Smartcard usb-ccid-specific Descriptor Type.

Definition at line 135 of file em_usb.h.

#define USB_SMARTCARD_DESCSIZE   54

CCID descriptor size.

Definition at line 160 of file em_usb.h.

#define USB_STRING_DESCRIPTOR   3

STRING descriptor value.

Definition at line 126 of file em_usb.h.

Referenced by USBH_GetStringB(), and USBX_SetupCmdCb().

Typedef Documentation

typedef unsigned short char16_t

Data type used for UTF-16LE formatted USB string descriptors.

Definition at line 246 of file em_usb.h.

typedef int(* USB_XferCompleteCb_TypeDef) (USB_Status_TypeDef status, uint32_t xferred, uint32_t remaining)

USB transfer callback function.

The callback function is called when a transfer has completed. An application should check the status, xferred and optionally the remaining parameters before deciding if the transfer is usable. In the case where the transfer is part of a control request data stage, the callback function should return an appropriate USB_Status_TypeDef status.

Parameters
[in]statusThe transfer status. See USB_Status_TypeDef.
[in]xferredNumber of bytes actually transferred.
[in]remainingNumber of bytes not transferred.
Returns
USB_STATUS_OK on success, else an appropriate error code.

Definition at line 663 of file em_usb.h.

typedef void(* USBTIMER_Callback_TypeDef) (void)

USBTIMER callback function.

The callback function is called when an USBTIMER has expired. The callback is done with interrupts disabled.

Definition at line 673 of file em_usb.h.

Enumeration Type Documentation

USB transfer status enumerator.

Enumerator
USB_STATUS_OK 

No errors detected.

USB_STATUS_REQ_ERR 

Setup request error.

USB_STATUS_EP_BUSY 

Endpoint is busy.

USB_STATUS_REQ_UNHANDLED 

Setup request not handled.

USB_STATUS_ILLEGAL 

Illegal operation attempted.

USB_STATUS_EP_STALLED 

Endpoint is stalled.

USB_STATUS_EP_ABORTED 

Endpoint transfer was aborted.

USB_STATUS_EP_ERROR 

Endpoint transfer error.

USB_STATUS_EP_NAK 

Endpoint NAK'ed transfer request.

USB_STATUS_DEVICE_UNCONFIGURED 

Device is unconfigured.

USB_STATUS_DEVICE_SUSPENDED 

Device is suspended.

USB_STATUS_DEVICE_RESET 

Device is/was reset.

USB_STATUS_TIMEOUT 

Transfer timeout.

USB_STATUS_DEVICE_REMOVED 

Device was removed.

USB_STATUS_HC_BUSY 

Host channel is busy.

USB_STATUS_DEVICE_MALFUNCTION 

Malfunctioning device attached.

USB_STATUS_PORT_OVERCURRENT 

VBUS shortcircuit/overcurrent failure.

Definition at line 319 of file em_usb.h.

Function Documentation

char* USB_GetErrorMsgString ( int  error)

Return an error message string for a given error code.

Parameters
[in]errorError code, see USB_Status_TypeDef.
Returns
Error message string pointer.

Definition at line 72 of file em_usbhal.c.

Referenced by USB_PrintErrorMsgString().

void USB_PrintErrorMsgString ( char *  pre,
int  error 
)

Format and print a text string given an error code, prepends an optional user supplied leader string.

Parameters
[in]preOptional leader string to prepend to error message string.
[in]errorError code, see USB_Status_TypeDef.

Definition at line 93 of file em_usbhal.c.

References USB_GetErrorMsgString(), USB_PRINTF(), and USB_STATUS_OK.

int USB_PRINTF ( const char *  format,
  ... 
)

Transmit "printf" formated data on the debug serial port.

Note
This function is enabled with #define USB_USE_PRINTF when configuring the protocol stack in "usbconfig.h". This is convenient when debugging code, no need to remove use of this function when debugging has completed.
Parameters
[in]formatFormat string (as in printf). No floating point format support.
Returns
Number of chars transmitted.

Referenced by MSDH_Init(), USB_PrintErrorMsgString(), USBH_PrintConfigurationDescriptor(), USBH_PrintDeviceDescriptor(), USBH_PrintEndpointDescriptor(), and USBH_PrintInterfaceDescriptor().

int USB_PUTCHAR ( char  c)

Transmit a single char on the debug serial port.

Note
This function is enabled with #define DEBUG_USB_API when configuring the protocol stack in "usbconfig.h". This is convenient when debugging code, no need to remove use of this function when debugging has completed.
Parameters
[in]cChar to transmit.
Returns
The char transmitted.

Referenced by USBH_PrintConfigurationDescriptor(), and USBH_PrintString().

void USB_PUTS ( const char *  p)

Transmit a zero terminated string on the debug serial port.

Note
This function is enabled with #define DEBUG_USB_API when configuring the protocol stack in "usbconfig.h". This is convenient when debugging code, no need to remove use of this function when debugging has completed.
Parameters
[in]pPointer to string to transmit.

Referenced by USBH_PrintString().

void USBTIMER_DelayMs ( uint32_t  msec)

Active wait millisecond delay function. Can also be used inside interrupt handlers.

Parameters
[in]msecNumber of milliseconds to wait.

Definition at line 138 of file em_usbtimer.c.

Referenced by MSDH_Init(), USBH_PortReset(), USBH_PortResume(), USBH_PortSuspend(), and USBH_WaitForDeviceConnectionB().

void USBTIMER_DelayUs ( uint32_t  usec)

Active wait microsecond delay function. Can also be used inside interrupt handlers.

Parameters
[in]usecNumber of microseconds to wait.

Definition at line 159 of file em_usbtimer.c.

void USBTIMER_Init ( void  )

Activate the hardware timer used to pace the 1 millisecond timer system.

Call this function whenever the HFPERCLK frequency is changed. This function is initially called by HOST and DEVICE stack xxxx_Init() functions.

Definition at line 193 of file em_usbtimer.c.

References CMU_ClockEnable(), CMU_ClockFreqGet(), cmuClock_HFPER, TIMER_InitCC_TypeDef::mode, TIMER_CompareSet(), TIMER_CounterGet(), TIMER_IEN_CC0, TIMER_Init(), TIMER_INIT_DEFAULT, TIMER_InitCC(), TIMER_INITCC_DEFAULT, TIMER_IntClear(), TIMER_IntEnable(), TIMER_TopSet(), and timerCCModeCompare.

Referenced by USBD_Init(), and USBH_Init().

void USBTIMER_Start ( uint32_t  id,
uint32_t  timeout,
USBTIMER_Callback_TypeDef  callback 
)

Start a timer.

If the timer is already running, it will be restarted with new timeout.

Parameters
[in]idTimer id (0..).
[in]timeoutNumber of milliseconds before timer will elapse.
[in]callbackFunction to be called on timer elapse, ref. USBTIMER_Callback_TypeDef.

Definition at line 237 of file em_usbtimer.c.

References CORE_DECLARE_IRQ_STATE, CORE_ENTER_ATOMIC, CORE_EXIT_ATOMIC, and USBTIMER_Stop().

Referenced by CDC_StateChangeEvent(), HIDKBD_StateChangeEvent(), USBH_ControlMsg(), USBH_Read(), and USBH_Write().

void USBTIMER_Stop ( uint32_t  id)

Stop a timer.

Parameters
[in]idTimer id (0..).

Definition at line 306 of file em_usbtimer.c.

References CORE_DECLARE_IRQ_STATE, CORE_ENTER_ATOMIC, and CORE_EXIT_ATOMIC.

Referenced by CDC_StateChangeEvent(), HIDKBD_SetupCmd(), HIDKBD_StateChangeEvent(), USBH_Stop(), USBH_WaitForDeviceConnectionB(), and USBTIMER_Start().