ARMEBS4  revision-26.06.2015
usb_defines.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 usb_defines.h
6  * @author MCD Application Team
7  * @version V2.1.0
8  * @date 19-March-2012
9  * @brief Header of the Core Layer
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 #ifndef __USB_DEF_H__
32 #define __USB_DEF_H__
33 
34 /* Includes ------------------------------------------------------------------*/
35 #include "config/usb_conf.h"
36 
37 /** @addtogroup USB_OTG_DRIVER
38  * @{
39  */
40 
41 /** @defgroup USB_DEFINES
42  * @brief This file is the
43  * @{
44  */
45 
46 
47 /** @defgroup USB_DEFINES_Exported_Defines
48  * @{
49  */
50 /**
51  * @}
52  */
53 
54 
55 /** @defgroup _CORE_DEFINES_
56  * @{
57  */
58 
59 #define USB_OTG_SPEED_PARAM_HIGH 0
60 #define USB_OTG_SPEED_PARAM_HIGH_IN_FULL 1
61 #define USB_OTG_SPEED_PARAM_FULL 3
62 
63 #define USB_OTG_SPEED_HIGH 0
64 #define USB_OTG_SPEED_FULL 1
65 
66 #define USB_OTG_ULPI_PHY 1
67 #define USB_OTG_EMBEDDED_PHY 2
68 
69 /**
70  * @}
71  */
72 
73 
74 /** @defgroup _GLOBAL_DEFINES_
75  * @{
76  */
77 #define GAHBCFG_TXFEMPTYLVL_EMPTY 1
78 #define GAHBCFG_TXFEMPTYLVL_HALFEMPTY 0
79 #define GAHBCFG_GLBINT_ENABLE 1
80 #define GAHBCFG_INT_DMA_BURST_SINGLE 0
81 #define GAHBCFG_INT_DMA_BURST_INCR 1
82 #define GAHBCFG_INT_DMA_BURST_INCR4 3
83 #define GAHBCFG_INT_DMA_BURST_INCR8 5
84 #define GAHBCFG_INT_DMA_BURST_INCR16 7
85 #define GAHBCFG_DMAENABLE 1
86 #define GAHBCFG_TXFEMPTYLVL_EMPTY 1
87 #define GAHBCFG_TXFEMPTYLVL_HALFEMPTY 0
88 #define GRXSTS_PKTSTS_IN 2
89 #define GRXSTS_PKTSTS_IN_XFER_COMP 3
90 #define GRXSTS_PKTSTS_DATA_TOGGLE_ERR 5
91 #define GRXSTS_PKTSTS_CH_HALTED 7
92 /**
93  * @}
94  */
95 
96 
97 /** @defgroup _OnTheGo_DEFINES_
98  * @{
99  */
100 #define MODE_HNP_SRP_CAPABLE 0
101 #define MODE_SRP_ONLY_CAPABLE 1
102 #define MODE_NO_HNP_SRP_CAPABLE 2
103 #define MODE_SRP_CAPABLE_DEVICE 3
104 #define MODE_NO_SRP_CAPABLE_DEVICE 4
105 #define MODE_SRP_CAPABLE_HOST 5
106 #define MODE_NO_SRP_CAPABLE_HOST 6
107 #define A_HOST 1
108 #define A_SUSPEND 2
109 #define A_PERIPHERAL 3
110 #define B_PERIPHERAL 4
111 #define B_HOST 5
112 #define DEVICE_MODE 0
113 #define HOST_MODE 1
114 #define OTG_MODE 2
115 /**
116  * @}
117  */
118 
119 
120 /** @defgroup __DEVICE_DEFINES_
121  * @{
122  */
123 #define DSTS_ENUMSPD_HS_PHY_30MHZ_OR_60MHZ 0
124 #define DSTS_ENUMSPD_FS_PHY_30MHZ_OR_60MHZ 1
125 #define DSTS_ENUMSPD_LS_PHY_6MHZ 2
126 #define DSTS_ENUMSPD_FS_PHY_48MHZ 3
127 
128 #define DCFG_FRAME_INTERVAL_80 0
129 #define DCFG_FRAME_INTERVAL_85 1
130 #define DCFG_FRAME_INTERVAL_90 2
131 #define DCFG_FRAME_INTERVAL_95 3
132 
133 #define DEP0CTL_MPS_64 0
134 #define DEP0CTL_MPS_32 1
135 #define DEP0CTL_MPS_16 2
136 #define DEP0CTL_MPS_8 3
137 
138 #define EP_SPEED_LOW 0
139 #define EP_SPEED_FULL 1
140 #define EP_SPEED_HIGH 2
141 
142 #define EP_TYPE_CTRL 0
143 #define EP_TYPE_ISOC 1
144 #define EP_TYPE_BULK 2
145 #define EP_TYPE_INTR 3
146 #define EP_TYPE_MSK 3
147 
148 #define STS_GOUT_NAK 1
149 #define STS_DATA_UPDT 2
150 #define STS_XFER_COMP 3
151 #define STS_SETUP_COMP 4
152 #define STS_SETUP_UPDT 6
153 /**
154  * @}
155  */
156 
157 
158 /** @defgroup __HOST_DEFINES_
159  * @{
160  */
161 #define HC_PID_DATA0 0
162 #define HC_PID_DATA2 1
163 #define HC_PID_DATA1 2
164 #define HC_PID_SETUP 3
165 
166 #define HPRT0_PRTSPD_HIGH_SPEED 0
167 #define HPRT0_PRTSPD_FULL_SPEED 1
168 #define HPRT0_PRTSPD_LOW_SPEED 2
169 
170 #define HCFG_30_60_MHZ 0
171 #define HCFG_48_MHZ 1
172 #define HCFG_6_MHZ 2
173 
174 #define HCCHAR_CTRL 0
175 #define HCCHAR_ISOC 1
176 #define HCCHAR_BULK 2
177 #define HCCHAR_INTR 3
178 
179 #define MIN(a, b) (((a) < (b)) ? (a) : (b))
180 
181 /**
182  * @}
183  */
184 
185 
186 /** @defgroup USB_DEFINES_Exported_Types
187  * @{
188  */
189 
190 typedef enum
191 {
192  USB_OTG_HS_CORE_ID = 0,
193  USB_OTG_FS_CORE_ID = 1
194 }USB_OTG_CORE_ID_TypeDef;
195 /**
196  * @}
197  */
198 
199 
200 /** @defgroup USB_DEFINES_Exported_Macros
201  * @{
202  */
203 /**
204  * @}
205  */
206 
207 /** @defgroup USB_DEFINES_Exported_Variables
208  * @{
209  */
210 /**
211  * @}
212  */
213 
214 /** @defgroup USB_DEFINES_Exported_FunctionsPrototype
215  * @{
216  */
217 /**
218  * @}
219  */
220 
221 
222 /** @defgroup Internal_Macro's
223  * @{
224  */
225 #define USB_OTG_READ_REG32(reg) (*(__IO uint32_t *)reg)
226 #define USB_OTG_WRITE_REG32(reg,value) (*(__IO uint32_t *)reg = value)
227 #define USB_OTG_MODIFY_REG32(reg,clear_mask,set_mask) \
228  USB_OTG_WRITE_REG32(reg, (((USB_OTG_READ_REG32(reg)) & ~clear_mask) | set_mask ) )
229 
230 /********************************************************************************
231  ENUMERATION TYPE
232 ********************************************************************************/
233 enum USB_OTG_SPEED {
234  USB_SPEED_UNKNOWN = 0,
235  USB_SPEED_LOW,
236  USB_SPEED_FULL,
237  USB_SPEED_HIGH
238 };
239 
240 #endif //__USB_DEFINES__H__
241 
242 
243 /**
244  * @}
245  */
246 
247 /**
248  * @}
249  */
250 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
251 #endif /* (USE_STM32_USB_HOST_MODE || USE_STM32_USB_USE_DEVICE_MODE || USE_STM32_USB_OTG_MODE) */
libheivs configuration file