GD32F10x USB-Device: E:/USB Libraries/GD32_USB_Device_Library/Class/msc/src/usbd_storage_template.c File Reference

GD32F103 Firmware

usbd_storage_template.c File Reference

Memory management layer. More...

#include "usbd_msc_mem.h"

Go to the source code of this file.

Macros

#define STORAGE_LUN_NBR   1
 

Functions

int8_t STORAGE_Init (uint8_t lun)
 Initialize the storage medium. More...
 
int8_t STORAGE_GetCapacity (uint8_t lun, uint32_t *block_num, uint16_t *block_size)
 return medium capacity and block size More...
 
int8_t STORAGE_IsReady (uint8_t lun)
 check whether the medium is ready More...
 
int8_t STORAGE_IsWriteProtected (uint8_t lun)
 check 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)
 Read data from the medium. More...
 
int8_t STORAGE_Write (uint8_t lun, uint8_t *buf, uint32_t blk_addr, uint16_t blk_len)
 Write data to the medium. More...
 
int8_t STORAGE_GetMaxLun (void)
 Return number of supported logical unit. More...
 

Variables

const int8_t STORAGE_Inquirydata []
 
USBD_STORAGE_cb_TypeDef USBD_MICRO_SDIO_fops
 
USBD_STORAGE_cb_TypeDefUSBD_STORAGE_fops = &USBD_MICRO_SDIO_fops
 

Detailed Description

Memory management layer.

Author
MCU SD
Version
V1.0.0
Date
26-Dec-2014

Definition in file usbd_storage_template.c.

Function Documentation

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

return medium capacity and block size

Parameters
lun: logical unit number
block_num: number of physical block
block_size: size of a physical block
Return values
Status

Definition at line 92 of file usbd_storage_template.c.

int8_t STORAGE_GetMaxLun ( void  )

Return number of supported logical unit.

Parameters
None
Return values
numberof logical unit

Definition at line 154 of file usbd_storage_template.c.

int8_t STORAGE_Init ( uint8_t  lun)

Initialize the storage medium.

Parameters
lun: logical unit number
Return values
Status

Definition at line 80 of file usbd_storage_template.c.

int8_t STORAGE_IsReady ( uint8_t  lun)

check whether the medium is ready

Parameters
lun: logical unit number
Return values
Status

Definition at line 102 of file usbd_storage_template.c.

int8_t STORAGE_IsWriteProtected ( uint8_t  lun)

check whether the medium is write-protected

Parameters
lun: logical unit number
Return values
Status

Definition at line 112 of file usbd_storage_template.c.

int8_t STORAGE_Read ( uint8_t  lun,
uint8_t *  buf,
uint32_t  blk_addr,
uint16_t  blk_len 
)

Read data from the medium.

Parameters
lun: logical unit number
buf: Pointer to the buffer to save data
blk_addr: address of 1st block to be read
blk_len: nmber of blocks to be read
Return values
Status

Definition at line 125 of file usbd_storage_template.c.

int8_t STORAGE_Write ( uint8_t  lun,
uint8_t *  buf,
uint32_t  blk_addr,
uint16_t  blk_len 
)

Write data to the medium.

Parameters
lun: logical unit number
buf: Pointer to the buffer to write from
blk_addr: address of 1st block to be written
blk_len: nmber of blocks to be read
Return values
Status

Definition at line 141 of file usbd_storage_template.c.

Variable Documentation

const int8_t STORAGE_Inquirydata[]
Initial value:
=
{
0x00,
0x80,
0x02,
0x02,
(USBD_STD_INQUIRY_LENGTH - 5),
0x00,
0x00,
0x00,
'G', 'D', '3', '2', ' ', ' ', ' ', ' ',
'P', 'r', 'o', 'd', 'u', 't', ' ', ' ',
' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',
'1', '.', '0' ,'0',
}

Definition at line 19 of file usbd_storage_template.c.

USBD_STORAGE_cb_TypeDef USBD_MICRO_SDIO_fops
Initial value:
=
{
STORAGE_Inquirydata,
}
int8_t STORAGE_GetCapacity(uint8_t lun, uint32_t *block_num, uint16_t *block_size)
return medium capacity and block size
int8_t STORAGE_IsWriteProtected(uint8_t lun)
check whether the medium is write-protected
int8_t STORAGE_IsReady(uint8_t lun)
check whether the medium is ready
int8_t STORAGE_Init(uint8_t lun)
Initialize the storage medium.
int8_t STORAGE_Read(uint8_t lun, uint8_t *buf, uint32_t blk_addr, uint16_t blk_len)
Read data from the medium.
int8_t STORAGE_GetMaxLun(void)
Return number of supported logical unit.
int8_t STORAGE_Write(uint8_t lun, uint8_t *buf, uint32_t blk_addr, uint16_t blk_len)
Write data to the medium.

Definition at line 36 of file usbd_storage_template.c.

Generated on Fri Feb 6 2015 14:56:36 for GD32F10x USB-Device by   doxygen 1.8.8