USB Libraries Help > USB Device Libraries > USB Device Layer Library > Library Interface
MPLAB Harmony USB Stack
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 
 
Creates and initializes an instance of the USB device layer. 
 
De-initializes the specified instance of the USB device layer. 
 
Provides the current status of the USB device layer 
 
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 
 
Opens the specified USB device layer instance and returns a handle to it. 
 
Closes an opened handle to an instance of the USB device layer. 
 
Returns the client specific status. 
 
USB Device Layer Event Handler Callback Function set function. 
c) Device Power State Management Functions
 
Name 
Description 
 
Sets power state of the device. 
 
Gets the "Remote wake-up" status of the device. 
 
Returns true if the device is in a suspended state. 
 
This function will start the resume signaling. 
 
This function will start a self timed Remote Wake-up. 
 
This function will stop the resume signaling. 
d) Device Management Functions
 
Name 
Description 
 
Returns the current state of the USB device. 
 
This function will attach the device to the USB. 
 
This function will detach the device from the USB. 
 
Informs the client of the current USB device configuration set by the USB host. 
 
Informs the client of the current operation speed of the USB bus. 
e) Endpoint Management Functions
 
Name 
Description 
 
This function returns the stall status of the specified endpoint and direction. 
 
This function stalls an endpoint in the specified direction. 
 
This function clears the stall on an endpoint in the specified direction. 
 
Disables a device endpoint. 
 
Enables a device endpoint. 
 
Returns true if the endpoint is enabled. 
 
Reads data received from host on the requested endpoint. 
 
This function cancels a transfer scheduled on an endpoint. 
 
This function requests a data write to a USB Device Endpoint. 
f) Control Transfer Functions
 
Name 
Description 
 
Receives data stage of the control transfer from host to device. 
 
Sends data stage of the control transfer from device to host. 
 
Initiates status stage of the control transfer. 
g) Data Types and Constants
 
Name 
Description 
 
USB Device Layer Events. 
 
Data type for USB device handle. 
 
USB Device Layer Control Transfer Status Stage flags. 
 
Enumerated data type identifying results of a control transfer. 
 
USB Device Initialization Structure 
 
Enumerated data type that identifies if the device is self powered or bus powered . 
 
Enumerated data type that identifies if the remote wakeup status of the device. 
 
Constant that defines the value of an Invalid Device Handle. 
 
USB device layer index definitions. 
 
This is macro USB_DEVICE_INDEX_1. 
 
This is macro USB_DEVICE_INDEX_2. 
 
This is macro USB_DEVICE_INDEX_3. 
 
This is macro USB_DEVICE_INDEX_4. 
 
This is macro USB_DEVICE_INDEX_5. 
 
Enumerated data type that identifies the USB Device Layer Client Status. 
 
Pointer to an array that contains pointer to configuration descriptors. 
 
USB Device Set Configuration Event Data type. 
 
USB Device Layer Event Handler Function Pointer Type 
 
Device Layer Event Handler function return type. 
 
USB Device Function Registration Structure 
 
USB Device Master Descriptor Structure. 
 
Pointer to an array that contains pointer to string descriptors. 
 
Device Layer Event Handler Function Response Type. 
 
USB Device Layer Endpoint Read and Write Complete Event Data type. 
 
USB Device Layer Endpoint Read and Write Complete Event Data type. 
 
USB Device Start Of Frame Event Data Type 
 
USB Device Synch Frame Event Data type. 
 
USB Device Layer Results Enumeration 
 
Enumerated data type that identifies the USB Device Layer Transfer Flags. 
 
Data type for USB Device Endpoint Data Transfer Handle. 
 
This is macro _USB_DEVICE_H. 
 
Specifies if the USB Device stack should support Microsoft OS Descriptor.