PDL for FM4  Version1.2
Peripheral Driverl Library for FM4
UsbHostMassStorage.h File Reference
#include "usb.h"
#include "UsbHost.h"
#include "diskio.h"
Include dependency graph for UsbHostMassStorage.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  cbw
 
struct  csw
 
struct  InquiryResponse
 
struct  read_capacity
 
struct  RequestSenseResponse
 
struct  StorageInfo
 
struct  inquiry_response
 
struct  ModeSenseResponse
 
struct  StorageReadWrite
 
struct  StorageWrite
 

Macros

#define USBHOSTMASSSTORAGE_ENABLED   OFF
 
#define USBMASSSTORAGE_FLAG_TRANSFERDONE   (1<<0)
 
#define USBMASSSTORAGE_FLAG_TRANSFERDONE_IN   (1<<1)
 
#define USBMASSSTORAGE_FLAG_TRANSFERDONE_OUT   (1<<2)
 
#define FORMAT_UNIT   0x04
 
#define INQUIRY_MASS_STORAGE   0x12
 
#define MODE_SELECT   0x55
 
#define MODE_SENSE   0x5A
 
#define PREVENT_ALLOW_MEDIUM_REMOVAL   0x1E
 
#define READ_MASS_STORAGE   0x28
 
#define READ_MASS_STORAGE_CAPACITY   0x25
 
#define READ_FORMAT_CAPACITIES   0x23
 
#define MASS_STORAGE_REQUEST_SENSE   0x03
 
#define REZERO   0x01
 
#define SEEK10   0x2B
 
#define SEND_DIAGNOSTIC   0x1D
 
#define START_STOP_UNIT   0x1B
 
#define TEST_UNIT_READY   0x00
 
#define VERIFY   0x2F
 
#define WRITE_MASS_STORAGE   0x2A
 
#define WRITE12   0xAA
 
#define WRITE_AND_VERIFY   0x2E
 
#define CBW_TAG   0x1A2B3C4D
 
#define LITTLEENDIAN   1
 
#define BIGENDIAN   2
 
#define ENDIANTYPE   BIGENDIAN
 
#define LENDIAN_BUFFER_TO_U32(pu8Buffer)
 
#define U32_TO_LENDIAN_BUFFER(pu8Buffer, u32Data)
 

Typedefs

typedef struct cbw cbw_t
 
typedef struct csw csw_t
 
typedef struct InquiryResponse InquiryResponse_t
 
typedef struct read_capacity read_capacity_t
 
typedef struct RequestSenseResponse RequestSenseResponse_t
 
typedef struct StorageInfo StorageInfo_t
 
typedef struct inquiry_response inquiry_response_t
 
typedef struct ModeSenseResponse ModeSenseResponse_t
 
typedef struct StorageReadWrite StorageReadWrite_t
 
typedef struct StorageWrite StorageWrite_t
 

Functions

int UsbHostMassStorage_StorageApiRead (BYTE *buff, DWORD sector, BYTE count)
 
int UsbHostMassStorage_StorageApiWrite (BYTE *buff, DWORD sector, BYTE count)
 
int UsbHostMassStorage_StorageApiReadCapacity (void(*Buff))
 
int UsbHostMassStorage_StorageApiInit (void)
 
int UsbHostMassStorage_StorageApiModeSense (void)
 
void UsbHostMassStorage_Init (void)
 
boolean_t UsbHostMassStorage_DeinitHandler (stc_usbn_t *pstcUsb)
 
boolean_t UsbHostMassStorage_InitHandler (stc_usbn_t *pstcUsb, uint8_t *pu8Configuration, uint32_t u32Length)
 
void UsbHostMassStorage_BulkInCompletion (stc_usbn_t *pstcUsbHandle)
 
void UsbHostMassStorage_BulkOutCompletion (stc_usbn_t *pstcUsbHandle)
 
void UsbHostMassStorage_InTransferDone (void)
 
void UsbHostMassStorage_OutTransferDone (void)
 
void UsbHostMassStorage_CheckForCompletion (volatile uint8_t *NAKDetected)
 
StorageInfo_t * UsbHostMassStorage_GetGlobalStorageInfo (void)
 
int16_t UsbHostMassStorage_StorageCommandSend (StorageInfo_t *pstcStorageInfo)
 
int16_t UsbHostMassStorage_SendCBW (StorageInfo_t *pstcStorageInfo)
 
int16_t UsbHostMassStorage_Transmit_MSDC_Data (uint8_t *pu8Buffer, StorageInfo_t *pstcStorageInfo)
 
int16_t UsbHostMassStorage_Transmit_Data (StorageInfo_t *pstcStorageInfo)
 
int16_t UsbHostMassStorage_GetCSW (StorageInfo_t *pstcStorageInfo)
 
int16_t UsbHostMassStorage_CheckCSW (StorageInfo_t *pstcStorageInfo)
 
int16_t UsbHostMassStorage_BulkOnlyMSReset (void)
 
int16_t UsbHostMassStorage_StorageStatus (void)
 
int16_t UsbHostMassStorage_ResetRecovery (void)
 
int16_t UsbHostMassStorage_ClearInEndpoint (void)
 
int16_t UsbHostMassStorage_ClearOutEndpoint (void)
 
void UsbHostMassStorage_GetEPStatus (uint8_t *InEpStatus, uint8_t *OutEpStatus)
 
int UsbHostMassStorage_TestUnitReady (StorageInfo_t *pstcStorageInfo)
 
void MassStorageWaitForSetupComplete (void)
 
boolean_t UsbHostMassStorage_DriverActive (void)
 

Detailed Description

A detailed description is available at USB Host Mass Storage Module description

History:

  • 2010-03-30 1.0 MSc First version (works with 16FX)
  • 2011-08-11 1.1 MSc Several Bug fixes
  • 2011-08-24 1.2 MSc Timeout Bug fixes
  • 2013-10-14 1.3 MSc PDL support added

Definition in file UsbHostMassStorage.h.

Macro Definition Documentation

#define USBHOSTMASSSTORAGE_ENABLED   OFF

Definition at line 64 of file UsbHostMassStorage.h.