ARMEBS4  revision-26.06.2015
usbd_msc_bot.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 usbd_msc_bot.h
6  * @author MCD Application Team
7  * @version V1.1.0
8  * @date 19-March-2012
9  * @brief header for the usbd_msc_bot.c file
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 inclusion -------------------------------------*/
31 
32 #include "stm32/usb/usbd_core.h"
33 
34 /* Define to prevent recursive inclusion -------------------------------------*/
35 #ifndef __USBD_MSC_BOT_H
36 #define __USBD_MSC_BOT_H
37 
38 #define MSC_IN_EP 0x81
39 #define MSC_OUT_EP 0x01
40 #ifdef USE_USB_OTG_HS
41 #ifdef USE_ULPI_PHY
42 #define MSC_MAX_PACKET 512
43 #else
44 #define MSC_MAX_PACKET 64
45 #endif
46 #else /*USE_USB_OTG_FS*/
47 #define MSC_MAX_PACKET 64
48 #endif
49 
50 
51 #define MSC_MEDIA_PACKET 4096
52 
53 /** @addtogroup STM32_USB_OTG_DEVICE_LIBRARY
54  * @{
55  */
56 
57 /** @defgroup MSC_BOT
58  * @brief This file is the Header file for usbd_bot.c
59  * @{
60  */
61 
62 
63 /** @defgroup USBD_CORE_Exported_Defines
64  * @{
65  */
66 #define BOT_IDLE 0 /* Idle state */
67 #define BOT_DATA_OUT 1 /* Data Out state */
68 #define BOT_DATA_IN 2 /* Data In state */
69 #define BOT_LAST_DATA_IN 3 /* Last Data In Last */
70 #define BOT_SEND_DATA 4 /* Send Immediate data */
71 
72 #define BOT_CBW_SIGNATURE 0x43425355
73 #define BOT_CSW_SIGNATURE 0x53425355
74 #define BOT_CBW_LENGTH 31
75 #define BOT_CSW_LENGTH 13
76 
77 /* CSW Status Definitions */
78 #define CSW_CMD_PASSED 0x00
79 #define CSW_CMD_FAILED 0x01
80 #define CSW_PHASE_ERROR 0x02
81 
82 /* BOT Status */
83 #define BOT_STATE_NORMAL 0
84 #define BOT_STATE_RECOVERY 1
85 #define BOT_STATE_ERROR 2
86 
87 
88 #define DIR_IN 0
89 #define DIR_OUT 1
90 #define BOTH_DIR 2
91 
92 /**
93  * @}
94  */
95 
96 /** @defgroup MSC_CORE_Private_TypesDefinitions
97  * @{
98  */
99 
100 typedef struct _MSC_BOT_CBW
101 {
102  uint32_t dSignature;
103  uint32_t dTag;
104  uint32_t dDataLength;
105  uint8_t bmFlags;
106  uint8_t bLUN;
107  uint8_t bCBLength;
108  uint8_t CB[16];
109 }
110 MSC_BOT_CBW_TypeDef;
111 
112 
113 typedef struct _MSC_BOT_CSW
114 {
115  uint32_t dSignature;
116  uint32_t dTag;
117  uint32_t dDataResidue;
118  uint8_t bStatus;
119 }
120 MSC_BOT_CSW_TypeDef;
121 
122 /**
123  * @}
124  */
125 
126 
127 /** @defgroup USBD_CORE_Exported_Types
128  * @{
129  */
130 
131 extern uint8_t MSC_BOT_Data[];
132 extern uint16_t MSC_BOT_DataLen;
133 extern uint8_t MSC_BOT_State;
134 extern uint8_t MSC_BOT_BurstMode;
135 extern MSC_BOT_CBW_TypeDef MSC_BOT_cbw;
136 extern MSC_BOT_CSW_TypeDef MSC_BOT_csw;
137 /**
138  * @}
139  */
140 /** @defgroup USBD_CORE_Exported_FunctionsPrototypes
141  * @{
142  */
143 void MSC_BOT_Init (USB_OTG_CORE_HANDLE *pdev);
144 void MSC_BOT_Reset (USB_OTG_CORE_HANDLE *pdev);
145 void MSC_BOT_DeInit (USB_OTG_CORE_HANDLE *pdev);
146 void MSC_BOT_DataIn (USB_OTG_CORE_HANDLE *pdev,
147  uint8_t epnum);
148 
149 void MSC_BOT_DataOut (USB_OTG_CORE_HANDLE *pdev,
150  uint8_t epnum);
151 
152 void MSC_BOT_SendCSW (USB_OTG_CORE_HANDLE *pdev,
153  uint8_t CSW_Status);
154 
155 void MSC_BOT_CplClrFeature (USB_OTG_CORE_HANDLE *pdev,
156  uint8_t epnum);
157 /**
158  * @}
159  */
160 
161 #endif /* __USBD_MSC_BOT_H */
162 /**
163  * @}
164  */
165 
166 /**
167 * @}
168 */
169 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
170 #endif /* (USE_STM32_USB_HOST_MODE || USE_STM32_USB_USE_DEVICE_MODE || USE_STM32_USB_OTG_MODE) */
171 
libheivs configuration file