Module Description
The USB Core Layer implements the device abstraction defined in the Universal Serial Bus Specification, for applications to interact with the USB device interface on the device. The software in this layer responds to standard requests and returns standard descriptors. In current stack the Init() routine part of USBD_HW_API_T structure initializes both hardware layer and core layer.
Module Description
The USB Core Layer implements the device abstraction defined in the Universal Serial Bus Specification, for applications to interact with the USB device interface on the device. The software in this layer responds to standard requests and returns standard descriptors. In current stack the Init() routine part of USBD_HW_API_T structure initializes both hardware layer and core layer.
Common definitions and declarations for the USB stack.
| #define B3VAL |
( |
|
x | ) |
((x) & 0xFF),(((x) >> 8) & 0xFF),(((x) >> 16) & 0xFF) |
Class Request
Definition at line 93 of file usbd.h.
Class Request
Definition at line 100 of file usbd.h.
| #define REQUEST_DEVICE_TO_HOST 1 |
Request from device to host
Definition at line 84 of file usbd.h.
| #define REQUEST_DEVICE_TO_HOST 1 |
Request from device to host
Definition at line 91 of file usbd.h.
| #define REQUEST_HOST_TO_DEVICE 0 |
bmRequestType.Dir defines Request from host to device
Definition at line 82 of file usbd.h.
| #define REQUEST_HOST_TO_DEVICE 0 |
bmRequestType.Dir definesRequest from host to device
Definition at line 89 of file usbd.h.
| #define REQUEST_RESERVED 3 |
Reserved Request
Definition at line 97 of file usbd.h.
| #define REQUEST_RESERVED 3 |
Reserved Request
Definition at line 104 of file usbd.h.
| #define REQUEST_STANDARD 0 |
bmRequestType.Type defines Standard Request
Definition at line 91 of file usbd.h.
| #define REQUEST_STANDARD 0 |
bmRequestType.Type definesStandard Request
Definition at line 98 of file usbd.h.
| #define REQUEST_TO_DEVICE 0 |
bmRequestType.Recipient defines Request to device
Definition at line 104 of file usbd.h.
| #define REQUEST_TO_DEVICE 0 |
bmRequestType.Recipient definesRequest to device
Definition at line 111 of file usbd.h.
| #define REQUEST_TO_ENDPOINT 2 |
Request to endpoint
Definition at line 108 of file usbd.h.
| #define REQUEST_TO_ENDPOINT 2 |
Request to endpoint
Definition at line 115 of file usbd.h.
| #define REQUEST_TO_INTERFACE 1 |
Request to interface
Definition at line 106 of file usbd.h.
| #define REQUEST_TO_INTERFACE 1 |
Request to interface
Definition at line 113 of file usbd.h.
| #define REQUEST_TO_OTHER 3 |
Request to other
Definition at line 110 of file usbd.h.
| #define REQUEST_TO_OTHER 3 |
Request to other
Definition at line 117 of file usbd.h.
Vendor Request
Definition at line 95 of file usbd.h.
Vendor Request
Definition at line 102 of file usbd.h.
| #define USB_CONFIG_BUS_POWERED 0x80 |
Bus powered
Definition at line 271 of file usbd.h.
| #define USB_CONFIG_BUS_POWERED 0x80 |
Bus powered
Definition at line 279 of file usbd.h.
| #define USB_CONFIG_POWER_MA |
( |
|
mA | ) |
((mA)/2) |
bMaxPower in Configuration Descriptor
Definition at line 279 of file usbd.h.
| #define USB_CONFIG_POWERED_MASK 0x40 |
bmAttributes in Configuration Descriptor Power field mask
Definition at line 269 of file usbd.h.
| #define USB_CONFIG_POWERED_MASK 0x40 |
bmAttributes in Configuration DescriptorPower field mask
Definition at line 277 of file usbd.h.
| #define USB_CONFIG_REMOTE_WAKEUP 0x20 |
remote wakeup
Definition at line 275 of file usbd.h.
| #define USB_CONFIG_REMOTE_WAKEUP 0x20 |
remote wakeup
Definition at line 283 of file usbd.h.
| #define USB_CONFIG_SELF_POWERED 0xC0 |
Self powered
Definition at line 273 of file usbd.h.
| #define USB_CONFIG_SELF_POWERED 0xC0 |
Self powered
Definition at line 281 of file usbd.h.
| #define USB_CONFIGUARTION_DESC_SIZE (sizeof(USB_CONFIGURATION_DESCRIPTOR)) |
| #define USB_CONFIGURATION_DESCRIPTOR_TYPE 2 |
Configuration descriptor type
Definition at line 213 of file usbd.h.
| #define USB_CONFIGURATION_DESCRIPTOR_TYPE 2 |
Configuration descriptor type
Definition at line 221 of file usbd.h.
| #define USB_DEBUG_DESCRIPTOR_TYPE 10 |
Debug descriptor type
Definition at line 229 of file usbd.h.
| #define USB_DEBUG_DESCRIPTOR_TYPE 10 |
Debug descriptor type
Definition at line 237 of file usbd.h.
| #define USB_DEVICE_CLASS_APP 0xFE |
Application device class
Definition at line 260 of file usbd.h.
| #define USB_DEVICE_CLASS_APP 0xFE |
Application device class
Definition at line 268 of file usbd.h.
| #define USB_DEVICE_CLASS_AUDIO 0x01 |
Audio device class
Definition at line 240 of file usbd.h.
| #define USB_DEVICE_CLASS_AUDIO 0x01 |
Audio device class
Definition at line 248 of file usbd.h.
| #define USB_DEVICE_CLASS_COMMUNICATIONS 0x02 |
Communications device class
Definition at line 242 of file usbd.h.
| #define USB_DEVICE_CLASS_COMMUNICATIONS 0x02 |
Communications device class
Definition at line 250 of file usbd.h.
| #define USB_DEVICE_CLASS_HUB 0x09 |
Hub device class
Definition at line 256 of file usbd.h.
| #define USB_DEVICE_CLASS_HUB 0x09 |
Hub device class
Definition at line 264 of file usbd.h.
| #define USB_DEVICE_CLASS_HUMAN_INTERFACE 0x03 |
Human interface device class
Definition at line 244 of file usbd.h.
| #define USB_DEVICE_CLASS_HUMAN_INTERFACE 0x03 |
Human interface device class
Definition at line 252 of file usbd.h.
| #define USB_DEVICE_CLASS_MISCELLANEOUS 0xEF |
miscellaneous device class
Definition at line 258 of file usbd.h.
| #define USB_DEVICE_CLASS_MISCELLANEOUS 0xEF |
miscellaneous device class
Definition at line 266 of file usbd.h.
| #define USB_DEVICE_CLASS_MONITOR 0x04 |
monitor device class
Definition at line 246 of file usbd.h.
| #define USB_DEVICE_CLASS_MONITOR 0x04 |
monitor device class
Definition at line 254 of file usbd.h.
| #define USB_DEVICE_CLASS_PHYSICAL_INTERFACE 0x05 |
physical interface device class
Definition at line 248 of file usbd.h.
| #define USB_DEVICE_CLASS_PHYSICAL_INTERFACE 0x05 |
physical interface device class
Definition at line 256 of file usbd.h.
| #define USB_DEVICE_CLASS_POWER 0x06 |
power device class
Definition at line 250 of file usbd.h.
| #define USB_DEVICE_CLASS_POWER 0x06 |
power device class
Definition at line 258 of file usbd.h.
| #define USB_DEVICE_CLASS_PRINTER 0x07 |
Printer device class
Definition at line 252 of file usbd.h.
| #define USB_DEVICE_CLASS_PRINTER 0x07 |
Printer device class
Definition at line 260 of file usbd.h.
| #define USB_DEVICE_CLASS_RESERVED 0x00 |
USB Device Classes Reserved device class
Definition at line 238 of file usbd.h.
| #define USB_DEVICE_CLASS_RESERVED 0x00 |
USB Device ClassesReserved device class
Definition at line 246 of file usbd.h.
| #define USB_DEVICE_CLASS_STORAGE 0x08 |
Storage device class
Definition at line 254 of file usbd.h.
| #define USB_DEVICE_CLASS_STORAGE 0x08 |
Storage device class
Definition at line 262 of file usbd.h.
| #define USB_DEVICE_CLASS_VENDOR_SPECIFIC 0xFF |
Vendor specific device class
Definition at line 262 of file usbd.h.
| #define USB_DEVICE_CLASS_VENDOR_SPECIFIC 0xFF |
Vendor specific device class
Definition at line 270 of file usbd.h.
| #define USB_DEVICE_DESC_SIZE (sizeof(USB_DEVICE_DESCRIPTOR)) |
| #define USB_DEVICE_DESCRIPTOR_TYPE 1 |
USB Descriptor Types Device descriptor type
Definition at line 211 of file usbd.h.
| #define USB_DEVICE_DESCRIPTOR_TYPE 1 |
USB Descriptor TypesDevice descriptor type
Definition at line 219 of file usbd.h.
| #define USB_DEVICE_QUALI_SIZE (sizeof(USB_DEVICE_QUALIFIER_DESCRIPTOR)) |
| #define USB_DEVICE_QUALIFIER_DESCRIPTOR_TYPE 6 |
Device qualifier descriptor type
Definition at line 221 of file usbd.h.
| #define USB_DEVICE_QUALIFIER_DESCRIPTOR_TYPE 6 |
Device qualifier descriptor type
Definition at line 229 of file usbd.h.
| #define USB_ENDPOINT_0_HS_MAXP 64 |
Control endopint EP0's maximum packet size in high-speed mode.
Definition at line 328 of file usbd.h.
| #define USB_ENDPOINT_0_HS_MAXP 64 |
Control endopint EP0's maximum packet size in high-speed mode.
Definition at line 336 of file usbd.h.
| #define USB_ENDPOINT_0_LS_MAXP 8 |
Control endopint EP0's maximum packet size in low-speed mode.
Definition at line 330 of file usbd.h.
| #define USB_ENDPOINT_0_LS_MAXP 8 |
Control endopint EP0's maximum packet size in low-speed mode.
Definition at line 338 of file usbd.h.
| #define USB_ENDPOINT_BULK_HS_MAXP 512 |
Bulk endopint's maximum packet size in high-speed mode.
Definition at line 332 of file usbd.h.
| #define USB_ENDPOINT_BULK_HS_MAXP 512 |
Bulk endopint's maximum packet size in high-speed mode.
Definition at line 340 of file usbd.h.
| #define USB_ENDPOINT_DESC_SIZE (sizeof(USB_ENDPOINT_DESCRIPTOR)) |
| #define USB_ENDPOINT_DESCRIPTOR_TYPE 5 |
Endpoint descriptor type
Definition at line 219 of file usbd.h.
| #define USB_ENDPOINT_DESCRIPTOR_TYPE 5 |
Endpoint descriptor type
Definition at line 227 of file usbd.h.
| #define USB_ENDPOINT_DIRECTION_MASK 0x80 |
bEndpointAddress in Endpoint Descriptor Endopint address mask
Definition at line 285 of file usbd.h.
| #define USB_ENDPOINT_DIRECTION_MASK 0x80 |
bMaxPower in Configuration Descriptor bEndpointAddress in Endpoint DescriptorEndopint address mask
Definition at line 293 of file usbd.h.
| #define USB_ENDPOINT_IN |
( |
|
addr | ) |
((addr) | 0x80) |
Macro to convert IN endopint number to endpoint address value.
Definition at line 289 of file usbd.h.
| #define USB_ENDPOINT_IN |
( |
|
addr | ) |
((addr) | 0x80) |
Macro to convert IN endopint number to endpoint address value.
Definition at line 297 of file usbd.h.
| #define USB_ENDPOINT_OUT |
( |
|
addr | ) |
((addr) | 0x00) |
Macro to convert OUT endopint number to endpoint address value.
Definition at line 287 of file usbd.h.
| #define USB_ENDPOINT_OUT |
( |
|
addr | ) |
((addr) | 0x00) |
Macro to convert OUT endopint number to endpoint address value.
Definition at line 295 of file usbd.h.
| #define USB_ENDPOINT_SYNC_ADAPTIVE 0x08 |
Adaptive sync Endopint
Definition at line 312 of file usbd.h.
| #define USB_ENDPOINT_SYNC_ADAPTIVE 0x08 |
Adaptive sync Endopint
Definition at line 320 of file usbd.h.
| #define USB_ENDPOINT_SYNC_ASYNCHRONOUS 0x04 |
Asynchronous sync Endopint
Definition at line 310 of file usbd.h.
| #define USB_ENDPOINT_SYNC_ASYNCHRONOUS 0x04 |
Asynchronous sync Endopint
Definition at line 318 of file usbd.h.
| #define USB_ENDPOINT_SYNC_MASK 0x0C |
Endopint sync type mask
Definition at line 306 of file usbd.h.
| #define USB_ENDPOINT_SYNC_MASK 0x0C |
Endopint sync type mask
Definition at line 314 of file usbd.h.
| #define USB_ENDPOINT_SYNC_NO_SYNCHRONIZATION 0x00 |
no synchronization Endopint
Definition at line 308 of file usbd.h.
| #define USB_ENDPOINT_SYNC_NO_SYNCHRONIZATION 0x00 |
no synchronization Endopint
Definition at line 316 of file usbd.h.
| #define USB_ENDPOINT_SYNC_SYNCHRONOUS 0x0C |
Synchronous sync Endopint
Definition at line 314 of file usbd.h.
| #define USB_ENDPOINT_SYNC_SYNCHRONOUS 0x0C |
Synchronous sync Endopint
Definition at line 322 of file usbd.h.
| #define USB_ENDPOINT_TYPE_BULK 0x02 |
bulk Endopint type
Definition at line 302 of file usbd.h.
| #define USB_ENDPOINT_TYPE_BULK 0x02 |
bulk Endopint type
Definition at line 310 of file usbd.h.
| #define USB_ENDPOINT_TYPE_CONTROL 0x00 |
Control Endopint type
Definition at line 298 of file usbd.h.
| #define USB_ENDPOINT_TYPE_CONTROL 0x00 |
Control Endopint type
Definition at line 306 of file usbd.h.
| #define USB_ENDPOINT_TYPE_INTERRUPT 0x03 |
interrupt Endopint type
Definition at line 304 of file usbd.h.
| #define USB_ENDPOINT_TYPE_INTERRUPT 0x03 |
interrupt Endopint type
Definition at line 312 of file usbd.h.
| #define USB_ENDPOINT_TYPE_ISOCHRONOUS 0x01 |
isochronous Endopint type
Definition at line 300 of file usbd.h.
| #define USB_ENDPOINT_TYPE_ISOCHRONOUS 0x01 |
isochronous Endopint type
Definition at line 308 of file usbd.h.
| #define USB_ENDPOINT_TYPE_MASK 0x03 |
bmAttributes in Endpoint Descriptor Endopint type mask
Definition at line 296 of file usbd.h.
| #define USB_ENDPOINT_TYPE_MASK 0x03 |
bmAttributes in Endpoint DescriptorEndopint type mask
Definition at line 304 of file usbd.h.
| #define USB_ENDPOINT_USAGE_DATA 0x00 |
Endopint data usage type
Definition at line 318 of file usbd.h.
| #define USB_ENDPOINT_USAGE_DATA 0x00 |
Endopint data usage type
Definition at line 326 of file usbd.h.
| #define USB_ENDPOINT_USAGE_FEEDBACK 0x10 |
Endopint feedback usage type
Definition at line 320 of file usbd.h.
| #define USB_ENDPOINT_USAGE_FEEDBACK 0x10 |
Endopint feedback usage type
Definition at line 328 of file usbd.h.
| #define USB_ENDPOINT_USAGE_IMPLICIT_FEEDBACK 0x20 |
Endopint implicit feedback usage type
Definition at line 322 of file usbd.h.
| #define USB_ENDPOINT_USAGE_IMPLICIT_FEEDBACK 0x20 |
Endopint implicit feedback usage type
Definition at line 330 of file usbd.h.
| #define USB_ENDPOINT_USAGE_MASK 0x30 |
Endopint usage type mask
Definition at line 316 of file usbd.h.
| #define USB_ENDPOINT_USAGE_MASK 0x30 |
Endopint usage type mask
Definition at line 324 of file usbd.h.
| #define USB_ENDPOINT_USAGE_RESERVED 0x30 |
Endopint reserved usage type
Definition at line 324 of file usbd.h.
| #define USB_ENDPOINT_USAGE_RESERVED 0x30 |
Endopint reserved usage type
Definition at line 332 of file usbd.h.
| #define USB_FEATURE_ENDPOINT_STALL 0 |
USB Standard Feature selectors ENDPOINT_STALL feature
Definition at line 174 of file usbd.h.
| #define USB_FEATURE_ENDPOINT_STALL 0 |
USB Standard Feature selectorsENDPOINT_STALL feature
Definition at line 182 of file usbd.h.
| #define USB_FEATURE_REMOTE_WAKEUP 1 |
REMOTE_WAKEUP feature
Definition at line 176 of file usbd.h.
| #define USB_FEATURE_REMOTE_WAKEUP 1 |
REMOTE_WAKEUP feature
Definition at line 184 of file usbd.h.
| #define USB_FEATURE_TEST_MODE 2 |
TEST_MODE feature
Definition at line 178 of file usbd.h.
| #define USB_FEATURE_TEST_MODE 2 |
TEST_MODE feature
Definition at line 186 of file usbd.h.
| #define USB_GETSTATUS_ENDPOINT_STALL 0x01 |
ENDPOINT_STALL status
Definition at line 167 of file usbd.h.
| #define USB_GETSTATUS_ENDPOINT_STALL 0x01 |
ENDPOINT_STALL status
Definition at line 175 of file usbd.h.
| #define USB_GETSTATUS_REMOTE_WAKEUP 0x02 |
REMOTE_WAKEUP capable status
Definition at line 165 of file usbd.h.
| #define USB_GETSTATUS_REMOTE_WAKEUP 0x02 |
REMOTE_WAKEUP capable status
Definition at line 173 of file usbd.h.
| #define USB_GETSTATUS_SELF_POWERED 0x01 |
USB GET_STATUS Bit Values SELF_POWERED status
Definition at line 163 of file usbd.h.
| #define USB_GETSTATUS_SELF_POWERED 0x01 |
USB GET_STATUS Bit ValuesSELF_POWERED status
Definition at line 171 of file usbd.h.
| #define USB_INTERFACE_ASSOCIATION_DESCRIPTOR_TYPE 11 |
Interface association descriptor type
Definition at line 231 of file usbd.h.
| #define USB_INTERFACE_ASSOCIATION_DESCRIPTOR_TYPE 11 |
Interface association descriptor type
Definition at line 239 of file usbd.h.
| #define USB_INTERFACE_DESC_SIZE (sizeof(USB_INTERFACE_DESCRIPTOR)) |
| #define USB_INTERFACE_DESCRIPTOR_TYPE 4 |
Interface descriptor type
Definition at line 217 of file usbd.h.
| #define USB_INTERFACE_DESCRIPTOR_TYPE 4 |
Interface descriptor type
Definition at line 225 of file usbd.h.
| #define USB_INTERFACE_POWER_DESCRIPTOR_TYPE 8 |
Interface power descriptor type
Definition at line 225 of file usbd.h.
| #define USB_INTERFACE_POWER_DESCRIPTOR_TYPE 8 |
Interface power descriptor type
Definition at line 233 of file usbd.h.
| #define USB_OTG_DESCRIPTOR_TYPE 9 |
OTG descriptor type
Definition at line 227 of file usbd.h.
| #define USB_OTG_DESCRIPTOR_TYPE 9 |
OTG descriptor type
Definition at line 235 of file usbd.h.
| #define USB_OTHER_SPEED_CONF_SIZE (sizeof(USB_OTHER_SPEED_CONFIGURATION)) |
| #define USB_OTHER_SPEED_CONFIG_DESCRIPTOR_TYPE 7 |
Other speed configuration descriptor type
Definition at line 223 of file usbd.h.
| #define USB_OTHER_SPEED_CONFIG_DESCRIPTOR_TYPE 7 |
Other speed configuration descriptor type
Definition at line 231 of file usbd.h.
| #define USB_REQUEST_CLEAR_FEATURE 1 |
CLEAR_FEATURE request
Definition at line 138 of file usbd.h.
| #define USB_REQUEST_CLEAR_FEATURE 1 |
CLEAR_FEATURE request
Definition at line 146 of file usbd.h.
| #define USB_REQUEST_GET_CONFIGURATION 8 |
GET_CONFIGURATION request
Definition at line 148 of file usbd.h.
| #define USB_REQUEST_GET_CONFIGURATION 8 |
GET_CONFIGURATION request
Definition at line 156 of file usbd.h.
| #define USB_REQUEST_GET_DESCRIPTOR 6 |
GET_DESCRIPTOR request
Definition at line 144 of file usbd.h.
| #define USB_REQUEST_GET_DESCRIPTOR 6 |
GET_DESCRIPTOR request
Definition at line 152 of file usbd.h.
| #define USB_REQUEST_GET_INTERFACE 10 |
GET_INTERFACE request
Definition at line 152 of file usbd.h.
| #define USB_REQUEST_GET_INTERFACE 10 |
GET_INTERFACE request
Definition at line 160 of file usbd.h.
| #define USB_REQUEST_GET_STATUS 0 |
USB Standard Request Codes GET_STATUS request
Definition at line 136 of file usbd.h.
| #define USB_REQUEST_GET_STATUS 0 |
USB Standard Request CodesGET_STATUS request
Definition at line 144 of file usbd.h.
| #define USB_REQUEST_SET_ADDRESS 5 |
SET_ADDRESS request
Definition at line 142 of file usbd.h.
| #define USB_REQUEST_SET_ADDRESS 5 |
SET_ADDRESS request
Definition at line 150 of file usbd.h.
| #define USB_REQUEST_SET_CONFIGURATION 9 |
SET_CONFIGURATION request
Definition at line 150 of file usbd.h.
| #define USB_REQUEST_SET_CONFIGURATION 9 |
SET_CONFIGURATION request
Definition at line 158 of file usbd.h.
| #define USB_REQUEST_SET_DESCRIPTOR 7 |
SET_DESCRIPTOR request
Definition at line 146 of file usbd.h.
| #define USB_REQUEST_SET_DESCRIPTOR 7 |
SET_DESCRIPTOR request
Definition at line 154 of file usbd.h.
| #define USB_REQUEST_SET_FEATURE 3 |
SET_FEATURE request
Definition at line 140 of file usbd.h.
| #define USB_REQUEST_SET_FEATURE 3 |
SET_FEATURE request
Definition at line 148 of file usbd.h.
| #define USB_REQUEST_SET_INTERFACE 11 |
SET_INTERFACE request
Definition at line 154 of file usbd.h.
| #define USB_REQUEST_SET_INTERFACE 11 |
SET_INTERFACE request
Definition at line 162 of file usbd.h.
| #define USB_REQUEST_SYNC_FRAME 12 |
SYNC_FRAME request
Definition at line 156 of file usbd.h.
| #define USB_REQUEST_SYNC_FRAME 12 |
SYNC_FRAME request
Definition at line 164 of file usbd.h.
| #define USB_STRING_DESCRIPTOR_TYPE 3 |
String descriptor type
Definition at line 215 of file usbd.h.
| #define USB_STRING_DESCRIPTOR_TYPE 3 |
String descriptor type
Definition at line 223 of file usbd.h.
| #define WBVAL |
( |
|
x | ) |
((x) & 0xFF),(((x) >> 8) & 0xFF) |
USB device stack's event callback function type.
The USB device stack exposes several event triggers through callback to application layer. The application layer can register methods to be called when such USB event happens.
- Parameters
-
| [in] | hUsb | Handle to the USB device stack. |
- Returns
- The call back should returns ErrorCode_t type to indicate success or error condition.
- Return values
-
| LPC_OK | On success |
| ERR_USBD_UNHANDLED | Event is not handled hence pass the event to next in line. |
| ERR_USBD_xxx | Other error conditions. |
The USB device stack exposes several event triggers through callback to application layer. The application layer can register methods to be called when such USB event happens.
- Parameters
-
| hUsb | Handle to the USB device stack. |
- Returns
- The call back should returns ErrorCode_t type to indicate success or error condition.
- Return values
-
| LPC_OK | On success |
| ERR_USBD_UNHANDLED | Event is not handled hence pass the event to next in line. |
| ERR_USBD_xxx | Other error conditions. |
Definition at line 30 of file usbd_api.h.
USBD setup request and endpoint event handler type.
The application layer should define the custom class's EP0 handler with function signature. The stack calls all the registered class handlers on any EP0 event before going through default handling of the event. This gives the class handlers to implement class specific request handlers and also to override the default stack handling for a particular event targeted to the interface. If an event is not handled by the callback the function should return ERR_USBD_UNHANDLED. For all other return codes the stack assumes that callback has taken care of the event and hence will not process the event any further and issues a STALL condition on EP0 indicating error to the host.
For endpoint interrupt handler the return value is ignored by the stack.
- Parameters
-
| [in] | hUsb | Handle to the USB device stack. |
| [in] | data | Pointer to the data which will be passed when callback function is called by the stack. |
| [in] | event | Type of endpoint event. See USBD_EVENT_T for more details. |
- Returns
- The call back should returns ErrorCode_t type to indicate success or error condition.
- Return values
-
| LPC_OK | On success. |
| ERR_USBD_UNHANDLED | Event is not handled hence pass the event to next in line. |
| ERR_USBD_xxx | For other error conditions. |
The application layer should define the custom class's EP0 handler with function signature. The stack calls all the registered class handlers on any EP0 event before going through default handling of the event. This gives the class handlers to implement class specific request handlers and also to override the default stack handling for a particular event targeted to the interface. If an event is not handled by the callback the function should return ERR_USBD_UNHANDLED. For all other return codes the stack assumes that callback has taken care of the event and hence will not process the event any further and issues a STALL condition on EP0 indicating error to the host.
For endpoint interrupt handler the return value is ignored by the stack.
- Parameters
-
| hUsb | Handle to the USB device stack. |
| data | Pointer to the data which will be passed when callback function is called by the stack. |
| event | Type of endpoint event. See USBD_EVENT_T for more details. |
- Returns
- The call back should returns ErrorCode_t type to indicate success or error condition.
- Return values
-
| LPC_OK | On success. |
| ERR_USBD_UNHANDLED | Event is not handled hence pass the event to next in line. |
| ERR_USBD_xxx | For other error conditions. |
Definition at line 33 of file usbd_api.h.
USB device stack's event callback function type.
The USB device stack exposes several event triggers through callback to application layer. The application layer can register methods to be called when such USB event happens.
- Parameters
-
| [in] | hUsb | Handle to the USB device stack. |
| [in] | param1 | Extra information related to the event. |
- Returns
- The call back should returns ErrorCode_t type to indicate success or error condition.
- Return values
-
| LPC_OK | On success |
| ERR_USBD_UNHANDLED | Event is not handled hence pass the event to next in line. |
| ERR_USBD_xxx | For other error conditions. |
The USB device stack exposes several event triggers through callback to application layer. The application layer can register methods to be called when such USB event happens.
- Parameters
-
| hUsb | Handle to the USB device stack. |
| param1 | Extra information related to the event. |
- Returns
- The call back should returns ErrorCode_t type to indicate success or error condition.
- Return values
-
| LPC_OK | On success |
| ERR_USBD_UNHANDLED | Event is not handled hence pass the event to next in line. |
| ERR_USBD_xxx | For other error conditions. |
Definition at line 31 of file usbd_api.h.
USB device stack/module handle.
Definition at line 648 of file usbd.h.
USB device stack/module handle.
Definition at line 656 of file usbd.h.