rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
mcuconf.h
Go to the documentation of this file.
1/*
2 ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
3
4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
15*/
16
17#ifndef MCUCONF_H
18#define MCUCONF_H
19
20#include "interrupt_priority.h"
21
22/*
23 * STM32H7xx drivers configuration.
24 * The following settings override the default settings present in
25 * the various device driver implementation headers.
26 * Note that the settings for each driver only have effect if the whole
27 * driver is enabled in halconf.h.
28 *
29 * IRQ priorities:
30 * 15...0 Lowest...Highest.
31 *
32 * DMA priorities:
33 * 0...3 Lowest...Highest.
34 */
35
36#define STM32H7xx_MCUCONF
37
38// See hw_ports.mk
39#ifdef STM32H743xx
40 #define STM32H742_MCUCONF
41 #define STM32H743_MCUCONF
42 #define STM32H753_MCUCONF
43 #define STM32H745_MCUCONF
44 #define STM32H755_MCUCONF
45 #define STM32H747_MCUCONF
46 #define STM32H757_MCUCONF
47
48 #include "mcuconf_stm32h743.h"
49#endif
50#ifdef STM32H723xx
51 #define STM32H723_MCUCONF
52 #define STM32H723_MCUCONF
53 #define STM32H733_MCUCONF
54 #define STM32H725_MCUCONF
55 #define STM32H735_MCUCONF
56
57 #include "mcuconf_stm32h723.h"
58#endif
59
60// Allows LSE init to timeout and configure fallback RTC clock source in case
61#define RUSEFI_STM32_LSE_WAIT_MAX 1000000
62#define RUSEFI_STM32_LSE_WAIT_MAX_RTCSEL STM32_RTCSEL_LSI_CK
63
64/*
65 * General settings.
66 */
67#define STM32_NO_INIT FALSE
68#define STM32_TARGET_CORE 1
69
70/*
71 * IRQ system settings.
72 */
73
74#define STM32_DISABLE_EXTI0_HANDLER
75#define STM32_DISABLE_EXTI1_HANDLER
76#define STM32_DISABLE_EXTI2_HANDLER
77#define STM32_DISABLE_EXTI3_HANDLER
78#define STM32_DISABLE_EXTI4_HANDLER
79#define STM32_DISABLE_EXTI5_9_HANDLER
80#define STM32_DISABLE_EXTI10_15_HANDLER
81
82// we hijack this interrupt handler as the EXTI chained handler, see digital_input_exti.cpp
83#define STM32_I2C_I2C1_IRQ_PRIORITY 6
84
85#define STM32_IRQ_EXTI_PRIORITY EFI_IRQ_EXTI_PRIORITY
86#define STM32_IRQ_EXTI0_PRIORITY EFI_IRQ_EXTI_PRIORITY
87#define STM32_IRQ_EXTI1_PRIORITY EFI_IRQ_EXTI_PRIORITY
88#define STM32_IRQ_EXTI2_PRIORITY EFI_IRQ_EXTI_PRIORITY
89#define STM32_IRQ_EXTI3_PRIORITY EFI_IRQ_EXTI_PRIORITY
90#define STM32_IRQ_EXTI4_PRIORITY EFI_IRQ_EXTI_PRIORITY
91#define STM32_IRQ_EXTI5_9_PRIORITY EFI_IRQ_EXTI_PRIORITY
92#define STM32_IRQ_EXTI10_15_PRIORITY EFI_IRQ_EXTI_PRIORITY
93
94#define STM32_IRQ_EXTI16_PRIORITY 6
95#define STM32_IRQ_EXTI17_PRIORITY 6
96#define STM32_IRQ_EXTI18_PRIORITY 6
97#define STM32_IRQ_EXTI19_PRIORITY 6
98#define STM32_IRQ_EXTI20_21_PRIORITY 6
99
100#define STM32_IRQ_FDCAN1_PRIORITY EFI_IRQ_CAN_PRIORITY
101#define STM32_IRQ_FDCAN2_PRIORITY EFI_IRQ_CAN_PRIORITY
102#define STM32_IRQ_FDCAN3_PRIORITY EFI_IRQ_CAN_PRIORITY
103
104#define STM32_IRQ_MDMA_PRIORITY 9
105
106#define STM32_IRQ_OCTOSPI1_PRIORITY 10
107#define STM32_IRQ_OCTOSPI2_PRIORITY 10
108
109#define STM32_IRQ_QUADSPI1_PRIORITY 10
110
111#define STM32_IRQ_SDMMC1_PRIORITY EFI_IRQ_SDMMC_PRIORITY
112#define STM32_IRQ_SDMMC2_PRIORITY EFI_IRQ_SDMMC_PRIORITY
113
114#define STM32_IRQ_TIM1_UP_PRIORITY 7
115#define STM32_IRQ_TIM1_CC_PRIORITY 7
116#define STM32_IRQ_TIM2_PRIORITY 7
117#define STM32_IRQ_TIM3_PRIORITY 7
118#define STM32_IRQ_TIM4_PRIORITY 7
119#define STM32_IRQ_TIM5_PRIORITY EFI_IRQ_SCHEDULING_TIMER_PRIORITY
120#define STM32_IRQ_TIM6_PRIORITY 7
121#define STM32_IRQ_TIM7_PRIORITY 7
122#define STM32_IRQ_TIM8_BRK_TIM12_PRIORITY 7
123#define STM32_IRQ_TIM8_UP_TIM13_PRIORITY 7
124#define STM32_IRQ_TIM8_TRGCO_TIM14_PRIORITY 7
125#define STM32_IRQ_TIM8_CC_PRIORITY 7
126#define STM32_IRQ_TIM15_PRIORITY 7
127#define STM32_IRQ_TIM16_PRIORITY 7
128#define STM32_IRQ_TIM17_PRIORITY 7
129
130#define STM32_IRQ_USART1_PRIORITY EFI_IRQ_UART_PRIORITY
131#define STM32_IRQ_USART2_PRIORITY EFI_IRQ_UART_PRIORITY
132#define STM32_IRQ_USART3_PRIORITY EFI_IRQ_UART_PRIORITY
133#define STM32_IRQ_UART4_PRIORITY EFI_IRQ_UART_PRIORITY
134#define STM32_IRQ_UART5_PRIORITY EFI_IRQ_UART_PRIORITY
135#define STM32_IRQ_USART6_PRIORITY EFI_IRQ_UART_PRIORITY
136#define STM32_IRQ_UART7_PRIORITY EFI_IRQ_UART_PRIORITY
137#define STM32_IRQ_UART8_PRIORITY EFI_IRQ_UART_PRIORITY
138#define STM32_IRQ_UART9_PRIORITY EFI_IRQ_UART_PRIORITY
139#define STM32_IRQ_USART10_PRIORITY EFI_IRQ_UART_PRIORITY
140#define STM32_IRQ_LPUART1_PRIORITY EFI_IRQ_UART_PRIORITY
141
142/*
143 * ADC driver system settings.
144 */
145#define STM32_ADC_DUAL_MODE FALSE
146#define STM32_ADC_COMPACT_SAMPLES FALSE
147#define STM32_ADC_USE_ADC12 TRUE
148
149#ifndef STM32_ADC_USE_ADC3
150#define STM32_ADC_USE_ADC3 FALSE
151#endif /* STM32_ADC_USE_ADC3 */
152
153#define STM32_ADC_ADC12_DMA_STREAM STM32_DMA_STREAM_ID_ANY
154#define STM32_ADC_ADC3_BDMA_STREAM STM32_BDMA_STREAM_ID_ANY
155#define STM32_ADC_ADC12_DMA_PRIORITY 2
156#define STM32_ADC_ADC3_DMA_PRIORITY 2
157#define STM32_ADC_ADC12_IRQ_PRIORITY EFI_IRQ_ADC_PRIORITY
158#define STM32_ADC_ADC3_IRQ_PRIORITY EFI_IRQ_ADC_PRIORITY
159#define STM32_ADC_ADC12_CLOCK_MODE ADC_CCR_CKMODE_AHB_DIV4
160#define STM32_ADC_ADC3_CLOCK_MODE ADC_CCR_CKMODE_AHB_DIV4
161
162/*
163 * CAN driver system settings.
164 */
165#define STM32_CAN_USE_FDCAN1 TRUE
166#define STM32_CAN_USE_FDCAN2 TRUE
167
168/*
169 * DAC driver system settings.
170 */
171#define STM32_DAC_DUAL_MODE FALSE
172#define STM32_DAC_USE_DAC1_CH1 FALSE
173#define STM32_DAC_USE_DAC1_CH2 FALSE
174#define STM32_DAC_DAC1_CH1_IRQ_PRIORITY 10
175#define STM32_DAC_DAC1_CH2_IRQ_PRIORITY 10
176#define STM32_DAC_DAC1_CH1_DMA_PRIORITY 2
177#define STM32_DAC_DAC1_CH2_DMA_PRIORITY 2
178#define STM32_DAC_DAC1_CH1_DMA_STREAM STM32_DMA_STREAM_ID_ANY
179#define STM32_DAC_DAC1_CH2_DMA_STREAM STM32_DMA_STREAM_ID_ANY
180
181/*
182 * GPT driver system settings.
183 */
184#define STM32_GPT_USE_TIM1 FALSE
185#define STM32_GPT_USE_TIM2 FALSE
186#define STM32_GPT_USE_TIM3 TRUE
187#define STM32_GPT_USE_TIM4 FALSE
188#define STM32_GPT_USE_TIM5 FALSE
189#define STM32_GPT_USE_TIM6 TRUE
190#define STM32_GPT_USE_TIM7 FALSE
191#define STM32_GPT_USE_TIM8 FALSE
192#define STM32_GPT_USE_TIM12 FALSE
193#define STM32_GPT_USE_TIM13 FALSE
194#define STM32_GPT_USE_TIM14 FALSE
195#define STM32_GPT_USE_TIM15 FALSE
196#define STM32_GPT_USE_TIM16 FALSE
197#define STM32_GPT_USE_TIM17 FALSE
198
199/*
200 * I2C driver system settings.
201 */
202#define STM32_I2C_USE_I2C1 FALSE
203#define STM32_I2C_USE_I2C2 FALSE
204#define STM32_I2C_USE_I2C3 FALSE
205#define STM32_I2C_USE_I2C4 FALSE
206#define STM32_I2C_BUSY_TIMEOUT 50
207#define STM32_I2C_I2C1_RX_DMA_STREAM STM32_DMA_STREAM_ID_ANY
208#define STM32_I2C_I2C1_TX_DMA_STREAM STM32_DMA_STREAM_ID_ANY
209#define STM32_I2C_I2C2_RX_DMA_STREAM STM32_DMA_STREAM_ID_ANY
210#define STM32_I2C_I2C2_TX_DMA_STREAM STM32_DMA_STREAM_ID_ANY
211#define STM32_I2C_I2C3_RX_DMA_STREAM STM32_DMA_STREAM_ID_ANY
212#define STM32_I2C_I2C3_TX_DMA_STREAM STM32_DMA_STREAM_ID_ANY
213#define STM32_I2C_I2C4_RX_BDMA_STREAM STM32_BDMA_STREAM_ID_ANY
214#define STM32_I2C_I2C4_TX_BDMA_STREAM STM32_BDMA_STREAM_ID_ANY
215// STM32_I2C_I2C1_IRQ_PRIORITY is defined above, reused for fast EXTI handoff
216#define STM32_I2C_I2C2_IRQ_PRIORITY 5
217#define STM32_I2C_I2C3_IRQ_PRIORITY 5
218#define STM32_I2C_I2C4_IRQ_PRIORITY 5
219#define STM32_I2C_I2C1_DMA_PRIORITY 3
220#define STM32_I2C_I2C2_DMA_PRIORITY 3
221#define STM32_I2C_I2C3_DMA_PRIORITY 3
222#define STM32_I2C_I2C4_DMA_PRIORITY 3
223#define STM32_I2C_DMA_ERROR_HOOK(i2cp) osalSysHalt("DMA failure")
224
225/*
226 * ICU driver system settings.
227 */
228#ifndef STM32_ICU_USE_TIM1
229#define STM32_ICU_USE_TIM1 FALSE
230#endif
231
232#ifndef STM32_ICU_USE_TIM2
233#define STM32_ICU_USE_TIM2 TRUE
234#endif
235
236#ifndef STM32_ICU_USE_TIM3
237#define STM32_ICU_USE_TIM3 FALSE
238#endif
239
240#ifndef STM32_ICU_USE_TIM4
241#define STM32_ICU_USE_TIM4 FALSE
242#endif
243
244#ifndef STM32_ICU_USE_TIM5
245#define STM32_ICU_USE_TIM5 FALSE
246#endif
247
248#ifndef STM32_ICU_USE_TIM8
249#define STM32_ICU_USE_TIM8 FALSE
250#endif
251
252#ifndef STM32_ICU_USE_TIM9
253#define STM32_ICU_USE_TIM9 FALSE
254#endif
255
256#define STM32_ICU_USE_TIM12 FALSE
257#define STM32_ICU_USE_TIM13 FALSE
258#define STM32_ICU_USE_TIM14 FALSE
259#define STM32_ICU_USE_TIM15 FALSE
260#define STM32_ICU_USE_TIM16 FALSE
261#define STM32_ICU_USE_TIM17 FALSE
262
263/*
264 * MAC driver system settings.
265 */
266#define STM32_MAC_TRANSMIT_BUFFERS 4
267#define STM32_MAC_RECEIVE_BUFFERS 4
268#define STM32_MAC_BUFFERS_SIZE 1522
269#define STM32_MAC_PHY_TIMEOUT 100
270#define STM32_MAC_ETH1_CHANGE_PHY_STATE TRUE
271#define STM32_MAC_ETH1_IRQ_PRIORITY 13
272#define STM32_MAC_IP_CHECKSUM_OFFLOAD 0
273
274/*
275 * PWM driver system settings.
276 */
277#define STM32_PWM_USE_TIM1 FALSE
278#define STM32_PWM_USE_TIM2 FALSE
279
280#ifndef STM32_PWM_USE_TIM3
281#define STM32_PWM_USE_TIM3 FALSE
282#endif
283
284#ifndef STM32_PWM_USE_TIM4
285#define STM32_PWM_USE_TIM4 TRUE
286#endif
287
288#ifndef STM32_PWM_USE_TIM5
289#define STM32_PWM_USE_TIM5 TRUE
290#endif
291
292#ifndef STM32_PWM_USE_TIM8
293#define STM32_PWM_USE_TIM8 TRUE
294#endif
295
296#define STM32_PWM_USE_TIM12 FALSE
297#define STM32_PWM_USE_TIM13 FALSE
298#define STM32_PWM_USE_TIM14 FALSE
299#define STM32_PWM_USE_TIM15 FALSE
300#define STM32_PWM_USE_TIM16 FALSE
301#define STM32_PWM_USE_TIM17 FALSE
302
303/*
304 * RTC driver system settings.
305 */
306#define STM32_RTC_PRESA_VALUE 32
307#define STM32_RTC_PRESS_VALUE 1024
308#define STM32_RTC_CR_INIT 0
309#define STM32_RTC_TAMPCR_INIT 0
310
311/*
312 * SDC driver system settings.
313 */
314#define STM32_SDC_USE_SDMMC1 TRUE
315#define STM32_SDC_USE_SDMMC2 FALSE
316#define STM32_SDC_SDMMC_UNALIGNED_SUPPORT TRUE
317#define STM32_SDC_SDMMC_WRITE_TIMEOUT 1000000
318#define STM32_SDC_SDMMC_READ_TIMEOUT 1000000
319#define STM32_SDC_SDMMC_CLOCK_DELAY 10
320#define STM32_SDC_SDMMC_PWRSAV TRUE
321
322/*
323 * SERIAL driver system settings.
324 */
325#define STM32_SERIAL_USE_USART1 TRUE
326#define STM32_SERIAL_USE_USART2 FALSE
327#define STM32_SERIAL_USE_USART3 FALSE
328#define STM32_SERIAL_USE_UART4 FALSE
329#define STM32_SERIAL_USE_UART5 FALSE
330#define STM32_SERIAL_USE_USART6 TRUE
331#define STM32_SERIAL_USE_UART7 FALSE
332#define STM32_SERIAL_USE_UART8 FALSE
333#define STM32_SERIAL_USE_LPUART1 FALSE
334
335/*
336 * SPI driver system settings.
337 */
338#ifndef STM32_SPI_USE_SPI1
339#define STM32_SPI_USE_SPI1 TRUE
340#endif
341#ifndef STM32_SPI_USE_SPI2
342#define STM32_SPI_USE_SPI2 TRUE
343#endif
344#ifndef STM32_SPI_USE_SPI3
345#define STM32_SPI_USE_SPI3 TRUE
346#endif
347#ifndef STM32_SPI_USE_SPI4
348#define STM32_SPI_USE_SPI4 FALSE
349#endif
350#ifndef STM32_SPI_USE_SPI5
351#define STM32_SPI_USE_SPI5 FALSE
352#endif
353#ifndef STM32_SPI_USE_SPI6
354#define STM32_SPI_USE_SPI6 FALSE
355#endif
356
357#define STM32_SPI_SPI1_RX_DMA_STREAM STM32_DMA_STREAM_ID_ANY
358#define STM32_SPI_SPI1_TX_DMA_STREAM STM32_DMA_STREAM_ID_ANY
359#define STM32_SPI_SPI2_RX_DMA_STREAM STM32_DMA_STREAM_ID_ANY
360#define STM32_SPI_SPI2_TX_DMA_STREAM STM32_DMA_STREAM_ID_ANY
361#define STM32_SPI_SPI3_RX_DMA_STREAM STM32_DMA_STREAM_ID_ANY
362#define STM32_SPI_SPI3_TX_DMA_STREAM STM32_DMA_STREAM_ID_ANY
363#define STM32_SPI_SPI4_RX_DMA_STREAM STM32_DMA_STREAM_ID_ANY
364#define STM32_SPI_SPI4_TX_DMA_STREAM STM32_DMA_STREAM_ID_ANY
365#define STM32_SPI_SPI5_RX_DMA_STREAM STM32_DMA_STREAM_ID_ANY
366#define STM32_SPI_SPI5_TX_DMA_STREAM STM32_DMA_STREAM_ID_ANY
367#define STM32_SPI_SPI6_RX_BDMA_STREAM STM32_BDMA_STREAM_ID_ANY
368#define STM32_SPI_SPI6_TX_BDMA_STREAM STM32_BDMA_STREAM_ID_ANY
369#define STM32_SPI_SPI1_DMA_PRIORITY 1
370#define STM32_SPI_SPI2_DMA_PRIORITY 1
371#define STM32_SPI_SPI3_DMA_PRIORITY 1
372#define STM32_SPI_SPI4_DMA_PRIORITY 1
373#define STM32_SPI_SPI5_DMA_PRIORITY 1
374#define STM32_SPI_SPI6_DMA_PRIORITY 1
375#define STM32_SPI_SPI1_IRQ_PRIORITY EFI_IRQ_SPI_PRIORITY
376#define STM32_SPI_SPI2_IRQ_PRIORITY EFI_IRQ_SPI_PRIORITY
377#define STM32_SPI_SPI3_IRQ_PRIORITY EFI_IRQ_SPI_PRIORITY
378#define STM32_SPI_SPI4_IRQ_PRIORITY EFI_IRQ_SPI_PRIORITY
379#define STM32_SPI_SPI5_IRQ_PRIORITY EFI_IRQ_SPI_PRIORITY
380#define STM32_SPI_SPI6_IRQ_PRIORITY EFI_IRQ_SPI_PRIORITY
381#define STM32_SPI_DMA_ERROR_HOOK(spip) osalSysHalt("DMA failure")
382
383/*
384 * ST driver system settings.
385 */
386#define STM32_ST_IRQ_PRIORITY EFI_IRQ_SYSTICK_PRIORITY
387#define STM32_ST_USE_TIMER 2
388
389/*
390 * TRNG driver system settings.
391 */
392#define STM32_TRNG_USE_RNG1 FALSE
393
394/*
395 * UART driver system settings.
396 */
397#define STM32_UART_USE_USART1 FALSE
398
399#ifndef STM32_UART_USE_USART2
400#define STM32_UART_USE_USART2 FALSE
401#endif
402
403#define STM32_UART_USE_USART3 TRUE
404#define STM32_UART_USE_UART4 FALSE
405#define STM32_UART_USE_UART5 FALSE
406#define STM32_UART_USE_USART6 FALSE
407#define STM32_UART_USE_UART7 FALSE
408#define STM32_UART_USE_UART8 FALSE
409#define STM32_UART_USART1_RX_DMA_STREAM STM32_DMA_STREAM_ID_ANY
410#define STM32_UART_USART1_TX_DMA_STREAM STM32_DMA_STREAM_ID_ANY
411#define STM32_UART_USART2_RX_DMA_STREAM STM32_DMA_STREAM_ID_ANY
412#define STM32_UART_USART2_TX_DMA_STREAM STM32_DMA_STREAM_ID_ANY
413#define STM32_UART_USART3_RX_DMA_STREAM STM32_DMA_STREAM_ID_ANY
414#define STM32_UART_USART3_TX_DMA_STREAM STM32_DMA_STREAM_ID_ANY
415#define STM32_UART_UART4_RX_DMA_STREAM STM32_DMA_STREAM_ID_ANY
416#define STM32_UART_UART4_TX_DMA_STREAM STM32_DMA_STREAM_ID_ANY
417#define STM32_UART_UART5_RX_DMA_STREAM STM32_DMA_STREAM_ID_ANY
418#define STM32_UART_UART5_TX_DMA_STREAM STM32_DMA_STREAM_ID_ANY
419#define STM32_UART_USART6_RX_DMA_STREAM STM32_DMA_STREAM_ID_ANY
420#define STM32_UART_USART6_TX_DMA_STREAM STM32_DMA_STREAM_ID_ANY
421#define STM32_UART_UART7_RX_DMA_STREAM STM32_DMA_STREAM_ID_ANY
422#define STM32_UART_UART7_TX_DMA_STREAM STM32_DMA_STREAM_ID_ANY
423#define STM32_UART_UART8_RX_DMA_STREAM STM32_DMA_STREAM_ID_ANY
424#define STM32_UART_UART8_TX_DMA_STREAM STM32_DMA_STREAM_ID_ANY
425#define STM32_UART_USART1_DMA_PRIORITY 0
426#define STM32_UART_USART2_DMA_PRIORITY 0
427#define STM32_UART_USART3_DMA_PRIORITY 0
428#define STM32_UART_UART4_DMA_PRIORITY 0
429#define STM32_UART_UART5_DMA_PRIORITY 0
430#define STM32_UART_USART6_DMA_PRIORITY 0
431#define STM32_UART_UART7_DMA_PRIORITY 0
432#define STM32_UART_UART8_DMA_PRIORITY 0
433#define STM32_UART_DMA_ERROR_HOOK(uartp) osalSysHalt("DMA failure")
434
435/*
436 * USB driver system settings.
437 */
438#define STM32_USB_OTG1_IRQ_PRIORITY EFI_IRQ_USB_PRIORITY
439#define STM32_USB_OTG2_IRQ_PRIORITY EFI_IRQ_USB_PRIORITY
440
441/*
442 * WDG driver system settings.
443 */
444#define STM32_WDG_USE_IWDG TRUE
445
446/*
447 * WSPI driver system settings.
448 */
449#define STM32_WSPI_USE_QUADSPI1 FALSE
450#define STM32_WSPI_QUADSPI1_PRESCALER_VALUE 1
451#define STM32_WSPI_QUADSPI1_MDMA_CHANNEL STM32_MDMA_CHANNEL_ID_ANY
452#define STM32_WSPI_QUADSPI1_MDMA_PRIORITY 1
453#define STM32_WSPI_MDMA_ERROR_HOOK(qspip) osalSysHalt("MDMA failure")
454
455#define STM32_SYSCLK STM32_SYS_CK
456
457#ifndef ENABLE_AUTO_DETECT_HSE
458 #define ENABLE_AUTO_DETECT_HSE TRUE
459#endif
460
461#endif /* MCUCONF_H */