2 ******************************************************************************
3 * @file usbd_storage_template.c
4 * @author MCD Application Team
7 * @brief Memory management layer
8 ******************************************************************************
11 * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
12 * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
13 * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
14 * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
15 * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
16 * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
18 * <h2><center>© COPYRIGHT 2011 STMicroelectronics</center></h2>
19 ******************************************************************************
23 /* Includes ------------------------------------------------------------------*/
24 #include "usbd_msc_mem.h"
26 /* Private typedef -----------------------------------------------------------*/
27 /* Private define ------------------------------------------------------------*/
28 /* Private macro -------------------------------------------------------------*/
29 /* Private variables ---------------------------------------------------------*/
30 /* Private function prototypes -----------------------------------------------*/
31 /* Extern function prototypes ------------------------------------------------*/
32 /* Private functions ---------------------------------------------------------*/
34 #define STORAGE_LUN_NBR 1
36 int8_t STORAGE_Init (uint8_t lun);
38 int8_t STORAGE_GetCapacity (uint8_t lun,
40 uint16_t *block_size);
42 int8_t STORAGE_IsReady (uint8_t lun);
44 int8_t STORAGE_IsWriteProtected (uint8_t lun);
46 int8_t STORAGE_Read (uint8_t lun,
51 int8_t STORAGE_Write (uint8_t lun,
56 int8_t STORAGE_GetMaxLun (void);
58 /* USB Mass storage Standard Inquiry Data */
59 const int8_t STORAGE_Inquirydata[] = {//36
66 (USBD_STD_INQUIRY_LENGTH - 5),
70 'S', 'T', 'M', ' ', ' ', ' ', ' ', ' ', /* Manufacturer : 8 bytes */
71 'P', 'r', 'o', 'd', 'u', 't', ' ', ' ', /* Product : 16 Bytes */
72 ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',
73 '0', '.', '0' ,'1', /* Version : 4 Bytes */
76 USBD_STORAGE_cb_TypeDef USBD_MICRO_SDIO_fops =
81 STORAGE_IsWriteProtected,
89 USBD_STORAGE_cb_TypeDef *USBD_STORAGE_fops = &USBD_MICRO_SDIO_fops;
90 /*******************************************************************************
91 * Function Name : Read_Memory
92 * Description : Handle the Read operation from the microSD card.
96 *******************************************************************************/
97 int8_t STORAGE_Init (uint8_t lun)
102 /*******************************************************************************
103 * Function Name : Read_Memory
104 * Description : Handle the Read operation from the STORAGE card.
108 *******************************************************************************/
109 int8_t STORAGE_GetCapacity (uint8_t lun, uint32_t *block_num, uint16_t *block_size)
114 /*******************************************************************************
115 * Function Name : Read_Memory
116 * Description : Handle the Read operation from the STORAGE card.
120 *******************************************************************************/
121 int8_t STORAGE_IsReady (uint8_t lun)
126 /*******************************************************************************
127 * Function Name : Read_Memory
128 * Description : Handle the Read operation from the STORAGE card.
132 *******************************************************************************/
133 int8_t STORAGE_IsWriteProtected (uint8_t lun)
138 /*******************************************************************************
139 * Function Name : Read_Memory
140 * Description : Handle the Read operation from the STORAGE card.
144 *******************************************************************************/
145 int8_t STORAGE_Read (uint8_t lun,
152 /*******************************************************************************
153 * Function Name : Write_Memory
154 * Description : Handle the Write operation to the STORAGE card.
158 *******************************************************************************/
159 int8_t STORAGE_Write (uint8_t lun,
166 /*******************************************************************************
167 * Function Name : Write_Memory
168 * Description : Handle the Write operation to the STORAGE card.
172 *******************************************************************************/
173 int8_t STORAGE_GetMaxLun (void)
175 return (STORAGE_LUN_NBR - 1);
178 /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/