STM32F769IDiscovery  1.00
uDANTE Audio Networking with STM32F7 DISCO board
usbh_msc.h
Go to the documentation of this file.
1 
28 /* Define to prevent recursive ----------------------------------------------*/
29 #ifndef __USBH_MSC_H
30 #define __USBH_MSC_H
31 
32 #ifdef __cplusplus
33  extern "C" {
34 #endif
35 
36 /* Includes ------------------------------------------------------------------*/
37 #include "usbh_core.h"
38 #include "usbh_msc_bot.h"
39 #include "usbh_msc_scsi.h"
40 
63 typedef enum
64 {
65  MSC_INIT = 0,
75 }
77 
78 typedef enum
79 {
83 
84 }
86 
87 typedef enum
88 {
93 }
95 
96 #ifndef MAX_SUPPORTED_LUN
97  #define MAX_SUPPORTED_LUN 2
98 #endif
99 
100 
101 /* Structure for LUN */
102 typedef struct
103 {
104  MSC_StateTypeDef state;
105  MSC_ErrorTypeDef error;
110  uint8_t state_changed;
111 
112 }
114 
115 /* Structure for MSC process */
116 typedef struct _MSC_Process
117 {
118  uint32_t max_lun;
119  uint8_t InPipe;
120  uint8_t OutPipe;
121  uint8_t OutEp;
122  uint8_t InEp;
123  uint16_t OutEpSize;
124  uint16_t InEpSize;
125  MSC_StateTypeDef state;
126  MSC_ErrorTypeDef error;
127  MSC_ReqStateTypeDef req_state;
128  MSC_ReqStateTypeDef prev_req_state;
131  uint16_t current_lun;
132  uint16_t rw_lun;
133  uint32_t timer;
134 }
136 
137 
148 #define USB_REQ_BOT_RESET 0xFF
149 #define USB_REQ_GET_MAX_LUN 0xFE
150 
151 
152 /* MSC Class Codes */
153 #define USB_MSC_CLASS 0x08
154 
155 /* Interface Descriptor field values for HID Boot Protocol */
156 #define MSC_BOT 0x50
157 #define MSC_TRANSPARENT 0x06
158 
173 #define USBH_MSC_CLASS &USBH_msc
174 
183 /* Common APIs */
184 uint8_t USBH_MSC_IsReady (USBH_HandleTypeDef *phost);
185 
186 /* APIs for LUN */
187 int8_t USBH_MSC_GetMaxLUN (USBH_HandleTypeDef *phost);
188 
189 uint8_t USBH_MSC_UnitIsReady (USBH_HandleTypeDef *phost, uint8_t lun);
190 
192 
194  uint8_t lun,
195  uint32_t address,
196  uint8_t *pbuf,
197  uint32_t length);
198 
200  uint8_t lun,
201  uint32_t address,
202  uint8_t *pbuf,
203  uint32_t length);
208 #ifdef __cplusplus
209 }
210 #endif
211 
212 #endif /* __USBH_MSC_H */
213 
214 
230 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
231 
232 
233 
USBH_StatusTypeDef USBH_MSC_Write(USBH_HandleTypeDef *phost, uint8_t lun, uint32_t address, uint8_t *pbuf, uint32_t length)
USBH_MSC_Write The function performs a Write operation.
Definition: usbh_msc.c:748
Header file for usbh_core.c.
Header file for usbh_msc_bot.c.
struct _MSC_Process MSC_HandleTypeDef
uint32_t max_lun
Definition: usbh_msc.h:118
USBH_StatusTypeDef USBH_MSC_Read(USBH_HandleTypeDef *phost, uint8_t lun, uint32_t address, uint8_t *pbuf, uint32_t length)
USBH_MSC_Read The function performs a Read operation.
Definition: usbh_msc.c:700
MSC_LUNTypeDef unit[MAX_SUPPORTED_LUN]
Definition: usbh_msc.h:130
#define MAX_SUPPORTED_LUN
Definition: usbh_msc.h:97
MSC_ErrorTypeDef error
Definition: usbh_msc.h:105
uint8_t OutEp
Definition: usbh_msc.h:121
uint8_t InEp
Definition: usbh_msc.h:122
MSC_ErrorTypeDef
Definition: usbh_msc.h:78
MSC_StateTypeDef
Definition: usbh_msc.h:63
uint32_t timer
Definition: usbh_msc.h:133
SCSI_StdInquiryDataTypeDef inquiry
Definition: usbh_msc.h:109
Definition: pbuf.h:108
SCSI_CapacityTypeDef capacity
Definition: usbh_msc.h:107
USBH_ClassTypeDef USBH_msc
Definition: usbh_msc.c:111
Header file for usbh_msc_scsi.c.
uint16_t current_lun
Definition: usbh_msc.h:131
MSC_ReqStateTypeDef prev_req_state
Definition: usbh_msc.h:128
int8_t USBH_MSC_GetMaxLUN(USBH_HandleTypeDef *phost)
USBH_MSC_GetMaxLUN The function return the Max LUN supported.
Definition: usbh_msc.c:637
USBH_StatusTypeDef USBH_MSC_GetLUNInfo(USBH_HandleTypeDef *phost, uint8_t lun, MSC_LUNTypeDef *info)
USBH_MSC_GetLUNInfo The function return a LUN information.
Definition: usbh_msc.c:676
BOT_HandleTypeDef hbot
Definition: usbh_msc.h:129
USBH_StatusTypeDef
Definition: usbh_def.h:302
uint8_t USBH_MSC_UnitIsReady(USBH_HandleTypeDef *phost, uint8_t lun)
USBH_MSC_UnitIsReady The function check whether a LUN is ready.
Definition: usbh_msc.c:655
uint16_t rw_lun
Definition: usbh_msc.h:132
MSC_ReqStateTypeDef
Definition: usbh_msc.h:87
USBH_StatusTypeDef prev_ready_state
Definition: usbh_msc.h:106
uint8_t USBH_MSC_IsReady(USBH_HandleTypeDef *phost)
USBH_MSC_IsReady The function check if the MSC function is ready.
Definition: usbh_msc.c:617
MSC_ErrorTypeDef error
Definition: usbh_msc.h:126
MSC_ReqStateTypeDef req_state
Definition: usbh_msc.h:127
uint16_t InEpSize
Definition: usbh_msc.h:124
MSC_StateTypeDef state
Definition: usbh_msc.h:125
uint16_t OutEpSize
Definition: usbh_msc.h:123
uint8_t InPipe
Definition: usbh_msc.h:119
uint8_t OutPipe
Definition: usbh_msc.h:120
uint8_t state_changed
Definition: usbh_msc.h:110
MSC_StateTypeDef state
Definition: usbh_msc.h:104
SCSI_SenseTypeDef sense
Definition: usbh_msc.h:108