2.2.4 Library Interface
This section describes the Application Programming Interface (API) functions of the USB Device Layer Library.
Refer to each section for a detailed description.
a) System Interaction Functions
Name | Description |
USB_DEVICE_Initialize | Creates and initializes an instance of the USB device layer. |
USB_DEVICE_Deinitialize | De-initializes the specified instance of the USB device layer. |
USB_DEVICE_Status | Provides the current status of the USB device layer. |
USB_DEVICE_Tasks | USB Device layer calls all other function driver tasks in this function. It also generates and forwards events to its clients. |
b) Client Core Functions
Name | Description |
USB_DEVICE_Open | Opens the specified USB device layer instance and returns a handle to it. |
USB_DEVICE_Close | Closes an opened handle to an instance of the USB device layer. |
USB_DEVICE_ClientStatusGet | Returns the client specific status. |
USB_DEVICE_EventHandlerSet | USB Device Layer Event Handler Callback Function set function. |
c) Device Power State Management Functions
Name | Description |
USB_DEVICE_PowerStateSet | Sets power state of the device. |
USB_DEVICE_RemoteWakeupStatusGet | Gets the "Remote wake-up" status of the device. |
USB_DEVICE_IsSuspended | Returns true if the device is in a suspended state. |
USB_DEVICE_RemoteWakeupStart | This function will start the resume signaling. |
USB_DEVICE_RemoteWakeupStartTimed | This function will start a self timed Remote Wake-up. |
USB_DEVICE_RemoteWakeupStop | This function will stop the resume signaling. |
d) Device Management Functions
Name | Description |
USB_DEVICE_StateGet | Returns the current state of the USB device. |
USB_DEVICE_Attach | This function will attach the device to the USB. |
USB_DEVICE_Detach | This function will detach the device from the USB. |
USB_DEVICE_ActiveConfigurationGet | Informs the client of the current USB device configuration set by the USB host. |
USB_DEVICE_ActiveSpeedGet | Informs the client of the current operation speed of the USB bus. |
e) Endpoint Management Functions
Name | Description |
USB_DEVICE_EndpointIsStalled | This function returns the stall status of the specified endpoint and direction. |
USB_DEVICE_EndpointStall | This function stalls an endpoint in the specified direction. |
USB_DEVICE_EndpointStallClear | This function clears the stall on an endpoint in the specified direction. |
USB_DEVICE_EndpointDisable | Disables a device endpoint. |
USB_DEVICE_EndpointEnable | Enables a device endpoint. |
USB_DEVICE_EndpointIsEnabled | Returns true if the endpoint is enabled. |
USB_DEVICE_EndpointRead | Reads data received from host on the requested endpoint. |
USB_DEVICE_EndpointTransferCancel | This function cancels a transfer scheduled on an endpoint. |
USB_DEVICE_EndpointWrite | This function requests a data write to a USB Device Endpoint. |
f) Control Transfer Functions
Name | Description |
USB_DEVICE_ControlReceive | Receives data stage of the control transfer from host to device. |
USB_DEVICE_ControlSend | Sends data stage of the control transfer from device to host. |
USB_DEVICE_ControlStatus | Initiates status stage of the control transfer. |
g) Data Types and Constants
Name | Description |
USB_DEVICE_EVENT | USB Device Layer Events. |
USB_DEVICE_HANDLE | Data type for USB device handle. |
USB_DEVICE_CONTROL_STATUS | USB Device Layer Control Transfer Status Stage flags. |
USB_DEVICE_CONTROL_TRANSFER_RESULT | Enumerated data type identifying results of a control transfer. |
USB_DEVICE_INIT | USB Device Initialization Structure. |
USB_DEVICE_POWER_STATE | Enumerated data type that identifies if the device is self powered or bus powered. |
USB_DEVICE_REMOTE_WAKEUP_STATUS | Enumerated data type that identifies if the remote wakeup status of the device. |
USB_DEVICE_HANDLE_INVALID | Constant that defines the value of an Invalid Device Handle. |
USB_DEVICE_INDEX_0 | USB device layer index definitions. |
USB_DEVICE_INDEX_1 | This is macro USB_DEVICE_INDEX_1. |
USB_DEVICE_INDEX_2 | This is macro USB_DEVICE_INDEX_2. |
USB_DEVICE_INDEX_3 | This is macro USB_DEVICE_INDEX_3. |
USB_DEVICE_INDEX_4 | This is macro USB_DEVICE_INDEX_4. |
USB_DEVICE_INDEX_5 | This is macro USB_DEVICE_INDEX_5. |
USB_DEVICE_CLIENT_STATUS | Enumerated data type that identifies the USB Device Layer Client Status. |
USB_DEVICE_CONFIGURATION_DESCRIPTORS_TABLE | Pointer to an array that contains pointer to configuration descriptors. |
USB_DEVICE_EVENT_DATA_CONFIGURED | USB Device Set Configuration Event Data type. |
USB_DEVICE_EVENT_HANDLER | USB Device Layer Event Handler Function Pointer Type. |
USB_DEVICE_EVENT_RESPONSE | Device Layer Event Handler function return type. |
USB_DEVICE_FUNCTION_REGISTRATION_TABLE | USB Device Function Registration Structure. |
USB_DEVICE_MASTER_DESCRIPTOR | USB Device Master Descriptor Structure. |
USB_DEVICE_STRING_DESCRIPTORS_TABLE | Pointer to an array that contains pointer to string descriptors. |
USB_DEVICE_EVENT_RESPONSE_NONE | Device Layer Event Handler Function Response Type. |
USB_DEVICE_EVENT_DATA_ENDPOINT_READ_COMPLETE | USB Device Layer Endpoint Read and Write Complete Event Data type. |
USB_DEVICE_EVENT_DATA_ENDPOINT_WRITE_COMPLETE | USB Device Layer Endpoint Read and Write Complete Event Data type. |
USB_DEVICE_EVENT_DATA_SOF | USB Device Start Of Frame Event Data Type. |
USB_DEVICE_EVENT_DATA_SYNCH_FRAME | USB Device Synch Frame Event Data type. |
USB_DEVICE_RESULT | USB Device Layer Results Enumeration. |
USB_DEVICE_TRANSFER_FLAGS | Enumerated data type that identifies the USB Device Layer Transfer Flags. |
USB_DEVICE_TRANSFER_HANDLE | Data type for USB Device Endpoint Data Transfer Handle. |
USB_DEVICE_MICROSOFT_OS_DESCRIPTOR_SUPPORT_ENABLE | Specifies if the USB Device stack should support Microsoft OS Descriptor. |