GD32F1x0: USB/GD32_USB_Device_Library/Class/msc/src/usbd_storage_template.c File Reference

GD32F1x0

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
MCD Application Team
Version
V1.0.1
Date
31-January-2014
Attention

© COPYRIGHT 2014 STMicroelectronics

Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); You may not use this file except in compliance with the License. You may obtain a copy of the License at:

   http://www.st.com/software_license_agreement_liberty_v2

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

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 110 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 170 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 98 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 120 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 130 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 143 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 158 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,
'S', 'T', 'M', ' ', ' ', ' ', ' ', ' ',
'P', 'r', 'o', 'd', 'u', 't', ' ', ' ',
' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',
'0', '.', '0' ,'1',
}

Definition at line 37 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 54 of file usbd_storage_template.c.

Generated by   doxygen 1.8.10