LPCOpen Platform
LPCOpen Platform for NXP LPC Microcontrollers
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
MassStorageClassHost.c File Reference

Go to the source code of this file.

Functions

uint8_t MS_Host_ConfigurePipes (USB_ClassInfo_MS_Host_t *const MSInterfaceInfo, uint16_t ConfigDescriptorSize, void *ConfigDescriptorData)
 Host interface configuration routine, to configure a given Mass Storage host interface instance using the Configuration Descriptor read from an attached USB device. This function automatically updates the given Mass Storage Host instance's state values and configures the pipes required to communicate with the interface if it is found within the device. This should be called once after the stack has enumerated the attached device, while the host state machine is in the Addressed state.
 
static uint8_t DCOMP_MS_Host_NextMSInterface (void *const CurrentDescriptor)
 
static uint8_t DCOMP_MS_Host_NextMSInterfaceEndpoint (void *const CurrentDescriptor)
 
static uint8_t MS_Host_SendCommand (USB_ClassInfo_MS_Host_t *const MSInterfaceInfo, MS_CommandBlockWrapper_t *const SCSICommandBlock, const void *const BufferPtr)
 
static uint8_t MS_Host_WaitForDataReceived (USB_ClassInfo_MS_Host_t *const MSInterfaceInfo)
 
static uint8_t MS_Host_SendReceiveData (USB_ClassInfo_MS_Host_t *const MSInterfaceInfo, MS_CommandBlockWrapper_t *const SCSICommandBlock, void *BufferPtr)
 
static uint8_t MS_Host_GetReturnedStatus (USB_ClassInfo_MS_Host_t *const MSInterfaceInfo, MS_CommandStatusWrapper_t *const SCSICommandStatus)
 
uint8_t MS_Host_ResetMSInterface (USB_ClassInfo_MS_Host_t *const MSInterfaceInfo)
 Sends a MASS STORAGE RESET control request to the attached device, resetting the Mass Storage Interface and readying it for the next Mass Storage command. This should be called after a failed SCSI request to ensure the attached Mass Storage device is ready to receive the next command.
 
uint8_t MS_Host_GetMaxLUN (USB_ClassInfo_MS_Host_t *const MSInterfaceInfo, uint8_t *const MaxLUNIndex)
 Sends a GET MAX LUN control request to the attached device, retrieving the index of the highest LUN (Logical UNit, a logical drive) in the device. This value can then be used in the other functions of the Mass Storage Host mode Class driver to address a specific LUN within the device.
 
uint8_t MS_Host_GetInquiryData (USB_ClassInfo_MS_Host_t *const MSInterfaceInfo, const uint8_t LUNIndex, SCSI_Inquiry_Response_t *const InquiryData)
 Retrieves the Mass Storage device's inquiry data for the specified LUN, indicating the device characteristics and properties.
 
uint8_t MS_Host_TestUnitReady (USB_ClassInfo_MS_Host_t *const MSInterfaceInfo, const uint8_t LUNIndex)
 Sends a TEST UNIT READY command to the device, to determine if it is ready to accept other SCSI commands.
 
uint8_t MS_Host_ReadDeviceCapacity (USB_ClassInfo_MS_Host_t *const MSInterfaceInfo, const uint8_t LUNIndex, SCSI_Capacity_t *const DeviceCapacity)
 Retrieves the total capacity of the attached USB Mass Storage device, in blocks, and block size.
 
uint8_t MS_Host_RequestSense (USB_ClassInfo_MS_Host_t *const MSInterfaceInfo, const uint8_t LUNIndex, SCSI_Request_Sense_Response_t *const SenseData)
 Retrieves the device sense data, indicating the current device state and error codes for the previously issued command.
 
uint8_t MS_Host_PreventAllowMediumRemoval (USB_ClassInfo_MS_Host_t *const MSInterfaceInfo, const uint8_t LUNIndex, const bool PreventRemoval)
 Issues a PREVENT MEDIUM REMOVAL command, to logically (or, depending on the type of device, physically) lock the device from removal so that blocks of data on the medium can be read or altered.
 
uint8_t MS_Host_ReadDeviceBlocks (USB_ClassInfo_MS_Host_t *const MSInterfaceInfo, const uint8_t LUNIndex, const uint32_t BlockAddress, const uint8_t Blocks, const uint16_t BlockSize, void *BlockBuffer)
 Reads blocks of data from the attached Mass Storage device's medium.
 
uint8_t MS_Host_WriteDeviceBlocks (USB_ClassInfo_MS_Host_t *const MSInterfaceInfo, const uint8_t LUNIndex, const uint32_t BlockAddress, const uint8_t Blocks, const uint16_t BlockSize, const void *BlockBuffer)
 Writes blocks of data to the attached Mass Storage device's medium.
 

Function Documentation

static uint8_t DCOMP_MS_Host_NextMSInterface ( void *const  CurrentDescriptor)
static

Definition at line 131 of file MassStorageClassHost.c.

static uint8_t DCOMP_MS_Host_NextMSInterfaceEndpoint ( void *const  CurrentDescriptor)
static

Definition at line 150 of file MassStorageClassHost.c.

static uint8_t MS_Host_GetReturnedStatus ( USB_ClassInfo_MS_Host_t *const  MSInterfaceInfo,
MS_CommandStatusWrapper_t *const  SCSICommandStatus 
)
static

Definition at line 317 of file MassStorageClassHost.c.

static uint8_t MS_Host_SendCommand ( USB_ClassInfo_MS_Host_t *const  MSInterfaceInfo,
MS_CommandBlockWrapper_t *const  SCSICommandBlock,
const void *const  BufferPtr 
)
static

Definition at line 173 of file MassStorageClassHost.c.

static uint8_t MS_Host_SendReceiveData ( USB_ClassInfo_MS_Host_t *const  MSInterfaceInfo,
MS_CommandBlockWrapper_t *const  SCSICommandBlock,
void *  BufferPtr 
)
static

Definition at line 271 of file MassStorageClassHost.c.

static uint8_t MS_Host_WaitForDataReceived ( USB_ClassInfo_MS_Host_t *const  MSInterfaceInfo)
static

Definition at line 215 of file MassStorageClassHost.c.