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

GD32F1x0

usbd_storage_template.c
Go to the documentation of this file.
1 
28 /* Includes ------------------------------------------------------------------*/
29 #include "usbd_msc_mem.h"
30 
31 /* Private typedef -----------------------------------------------------------*/
32 /* Private define ------------------------------------------------------------*/
33 #define STORAGE_LUN_NBR 1
34 /* Private macro -------------------------------------------------------------*/
35 /* Private variables ---------------------------------------------------------*/
36 /* USB Mass storage Standard Inquiry Data */
37 const int8_t STORAGE_Inquirydata[] = {//36
38 
39  /* LUN 0 */
40  0x00,
41  0x80,
42  0x02,
43  0x02,
44  (USBD_STD_INQUIRY_LENGTH - 5),
45  0x00,
46  0x00,
47  0x00,
48  'S', 'T', 'M', ' ', ' ', ' ', ' ', ' ', /* Manufacturer : 8 bytes */
49  'P', 'r', 'o', 'd', 'u', 't', ' ', ' ', /* Product : 16 Bytes */
50  ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',
51  '0', '.', '0' ,'1', /* Version : 4 Bytes */
52 };
53 
54 USBD_STORAGE_cb_TypeDef USBD_MICRO_SDIO_fops =
55 {
63  STORAGE_Inquirydata,
64 
65 };
66 
67 USBD_STORAGE_cb_TypeDef *USBD_STORAGE_fops = &USBD_MICRO_SDIO_fops;
68 
69 /* Private function prototypes -----------------------------------------------*/
70 int8_t STORAGE_Init (uint8_t lun);
71 
72 int8_t STORAGE_GetCapacity (uint8_t lun,
73  uint32_t *block_num,
74  uint16_t *block_size);
75 
76 int8_t STORAGE_IsReady (uint8_t lun);
77 
78 int8_t STORAGE_IsWriteProtected (uint8_t lun);
79 
80 int8_t STORAGE_Read (uint8_t lun,
81  uint8_t *buf,
82  uint32_t blk_addr,
83  uint16_t blk_len);
84 
85 int8_t STORAGE_Write (uint8_t lun,
86  uint8_t *buf,
87  uint32_t blk_addr,
88  uint16_t blk_len);
89 
90 int8_t STORAGE_GetMaxLun (void);
91 
92 /* Private functions ---------------------------------------------------------*/
98 int8_t STORAGE_Init (uint8_t lun)
99 {
100  return (0);
101 }
102 
110 int8_t STORAGE_GetCapacity (uint8_t lun, uint32_t *block_num, uint16_t *block_size)
111 {
112  return (0);
113 }
114 
120 int8_t STORAGE_IsReady (uint8_t lun)
121 {
122  return (0);
123 }
124 
130 int8_t STORAGE_IsWriteProtected (uint8_t lun)
131 {
132  return 0;
133 }
134 
143 int8_t STORAGE_Read (uint8_t lun,
144  uint8_t *buf,
145  uint32_t blk_addr,
146  uint16_t blk_len)
147 {
148  return 0;
149 }
158 int8_t STORAGE_Write (uint8_t lun,
159  uint8_t *buf,
160  uint32_t blk_addr,
161  uint16_t blk_len)
162 {
163  return (0);
164 }
170 int8_t STORAGE_GetMaxLun (void)
171 {
172  return (STORAGE_LUN_NBR - 1);
173 }
174 
175 /************************ (C) COPYRIGHT STMicroelectronics *****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 by   doxygen 1.8.10