USB Libraries Help > USB Host Libraries > USB MSD Host Client Driver Library > Using the Library > Abstraction Model
MPLAB Harmony USB Stack
Abstraction Model

The USB MSD Host Client Driver provides the transport for SCSI commands that implements that media read, write and control operations. If abstracts the details of initiating and completing a BOT transfer and performing error handling and presents a simple event driven interface to the top-level block storage command driver library. 

The USB MSD Host Client Driver uses the USB Host data transfer and pipe management routines to implement the three stages of a BOT transfer. The library accepts a SCSI command from the SCSI Block Storage driver and transports this command in the command block of the Command Block Wrapper in the CBW stage of the BOT transfer. If the command requires a data stage, the USB MSD Host Client Driver library will transfer data between the USB Host and the device. The USB MSD Host Client Driver will then terminate the BOT transfer by requesting for the Command Status Wrapper (CSW) from the device. 

If the device stalls any stage of the transfer, the USB MSD Host Client Driver will clear the stall and will automatically initiate the CSW stage to complete the transfer. The transfer result is communicated to the top level block storage driver library through a callback mechanism. 

The USB Host layer will attach the USB MSD Host Client Driver to a mass storage device based on a TPL entry match. The USB MSD Host Client Driver will then open data and communication control pipes to the device. It will first get the number of logical units (LUN) that the device contains. It will then initialize the SCSI block storage driver for each reported LUN and mark the device state as being ready for data transfers.