EU1KY AA FW
usbd_storage.c File Reference
#include "usbd_storage.h"
#include "stm32746g_discovery_sd.h"

Macros

#define STORAGE_LUN_NBR   1
 
#define STORAGE_BLK_NBR   0x10000
 
#define STORAGE_BLK_SIZ   0x200
 

Functions

int8_t STORAGE_Init (uint8_t lun)
 Initializes the storage unit (medium) More...
 
int8_t STORAGE_GetCapacity (uint8_t lun, uint32_t *block_num, uint16_t *block_size)
 Returns the medium capacity. More...
 
int8_t STORAGE_IsReady (uint8_t lun)
 Checks whether the medium is ready. More...
 
int8_t STORAGE_IsWriteProtected (uint8_t lun)
 Checks whether the medium is write protected. More...
 
int8_t STORAGE_Read (uint8_t lun, uint8_t *buf, uint32_t blk_addr, uint16_t blk_len)
 Reads data from the medium. More...
 
int8_t STORAGE_Write (uint8_t lun, uint8_t *buf, uint32_t blk_addr, uint16_t blk_len)
 Writes data into the medium. More...
 
int8_t STORAGE_GetMaxLun (void)
 Returns the Max Supported LUNs. More...
 

Variables

int8_t STORAGE_Inquirydata []
 
USBD_StorageTypeDef USBD_DISK_fops
 

Macro Definition Documentation

#define STORAGE_BLK_NBR   0x10000
#define STORAGE_BLK_SIZ   0x200
#define STORAGE_LUN_NBR   1

Function Documentation

int8_t STORAGE_GetCapacity ( uint8_t  lun,
uint32_t *  block_num,
uint16_t *  block_size 
)

Returns the medium capacity.

Parameters
lunLogical unit number
block_numNumber of total block number
block_sizeBlock size
Return values
Status(0: OK / -1: Error)
int8_t STORAGE_GetMaxLun ( void  )

Returns the Max Supported LUNs.

Parameters
None
Return values
Lun(s)number
int8_t STORAGE_Init ( uint8_t  lun)

Initializes the storage unit (medium)

Parameters
lunLogical unit number
Return values
Status(0 : OK / -1 : Error)
int8_t STORAGE_IsReady ( uint8_t  lun)

Checks whether the medium is ready.

Parameters
lunLogical unit number
Return values
Status(0: OK / -1: Error)
int8_t STORAGE_IsWriteProtected ( uint8_t  lun)

Checks whether the medium is write protected.

Parameters
lunLogical unit number
Return values
Status(0: write enabled / -1: otherwise)
int8_t STORAGE_Read ( uint8_t  lun,
uint8_t *  buf,
uint32_t  blk_addr,
uint16_t  blk_len 
)

Reads data from the medium.

Parameters
lunLogical unit number
blk_addrLogical block address
blk_lenBlocks number
Return values
Status(0: OK / -1: Error)
int8_t STORAGE_Write ( uint8_t  lun,
uint8_t *  buf,
uint32_t  blk_addr,
uint16_t  blk_len 
)

Writes data into the medium.

Parameters
lunLogical unit number
blk_addrLogical block address
blk_lenBlocks number
Return values
Status(0 : OK / -1 : Error)

Variable Documentation

int8_t STORAGE_Inquirydata[]
Initial value:
= {
0x00,
0x80,
0x02,
0x02,
0x00,
0x00,
0x00,
'S', 'T', 'M', ' ', ' ', ' ', ' ', ' ',
'P', 'r', 'o', 'd', 'u', 'c', 't', ' ',
' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',
'0', '.', '0','1',
}
#define STANDARD_INQUIRY_DATA_LEN
Definition: usbd_msc_scsi.h:117
USBD_StorageTypeDef USBD_DISK_fops
Initial value:
= {
}
int8_t STORAGE_Init(uint8_t lun)
Initializes the storage unit (medium)
Definition: usbd_storage.c:103
int8_t STORAGE_GetMaxLun(void)
Returns the Max Supported LUNs.
Definition: usbd_storage.c:217
int8_t STORAGE_IsWriteProtected(uint8_t lun)
Checks whether the medium is write protected.
Definition: usbd_storage.c:167
int8_t STORAGE_IsReady(uint8_t lun)
Checks whether the medium is ready.
Definition: usbd_storage.c:137
int8_t STORAGE_Inquirydata[]
Definition: usbd_storage.c:61
int8_t STORAGE_GetCapacity(uint8_t lun, uint32_t *block_num, uint16_t *block_size)
Returns the medium capacity.
Definition: usbd_storage.c:116
int8_t STORAGE_Write(uint8_t lun, uint8_t *buf, uint32_t blk_addr, uint16_t blk_len)
Writes data into the medium.
Definition: usbd_storage.c:199
int8_t STORAGE_Read(uint8_t lun, uint8_t *buf, uint32_t blk_addr, uint16_t blk_len)
Reads data from the medium.
Definition: usbd_storage.c:179