xref: /aosp_15_r20/external/pigweed/targets/stm32f429i_disc1_stm32cube/config/stm32f4xx_hal_conf.h (revision 61c4878ac05f98d0ceed94b57d316916de578985)
1 // Copyright 2021 The Pigweed Authors
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License"); you may not
4 // use this file except in compliance with the License. You may obtain a copy of
5 // the License at
6 //
7 //     https://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11 // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12 // License for the specific language governing permissions and limitations under
13 // the License.
14 
15 #pragma once
16 
17 #include <stdint.h>
18 
19 /* Clock setup */
20 #define HSI_VALUE 16000000U
21 #define LSI_VALUE 32000U
22 
23 // The F429-disc has an 8Mhz external crystal
24 #define HSE_VALUE 8000000U
25 #define HSE_STARTUP_TIMEOUT 100U
26 
27 // The F429-disc has no LSE
28 #define LSE_VALUE 0U
29 #define LSE_STARTUP_TIMEOUT 5000U
30 
31 #define EXTERNAL_CLOCK_VALUE 0U
32 
33 /* HAL Config */
34 #define TICK_INT_PRIORITY 0x0FU
35 #define USE_RTOS 0U
36 #define PREFETCH_ENABLE 1U
37 #define INSTRUCTION_CACHE_ENABLE 1U
38 #define DATA_CACHE_ENABLE 1U
39 
40 #define assert_param(expr) ((void)0U)
41 
42 /* Ethernet driver buffers size + count
43  * (also used by FreeRTOS_Plus_TCP's stm32 driver) */
44 #define ETH_RX_BUF_SIZE ETH_MAX_PACKET_SIZE
45 #define ETH_TX_BUF_SIZE ETH_MAX_PACKET_SIZE
46 #define ETH_RXBUFNB 4U
47 #define ETH_TXBUFNB 4U
48 
49 /* Ethernet PHY Defines (unused by FreeRTOS_Plus_TCP's driver) */
50 #define PHY_RESET_DELAY 0x000000FFU
51 #define PHY_CONFIG_DELAY 0x00000FFFU
52 
53 #define PHY_READ_TO 0x0000FFFFU
54 #define PHY_WRITE_TO 0x0000FFFFU
55 
56 /* Common PHY Registers */
57 #define PHY_BCR ((uint16_t)0x0000)
58 #define PHY_BSR ((uint16_t)0x0001)
59 
60 #define PHY_RESET ((uint16_t)0x8000)
61 #define PHY_LOOPBACK ((uint16_t)0x4000)
62 #define PHY_FULLDUPLEX_100M ((uint16_t)0x2100)
63 #define PHY_HALFDUPLEX_100M ((uint16_t)0x2000)
64 #define PHY_FULLDUPLEX_10M ((uint16_t)0x0100)
65 #define PHY_HALFDUPLEX_10M ((uint16_t)0x0000)
66 #define PHY_AUTONEGOTIATION ((uint16_t)0x1000)
67 #define PHY_RESTART_AUTONEGOTIATION ((uint16_t)0x0200)
68 #define PHY_POWERDOWN ((uint16_t)0x0800)
69 #define PHY_ISOLATE ((uint16_t)0x0400)
70 
71 #define PHY_AUTONEGO_COMPLETE ((uint16_t)0x0020)
72 #define PHY_LINKED_STATUS ((uint16_t)0x0004)
73 #define PHY_JABBER_DETECTION ((uint16_t)0x0002)
74 
75 /* Extended PHY Registers */
76 #define PHY_SR ((uint16_t)0x0010)
77 #define PHY_MICR ((uint16_t)0x0011)
78 #define PHY_MISR ((uint16_t)0x0012)
79 
80 #define PHY_LINK_STATUS ((uint16_t)0x0001)
81 #define PHY_SPEED_STATUS ((uint16_t)0x0002)
82 #define PHY_DUPLEX_STATUS ((uint16_t)0x0004)
83 
84 #define PHY_MICR_INT_EN ((uint16_t)0x0002)
85 #define PHY_MICR_INT_OE ((uint16_t)0x0001)
86 
87 #define PHY_MISR_LINK_INT_EN ((uint16_t)0x0020)
88 #define PHY_LINK_INTERRUPT ((uint16_t)0x2000)
89 
90 // SPI config
91 #define USE_SPI_CRC 1U
92 
93 /** HAL Headers: comment out defines + include to remove **/
94 /* primary HAL headers */
95 #define HAL_CORTEX_MODULE_ENABLED
96 #include "stm32f4xx_hal_cortex.h"
97 
98 #define HAL_DMA_MODULE_ENABLED
99 #include "stm32f4xx_hal_dma.h"
100 
101 #define HAL_EXTI_MODULE_ENABLED
102 #include "stm32f4xx_hal_exti.h"
103 
104 #define HAL_GPIO_MODULE_ENABLED
105 #include "stm32f4xx_hal_gpio.h"
106 
107 #define HAL_RCC_MODULE_ENABLED
108 #include "stm32f4xx_hal_rcc.h"
109 
110 /* remaining headers (can be commented out if desired) */
111 #define HAL_ADC_MODULE_ENABLED
112 #define USE_HAL_ADC_REGISTER_CALLBACKS 0U
113 #include "stm32f4xx_hal_adc.h"
114 
115 #define HAL_CAN_MODULE_ENABLED
116 #define USE_HAL_CAN_REGISTER_CALLBACKS 0U
117 #include "stm32f4xx_hal_can.h"
118 
119 // #define HAL_CAN_LEGACY_MODULE_ENABLED
120 // #include "stm32f4xx_hal_can_legacy.h"
121 
122 #define HAL_CEC_MODULE_ENABLED
123 #define USE_HAL_CEC_REGISTER_CALLBACKS 0U
124 #include "stm32f4xx_hal_cec.h"
125 
126 #define HAL_CRC_MODULE_ENABLED
127 #include "stm32f4xx_hal_crc.h"
128 
129 #define HAL_CRYP_MODULE_ENABLED
130 #define USE_HAL_CRYP_REGISTER_CALLBACKS 0U
131 #include "stm32f4xx_hal_cryp.h"
132 
133 #define HAL_DAC_MODULE_ENABLED
134 #define USE_HAL_DAC_REGISTER_CALLBACKS 0U
135 #include "stm32f4xx_hal_dac.h"
136 
137 #define HAL_DCMI_MODULE_ENABLED
138 #define USE_HAL_DCMI_REGISTER_CALLBACKS 0U
139 #include "stm32f4xx_hal_dcmi.h"
140 
141 #define HAL_DMA2D_MODULE_ENABLED
142 #define USE_HAL_DMA2D_REGISTER_CALLBACKS 0U
143 #include "stm32f4xx_hal_dma2d.h"
144 
145 #define HAL_DFSDM_MODULE_ENABLED
146 #define USE_HAL_DFSDM_REGISTER_CALLBACKS 0U
147 #include "stm32f4xx_hal_dfsdm.h"
148 
149 #define HAL_DSI_MODULE_ENABLED
150 #define USE_HAL_DSI_REGISTER_CALLBACKS 0U
151 #include "stm32f4xx_hal_dsi.h"
152 
153 #define HAL_ETH_MODULE_ENABLED
154 #define USE_HAL_ETH_REGISTER_CALLBACKS 0U
155 #include "stm32f4xx_hal_eth.h"
156 
157 #define HAL_FLASH_MODULE_ENABLED
158 #include "stm32f4xx_hal_flash.h"
159 
160 #define HAL_FMPI2C_MODULE_ENABLED
161 #define USE_HAL_FMPI2C_REGISTER_CALLBACKS 0U
162 #include "stm32f4xx_hal_fmpi2c.h"
163 
164 #define HAL_FMPSMBUS_MODULE_ENABLED
165 #define USE_HAL_FMPSMBUS_REGISTER_CALLBACKS 0U
166 #include "stm32f4xx_hal_fmpsmbus.h"
167 
168 #define HAL_HASH_MODULE_ENABLED
169 #define USE_HAL_HASH_REGISTER_CALLBACKS 0U
170 #include "stm32f4xx_hal_hash.h"
171 
172 #define HAL_HCD_MODULE_ENABLED
173 #define USE_HAL_HCD_REGISTER_CALLBACKS 0U
174 #include "stm32f4xx_hal_hcd.h"
175 
176 #define HAL_I2C_MODULE_ENABLED
177 #define USE_HAL_I2C_REGISTER_CALLBACKS 0U
178 #include "stm32f4xx_hal_i2c.h"
179 
180 #define HAL_I2S_MODULE_ENABLED
181 #define USE_HAL_I2S_REGISTER_CALLBACKS 0U
182 #include "stm32f4xx_hal_i2s.h"
183 
184 #define HAL_IRDA_MODULE_ENABLED
185 #define USE_HAL_IRDA_REGISTER_CALLBACKS 0U
186 #include "stm32f4xx_hal_irda.h"
187 
188 #define HAL_IWDG_MODULE_ENABLED
189 #include "stm32f4xx_hal_iwdg.h"
190 
191 #define HAL_LPTIM_MODULE_ENABLED
192 #define USE_HAL_LPTIM_REGISTER_CALLBACKS 0U
193 #include "stm32f4xx_hal_lptim.h"
194 
195 #define HAL_LTDC_MODULE_ENABLED
196 #define USE_HAL_LTDC_REGISTER_CALLBACKS 0U
197 #include "stm32f4xx_hal_ltdc.h"
198 
199 #define HAL_MMC_MODULE_ENABLED
200 #define USE_HAL_MMC_REGISTER_CALLBACKS 0U
201 #include "stm32f4xx_hal_mmc.h"
202 
203 #define HAL_NAND_MODULE_ENABLED
204 #define USE_HAL_NAND_REGISTER_CALLBACKS 0U
205 #include "stm32f4xx_hal_nand.h"
206 
207 #define HAL_NOR_MODULE_ENABLED
208 #define USE_HAL_NOR_REGISTER_CALLBACKS 0U
209 #include "stm32f4xx_hal_nor.h"
210 
211 #define HAL_PCCARD_MODULE_ENABLED
212 #define USE_HAL_PCCARD_REGISTER_CALLBACKS 0U
213 #include "stm32f4xx_hal_pccard.h"
214 
215 #define HAL_PCD_MODULE_ENABLED
216 #define USE_HAL_PCD_REGISTER_CALLBACKS 0U
217 #include "stm32f4xx_hal_pcd.h"
218 
219 #define HAL_PWR_MODULE_ENABLED
220 #include "stm32f4xx_hal_pwr.h"
221 
222 #define HAL_QSPI_MODULE_ENABLED
223 #define USE_HAL_QSPI_REGISTER_CALLBACKS 0U
224 #include "stm32f4xx_hal_qspi.h"
225 
226 #define HAL_RNG_MODULE_ENABLED
227 #define USE_HAL_RNG_REGISTER_CALLBACKS 0U
228 #include "stm32f4xx_hal_rng.h"
229 
230 #define HAL_RTC_MODULE_ENABLED
231 #define USE_HAL_RTC_REGISTER_CALLBACKS 0U
232 #include "stm32f4xx_hal_rtc.h"
233 
234 #define HAL_SAI_MODULE_ENABLED
235 #define USE_HAL_SAI_REGISTER_CALLBACKS 0U
236 #include "stm32f4xx_hal_sai.h"
237 
238 #define HAL_SD_MODULE_ENABLED
239 #define USE_HAL_SD_REGISTER_CALLBACKS 0U
240 #include "stm32f4xx_hal_sd.h"
241 
242 #define HAL_SDRAM_MODULE_ENABLED
243 #define USE_HAL_SDRAM_REGISTER_CALLBACKS 0U
244 #include "stm32f4xx_hal_sdram.h"
245 
246 #define HAL_SMARTCARD_MODULE_ENABLED
247 #define USE_HAL_SMARTCARD_REGISTER_CALLBACKS 0U
248 #include "stm32f4xx_hal_smartcard.h"
249 
250 #define HAL_SMBUS_MODULE_ENABLED
251 #define USE_HAL_SMBUS_REGISTER_CALLBACKS 0U
252 #include "stm32f4xx_hal_smbus.h"
253 
254 #define HAL_SPDIFRX_MODULE_ENABLED
255 #define USE_HAL_SPDIFRX_REGISTER_CALLBACKS 0U
256 #include "stm32f4xx_hal_spdifrx.h"
257 
258 #define HAL_SPI_MODULE_ENABLED
259 #define USE_HAL_SPI_REGISTER_CALLBACKS 0U
260 #include "stm32f4xx_hal_spi.h"
261 
262 #define HAL_SRAM_MODULE_ENABLED
263 #define USE_HAL_SRAM_REGISTER_CALLBACKS 0U
264 #include "stm32f4xx_hal_sram.h"
265 
266 #define HAL_TIM_MODULE_ENABLED
267 #define USE_HAL_TIM_REGISTER_CALLBACKS 0U
268 #include "stm32f4xx_hal_tim.h"
269 
270 #define HAL_UART_MODULE_ENABLED
271 #define USE_HAL_UART_REGISTER_CALLBACKS 0U
272 #include "stm32f4xx_hal_uart.h"
273 
274 #define HAL_USART_MODULE_ENABLED
275 #define USE_HAL_USART_REGISTER_CALLBACKS 0U
276 #include "stm32f4xx_hal_usart.h"
277 
278 #define HAL_WWDG_MODULE_ENABLED
279 #define USE_HAL_WWDG_REGISTER_CALLBACKS 0U
280 #include "stm32f4xx_hal_wwdg.h"
281