MPLAB Harmony USB Stack
|
The Device Layer in the MPLAB Harmony USB Device Stack handles enumeration requests from the USB Host and provides an abstracted access to Control Transfers and Non-Control Endpoint Management. The Device Layer intercepts all Control transfers issues by the host. Only those control transfers that require application or function driver intervention are forwarded. Standard device control transfers are completely handled by the Device Layer. All access to the bus is routed via the Device Layer.
The following block diagram shows the USB Device Layer interaction with USB Controller Driver, Function Drivers, User Application and the Harmony System module.
USB Device Layer Interaction Block Diagram
Harmony System Module Interaction
The MPLAB Harmony System Module initializes the Device Layer in the SYS_Initialize() function. It calls the USB Device Layer task routine periodically from the SYS_Tasks() function.
USB Controller Driver Interaction
The Device Layer opens the USB Controller Driver exclusively. It is the only client to the controller driver. The Device Layer manages Endpoint 0 and has exclusive access to this endpoint. It maintains the Control Transfer state machine and seeks intervention from the Application or the Function Drivers where required. The Device Layer provides layered access to the required USB Controller Driver functions.
Function Driver Interaction
The USB Device Layer interaction with the function driver involves the following:
The Device Layer initiates all of the above interactions with the function driver independent of function driver type. Each function driver implements a set of common APIs. These common API allow the Device Layer to initialize/deinitialize the function driver, forward control transfers and invoke the function driver's task routine. Function Drivers are registered with the Device Layer as a part of the Device Stack Configuration. This is a compile time step. Function driver registration is explained elsewhere in this help section.
User Application (Client) Interaction
The user application opens the Device Layer and becomes a Device Layer client. It registers an event callback function with the Device_layer to get Device Layer event notifications. Other than receiving such notifications, the application client can also interact with the Device Layer_to determine device status such as USB speed or initiate a remote wake-up. The Device Layer will forward Control Transfers, whose recipient field is set to Other, to the application. The application must use the Device Layer Control Transfer Routines to complete these control transfers.
MPLAB Harmony USB Stack
|