discoverpixy
usb_conf.h
1 
22 /* Define to prevent recursive inclusion -------------------------------------*/
23 #ifndef __USB_CONF__H__
24 #define __USB_CONF__H__
25 
26 /* Includes ------------------------------------------------------------------*/
27 #include "stm32f4xx.h"
28 
43 /* USB Core and PHY interface configuration.
44  Tip: To avoid modifying these defines each time you need to change the USB
45  configuration, you can declare the needed define in your toolchain
46  compiler preprocessor.
47  */
48 #ifndef USE_USB_OTG_FS
49  //#define USE_USB_OTG_FS
50 #endif /* USE_USB_OTG_FS */
51 
52 #ifndef USE_USB_OTG_HS
53  //#define USE_USB_OTG_HS
54 #endif /* USE_USB_OTG_HS */
55 
56 #ifndef USE_ULPI_PHY
57  //#define USE_ULPI_PHY
58 #endif /* USE_ULPI_PHY */
59 
60 #ifndef USE_EMBEDDED_PHY
61  //#define USE_EMBEDDED_PHY
62 #endif /* USE_EMBEDDED_PHY */
63 
64 #ifndef USE_I2C_PHY
65  //#define USE_I2C_PHY
66 #endif /* USE_I2C_PHY */
67 
68 
69 #ifdef USE_USB_OTG_FS
70  #define USB_OTG_FS_CORE
71 #endif
72 
73 #ifdef USE_USB_OTG_HS
74  #define USB_OTG_HS_CORE
75 #endif
76 
77 /*******************************************************************************
78 * FIFO Size Configuration in Host mode
79 *
80 * (i) Receive data FIFO size = (Largest Packet Size / 4) + 1 or
81 * 2x (Largest Packet Size / 4) + 1, If a
82 * high-bandwidth channel or multiple isochronous
83 * channels are enabled
84 *
85 * (ii) For the host nonperiodic Transmit FIFO is the largest maximum packet size
86 * for all supported nonperiodic OUT channels. Typically, a space
87 * corresponding to two Largest Packet Size is recommended.
88 *
89 * (iii) The minimum amount of RAM required for Host periodic Transmit FIFO is
90 * the largest maximum packet size for all supported periodic OUT channels.
91 * If there is at least one High Bandwidth Isochronous OUT endpoint,
92 * then the space must be at least two times the maximum packet size for
93 * that channel.
94 *******************************************************************************/
95 
96 /****************** USB OTG HS CONFIGURATION **********************************/
97 #ifdef USB_OTG_HS_CORE
98  #define RX_FIFO_HS_SIZE 512
99  #define TXH_NP_HS_FIFOSIZ 256
100  #define TXH_P_HS_FIFOSIZ 256
101 
102  //#define USB_OTG_HS_LOW_PWR_MGMT_SUPPORT
103  //#define USB_OTG_HS_SOF_OUTPUT_ENABLED
104 
105  #ifdef USE_ULPI_PHY
106  #define USB_OTG_ULPI_PHY_ENABLED
107  #endif
108  #ifdef USE_EMBEDDED_PHY
109  #define USB_OTG_EMBEDDED_PHY_ENABLED
110  #endif
111  #ifdef USE_I2C_PHY
112  #define USB_OTG_I2C_PHY_ENABLED
113  #endif
114  #define USB_OTG_HS_INTERNAL_DMA_ENABLED
115  #define USB_OTG_EXTERNAL_VBUS_ENABLED
116  //#define USB_OTG_INTERNAL_VBUS_ENABLED
117 #endif
118 
119 /****************** USB OTG FS CONFIGURATION **********************************/
120 #ifdef USB_OTG_FS_CORE
121  #define RX_FIFO_FS_SIZE 128
122  #define TXH_NP_FS_FIFOSIZ 96
123  #define TXH_P_FS_FIFOSIZ 96
124 
125  //#define USB_OTG_FS_LOW_PWR_MGMT_SUPPORT
126  //#define USB_OTG_FS_SOF_OUTPUT_ENABLED
127 #endif
128 
129 /****************** USB OTG MODE CONFIGURATION ********************************/
130 
131 //#define USE_HOST_MODE
132 //#define USE_DEVICE_MODE
133 //#define USE_OTG_MODE
134 
135 
136 #ifndef USB_OTG_FS_CORE
137  #ifndef USB_OTG_HS_CORE
138  #error "USB_OTG_HS_CORE or USB_OTG_FS_CORE should be defined"
139  #endif
140 #endif
141 
142 
143 #ifndef USE_DEVICE_MODE
144  #ifndef USE_HOST_MODE
145  #error "USE_DEVICE_MODE or USE_HOST_MODE should be defined"
146  #endif
147 #endif
148 
149 #ifndef USE_USB_OTG_HS
150  #ifndef USE_USB_OTG_FS
151  #error "USE_USB_OTG_HS or USE_USB_OTG_FS should be defined"
152  #endif
153 #else //USE_USB_OTG_HS
154  #ifndef USE_ULPI_PHY
155  #ifndef USE_EMBEDDED_PHY
156  #ifndef USE_I2C_PHY
157  #error "USE_ULPI_PHY or USE_EMBEDDED_PHY or USE_I2C_PHY should be defined"
158  #endif
159  #endif
160  #endif
161 #endif
162 
163 /****************** C Compilers dependant keywords ****************************/
164 /* In HS mode and when the DMA is used, all variables and data structures dealing
165  with the DMA during the transaction process should be 4-bytes aligned */
166 #ifdef USB_OTG_HS_INTERNAL_DMA_ENABLED
167  #if defined (__GNUC__) /* GNU Compiler */
168  #define __ALIGN_END __attribute__ ((aligned (4)))
169  #define __ALIGN_BEGIN
170  #else
171  #define __ALIGN_END
172  #if defined (__CC_ARM) /* ARM Compiler */
173  #define __ALIGN_BEGIN __align(4)
174  #elif defined (__ICCARM__) /* IAR Compiler */
175  #define __ALIGN_BEGIN
176  #elif defined (__TASKING__) /* TASKING Compiler */
177  #define __ALIGN_BEGIN __align(4)
178  #endif /* __CC_ARM */
179  #endif /* __GNUC__ */
180 #else
181  #define __ALIGN_BEGIN
182  #define __ALIGN_END
183 #endif /* USB_OTG_HS_INTERNAL_DMA_ENABLED */
184 
185 /* __packed keyword used to decrease the data type alignment to 1-byte */
186 #if defined (__CC_ARM) /* ARM Compiler */
187  #define __packed __packed
188 #elif defined (__ICCARM__) /* IAR Compiler */
189  #define __packed __packed
190 #elif defined ( __GNUC__ ) /* GNU Compiler */
191  // #define __packed __attribute__ ((__packed__))
192 #elif defined (__TASKING__) /* TASKING Compiler */
193  #define __packed __unaligned
194 #endif /* __CC_ARM */
195 
231 #endif //__USB_CONF__H__
232 
233 
241 /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/
242 
CMSIS Cortex-M4 Device Peripheral Access Layer Header File. This file contains all the peripheral reg...