ARMEBS4  revision-26.06.2015
usbh_msc_scsi.h
1 #include "heivs/config.h"
2 #if (USE_STM32_USB_HOST_MODE || USE_STM32_USB_USE_DEVICE_MODE || USE_STM32_USB_OTG_MODE)
3 /**
4  ******************************************************************************
5  * @file usbh_msc_scsi.h
6  * @author MCD Application Team
7  * @version V2.1.0
8  * @date 19-March-2012
9  * @brief Header file for usbh_msc_scsi.c
10  ******************************************************************************
11  * @attention
12  *
13  * <h2><center>&copy; COPYRIGHT 2012 STMicroelectronics</center></h2>
14  *
15  * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
16  * You may not use this file except in compliance with the License.
17  * You may obtain a copy of the License at:
18  *
19  * http://www.st.com/software_license_agreement_liberty_v2
20  *
21  * Unless required by applicable law or agreed to in writing, software
22  * distributed under the License is distributed on an "AS IS" BASIS,
23  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
24  * See the License for the specific language governing permissions and
25  * limitations under the License.
26  *
27  ******************************************************************************
28  */
29 
30 /* Define to prevent recursive ----------------------------------------------*/
31 #ifndef __USBH_MSC_SCSI_H__
32 #define __USBH_MSC_SCSI_H__
33 
34 /* Includes ------------------------------------------------------------------*/
35 #include "stm32/usb/usbh_stdreq.h"
36 
37 
38 /** @addtogroup USBH_LIB
39  * @{
40  */
41 
42 /** @addtogroup USBH_CLASS
43  * @{
44  */
45 
46 /** @addtogroup USBH_MSC_CLASS
47  * @{
48  */
49 
50 /** @defgroup USBH_MSC_SCSI
51  * @brief This file is the Header file for usbh_msc_scsi.c
52  * @{
53  */
54 
55 
56 /** @defgroup USBH_MSC_SCSI_Exported_Types
57  * @{
58  */
59 typedef enum {
60  USBH_MSC_OK = 0,
61  USBH_MSC_FAIL = 1,
62  USBH_MSC_PHASE_ERROR = 2,
63  USBH_MSC_BUSY = 3
64 }USBH_MSC_Status_TypeDef;
65 
66 typedef enum {
67  CMD_UNINITIALIZED_STATE =0,
68  CMD_SEND_STATE,
69  CMD_WAIT_STATUS
70 } CMD_STATES_TypeDef;
71 
72 
73 
74 typedef struct __MassStorageParameter
75 {
76  uint32_t MSCapacity;
77  uint32_t MSSenseKey;
78  uint16_t MSPageLength;
79  uint8_t MSBulkOutEp;
80  uint8_t MSBulkInEp;
81  uint8_t MSWriteProtect;
82 } MassStorageParameter_TypeDef;
83 /**
84  * @}
85  */
86 
87 
88 
89 /** @defgroup USBH_MSC_SCSI_Exported_Defines
90  * @{
91  */
92 
93 
94 
95 #define OPCODE_TEST_UNIT_READY 0X00
96 #define OPCODE_READ_CAPACITY10 0x25
97 #define OPCODE_MODE_SENSE6 0x1A
98 #define OPCODE_READ10 0x28
99 #define OPCODE_WRITE10 0x2A
100 #define OPCODE_REQUEST_SENSE 0x03
101 
102 #define DESC_REQUEST_SENSE 0X00
103 #define ALLOCATION_LENGTH_REQUEST_SENSE 63
104 #define XFER_LEN_READ_CAPACITY10 8
105 #define XFER_LEN_MODE_SENSE6 63
106 
107 #define MASK_MODE_SENSE_WRITE_PROTECT 0x80
108 #define MODE_SENSE_PAGE_CONTROL_FIELD 0x00
109 #define MODE_SENSE_PAGE_CODE 0x3F
110 #define DISK_WRITE_PROTECTED 0x01
111 /**
112  * @}
113  */
114 
115 /** @defgroup USBH_MSC_SCSI_Exported_Macros
116  * @{
117  */
118 /**
119  * @}
120  */
121 
122 /** @defgroup _Exported_Variables
123  * @{
124  */
125 extern MassStorageParameter_TypeDef USBH_MSC_Param;
126 /**
127  * @}
128  */
129 
130 /** @defgroup USBH_MSC_SCSI_Exported_FunctionsPrototype
131  * @{
132  */
133 uint8_t USBH_MSC_TestUnitReady(USB_OTG_CORE_HANDLE *pdev);
134 uint8_t USBH_MSC_ReadCapacity10(USB_OTG_CORE_HANDLE *pdev);
135 uint8_t USBH_MSC_ModeSense6(USB_OTG_CORE_HANDLE *pdev);
136 uint8_t USBH_MSC_RequestSense(USB_OTG_CORE_HANDLE *pdev);
137 uint8_t USBH_MSC_Write10(USB_OTG_CORE_HANDLE *pdev,
138  uint8_t *,
139  uint32_t ,
140  uint32_t );
141 uint8_t USBH_MSC_Read10(USB_OTG_CORE_HANDLE *pdev,
142  uint8_t *,
143  uint32_t ,
144  uint32_t );
145 void USBH_MSC_StateMachine(USB_OTG_CORE_HANDLE *pdev);
146 
147 /**
148  * @}
149  */
150 
151 #endif //__USBH_MSC_SCSI_H__
152 
153 
154 /**
155  * @}
156  */
157 
158 /**
159  * @}
160  */
161 
162 /**
163  * @}
164  */
165 
166 /**
167  * @}
168  */
169 
170 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
171 #endif /* (USE_STM32_USB_HOST_MODE || USE_STM32_USB_USE_DEVICE_MODE || USE_STM32_USB_OTG_MODE) */
libheivs configuration file