2.8.2.1 Abstraction Model
The following diagram illustrates the functional interaction between the application, the MSD Function Driver, the media drivers, and the USB Device Layer.
As seen in the previous figure, the application does not have to interact with MSD function driver. Also, the MSD Function Driver does not have application functions that can be called. The media drivers control the storage media. The application interacts with the media drivers to update or access the information on the storage media. The MSD Function Driver interacts with the media drivers to process data read and write requests that it receives from the Host. This data is always accessed in blocks.
The MPLAB Harmony System module initializes the Device Layer and media drivers. A media driver is plugged into the MSD Function Driver by providing a media driver entry point in the MSD Function Driver initialization data structure. In the case of a multi-LUN storage, multiple media drivers can be plugged into the MSD Function Driver, with each one being capable of accessing different storage media types. The Device Layer initializes the MSD Function Driver when the Host sets the configuration that contains the Mass Storage interfaces. The MSD Function Driver Tasks routine is invoked in the context of the Device Layer Tasks routine. The MSD Function Driver interfaces should be registered in the USB Device Layer Function Driver Registration Table.