Jump to main content

##

# 2.2.1 Introduction

The MPLAB Harmony 3 USB Device Layer Library (also referred to as the Device Layer) is part of the MPLAB Harmony 3 USB Device Stack. Within the USB Device Stack, the Device Layer implementation is independent of the USB Controller Hardware. It responds to enumeration requests from the Host. It receives control transfers from the Host and responds to these control transfers in the case of standard device requests. It dispatches all other control transfers to function drivers and the application. It provides the application and function drivers with API routines that allow them to respond to and complete a control transfer, with a facility to defer the responses to a control transfer. The Device Layer also provides the application with events and functions that allow the application to track the state of the device.

The Device Layer plays the role of a system within the MPLAB Harmony USB Device Stack. It initializes USB device function drivers that are contained in the active configuration. The state machines of these function drivers are maintained by the Device Layer; that is, the Device Layer invokes the function driver task routines from within its own task routine. The Device Layer thus treats the function drivers as submodules.

The device layer features the following:

- Supports both USB Full-Speed and High-Speed operation.
- Based on a modular and event-driven architecture.
- Hardware-independent architecture. APIs does not change across microcontrollers or microprocessors.
- Supports PIC32M, PIC32C, SAM Microcontrollers, as well as SAMA5, SAMA7, SAM9X6, and SAM9X7 Microprocessors.
- Supports composite USB devices.
- Supports CDC, HID, MSD, Printer, Audio v1.0. Audio v2.0 and Generic/Vendor Devices.
- All functions are non-blocking.
- Operates readily with a RTOS.
- Designed to integrate readily with other MPLAB Harmony middleware.
- Completely interrupt-driven.
- Requires minimal application intervention while maintaining the USB Device state.
- Allows implementation of a multi-configuration USB device.
- In case of multiple UBS controllers, allows itself to be instantiated more than once.