EFM32 Gecko Software Documentation  efm32g-doc-5.1.2
msdscsi.c File Reference

Detailed Description

SCSI interface for Mass Storage Devices (MSD).

Version
5.1.1

License

Copyright 2015 Silicon Labs, Inc. http://www.silabs.com

This file is licensed under the Silabs License Agreement. See the file "Silabs_License_Agreement.txt" for details. Before using this software for any purpose, you must agree to the terms of that agreement.

Definition in file msdscsi.c.

#include "em_usb.h"
#include "msdscsi.h"
#include "msdbot.h"

Go to the source code of this file.

Functions

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

Function Documentation

bool MSDSCSI_Init ( USBH_Ep_TypeDef *  out,
USBH_Ep_TypeDef *  in 
)

MSDSCSI module initialization.

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

Definition at line 157 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().

bool MSDSCSI_Inquiry ( MSDSCSI_InquiryData_TypeDef data)

Issue a SCSI Inquiry command.

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

Definition at line 189 of file msdscsi.c.

References MSDBOT_Xfer(), and SCSI_INQUIRYDATA_LEN.

Referenced by MSDH_Init().

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

Issue a SCSI Read(10) command.

Parameters
[in]lbaSector address (LBA) of first sector to read.
[in]sectorsNumber of sectors to read.
[out]dataData buffer through which data is returned to caller.
Returns
Returns true on success, false otherwise.

Definition at line 213 of file msdscsi.c.

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

Referenced by MSDH_ReadSectors().

bool MSDSCSI_ReadCapacity ( MSDSCSI_ReadCapacityData_TypeDef data)

Issue a SCSI Read Capacity command.

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

Definition at line 240 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().

bool MSDSCSI_RequestSense ( MSDSCSI_RequestSenseData_TypeDef data)

Issue a SCSI Request Sense command.

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

Definition at line 267 of file msdscsi.c.

References MSDBOT_Xfer(), and SCSI_REQUESTSENSEDATA_LEN.

Referenced by MSDH_Init().

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 283 of file msdscsi.c.

References MSDBOT_STATUS_OK, and MSDBOT_Xfer().

Referenced by MSDH_Init().

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

Perform a SCSI Write(10) command.

Parameters
[in]lbaSector address (LBA) of first sector to write.
[in]sectorsNumber of sectors to write.
[out]dataData buffer containing data to be written.
Returns
Returns true on success, false otherwise.

Definition at line 307 of file msdscsi.c.

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

Referenced by MSDH_WriteSectors().