msdscsi.c File Reference

SCSI interface for Mass Storage Devices (MSD). More...

#include "em_usb.h"
#include "msdscsi.h"
#include "msdbot.h"
Include dependency graph for msdscsi.c:

Go to the source code of this file.

Functions

bool MSDSCSI_Init (USBH_Ep_TypeDef *out, USBH_Ep_TypeDef *in)
 MSDSCSI module initialization.
bool MSDSCSI_Inquiry (MSDSCSI_InquiryData_TypeDef *data)
 Issue a SCSI Inquiry command.
bool MSDSCSI_Read10 (uint32_t lba, uint16_t sectors, void *data)
 Issue a SCSI Read(10) command.
bool MSDSCSI_ReadCapacity (MSDSCSI_ReadCapacityData_TypeDef *data)
 Issue a SCSI Read Capacity command.
bool MSDSCSI_RequestSense (MSDSCSI_RequestSenseData_TypeDef *data)
 Issue a SCSI Request Sense command.
bool MSDSCSI_TestUnitReady (void)
 Issue a SCSI Test Unit Ready command.
bool MSDSCSI_Write10 (uint32_t lba, uint16_t sectors, const void *data)
 Perform a SCSI Write(10) command.

Detailed Description

SCSI interface for Mass Storage Devices (MSD).

Author:
Energy Micro AS
Version:
3.20.0

License

(C) Copyright 2012 Energy Micro AS, http://www.energymicro.com

Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:

1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. 4. The source and compiled code may only be used on Energy Micro "EFM32" microcontrollers and "EFR4" radios.

DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Energy Micro AS has no obligation to support this Software. Energy Micro AS is providing the Software "AS IS", with no express or implied warranties of any kind, including, but not limited to, any implied warranties of merchantability or fitness for any particular purpose or warranties against infringement of any proprietary rights of a third party.

Energy Micro AS will not be liable for any consequential, incidental, or special damages, or any other relief, or for any claim by any third party, arising from your use of this Software.

Definition in file msdscsi.c.


Function Documentation

bool MSDSCSI_Init ( USBH_Ep_TypeDef *  out,
USBH_Ep_TypeDef *  in 
)

MSDSCSI module initialization.

Parameters:
[in] out Pointer to an MSD bulk OUT endpoint structure.
[in] in Pointer to an MSD bulk IN endpoint structure.
Returns:
Returns true on success, false otherwise.

Definition at line 175 of file msdscsi.c.

References MSDBOT_Init(), MSDBOT_STATUS_OK, SCSI_INQUIRYDATA_LEN, SCSI_READ10_LEN, SCSI_READCAPACITYDATA_LEN, SCSI_REQUESTSENSEDATA_LEN, and SCSI_WRITE10_LEN.

Referenced by MSDH_Init().

Here is the call graph for this function:

Here is the caller graph for this function:

bool MSDSCSI_Inquiry ( MSDSCSI_InquiryData_TypeDef data  ) 

Issue a SCSI Inquiry command.

Parameters:
[out] data Inquiry response data buffer.
Returns:
Returns true on success, false otherwise.

Definition at line 207 of file msdscsi.c.

References MSDBOT_Xfer(), and SCSI_INQUIRYDATA_LEN.

Referenced by MSDH_Init().

Here is the call graph for this function:

Here is the caller graph for this function:

bool MSDSCSI_Read10 ( uint32_t  lba,
uint16_t  sectors,
void *  data 
)

Issue a SCSI Read(10) command.

Parameters:
[in] lba Sector address (LBA) of first sector to read.
[in] sectors Number of sectors to read.
[out] data Data buffer through which data is returned to caller.
Returns:
Returns true on success, false otherwise.

Definition at line 231 of file msdscsi.c.

References MSDSCSI_Read10_TypeDef::Lba, MSDBOT_Xfer(), and MSDSCSI_Read10_TypeDef::TransferLength.

Referenced by MSDH_ReadSectors().

Here is the call graph for this function:

Here is the caller graph for this function:

bool MSDSCSI_ReadCapacity ( MSDSCSI_ReadCapacityData_TypeDef data  ) 

Issue a SCSI Read Capacity command.

Parameters:
[out] data Read Capacity response data buffer.
Returns:
Returns true on success, false otherwise.

Definition at line 258 of file msdscsi.c.

References MSDSCSI_ReadCapacityData_TypeDef::LogicalBlockAddress, MSDSCSI_ReadCapacityData_TypeDef::LogicalBlockLength, MSDBOT_Xfer(), and SCSI_READCAPACITYDATA_LEN.

Referenced by MSDH_GetBlockSize(), MSDH_GetSectorCount(), MSDH_GetSectorSize(), and MSDH_Init().

Here is the call graph for this function:

Here is the caller graph for this function:

bool MSDSCSI_RequestSense ( MSDSCSI_RequestSenseData_TypeDef data  ) 

Issue a SCSI Request Sense command.

Parameters:
[out] data Request Sense response data buffer.
Returns:
Returns true on success, false otherwise.

Definition at line 285 of file msdscsi.c.

References MSDBOT_Xfer(), and SCSI_REQUESTSENSEDATA_LEN.

Referenced by MSDH_Init().

Here is the call graph for this function:

Here is the caller graph for this function:

bool MSDSCSI_TestUnitReady ( void   ) 

Issue a SCSI Test Unit Ready command.

Returns:
Returns true if device ready, false if device not ready or cmd transfer error.

Definition at line 301 of file msdscsi.c.

References MSDBOT_STATUS_OK, and MSDBOT_Xfer().

Referenced by MSDH_Init().

Here is the call graph for this function:

Here is the caller graph for this function:

bool MSDSCSI_Write10 ( uint32_t  lba,
uint16_t  sectors,
const void *  data 
)

Perform a SCSI Write(10) command.

Parameters:
[in] lba Sector address (LBA) of first sector to write.
[in] sectors Number of sectors to write.
[out] data Data buffer containing data to be written.
Returns:
Returns true on success, false otherwise.

Definition at line 325 of file msdscsi.c.

References MSDSCSI_Write10_TypeDef::Lba, MSDBOT_Xfer(), and MSDSCSI_Write10_TypeDef::TransferLength.

Referenced by MSDH_WriteSectors().

Here is the call graph for this function:

Here is the caller graph for this function: