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

GD32F103 Firmware

usbd_storage_template.c
Go to the documentation of this file.
1 
11 /* Includes ------------------------------------------------------------------*/
12 #include "usbd_msc_mem.h"
13 
14 /* Private define ------------------------------------------------------------*/
15 #define STORAGE_LUN_NBR 1
16 
17 /* Private variables ---------------------------------------------------------*/
18 /* USB Mass storage Standard Inquiry Data */
19 const int8_t STORAGE_Inquirydata[] =
20 { //36
21  /* LUN 0 */
22  0x00,
23  0x80,
24  0x02,
25  0x02,
26  (USBD_STD_INQUIRY_LENGTH - 5),
27  0x00,
28  0x00,
29  0x00,
30  'G', 'D', '3', '2', ' ', ' ', ' ', ' ', /* Manufacturer : 8 bytes */
31  'P', 'r', 'o', 'd', 'u', 't', ' ', ' ', /* Product : 16 Bytes */
32  ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',
33  '1', '.', '0' ,'0', /* Version : 4 Bytes */
34 };
35 
36 USBD_STORAGE_cb_TypeDef USBD_MICRO_SDIO_fops =
37 {
45  STORAGE_Inquirydata,
46 };
47 
48 USBD_STORAGE_cb_TypeDef *USBD_STORAGE_fops = &USBD_MICRO_SDIO_fops;
49 
50 /* Private function prototypes -----------------------------------------------*/
51 int8_t STORAGE_Init (uint8_t lun);
52 
53 int8_t STORAGE_GetCapacity (uint8_t lun,
54  uint32_t *block_num,
55  uint16_t *block_size);
56 
57 int8_t STORAGE_IsReady (uint8_t lun);
58 
59 int8_t STORAGE_IsWriteProtected (uint8_t lun);
60 
61 int8_t STORAGE_Read (uint8_t lun,
62  uint8_t *buf,
63  uint32_t blk_addr,
64  uint16_t blk_len);
65 
66 int8_t STORAGE_Write (uint8_t lun,
67  uint8_t *buf,
68  uint32_t blk_addr,
69  uint16_t blk_len);
70 
71 int8_t STORAGE_GetMaxLun (void);
72 
73 /* Private functions ---------------------------------------------------------*/
74 
80 int8_t STORAGE_Init (uint8_t lun)
81 {
82  return (0);
83 }
84 
92 int8_t STORAGE_GetCapacity (uint8_t lun, uint32_t *block_num, uint16_t *block_size)
93 {
94  return (0);
95 }
96 
102 int8_t STORAGE_IsReady (uint8_t lun)
103 {
104  return (0);
105 }
106 
112 int8_t STORAGE_IsWriteProtected (uint8_t lun)
113 {
114  return 0;
115 }
116 
125 int8_t STORAGE_Read (uint8_t lun,
126  uint8_t *buf,
127  uint32_t blk_addr,
128  uint16_t blk_len)
129 {
130  return 0;
131 }
132 
141 int8_t STORAGE_Write (uint8_t lun,
142  uint8_t *buf,
143  uint32_t blk_addr,
144  uint16_t blk_len)
145 {
146  return (0);
147 }
148 
154 int8_t STORAGE_GetMaxLun (void)
155 {
156  return (STORAGE_LUN_NBR - 1);
157 }
158 
159 /************************ (C) COPYRIGHT 2014 GIGADEVICE *****END OF FILE****/
int8_t STORAGE_GetCapacity(uint8_t lun, uint32_t *block_num, uint16_t *block_size)
return medium capacity and block size
Header for the STORAGE DISK file.
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.
Generated on Fri Feb 6 2015 14:56:35 for GD32F10x USB-Device by   doxygen 1.8.8