aboutsummaryrefslogtreecommitdiff
path: root/lib/chibios/os/hal/boards/OLIMEX_STM32_E407
diff options
context:
space:
mode:
Diffstat (limited to 'lib/chibios/os/hal/boards/OLIMEX_STM32_E407')
-rw-r--r--lib/chibios/os/hal/boards/OLIMEX_STM32_E407/board.c266
-rw-r--r--lib/chibios/os/hal/boards/OLIMEX_STM32_E407/board.h1380
-rw-r--r--lib/chibios/os/hal/boards/OLIMEX_STM32_E407/board.mk9
-rw-r--r--lib/chibios/os/hal/boards/OLIMEX_STM32_E407/cfg/board.chcfg342
-rw-r--r--lib/chibios/os/hal/boards/OLIMEX_STM32_E407/cfg/board.fmpp15
5 files changed, 2012 insertions, 0 deletions
diff --git a/lib/chibios/os/hal/boards/OLIMEX_STM32_E407/board.c b/lib/chibios/os/hal/boards/OLIMEX_STM32_E407/board.c
new file mode 100644
index 000000000..bdfa5a62a
--- /dev/null
+++ b/lib/chibios/os/hal/boards/OLIMEX_STM32_E407/board.c
@@ -0,0 +1,266 @@
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/*
18 * This file has been automatically generated using ChibiStudio board
19 * generator plugin. Do not edit manually.
20 */
21
22#include "hal.h"
23#include "stm32_gpio.h"
24
25/*===========================================================================*/
26/* Driver local definitions. */
27/*===========================================================================*/
28
29/*===========================================================================*/
30/* Driver exported variables. */
31/*===========================================================================*/
32
33/*===========================================================================*/
34/* Driver local variables and types. */
35/*===========================================================================*/
36
37/**
38 * @brief Type of STM32 GPIO port setup.
39 */
40typedef struct {
41 uint32_t moder;
42 uint32_t otyper;
43 uint32_t ospeedr;
44 uint32_t pupdr;
45 uint32_t odr;
46 uint32_t afrl;
47 uint32_t afrh;
48} gpio_setup_t;
49
50/**
51 * @brief Type of STM32 GPIO initialization data.
52 */
53typedef struct {
54#if STM32_HAS_GPIOA || defined(__DOXYGEN__)
55 gpio_setup_t PAData;
56#endif
57#if STM32_HAS_GPIOB || defined(__DOXYGEN__)
58 gpio_setup_t PBData;
59#endif
60#if STM32_HAS_GPIOC || defined(__DOXYGEN__)
61 gpio_setup_t PCData;
62#endif
63#if STM32_HAS_GPIOD || defined(__DOXYGEN__)
64 gpio_setup_t PDData;
65#endif
66#if STM32_HAS_GPIOE || defined(__DOXYGEN__)
67 gpio_setup_t PEData;
68#endif
69#if STM32_HAS_GPIOF || defined(__DOXYGEN__)
70 gpio_setup_t PFData;
71#endif
72#if STM32_HAS_GPIOG || defined(__DOXYGEN__)
73 gpio_setup_t PGData;
74#endif
75#if STM32_HAS_GPIOH || defined(__DOXYGEN__)
76 gpio_setup_t PHData;
77#endif
78#if STM32_HAS_GPIOI || defined(__DOXYGEN__)
79 gpio_setup_t PIData;
80#endif
81#if STM32_HAS_GPIOJ || defined(__DOXYGEN__)
82 gpio_setup_t PJData;
83#endif
84#if STM32_HAS_GPIOK || defined(__DOXYGEN__)
85 gpio_setup_t PKData;
86#endif
87} gpio_config_t;
88
89/**
90 * @brief STM32 GPIO static initialization data.
91 */
92static const gpio_config_t gpio_default_config = {
93#if STM32_HAS_GPIOA
94 {VAL_GPIOA_MODER, VAL_GPIOA_OTYPER, VAL_GPIOA_OSPEEDR, VAL_GPIOA_PUPDR,
95 VAL_GPIOA_ODR, VAL_GPIOA_AFRL, VAL_GPIOA_AFRH},
96#endif
97#if STM32_HAS_GPIOB
98 {VAL_GPIOB_MODER, VAL_GPIOB_OTYPER, VAL_GPIOB_OSPEEDR, VAL_GPIOB_PUPDR,
99 VAL_GPIOB_ODR, VAL_GPIOB_AFRL, VAL_GPIOB_AFRH},
100#endif
101#if STM32_HAS_GPIOC
102 {VAL_GPIOC_MODER, VAL_GPIOC_OTYPER, VAL_GPIOC_OSPEEDR, VAL_GPIOC_PUPDR,
103 VAL_GPIOC_ODR, VAL_GPIOC_AFRL, VAL_GPIOC_AFRH},
104#endif
105#if STM32_HAS_GPIOD
106 {VAL_GPIOD_MODER, VAL_GPIOD_OTYPER, VAL_GPIOD_OSPEEDR, VAL_GPIOD_PUPDR,
107 VAL_GPIOD_ODR, VAL_GPIOD_AFRL, VAL_GPIOD_AFRH},
108#endif
109#if STM32_HAS_GPIOE
110 {VAL_GPIOE_MODER, VAL_GPIOE_OTYPER, VAL_GPIOE_OSPEEDR, VAL_GPIOE_PUPDR,
111 VAL_GPIOE_ODR, VAL_GPIOE_AFRL, VAL_GPIOE_AFRH},
112#endif
113#if STM32_HAS_GPIOF
114 {VAL_GPIOF_MODER, VAL_GPIOF_OTYPER, VAL_GPIOF_OSPEEDR, VAL_GPIOF_PUPDR,
115 VAL_GPIOF_ODR, VAL_GPIOF_AFRL, VAL_GPIOF_AFRH},
116#endif
117#if STM32_HAS_GPIOG
118 {VAL_GPIOG_MODER, VAL_GPIOG_OTYPER, VAL_GPIOG_OSPEEDR, VAL_GPIOG_PUPDR,
119 VAL_GPIOG_ODR, VAL_GPIOG_AFRL, VAL_GPIOG_AFRH},
120#endif
121#if STM32_HAS_GPIOH
122 {VAL_GPIOH_MODER, VAL_GPIOH_OTYPER, VAL_GPIOH_OSPEEDR, VAL_GPIOH_PUPDR,
123 VAL_GPIOH_ODR, VAL_GPIOH_AFRL, VAL_GPIOH_AFRH},
124#endif
125#if STM32_HAS_GPIOI
126 {VAL_GPIOI_MODER, VAL_GPIOI_OTYPER, VAL_GPIOI_OSPEEDR, VAL_GPIOI_PUPDR,
127 VAL_GPIOI_ODR, VAL_GPIOI_AFRL, VAL_GPIOI_AFRH},
128#endif
129#if STM32_HAS_GPIOJ
130 {VAL_GPIOJ_MODER, VAL_GPIOJ_OTYPER, VAL_GPIOJ_OSPEEDR, VAL_GPIOJ_PUPDR,
131 VAL_GPIOJ_ODR, VAL_GPIOJ_AFRL, VAL_GPIOJ_AFRH},
132#endif
133#if STM32_HAS_GPIOK
134 {VAL_GPIOK_MODER, VAL_GPIOK_OTYPER, VAL_GPIOK_OSPEEDR, VAL_GPIOK_PUPDR,
135 VAL_GPIOK_ODR, VAL_GPIOK_AFRL, VAL_GPIOK_AFRH}
136#endif
137};
138
139/*===========================================================================*/
140/* Driver local functions. */
141/*===========================================================================*/
142
143static void gpio_init(stm32_gpio_t *gpiop, const gpio_setup_t *config) {
144
145 gpiop->OTYPER = config->otyper;
146 gpiop->OSPEEDR = config->ospeedr;
147 gpiop->PUPDR = config->pupdr;
148 gpiop->ODR = config->odr;
149 gpiop->AFRL = config->afrl;
150 gpiop->AFRH = config->afrh;
151 gpiop->MODER = config->moder;
152}
153
154static void stm32_gpio_init(void) {
155
156 /* Enabling GPIO-related clocks, the mask comes from the
157 registry header file.*/
158 rccResetAHB1(STM32_GPIO_EN_MASK);
159 rccEnableAHB1(STM32_GPIO_EN_MASK, true);
160
161 /* Initializing all the defined GPIO ports.*/
162#if STM32_HAS_GPIOA
163 gpio_init(GPIOA, &gpio_default_config.PAData);
164#endif
165#if STM32_HAS_GPIOB
166 gpio_init(GPIOB, &gpio_default_config.PBData);
167#endif
168#if STM32_HAS_GPIOC
169 gpio_init(GPIOC, &gpio_default_config.PCData);
170#endif
171#if STM32_HAS_GPIOD
172 gpio_init(GPIOD, &gpio_default_config.PDData);
173#endif
174#if STM32_HAS_GPIOE
175 gpio_init(GPIOE, &gpio_default_config.PEData);
176#endif
177#if STM32_HAS_GPIOF
178 gpio_init(GPIOF, &gpio_default_config.PFData);
179#endif
180#if STM32_HAS_GPIOG
181 gpio_init(GPIOG, &gpio_default_config.PGData);
182#endif
183#if STM32_HAS_GPIOH
184 gpio_init(GPIOH, &gpio_default_config.PHData);
185#endif
186#if STM32_HAS_GPIOI
187 gpio_init(GPIOI, &gpio_default_config.PIData);
188#endif
189#if STM32_HAS_GPIOJ
190 gpio_init(GPIOJ, &gpio_default_config.PJData);
191#endif
192#if STM32_HAS_GPIOK
193 gpio_init(GPIOK, &gpio_default_config.PKData);
194#endif
195}
196
197/*===========================================================================*/
198/* Driver interrupt handlers. */
199/*===========================================================================*/
200
201/*===========================================================================*/
202/* Driver exported functions. */
203/*===========================================================================*/
204
205/**
206 * @brief Early initialization code.
207 * @details GPIO ports and system clocks are initialized before everything
208 * else.
209 */
210void __early_init(void) {
211
212 stm32_gpio_init();
213 stm32_clock_init();
214}
215
216#if HAL_USE_SDC || defined(__DOXYGEN__)
217/**
218 * @brief SDC card detection.
219 */
220bool sdc_lld_is_card_inserted(SDCDriver *sdcp) {
221 static bool last_status = false;
222
223 if (blkIsTransferring(sdcp))
224 return last_status;
225 return last_status = (bool)palReadPad(GPIOC, GPIOC_SD_D3);
226}
227
228/**
229 * @brief SDC card write protection detection.
230 */
231bool sdc_lld_is_write_protected(SDCDriver *sdcp) {
232
233 (void)sdcp;
234 return false;
235}
236#endif /* HAL_USE_SDC */
237
238#if HAL_USE_MMC_SPI || defined(__DOXYGEN__)
239/**
240 * @brief MMC_SPI card detection.
241 */
242bool mmc_lld_is_card_inserted(MMCDriver *mmcp) {
243
244 (void)mmcp;
245 /* CHTODO: Fill the implementation.*/
246 return true;
247}
248
249/**
250 * @brief MMC_SPI card write protection detection.
251 */
252bool mmc_lld_is_write_protected(MMCDriver *mmcp) {
253
254 (void)mmcp;
255 /* CHTODO: Fill the implementation.*/
256 return false;
257}
258#endif
259
260/**
261 * @brief Board-specific initialization code.
262 * @note You can add your board-specific code here.
263 */
264void boardInit(void) {
265
266}
diff --git a/lib/chibios/os/hal/boards/OLIMEX_STM32_E407/board.h b/lib/chibios/os/hal/boards/OLIMEX_STM32_E407/board.h
new file mode 100644
index 000000000..d48e75b1c
--- /dev/null
+++ b/lib/chibios/os/hal/boards/OLIMEX_STM32_E407/board.h
@@ -0,0 +1,1380 @@
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/*
18 * This file has been automatically generated using ChibiStudio board
19 * generator plugin. Do not edit manually.
20 */
21
22#ifndef BOARD_H
23#define BOARD_H
24
25/*===========================================================================*/
26/* Driver constants. */
27/*===========================================================================*/
28
29/*
30 * Setup for Olimex STM32-E407 board.
31 */
32
33/*
34 * Board identifier.
35 */
36#define BOARD_OLIMEX_STM32_E407
37#define BOARD_NAME "Olimex STM32-E407"
38
39/*
40 * Ethernet PHY type.
41 */
42#define BOARD_PHY_ID MII_KS8721_ID
43#define BOARD_PHY_RMII
44
45/*
46 * Board oscillators-related settings.
47 */
48#if !defined(STM32_LSECLK)
49#define STM32_LSECLK 32768U
50#endif
51
52#if !defined(STM32_HSECLK)
53#define STM32_HSECLK 12000000U
54#endif
55
56/*
57 * Board voltages.
58 * Required for performance limits calculation.
59 */
60#define STM32_VDD 330U
61
62/*
63 * MCU type as defined in the ST header.
64 */
65#define STM32F407xx
66
67/*
68 * IO pins assignments.
69 */
70#define GPIOA_BUTTON_WKUP 0U
71#define GPIOA_ETH_RMII_REF_CLK 1U
72#define GPIOA_ETH_RMII_MDIO 2U
73#define GPIOA_ETH_RMII_MDINT 3U
74#define GPIOA_PIN4 4U
75#define GPIOA_PIN5 5U
76#define GPIOA_PIN6 6U
77#define GPIOA_ETH_RMII_CRS_DV 7U
78#define GPIOA_USB_HS_BUSON 8U
79#define GPIOA_OTG_FS_VBUS 9U
80#define GPIOA_OTG_FS_ID 10U
81#define GPIOA_OTG_FS_DM 11U
82#define GPIOA_OTG_FS_DP 12U
83#define GPIOA_JTAG_TMS 13U
84#define GPIOA_JTAG_TCK 14U
85#define GPIOA_JTAG_TDI 15U
86
87#define GPIOB_USB_FS_BUSON 0U
88#define GPIOB_USB_HS_FAULT 1U
89#define GPIOB_BOOT1 2U
90#define GPIOB_JTAG_TDO 3U
91#define GPIOB_JTAG_TRST 4U
92#define GPIOB_PIN5 5U
93#define GPIOB_PIN6 6U
94#define GPIOB_PIN7 7U
95#define GPIOB_I2C1_SCL 8U
96#define GPIOB_I2C1_SDA 9U
97#define GPIOB_SPI2_SCK 10U
98#define GPIOB_PIN11 11U
99#define GPIOB_OTG_HS_ID 12U
100#define GPIOB_OTG_HS_VBUS 13U
101#define GPIOB_OTG_HS_DM 14U
102#define GPIOB_OTG_HS_DP 15U
103
104#define GPIOC_PIN0 0U
105#define GPIOC_ETH_RMII_MDC 1U
106#define GPIOC_SPI2_MISO 2U
107#define GPIOC_SPI2_MOSI 3U
108#define GPIOC_ETH_RMII_RXD0 4U
109#define GPIOC_ETH_RMII_RXD1 5U
110#define GPIOC_USART6_TX 6U
111#define GPIOC_USART6_RX 7U
112#define GPIOC_SD_D0 8U
113#define GPIOC_SD_D1 9U
114#define GPIOC_SD_D2 10U
115#define GPIOC_SD_D3 11U
116#define GPIOC_SD_CLK 12U
117#define GPIOC_LED 13U
118#define GPIOC_OSC32_IN 14U
119#define GPIOC_OSC32_OUT 15U
120
121#define GPIOD_PIN0 0U
122#define GPIOD_PIN1 1U
123#define GPIOD_SD_CMD 2U
124#define GPIOD_PIN3 3U
125#define GPIOD_PIN4 4U
126#define GPIOD_PIN5 5U
127#define GPIOD_PIN6 6U
128#define GPIOD_PIN7 7U
129#define GPIOD_PIN8 8U
130#define GPIOD_PIN9 9U
131#define GPIOD_PIN10 10U
132#define GPIOD_PIN11 11U
133#define GPIOD_PIN12 12U
134#define GPIOD_PIN13 13U
135#define GPIOD_PIN14 14U
136#define GPIOD_PIN15 15U
137
138#define GPIOE_PIN0 0U
139#define GPIOE_PIN1 1U
140#define GPIOE_PIN2 2U
141#define GPIOE_PIN3 3U
142#define GPIOE_PIN4 4U
143#define GPIOE_PIN5 5U
144#define GPIOE_PIN6 6U
145#define GPIOE_PIN7 7U
146#define GPIOE_PIN8 8U
147#define GPIOE_PIN9 9U
148#define GPIOE_PIN10 10U
149#define GPIOE_PIN11 11U
150#define GPIOE_PIN12 12U
151#define GPIOE_PIN13 13U
152#define GPIOE_PIN14 14U
153#define GPIOE_PIN15 15U
154
155#define GPIOF_PIN0 0U
156#define GPIOF_PIN1 1U
157#define GPIOF_PIN2 2U
158#define GPIOF_PIN3 3U
159#define GPIOF_PIN4 4U
160#define GPIOF_PIN5 5U
161#define GPIOF_PIN6 6U
162#define GPIOF_PIN7 7U
163#define GPIOF_PIN8 8U
164#define GPIOF_PIN9 9U
165#define GPIOF_PIN10 10U
166#define GPIOF_USB_FS_FAULT 11U
167#define GPIOF_PIN12 12U
168#define GPIOF_PIN13 13U
169#define GPIOF_PIN14 14U
170#define GPIOF_PIN15 15U
171
172#define GPIOG_PIN0 0U
173#define GPIOG_PIN1 1U
174#define GPIOG_PIN2 2U
175#define GPIOG_PIN3 3U
176#define GPIOG_PIN4 4U
177#define GPIOG_PIN5 5U
178#define GPIOG_PIN6 6U
179#define GPIOG_PIN7 7U
180#define GPIOG_PIN8 8U
181#define GPIOG_PIN9 9U
182#define GPIOG_SPI2_CS 10U
183#define GPIOG_ETH_RMII_TXEN 11U
184#define GPIOG_PIN12 12U
185#define GPIOG_ETH_RMII_TXD0 13U
186#define GPIOG_ETH_RMII_TXD1 14U
187#define GPIOG_PIN15 15U
188
189#define GPIOH_OSC_IN 0U
190#define GPIOH_OSC_OUT 1U
191#define GPIOH_PIN2 2U
192#define GPIOH_PIN3 3U
193#define GPIOH_PIN4 4U
194#define GPIOH_PIN5 5U
195#define GPIOH_PIN6 6U
196#define GPIOH_PIN7 7U
197#define GPIOH_PIN8 8U
198#define GPIOH_PIN9 9U
199#define GPIOH_PIN10 10U
200#define GPIOH_PIN11 11U
201#define GPIOH_PIN12 12U
202#define GPIOH_PIN13 13U
203#define GPIOH_PIN14 14U
204#define GPIOH_PIN15 15U
205
206#define GPIOI_PIN0 0U
207#define GPIOI_PIN1 1U
208#define GPIOI_PIN2 2U
209#define GPIOI_PIN3 3U
210#define GPIOI_PIN4 4U
211#define GPIOI_PIN5 5U
212#define GPIOI_PIN6 6U
213#define GPIOI_PIN7 7U
214#define GPIOI_PIN8 8U
215#define GPIOI_PIN9 9U
216#define GPIOI_PIN10 10U
217#define GPIOI_PIN11 11U
218#define GPIOI_PIN12 12U
219#define GPIOI_PIN13 13U
220#define GPIOI_PIN14 14U
221#define GPIOI_PIN15 15U
222
223/*
224 * IO lines assignments.
225 */
226#define LINE_BUTTON_WKUP PAL_LINE(GPIOA, 0U)
227#define LINE_ETH_RMII_REF_CLK PAL_LINE(GPIOA, 1U)
228#define LINE_ETH_RMII_MDIO PAL_LINE(GPIOA, 2U)
229#define LINE_ETH_RMII_MDINT PAL_LINE(GPIOA, 3U)
230#define LINE_ETH_RMII_CRS_DV PAL_LINE(GPIOA, 7U)
231#define LINE_USB_HS_BUSON PAL_LINE(GPIOA, 8U)
232#define LINE_OTG_FS_VBUS PAL_LINE(GPIOA, 9U)
233#define LINE_OTG_FS_ID PAL_LINE(GPIOA, 10U)
234#define LINE_OTG_FS_DM PAL_LINE(GPIOA, 11U)
235#define LINE_OTG_FS_DP PAL_LINE(GPIOA, 12U)
236#define LINE_JTAG_TMS PAL_LINE(GPIOA, 13U)
237#define LINE_JTAG_TCK PAL_LINE(GPIOA, 14U)
238#define LINE_JTAG_TDI PAL_LINE(GPIOA, 15U)
239#define LINE_USB_FS_BUSON PAL_LINE(GPIOB, 0U)
240#define LINE_USB_HS_FAULT PAL_LINE(GPIOB, 1U)
241#define LINE_BOOT1 PAL_LINE(GPIOB, 2U)
242#define LINE_JTAG_TDO PAL_LINE(GPIOB, 3U)
243#define LINE_JTAG_TRST PAL_LINE(GPIOB, 4U)
244#define LINE_I2C1_SCL PAL_LINE(GPIOB, 8U)
245#define LINE_I2C1_SDA PAL_LINE(GPIOB, 9U)
246#define LINE_SPI2_SCK PAL_LINE(GPIOB, 10U)
247#define LINE_OTG_HS_ID PAL_LINE(GPIOB, 12U)
248#define LINE_OTG_HS_VBUS PAL_LINE(GPIOB, 13U)
249#define LINE_OTG_HS_DM PAL_LINE(GPIOB, 14U)
250#define LINE_OTG_HS_DP PAL_LINE(GPIOB, 15U)
251#define LINE_ETH_RMII_MDC PAL_LINE(GPIOC, 1U)
252#define LINE_SPI2_MISO PAL_LINE(GPIOC, 2U)
253#define LINE_SPI2_MOSI PAL_LINE(GPIOC, 3U)
254#define LINE_ETH_RMII_RXD0 PAL_LINE(GPIOC, 4U)
255#define LINE_ETH_RMII_RXD1 PAL_LINE(GPIOC, 5U)
256#define LINE_USART6_TX PAL_LINE(GPIOC, 6U)
257#define LINE_USART6_RX PAL_LINE(GPIOC, 7U)
258#define LINE_SD_D0 PAL_LINE(GPIOC, 8U)
259#define LINE_SD_D1 PAL_LINE(GPIOC, 9U)
260#define LINE_SD_D2 PAL_LINE(GPIOC, 10U)
261#define LINE_SD_D3 PAL_LINE(GPIOC, 11U)
262#define LINE_SD_CLK PAL_LINE(GPIOC, 12U)
263#define LINE_LED PAL_LINE(GPIOC, 13U)
264#define LINE_OSC32_IN PAL_LINE(GPIOC, 14U)
265#define LINE_OSC32_OUT PAL_LINE(GPIOC, 15U)
266#define LINE_SD_CMD PAL_LINE(GPIOD, 2U)
267#define LINE_USB_FS_FAULT PAL_LINE(GPIOF, 11U)
268#define LINE_SPI2_CS PAL_LINE(GPIOG, 10U)
269#define LINE_ETH_RMII_TXEN PAL_LINE(GPIOG, 11U)
270#define LINE_ETH_RMII_TXD0 PAL_LINE(GPIOG, 13U)
271#define LINE_ETH_RMII_TXD1 PAL_LINE(GPIOG, 14U)
272#define LINE_OSC_IN PAL_LINE(GPIOH, 0U)
273#define LINE_OSC_OUT PAL_LINE(GPIOH, 1U)
274
275/*===========================================================================*/
276/* Driver pre-compile time settings. */
277/*===========================================================================*/
278
279/*===========================================================================*/
280/* Derived constants and error checks. */
281/*===========================================================================*/
282
283/*===========================================================================*/
284/* Driver data structures and types. */
285/*===========================================================================*/
286
287/*===========================================================================*/
288/* Driver macros. */
289/*===========================================================================*/
290
291/*
292 * I/O ports initial setup, this configuration is established soon after reset
293 * in the initialization code.
294 * Please refer to the STM32 Reference Manual for details.
295 */
296#define PIN_MODE_INPUT(n) (0U << ((n) * 2U))
297#define PIN_MODE_OUTPUT(n) (1U << ((n) * 2U))
298#define PIN_MODE_ALTERNATE(n) (2U << ((n) * 2U))
299#define PIN_MODE_ANALOG(n) (3U << ((n) * 2U))
300#define PIN_ODR_LOW(n) (0U << (n))
301#define PIN_ODR_HIGH(n) (1U << (n))
302#define PIN_OTYPE_PUSHPULL(n) (0U << (n))
303#define PIN_OTYPE_OPENDRAIN(n) (1U << (n))
304#define PIN_OSPEED_VERYLOW(n) (0U << ((n) * 2U))
305#define PIN_OSPEED_LOW(n) (1U << ((n) * 2U))
306#define PIN_OSPEED_MEDIUM(n) (2U << ((n) * 2U))
307#define PIN_OSPEED_HIGH(n) (3U << ((n) * 2U))
308#define PIN_PUPDR_FLOATING(n) (0U << ((n) * 2U))
309#define PIN_PUPDR_PULLUP(n) (1U << ((n) * 2U))
310#define PIN_PUPDR_PULLDOWN(n) (2U << ((n) * 2U))
311#define PIN_AFIO_AF(n, v) ((v) << (((n) % 8U) * 4U))
312
313/*
314 * GPIOA setup:
315 *
316 * PA0 - BUTTON_WKUP (input floating).
317 * PA1 - ETH_RMII_REF_CLK (alternate 11).
318 * PA2 - ETH_RMII_MDIO (alternate 11).
319 * PA3 - ETH_RMII_MDINT (input floating).
320 * PA4 - PIN4 (input pullup).
321 * PA5 - PIN5 (input pullup).
322 * PA6 - PIN6 (input pullup).
323 * PA7 - ETH_RMII_CRS_DV (alternate 11).
324 * PA8 - USB_HS_BUSON (output pushpull maximum).
325 * PA9 - OTG_FS_VBUS (input pulldown).
326 * PA10 - OTG_FS_ID (alternate 10).
327 * PA11 - OTG_FS_DM (alternate 10).
328 * PA12 - OTG_FS_DP (alternate 10).
329 * PA13 - JTAG_TMS (alternate 0).
330 * PA14 - JTAG_TCK (alternate 0).
331 * PA15 - JTAG_TDI (alternate 0).
332 */
333#define VAL_GPIOA_MODER (PIN_MODE_INPUT(GPIOA_BUTTON_WKUP) | \
334 PIN_MODE_ALTERNATE(GPIOA_ETH_RMII_REF_CLK) |\
335 PIN_MODE_ALTERNATE(GPIOA_ETH_RMII_MDIO) |\
336 PIN_MODE_INPUT(GPIOA_ETH_RMII_MDINT) | \
337 PIN_MODE_INPUT(GPIOA_PIN4) | \
338 PIN_MODE_INPUT(GPIOA_PIN5) | \
339 PIN_MODE_INPUT(GPIOA_PIN6) | \
340 PIN_MODE_ALTERNATE(GPIOA_ETH_RMII_CRS_DV) |\
341 PIN_MODE_OUTPUT(GPIOA_USB_HS_BUSON) | \
342 PIN_MODE_INPUT(GPIOA_OTG_FS_VBUS) | \
343 PIN_MODE_ALTERNATE(GPIOA_OTG_FS_ID) | \
344 PIN_MODE_ALTERNATE(GPIOA_OTG_FS_DM) | \
345 PIN_MODE_ALTERNATE(GPIOA_OTG_FS_DP) | \
346 PIN_MODE_ALTERNATE(GPIOA_JTAG_TMS) | \
347 PIN_MODE_ALTERNATE(GPIOA_JTAG_TCK) | \
348 PIN_MODE_ALTERNATE(GPIOA_JTAG_TDI))
349#define VAL_GPIOA_OTYPER (PIN_OTYPE_PUSHPULL(GPIOA_BUTTON_WKUP) |\
350 PIN_OTYPE_PUSHPULL(GPIOA_ETH_RMII_REF_CLK) |\
351 PIN_OTYPE_PUSHPULL(GPIOA_ETH_RMII_MDIO) |\
352 PIN_OTYPE_PUSHPULL(GPIOA_ETH_RMII_MDINT) |\
353 PIN_OTYPE_PUSHPULL(GPIOA_PIN4) | \
354 PIN_OTYPE_PUSHPULL(GPIOA_PIN5) | \
355 PIN_OTYPE_PUSHPULL(GPIOA_PIN6) | \
356 PIN_OTYPE_PUSHPULL(GPIOA_ETH_RMII_CRS_DV) |\
357 PIN_OTYPE_PUSHPULL(GPIOA_USB_HS_BUSON) |\
358 PIN_OTYPE_PUSHPULL(GPIOA_OTG_FS_VBUS) |\
359 PIN_OTYPE_PUSHPULL(GPIOA_OTG_FS_ID) | \
360 PIN_OTYPE_PUSHPULL(GPIOA_OTG_FS_DM) | \
361 PIN_OTYPE_PUSHPULL(GPIOA_OTG_FS_DP) | \
362 PIN_OTYPE_PUSHPULL(GPIOA_JTAG_TMS) | \
363 PIN_OTYPE_PUSHPULL(GPIOA_JTAG_TCK) | \
364 PIN_OTYPE_PUSHPULL(GPIOA_JTAG_TDI))
365#define VAL_GPIOA_OSPEEDR (PIN_OSPEED_HIGH(GPIOA_BUTTON_WKUP) | \
366 PIN_OSPEED_HIGH(GPIOA_ETH_RMII_REF_CLK) |\
367 PIN_OSPEED_HIGH(GPIOA_ETH_RMII_MDIO) | \
368 PIN_OSPEED_HIGH(GPIOA_ETH_RMII_MDINT) |\
369 PIN_OSPEED_HIGH(GPIOA_PIN4) | \
370 PIN_OSPEED_HIGH(GPIOA_PIN5) | \
371 PIN_OSPEED_HIGH(GPIOA_PIN6) | \
372 PIN_OSPEED_HIGH(GPIOA_ETH_RMII_CRS_DV) |\
373 PIN_OSPEED_HIGH(GPIOA_USB_HS_BUSON) | \
374 PIN_OSPEED_HIGH(GPIOA_OTG_FS_VBUS) | \
375 PIN_OSPEED_HIGH(GPIOA_OTG_FS_ID) | \
376 PIN_OSPEED_HIGH(GPIOA_OTG_FS_DM) | \
377 PIN_OSPEED_HIGH(GPIOA_OTG_FS_DP) | \
378 PIN_OSPEED_HIGH(GPIOA_JTAG_TMS) | \
379 PIN_OSPEED_HIGH(GPIOA_JTAG_TCK) | \
380 PIN_OSPEED_HIGH(GPIOA_JTAG_TDI))
381#define VAL_GPIOA_PUPDR (PIN_PUPDR_FLOATING(GPIOA_BUTTON_WKUP) |\
382 PIN_PUPDR_FLOATING(GPIOA_ETH_RMII_REF_CLK) |\
383 PIN_PUPDR_FLOATING(GPIOA_ETH_RMII_MDIO) |\
384 PIN_PUPDR_FLOATING(GPIOA_ETH_RMII_MDINT) |\
385 PIN_PUPDR_PULLUP(GPIOA_PIN4) | \
386 PIN_PUPDR_PULLUP(GPIOA_PIN5) | \
387 PIN_PUPDR_PULLUP(GPIOA_PIN6) | \
388 PIN_PUPDR_FLOATING(GPIOA_ETH_RMII_CRS_DV) |\
389 PIN_PUPDR_FLOATING(GPIOA_USB_HS_BUSON) |\
390 PIN_PUPDR_PULLDOWN(GPIOA_OTG_FS_VBUS) |\
391 PIN_PUPDR_FLOATING(GPIOA_OTG_FS_ID) | \
392 PIN_PUPDR_FLOATING(GPIOA_OTG_FS_DM) | \
393 PIN_PUPDR_FLOATING(GPIOA_OTG_FS_DP) | \
394 PIN_PUPDR_FLOATING(GPIOA_JTAG_TMS) | \
395 PIN_PUPDR_PULLDOWN(GPIOA_JTAG_TCK) | \
396 PIN_PUPDR_FLOATING(GPIOA_JTAG_TDI))
397#define VAL_GPIOA_ODR (PIN_ODR_HIGH(GPIOA_BUTTON_WKUP) | \
398 PIN_ODR_HIGH(GPIOA_ETH_RMII_REF_CLK) | \
399 PIN_ODR_HIGH(GPIOA_ETH_RMII_MDIO) | \
400 PIN_ODR_HIGH(GPIOA_ETH_RMII_MDINT) | \
401 PIN_ODR_HIGH(GPIOA_PIN4) | \
402 PIN_ODR_HIGH(GPIOA_PIN5) | \
403 PIN_ODR_HIGH(GPIOA_PIN6) | \
404 PIN_ODR_HIGH(GPIOA_ETH_RMII_CRS_DV) | \
405 PIN_ODR_LOW(GPIOA_USB_HS_BUSON) | \
406 PIN_ODR_HIGH(GPIOA_OTG_FS_VBUS) | \
407 PIN_ODR_HIGH(GPIOA_OTG_FS_ID) | \
408 PIN_ODR_HIGH(GPIOA_OTG_FS_DM) | \
409 PIN_ODR_HIGH(GPIOA_OTG_FS_DP) | \
410 PIN_ODR_HIGH(GPIOA_JTAG_TMS) | \
411 PIN_ODR_HIGH(GPIOA_JTAG_TCK) | \
412 PIN_ODR_HIGH(GPIOA_JTAG_TDI))
413#define VAL_GPIOA_AFRL (PIN_AFIO_AF(GPIOA_BUTTON_WKUP, 0U) | \
414 PIN_AFIO_AF(GPIOA_ETH_RMII_REF_CLK, 11U) |\
415 PIN_AFIO_AF(GPIOA_ETH_RMII_MDIO, 11U) |\
416 PIN_AFIO_AF(GPIOA_ETH_RMII_MDINT, 0U) |\
417 PIN_AFIO_AF(GPIOA_PIN4, 0U) | \
418 PIN_AFIO_AF(GPIOA_PIN5, 0U) | \
419 PIN_AFIO_AF(GPIOA_PIN6, 0U) | \
420 PIN_AFIO_AF(GPIOA_ETH_RMII_CRS_DV, 11U))
421#define VAL_GPIOA_AFRH (PIN_AFIO_AF(GPIOA_USB_HS_BUSON, 0U) | \
422 PIN_AFIO_AF(GPIOA_OTG_FS_VBUS, 0U) | \
423 PIN_AFIO_AF(GPIOA_OTG_FS_ID, 10U) | \
424 PIN_AFIO_AF(GPIOA_OTG_FS_DM, 10U) | \
425 PIN_AFIO_AF(GPIOA_OTG_FS_DP, 10U) | \
426 PIN_AFIO_AF(GPIOA_JTAG_TMS, 0U) | \
427 PIN_AFIO_AF(GPIOA_JTAG_TCK, 0U) | \
428 PIN_AFIO_AF(GPIOA_JTAG_TDI, 0U))
429
430/*
431 * GPIOB setup:
432 *
433 * PB0 - USB_FS_BUSON (output pushpull maximum).
434 * PB1 - USB_HS_FAULT (input floating).
435 * PB2 - BOOT1 (input floating).
436 * PB3 - JTAG_TDO (alternate 0).
437 * PB4 - JTAG_TRST (alternate 0).
438 * PB5 - PIN5 (input pullup).
439 * PB6 - PIN6 (input pullup).
440 * PB7 - PIN7 (input pullup).
441 * PB8 - I2C1_SCL (alternate 4).
442 * PB9 - I2C1_SDA (alternate 4).
443 * PB10 - SPI2_SCK (alternate 5).
444 * PB11 - PIN11 (input pullup).
445 * PB12 - OTG_HS_ID (alternate 12).
446 * PB13 - OTG_HS_VBUS (input pulldown).
447 * PB14 - OTG_HS_DM (alternate 12).
448 * PB15 - OTG_HS_DP (alternate 12).
449 */
450#define VAL_GPIOB_MODER (PIN_MODE_OUTPUT(GPIOB_USB_FS_BUSON) | \
451 PIN_MODE_INPUT(GPIOB_USB_HS_FAULT) | \
452 PIN_MODE_INPUT(GPIOB_BOOT1) | \
453 PIN_MODE_ALTERNATE(GPIOB_JTAG_TDO) | \
454 PIN_MODE_ALTERNATE(GPIOB_JTAG_TRST) | \
455 PIN_MODE_INPUT(GPIOB_PIN5) | \
456 PIN_MODE_INPUT(GPIOB_PIN6) | \
457 PIN_MODE_INPUT(GPIOB_PIN7) | \
458 PIN_MODE_ALTERNATE(GPIOB_I2C1_SCL) | \
459 PIN_MODE_ALTERNATE(GPIOB_I2C1_SDA) | \
460 PIN_MODE_ALTERNATE(GPIOB_SPI2_SCK) | \
461 PIN_MODE_INPUT(GPIOB_PIN11) | \
462 PIN_MODE_ALTERNATE(GPIOB_OTG_HS_ID) | \
463 PIN_MODE_INPUT(GPIOB_OTG_HS_VBUS) | \
464 PIN_MODE_ALTERNATE(GPIOB_OTG_HS_DM) | \
465 PIN_MODE_ALTERNATE(GPIOB_OTG_HS_DP))
466#define VAL_GPIOB_OTYPER (PIN_OTYPE_PUSHPULL(GPIOB_USB_FS_BUSON) |\
467 PIN_OTYPE_PUSHPULL(GPIOB_USB_HS_FAULT) |\
468 PIN_OTYPE_PUSHPULL(GPIOB_BOOT1) | \
469 PIN_OTYPE_PUSHPULL(GPIOB_JTAG_TDO) | \
470 PIN_OTYPE_PUSHPULL(GPIOB_JTAG_TRST) | \
471 PIN_OTYPE_PUSHPULL(GPIOB_PIN5) | \
472 PIN_OTYPE_PUSHPULL(GPIOB_PIN6) | \
473 PIN_OTYPE_PUSHPULL(GPIOB_PIN7) | \
474 PIN_OTYPE_OPENDRAIN(GPIOB_I2C1_SCL) | \
475 PIN_OTYPE_OPENDRAIN(GPIOB_I2C1_SDA) | \
476 PIN_OTYPE_PUSHPULL(GPIOB_SPI2_SCK) | \
477 PIN_OTYPE_PUSHPULL(GPIOB_PIN11) | \
478 PIN_OTYPE_PUSHPULL(GPIOB_OTG_HS_ID) | \
479 PIN_OTYPE_PUSHPULL(GPIOB_OTG_HS_VBUS) |\
480 PIN_OTYPE_PUSHPULL(GPIOB_OTG_HS_DM) | \
481 PIN_OTYPE_PUSHPULL(GPIOB_OTG_HS_DP))
482#define VAL_GPIOB_OSPEEDR (PIN_OSPEED_HIGH(GPIOB_USB_FS_BUSON) | \
483 PIN_OSPEED_HIGH(GPIOB_USB_HS_FAULT) | \
484 PIN_OSPEED_HIGH(GPIOB_BOOT1) | \
485 PIN_OSPEED_HIGH(GPIOB_JTAG_TDO) | \
486 PIN_OSPEED_HIGH(GPIOB_JTAG_TRST) | \
487 PIN_OSPEED_HIGH(GPIOB_PIN5) | \
488 PIN_OSPEED_HIGH(GPIOB_PIN6) | \
489 PIN_OSPEED_HIGH(GPIOB_PIN7) | \
490 PIN_OSPEED_HIGH(GPIOB_I2C1_SCL) | \
491 PIN_OSPEED_HIGH(GPIOB_I2C1_SDA) | \
492 PIN_OSPEED_HIGH(GPIOB_SPI2_SCK) | \
493 PIN_OSPEED_HIGH(GPIOB_PIN11) | \
494 PIN_OSPEED_HIGH(GPIOB_OTG_HS_ID) | \
495 PIN_OSPEED_HIGH(GPIOB_OTG_HS_VBUS) | \
496 PIN_OSPEED_HIGH(GPIOB_OTG_HS_DM) | \
497 PIN_OSPEED_HIGH(GPIOB_OTG_HS_DP))
498#define VAL_GPIOB_PUPDR (PIN_PUPDR_FLOATING(GPIOB_USB_FS_BUSON) |\
499 PIN_PUPDR_FLOATING(GPIOB_USB_HS_FAULT) |\
500 PIN_PUPDR_FLOATING(GPIOB_BOOT1) | \
501 PIN_PUPDR_FLOATING(GPIOB_JTAG_TDO) | \
502 PIN_PUPDR_FLOATING(GPIOB_JTAG_TRST) | \
503 PIN_PUPDR_PULLUP(GPIOB_PIN5) | \
504 PIN_PUPDR_PULLUP(GPIOB_PIN6) | \
505 PIN_PUPDR_PULLUP(GPIOB_PIN7) | \
506 PIN_PUPDR_FLOATING(GPIOB_I2C1_SCL) | \
507 PIN_PUPDR_FLOATING(GPIOB_I2C1_SDA) | \
508 PIN_PUPDR_FLOATING(GPIOB_SPI2_SCK) | \
509 PIN_PUPDR_PULLUP(GPIOB_PIN11) | \
510 PIN_PUPDR_FLOATING(GPIOB_OTG_HS_ID) | \
511 PIN_PUPDR_PULLDOWN(GPIOB_OTG_HS_VBUS) |\
512 PIN_PUPDR_FLOATING(GPIOB_OTG_HS_DM) | \
513 PIN_PUPDR_FLOATING(GPIOB_OTG_HS_DP))
514#define VAL_GPIOB_ODR (PIN_ODR_LOW(GPIOB_USB_FS_BUSON) | \
515 PIN_ODR_HIGH(GPIOB_USB_HS_FAULT) | \
516 PIN_ODR_HIGH(GPIOB_BOOT1) | \
517 PIN_ODR_HIGH(GPIOB_JTAG_TDO) | \
518 PIN_ODR_HIGH(GPIOB_JTAG_TRST) | \
519 PIN_ODR_HIGH(GPIOB_PIN5) | \
520 PIN_ODR_HIGH(GPIOB_PIN6) | \
521 PIN_ODR_HIGH(GPIOB_PIN7) | \
522 PIN_ODR_HIGH(GPIOB_I2C1_SCL) | \
523 PIN_ODR_HIGH(GPIOB_I2C1_SDA) | \
524 PIN_ODR_HIGH(GPIOB_SPI2_SCK) | \
525 PIN_ODR_HIGH(GPIOB_PIN11) | \
526 PIN_ODR_HIGH(GPIOB_OTG_HS_ID) | \
527 PIN_ODR_HIGH(GPIOB_OTG_HS_VBUS) | \
528 PIN_ODR_HIGH(GPIOB_OTG_HS_DM) | \
529 PIN_ODR_HIGH(GPIOB_OTG_HS_DP))
530#define VAL_GPIOB_AFRL (PIN_AFIO_AF(GPIOB_USB_FS_BUSON, 0U) | \
531 PIN_AFIO_AF(GPIOB_USB_HS_FAULT, 0U) | \
532 PIN_AFIO_AF(GPIOB_BOOT1, 0U) | \
533 PIN_AFIO_AF(GPIOB_JTAG_TDO, 0U) | \
534 PIN_AFIO_AF(GPIOB_JTAG_TRST, 0U) | \
535 PIN_AFIO_AF(GPIOB_PIN5, 0U) | \
536 PIN_AFIO_AF(GPIOB_PIN6, 0U) | \
537 PIN_AFIO_AF(GPIOB_PIN7, 0U))
538#define VAL_GPIOB_AFRH (PIN_AFIO_AF(GPIOB_I2C1_SCL, 4U) | \
539 PIN_AFIO_AF(GPIOB_I2C1_SDA, 4U) | \
540 PIN_AFIO_AF(GPIOB_SPI2_SCK, 5U) | \
541 PIN_AFIO_AF(GPIOB_PIN11, 0U) | \
542 PIN_AFIO_AF(GPIOB_OTG_HS_ID, 12U) | \
543 PIN_AFIO_AF(GPIOB_OTG_HS_VBUS, 0U) | \
544 PIN_AFIO_AF(GPIOB_OTG_HS_DM, 12U) | \
545 PIN_AFIO_AF(GPIOB_OTG_HS_DP, 12U))
546
547/*
548 * GPIOC setup:
549 *
550 * PC0 - PIN0 (input pullup).
551 * PC1 - ETH_RMII_MDC (alternate 11).
552 * PC2 - SPI2_MISO (alternate 5).
553 * PC3 - SPI2_MOSI (alternate 5).
554 * PC4 - ETH_RMII_RXD0 (alternate 11).
555 * PC5 - ETH_RMII_RXD1 (alternate 11).
556 * PC6 - USART6_TX (alternate 8).
557 * PC7 - USART6_RX (alternate 8).
558 * PC8 - SD_D0 (alternate 12).
559 * PC9 - SD_D1 (alternate 12).
560 * PC10 - SD_D2 (alternate 12).
561 * PC11 - SD_D3 (alternate 12).
562 * PC12 - SD_CLK (alternate 12).
563 * PC13 - LED (output pushpull maximum).
564 * PC14 - OSC32_IN (input floating).
565 * PC15 - OSC32_OUT (input floating).
566 */
567#define VAL_GPIOC_MODER (PIN_MODE_INPUT(GPIOC_PIN0) | \
568 PIN_MODE_ALTERNATE(GPIOC_ETH_RMII_MDC) |\
569 PIN_MODE_ALTERNATE(GPIOC_SPI2_MISO) | \
570 PIN_MODE_ALTERNATE(GPIOC_SPI2_MOSI) | \
571 PIN_MODE_ALTERNATE(GPIOC_ETH_RMII_RXD0) |\
572 PIN_MODE_ALTERNATE(GPIOC_ETH_RMII_RXD1) |\
573 PIN_MODE_ALTERNATE(GPIOC_USART6_TX) | \
574 PIN_MODE_ALTERNATE(GPIOC_USART6_RX) | \
575 PIN_MODE_ALTERNATE(GPIOC_SD_D0) | \
576 PIN_MODE_ALTERNATE(GPIOC_SD_D1) | \
577 PIN_MODE_ALTERNATE(GPIOC_SD_D2) | \
578 PIN_MODE_ALTERNATE(GPIOC_SD_D3) | \
579 PIN_MODE_ALTERNATE(GPIOC_SD_CLK) | \
580 PIN_MODE_OUTPUT(GPIOC_LED) | \
581 PIN_MODE_INPUT(GPIOC_OSC32_IN) | \
582 PIN_MODE_INPUT(GPIOC_OSC32_OUT))
583#define VAL_GPIOC_OTYPER (PIN_OTYPE_PUSHPULL(GPIOC_PIN0) | \
584 PIN_OTYPE_PUSHPULL(GPIOC_ETH_RMII_MDC) |\
585 PIN_OTYPE_PUSHPULL(GPIOC_SPI2_MISO) | \
586 PIN_OTYPE_PUSHPULL(GPIOC_SPI2_MOSI) | \
587 PIN_OTYPE_PUSHPULL(GPIOC_ETH_RMII_RXD0) |\
588 PIN_OTYPE_PUSHPULL(GPIOC_ETH_RMII_RXD1) |\
589 PIN_OTYPE_PUSHPULL(GPIOC_USART6_TX) | \
590 PIN_OTYPE_PUSHPULL(GPIOC_USART6_RX) | \
591 PIN_OTYPE_PUSHPULL(GPIOC_SD_D0) | \
592 PIN_OTYPE_PUSHPULL(GPIOC_SD_D1) | \
593 PIN_OTYPE_PUSHPULL(GPIOC_SD_D2) | \
594 PIN_OTYPE_PUSHPULL(GPIOC_SD_D3) | \
595 PIN_OTYPE_PUSHPULL(GPIOC_SD_CLK) | \
596 PIN_OTYPE_PUSHPULL(GPIOC_LED) | \
597 PIN_OTYPE_PUSHPULL(GPIOC_OSC32_IN) | \
598 PIN_OTYPE_PUSHPULL(GPIOC_OSC32_OUT))
599#define VAL_GPIOC_OSPEEDR (PIN_OSPEED_HIGH(GPIOC_PIN0) | \
600 PIN_OSPEED_HIGH(GPIOC_ETH_RMII_MDC) | \
601 PIN_OSPEED_HIGH(GPIOC_SPI2_MISO) | \
602 PIN_OSPEED_HIGH(GPIOC_SPI2_MOSI) | \
603 PIN_OSPEED_HIGH(GPIOC_ETH_RMII_RXD0) | \
604 PIN_OSPEED_HIGH(GPIOC_ETH_RMII_RXD1) | \
605 PIN_OSPEED_HIGH(GPIOC_USART6_TX) | \
606 PIN_OSPEED_HIGH(GPIOC_USART6_RX) | \
607 PIN_OSPEED_HIGH(GPIOC_SD_D0) | \
608 PIN_OSPEED_HIGH(GPIOC_SD_D1) | \
609 PIN_OSPEED_HIGH(GPIOC_SD_D2) | \
610 PIN_OSPEED_HIGH(GPIOC_SD_D3) | \
611 PIN_OSPEED_HIGH(GPIOC_SD_CLK) | \
612 PIN_OSPEED_HIGH(GPIOC_LED) | \
613 PIN_OSPEED_HIGH(GPIOC_OSC32_IN) | \
614 PIN_OSPEED_HIGH(GPIOC_OSC32_OUT))
615#define VAL_GPIOC_PUPDR (PIN_PUPDR_PULLUP(GPIOC_PIN0) | \
616 PIN_PUPDR_FLOATING(GPIOC_ETH_RMII_MDC) |\
617 PIN_PUPDR_FLOATING(GPIOC_SPI2_MISO) | \
618 PIN_PUPDR_FLOATING(GPIOC_SPI2_MOSI) | \
619 PIN_PUPDR_FLOATING(GPIOC_ETH_RMII_RXD0) |\
620 PIN_PUPDR_FLOATING(GPIOC_ETH_RMII_RXD1) |\
621 PIN_PUPDR_FLOATING(GPIOC_USART6_TX) | \
622 PIN_PUPDR_FLOATING(GPIOC_USART6_RX) | \
623 PIN_PUPDR_FLOATING(GPIOC_SD_D0) | \
624 PIN_PUPDR_FLOATING(GPIOC_SD_D1) | \
625 PIN_PUPDR_FLOATING(GPIOC_SD_D2) | \
626 PIN_PUPDR_FLOATING(GPIOC_SD_D3) | \
627 PIN_PUPDR_FLOATING(GPIOC_SD_CLK) | \
628 PIN_PUPDR_FLOATING(GPIOC_LED) | \
629 PIN_PUPDR_FLOATING(GPIOC_OSC32_IN) | \
630 PIN_PUPDR_FLOATING(GPIOC_OSC32_OUT))
631#define VAL_GPIOC_ODR (PIN_ODR_HIGH(GPIOC_PIN0) | \
632 PIN_ODR_HIGH(GPIOC_ETH_RMII_MDC) | \
633 PIN_ODR_HIGH(GPIOC_SPI2_MISO) | \
634 PIN_ODR_HIGH(GPIOC_SPI2_MOSI) | \
635 PIN_ODR_HIGH(GPIOC_ETH_RMII_RXD0) | \
636 PIN_ODR_HIGH(GPIOC_ETH_RMII_RXD1) | \
637 PIN_ODR_HIGH(GPIOC_USART6_TX) | \
638 PIN_ODR_HIGH(GPIOC_USART6_RX) | \
639 PIN_ODR_HIGH(GPIOC_SD_D0) | \
640 PIN_ODR_HIGH(GPIOC_SD_D1) | \
641 PIN_ODR_HIGH(GPIOC_SD_D2) | \
642 PIN_ODR_HIGH(GPIOC_SD_D3) | \
643 PIN_ODR_HIGH(GPIOC_SD_CLK) | \
644 PIN_ODR_HIGH(GPIOC_LED) | \
645 PIN_ODR_HIGH(GPIOC_OSC32_IN) | \
646 PIN_ODR_HIGH(GPIOC_OSC32_OUT))
647#define VAL_GPIOC_AFRL (PIN_AFIO_AF(GPIOC_PIN0, 0U) | \
648 PIN_AFIO_AF(GPIOC_ETH_RMII_MDC, 11U) | \
649 PIN_AFIO_AF(GPIOC_SPI2_MISO, 5U) | \
650 PIN_AFIO_AF(GPIOC_SPI2_MOSI, 5U) | \
651 PIN_AFIO_AF(GPIOC_ETH_RMII_RXD0, 11U) |\
652 PIN_AFIO_AF(GPIOC_ETH_RMII_RXD1, 11U) |\
653 PIN_AFIO_AF(GPIOC_USART6_TX, 8U) | \
654 PIN_AFIO_AF(GPIOC_USART6_RX, 8U))
655#define VAL_GPIOC_AFRH (PIN_AFIO_AF(GPIOC_SD_D0, 12U) | \
656 PIN_AFIO_AF(GPIOC_SD_D1, 12U) | \
657 PIN_AFIO_AF(GPIOC_SD_D2, 12U) | \
658 PIN_AFIO_AF(GPIOC_SD_D3, 12U) | \
659 PIN_AFIO_AF(GPIOC_SD_CLK, 12U) | \
660 PIN_AFIO_AF(GPIOC_LED, 0U) | \
661 PIN_AFIO_AF(GPIOC_OSC32_IN, 0U) | \
662 PIN_AFIO_AF(GPIOC_OSC32_OUT, 0U))
663
664/*
665 * GPIOD setup:
666 *
667 * PD0 - PIN0 (input pullup).
668 * PD1 - PIN1 (input pullup).
669 * PD2 - SD_CMD (alternate 12).
670 * PD3 - PIN3 (input pullup).
671 * PD4 - PIN4 (input pullup).
672 * PD5 - PIN5 (input pullup).
673 * PD6 - PIN6 (input pullup).
674 * PD7 - PIN7 (input pullup).
675 * PD8 - PIN8 (input pullup).
676 * PD9 - PIN9 (input pullup).
677 * PD10 - PIN10 (input pullup).
678 * PD11 - PIN11 (input pullup).
679 * PD12 - PIN12 (input pullup).
680 * PD13 - PIN13 (input pullup).
681 * PD14 - PIN14 (input pullup).
682 * PD15 - PIN15 (input pullup).
683 */
684#define VAL_GPIOD_MODER (PIN_MODE_INPUT(GPIOD_PIN0) | \
685 PIN_MODE_INPUT(GPIOD_PIN1) | \
686 PIN_MODE_ALTERNATE(GPIOD_SD_CMD) | \
687 PIN_MODE_INPUT(GPIOD_PIN3) | \
688 PIN_MODE_INPUT(GPIOD_PIN4) | \
689 PIN_MODE_INPUT(GPIOD_PIN5) | \
690 PIN_MODE_INPUT(GPIOD_PIN6) | \
691 PIN_MODE_INPUT(GPIOD_PIN7) | \
692 PIN_MODE_INPUT(GPIOD_PIN8) | \
693 PIN_MODE_INPUT(GPIOD_PIN9) | \
694 PIN_MODE_INPUT(GPIOD_PIN10) | \
695 PIN_MODE_INPUT(GPIOD_PIN11) | \
696 PIN_MODE_INPUT(GPIOD_PIN12) | \
697 PIN_MODE_INPUT(GPIOD_PIN13) | \
698 PIN_MODE_INPUT(GPIOD_PIN14) | \
699 PIN_MODE_INPUT(GPIOD_PIN15))
700#define VAL_GPIOD_OTYPER (PIN_OTYPE_PUSHPULL(GPIOD_PIN0) | \
701 PIN_OTYPE_PUSHPULL(GPIOD_PIN1) | \
702 PIN_OTYPE_PUSHPULL(GPIOD_SD_CMD) | \
703 PIN_OTYPE_PUSHPULL(GPIOD_PIN3) | \
704 PIN_OTYPE_PUSHPULL(GPIOD_PIN4) | \
705 PIN_OTYPE_PUSHPULL(GPIOD_PIN5) | \
706 PIN_OTYPE_PUSHPULL(GPIOD_PIN6) | \
707 PIN_OTYPE_PUSHPULL(GPIOD_PIN7) | \
708 PIN_OTYPE_PUSHPULL(GPIOD_PIN8) | \
709 PIN_OTYPE_PUSHPULL(GPIOD_PIN9) | \
710 PIN_OTYPE_PUSHPULL(GPIOD_PIN10) | \
711 PIN_OTYPE_PUSHPULL(GPIOD_PIN11) | \
712 PIN_OTYPE_PUSHPULL(GPIOD_PIN12) | \
713 PIN_OTYPE_PUSHPULL(GPIOD_PIN13) | \
714 PIN_OTYPE_PUSHPULL(GPIOD_PIN14) | \
715 PIN_OTYPE_PUSHPULL(GPIOD_PIN15))
716#define VAL_GPIOD_OSPEEDR (PIN_OSPEED_HIGH(GPIOD_PIN0) | \
717 PIN_OSPEED_HIGH(GPIOD_PIN1) | \
718 PIN_OSPEED_HIGH(GPIOD_SD_CMD) | \
719 PIN_OSPEED_HIGH(GPIOD_PIN3) | \
720 PIN_OSPEED_HIGH(GPIOD_PIN4) | \
721 PIN_OSPEED_HIGH(GPIOD_PIN5) | \
722 PIN_OSPEED_HIGH(GPIOD_PIN6) | \
723 PIN_OSPEED_HIGH(GPIOD_PIN7) | \
724 PIN_OSPEED_HIGH(GPIOD_PIN8) | \
725 PIN_OSPEED_HIGH(GPIOD_PIN9) | \
726 PIN_OSPEED_HIGH(GPIOD_PIN10) | \
727 PIN_OSPEED_HIGH(GPIOD_PIN11) | \
728 PIN_OSPEED_HIGH(GPIOD_PIN12) | \
729 PIN_OSPEED_HIGH(GPIOD_PIN13) | \
730 PIN_OSPEED_HIGH(GPIOD_PIN14) | \
731 PIN_OSPEED_HIGH(GPIOD_PIN15))
732#define VAL_GPIOD_PUPDR (PIN_PUPDR_PULLUP(GPIOD_PIN0) | \
733 PIN_PUPDR_PULLUP(GPIOD_PIN1) | \
734 PIN_PUPDR_FLOATING(GPIOD_SD_CMD) | \
735 PIN_PUPDR_PULLUP(GPIOD_PIN3) | \
736 PIN_PUPDR_PULLUP(GPIOD_PIN4) | \
737 PIN_PUPDR_PULLUP(GPIOD_PIN5) | \
738 PIN_PUPDR_PULLUP(GPIOD_PIN6) | \
739 PIN_PUPDR_PULLUP(GPIOD_PIN7) | \
740 PIN_PUPDR_PULLUP(GPIOD_PIN8) | \
741 PIN_PUPDR_PULLUP(GPIOD_PIN9) | \
742 PIN_PUPDR_PULLUP(GPIOD_PIN10) | \
743 PIN_PUPDR_PULLUP(GPIOD_PIN11) | \
744 PIN_PUPDR_PULLUP(GPIOD_PIN12) | \
745 PIN_PUPDR_PULLUP(GPIOD_PIN13) | \
746 PIN_PUPDR_PULLUP(GPIOD_PIN14) | \
747 PIN_PUPDR_PULLUP(GPIOD_PIN15))
748#define VAL_GPIOD_ODR (PIN_ODR_HIGH(GPIOD_PIN0) | \
749 PIN_ODR_HIGH(GPIOD_PIN1) | \
750 PIN_ODR_HIGH(GPIOD_SD_CMD) | \
751 PIN_ODR_HIGH(GPIOD_PIN3) | \
752 PIN_ODR_HIGH(GPIOD_PIN4) | \
753 PIN_ODR_HIGH(GPIOD_PIN5) | \
754 PIN_ODR_HIGH(GPIOD_PIN6) | \
755 PIN_ODR_HIGH(GPIOD_PIN7) | \
756 PIN_ODR_HIGH(GPIOD_PIN8) | \
757 PIN_ODR_HIGH(GPIOD_PIN9) | \
758 PIN_ODR_HIGH(GPIOD_PIN10) | \
759 PIN_ODR_HIGH(GPIOD_PIN11) | \
760 PIN_ODR_HIGH(GPIOD_PIN12) | \
761 PIN_ODR_HIGH(GPIOD_PIN13) | \
762 PIN_ODR_HIGH(GPIOD_PIN14) | \
763 PIN_ODR_HIGH(GPIOD_PIN15))
764#define VAL_GPIOD_AFRL (PIN_AFIO_AF(GPIOD_PIN0, 0U) | \
765 PIN_AFIO_AF(GPIOD_PIN1, 0U) | \
766 PIN_AFIO_AF(GPIOD_SD_CMD, 12U) | \
767 PIN_AFIO_AF(GPIOD_PIN3, 0U) | \
768 PIN_AFIO_AF(GPIOD_PIN4, 0U) | \
769 PIN_AFIO_AF(GPIOD_PIN5, 0U) | \
770 PIN_AFIO_AF(GPIOD_PIN6, 0U) | \
771 PIN_AFIO_AF(GPIOD_PIN7, 0U))
772#define VAL_GPIOD_AFRH (PIN_AFIO_AF(GPIOD_PIN8, 0U) | \
773 PIN_AFIO_AF(GPIOD_PIN9, 0U) | \
774 PIN_AFIO_AF(GPIOD_PIN10, 0U) | \
775 PIN_AFIO_AF(GPIOD_PIN11, 0U) | \
776 PIN_AFIO_AF(GPIOD_PIN12, 0U) | \
777 PIN_AFIO_AF(GPIOD_PIN13, 0U) | \
778 PIN_AFIO_AF(GPIOD_PIN14, 0U) | \
779 PIN_AFIO_AF(GPIOD_PIN15, 0U))
780
781/*
782 * GPIOE setup:
783 *
784 * PE0 - PIN0 (input pullup).
785 * PE1 - PIN1 (input pullup).
786 * PE2 - PIN2 (input pullup).
787 * PE3 - PIN3 (input pullup).
788 * PE4 - PIN4 (input pullup).
789 * PE5 - PIN5 (input pullup).
790 * PE6 - PIN6 (input pullup).
791 * PE7 - PIN7 (input pullup).
792 * PE8 - PIN8 (input pullup).
793 * PE9 - PIN9 (input pullup).
794 * PE10 - PIN10 (input pullup).
795 * PE11 - PIN11 (input pullup).
796 * PE12 - PIN12 (input pullup).
797 * PE13 - PIN13 (input pullup).
798 * PE14 - PIN14 (input pullup).
799 * PE15 - PIN15 (input pullup).
800 */
801#define VAL_GPIOE_MODER (PIN_MODE_INPUT(GPIOE_PIN0) | \
802 PIN_MODE_INPUT(GPIOE_PIN1) | \
803 PIN_MODE_INPUT(GPIOE_PIN2) | \
804 PIN_MODE_INPUT(GPIOE_PIN3) | \
805 PIN_MODE_INPUT(GPIOE_PIN4) | \
806 PIN_MODE_INPUT(GPIOE_PIN5) | \
807 PIN_MODE_INPUT(GPIOE_PIN6) | \
808 PIN_MODE_INPUT(GPIOE_PIN7) | \
809 PIN_MODE_INPUT(GPIOE_PIN8) | \
810 PIN_MODE_INPUT(GPIOE_PIN9) | \
811 PIN_MODE_INPUT(GPIOE_PIN10) | \
812 PIN_MODE_INPUT(GPIOE_PIN11) | \
813 PIN_MODE_INPUT(GPIOE_PIN12) | \
814 PIN_MODE_INPUT(GPIOE_PIN13) | \
815 PIN_MODE_INPUT(GPIOE_PIN14) | \
816 PIN_MODE_INPUT(GPIOE_PIN15))
817#define VAL_GPIOE_OTYPER (PIN_OTYPE_PUSHPULL(GPIOE_PIN0) | \
818 PIN_OTYPE_PUSHPULL(GPIOE_PIN1) | \
819 PIN_OTYPE_PUSHPULL(GPIOE_PIN2) | \
820 PIN_OTYPE_PUSHPULL(GPIOE_PIN3) | \
821 PIN_OTYPE_PUSHPULL(GPIOE_PIN4) | \
822 PIN_OTYPE_PUSHPULL(GPIOE_PIN5) | \
823 PIN_OTYPE_PUSHPULL(GPIOE_PIN6) | \
824 PIN_OTYPE_PUSHPULL(GPIOE_PIN7) | \
825 PIN_OTYPE_PUSHPULL(GPIOE_PIN8) | \
826 PIN_OTYPE_PUSHPULL(GPIOE_PIN9) | \
827 PIN_OTYPE_PUSHPULL(GPIOE_PIN10) | \
828 PIN_OTYPE_PUSHPULL(GPIOE_PIN11) | \
829 PIN_OTYPE_PUSHPULL(GPIOE_PIN12) | \
830 PIN_OTYPE_PUSHPULL(GPIOE_PIN13) | \
831 PIN_OTYPE_PUSHPULL(GPIOE_PIN14) | \
832 PIN_OTYPE_PUSHPULL(GPIOE_PIN15))
833#define VAL_GPIOE_OSPEEDR (PIN_OSPEED_HIGH(GPIOE_PIN0) | \
834 PIN_OSPEED_HIGH(GPIOE_PIN1) | \
835 PIN_OSPEED_HIGH(GPIOE_PIN2) | \
836 PIN_OSPEED_HIGH(GPIOE_PIN3) | \
837 PIN_OSPEED_HIGH(GPIOE_PIN4) | \
838 PIN_OSPEED_HIGH(GPIOE_PIN5) | \
839 PIN_OSPEED_HIGH(GPIOE_PIN6) | \
840 PIN_OSPEED_HIGH(GPIOE_PIN7) | \
841 PIN_OSPEED_HIGH(GPIOE_PIN8) | \
842 PIN_OSPEED_HIGH(GPIOE_PIN9) | \
843 PIN_OSPEED_HIGH(GPIOE_PIN10) | \
844 PIN_OSPEED_HIGH(GPIOE_PIN11) | \
845 PIN_OSPEED_HIGH(GPIOE_PIN12) | \
846 PIN_OSPEED_HIGH(GPIOE_PIN13) | \
847 PIN_OSPEED_HIGH(GPIOE_PIN14) | \
848 PIN_OSPEED_HIGH(GPIOE_PIN15))
849#define VAL_GPIOE_PUPDR (PIN_PUPDR_PULLUP(GPIOE_PIN0) | \
850 PIN_PUPDR_PULLUP(GPIOE_PIN1) | \
851 PIN_PUPDR_PULLUP(GPIOE_PIN2) | \
852 PIN_PUPDR_PULLUP(GPIOE_PIN3) | \
853 PIN_PUPDR_PULLUP(GPIOE_PIN4) | \
854 PIN_PUPDR_PULLUP(GPIOE_PIN5) | \
855 PIN_PUPDR_PULLUP(GPIOE_PIN6) | \
856 PIN_PUPDR_PULLUP(GPIOE_PIN7) | \
857 PIN_PUPDR_PULLUP(GPIOE_PIN8) | \
858 PIN_PUPDR_PULLUP(GPIOE_PIN9) | \
859 PIN_PUPDR_PULLUP(GPIOE_PIN10) | \
860 PIN_PUPDR_PULLUP(GPIOE_PIN11) | \
861 PIN_PUPDR_PULLUP(GPIOE_PIN12) | \
862 PIN_PUPDR_PULLUP(GPIOE_PIN13) | \
863 PIN_PUPDR_PULLUP(GPIOE_PIN14) | \
864 PIN_PUPDR_PULLUP(GPIOE_PIN15))
865#define VAL_GPIOE_ODR (PIN_ODR_HIGH(GPIOE_PIN0) | \
866 PIN_ODR_HIGH(GPIOE_PIN1) | \
867 PIN_ODR_HIGH(GPIOE_PIN2) | \
868 PIN_ODR_HIGH(GPIOE_PIN3) | \
869 PIN_ODR_HIGH(GPIOE_PIN4) | \
870 PIN_ODR_HIGH(GPIOE_PIN5) | \
871 PIN_ODR_HIGH(GPIOE_PIN6) | \
872 PIN_ODR_HIGH(GPIOE_PIN7) | \
873 PIN_ODR_HIGH(GPIOE_PIN8) | \
874 PIN_ODR_HIGH(GPIOE_PIN9) | \
875 PIN_ODR_HIGH(GPIOE_PIN10) | \
876 PIN_ODR_HIGH(GPIOE_PIN11) | \
877 PIN_ODR_HIGH(GPIOE_PIN12) | \
878 PIN_ODR_HIGH(GPIOE_PIN13) | \
879 PIN_ODR_HIGH(GPIOE_PIN14) | \
880 PIN_ODR_HIGH(GPIOE_PIN15))
881#define VAL_GPIOE_AFRL (PIN_AFIO_AF(GPIOE_PIN0, 0U) | \
882 PIN_AFIO_AF(GPIOE_PIN1, 0U) | \
883 PIN_AFIO_AF(GPIOE_PIN2, 0U) | \
884 PIN_AFIO_AF(GPIOE_PIN3, 0U) | \
885 PIN_AFIO_AF(GPIOE_PIN4, 0U) | \
886 PIN_AFIO_AF(GPIOE_PIN5, 0U) | \
887 PIN_AFIO_AF(GPIOE_PIN6, 0U) | \
888 PIN_AFIO_AF(GPIOE_PIN7, 0U))
889#define VAL_GPIOE_AFRH (PIN_AFIO_AF(GPIOE_PIN8, 0U) | \
890 PIN_AFIO_AF(GPIOE_PIN9, 0U) | \
891 PIN_AFIO_AF(GPIOE_PIN10, 0U) | \
892 PIN_AFIO_AF(GPIOE_PIN11, 0U) | \
893 PIN_AFIO_AF(GPIOE_PIN12, 0U) | \
894 PIN_AFIO_AF(GPIOE_PIN13, 0U) | \
895 PIN_AFIO_AF(GPIOE_PIN14, 0U) | \
896 PIN_AFIO_AF(GPIOE_PIN15, 0U))
897
898/*
899 * GPIOF setup:
900 *
901 * PF0 - PIN0 (input pullup).
902 * PF1 - PIN1 (input pullup).
903 * PF2 - PIN2 (input pullup).
904 * PF3 - PIN3 (input pullup).
905 * PF4 - PIN4 (input pullup).
906 * PF5 - PIN5 (input pullup).
907 * PF6 - PIN6 (input pullup).
908 * PF7 - PIN7 (input pullup).
909 * PF8 - PIN8 (input pullup).
910 * PF9 - PIN9 (input pullup).
911 * PF10 - PIN10 (input pullup).
912 * PF11 - USB_FS_FAULT (input floating).
913 * PF12 - PIN12 (input pullup).
914 * PF13 - PIN13 (input pullup).
915 * PF14 - PIN14 (input pullup).
916 * PF15 - PIN15 (input pullup).
917 */
918#define VAL_GPIOF_MODER (PIN_MODE_INPUT(GPIOF_PIN0) | \
919 PIN_MODE_INPUT(GPIOF_PIN1) | \
920 PIN_MODE_INPUT(GPIOF_PIN2) | \
921 PIN_MODE_INPUT(GPIOF_PIN3) | \
922 PIN_MODE_INPUT(GPIOF_PIN4) | \
923 PIN_MODE_INPUT(GPIOF_PIN5) | \
924 PIN_MODE_INPUT(GPIOF_PIN6) | \
925 PIN_MODE_INPUT(GPIOF_PIN7) | \
926 PIN_MODE_INPUT(GPIOF_PIN8) | \
927 PIN_MODE_INPUT(GPIOF_PIN9) | \
928 PIN_MODE_INPUT(GPIOF_PIN10) | \
929 PIN_MODE_INPUT(GPIOF_USB_FS_FAULT) | \
930 PIN_MODE_INPUT(GPIOF_PIN12) | \
931 PIN_MODE_INPUT(GPIOF_PIN13) | \
932 PIN_MODE_INPUT(GPIOF_PIN14) | \
933 PIN_MODE_INPUT(GPIOF_PIN15))
934#define VAL_GPIOF_OTYPER (PIN_OTYPE_PUSHPULL(GPIOF_PIN0) | \
935 PIN_OTYPE_PUSHPULL(GPIOF_PIN1) | \
936 PIN_OTYPE_PUSHPULL(GPIOF_PIN2) | \
937 PIN_OTYPE_PUSHPULL(GPIOF_PIN3) | \
938 PIN_OTYPE_PUSHPULL(GPIOF_PIN4) | \
939 PIN_OTYPE_PUSHPULL(GPIOF_PIN5) | \
940 PIN_OTYPE_PUSHPULL(GPIOF_PIN6) | \
941 PIN_OTYPE_PUSHPULL(GPIOF_PIN7) | \
942 PIN_OTYPE_PUSHPULL(GPIOF_PIN8) | \
943 PIN_OTYPE_PUSHPULL(GPIOF_PIN9) | \
944 PIN_OTYPE_PUSHPULL(GPIOF_PIN10) | \
945 PIN_OTYPE_PUSHPULL(GPIOF_USB_FS_FAULT) |\
946 PIN_OTYPE_PUSHPULL(GPIOF_PIN12) | \
947 PIN_OTYPE_PUSHPULL(GPIOF_PIN13) | \
948 PIN_OTYPE_PUSHPULL(GPIOF_PIN14) | \
949 PIN_OTYPE_PUSHPULL(GPIOF_PIN15))
950#define VAL_GPIOF_OSPEEDR (PIN_OSPEED_HIGH(GPIOF_PIN0) | \
951 PIN_OSPEED_HIGH(GPIOF_PIN1) | \
952 PIN_OSPEED_HIGH(GPIOF_PIN2) | \
953 PIN_OSPEED_HIGH(GPIOF_PIN3) | \
954 PIN_OSPEED_HIGH(GPIOF_PIN4) | \
955 PIN_OSPEED_HIGH(GPIOF_PIN5) | \
956 PIN_OSPEED_HIGH(GPIOF_PIN6) | \
957 PIN_OSPEED_HIGH(GPIOF_PIN7) | \
958 PIN_OSPEED_HIGH(GPIOF_PIN8) | \
959 PIN_OSPEED_HIGH(GPIOF_PIN9) | \
960 PIN_OSPEED_HIGH(GPIOF_PIN10) | \
961 PIN_OSPEED_HIGH(GPIOF_USB_FS_FAULT) | \
962 PIN_OSPEED_HIGH(GPIOF_PIN12) | \
963 PIN_OSPEED_HIGH(GPIOF_PIN13) | \
964 PIN_OSPEED_HIGH(GPIOF_PIN14) | \
965 PIN_OSPEED_HIGH(GPIOF_PIN15))
966#define VAL_GPIOF_PUPDR (PIN_PUPDR_PULLUP(GPIOF_PIN0) | \
967 PIN_PUPDR_PULLUP(GPIOF_PIN1) | \
968 PIN_PUPDR_PULLUP(GPIOF_PIN2) | \
969 PIN_PUPDR_PULLUP(GPIOF_PIN3) | \
970 PIN_PUPDR_PULLUP(GPIOF_PIN4) | \
971 PIN_PUPDR_PULLUP(GPIOF_PIN5) | \
972 PIN_PUPDR_PULLUP(GPIOF_PIN6) | \
973 PIN_PUPDR_PULLUP(GPIOF_PIN7) | \
974 PIN_PUPDR_PULLUP(GPIOF_PIN8) | \
975 PIN_PUPDR_PULLUP(GPIOF_PIN9) | \
976 PIN_PUPDR_PULLUP(GPIOF_PIN10) | \
977 PIN_PUPDR_FLOATING(GPIOF_USB_FS_FAULT) |\
978 PIN_PUPDR_PULLUP(GPIOF_PIN12) | \
979 PIN_PUPDR_PULLUP(GPIOF_PIN13) | \
980 PIN_PUPDR_PULLUP(GPIOF_PIN14) | \
981 PIN_PUPDR_PULLUP(GPIOF_PIN15))
982#define VAL_GPIOF_ODR (PIN_ODR_HIGH(GPIOF_PIN0) | \
983 PIN_ODR_HIGH(GPIOF_PIN1) | \
984 PIN_ODR_HIGH(GPIOF_PIN2) | \
985 PIN_ODR_HIGH(GPIOF_PIN3) | \
986 PIN_ODR_HIGH(GPIOF_PIN4) | \
987 PIN_ODR_HIGH(GPIOF_PIN5) | \
988 PIN_ODR_HIGH(GPIOF_PIN6) | \
989 PIN_ODR_HIGH(GPIOF_PIN7) | \
990 PIN_ODR_HIGH(GPIOF_PIN8) | \
991 PIN_ODR_HIGH(GPIOF_PIN9) | \
992 PIN_ODR_HIGH(GPIOF_PIN10) | \
993 PIN_ODR_HIGH(GPIOF_USB_FS_FAULT) | \
994 PIN_ODR_HIGH(GPIOF_PIN12) | \
995 PIN_ODR_HIGH(GPIOF_PIN13) | \
996 PIN_ODR_HIGH(GPIOF_PIN14) | \
997 PIN_ODR_HIGH(GPIOF_PIN15))
998#define VAL_GPIOF_AFRL (PIN_AFIO_AF(GPIOF_PIN0, 0U) | \
999 PIN_AFIO_AF(GPIOF_PIN1, 0U) | \
1000 PIN_AFIO_AF(GPIOF_PIN2, 0U) | \
1001 PIN_AFIO_AF(GPIOF_PIN3, 0U) | \
1002 PIN_AFIO_AF(GPIOF_PIN4, 0U) | \
1003 PIN_AFIO_AF(GPIOF_PIN5, 0U) | \
1004 PIN_AFIO_AF(GPIOF_PIN6, 0U) | \
1005 PIN_AFIO_AF(GPIOF_PIN7, 0U))
1006#define VAL_GPIOF_AFRH (PIN_AFIO_AF(GPIOF_PIN8, 0U) | \
1007 PIN_AFIO_AF(GPIOF_PIN9, 0U) | \
1008 PIN_AFIO_AF(GPIOF_PIN10, 0U) | \
1009 PIN_AFIO_AF(GPIOF_USB_FS_FAULT, 0U) | \
1010 PIN_AFIO_AF(GPIOF_PIN12, 0U) | \
1011 PIN_AFIO_AF(GPIOF_PIN13, 0U) | \
1012 PIN_AFIO_AF(GPIOF_PIN14, 0U) | \
1013 PIN_AFIO_AF(GPIOF_PIN15, 0U))
1014
1015/*
1016 * GPIOG setup:
1017 *
1018 * PG0 - PIN0 (input pullup).
1019 * PG1 - PIN1 (input pullup).
1020 * PG2 - PIN2 (input pullup).
1021 * PG3 - PIN3 (input pullup).
1022 * PG4 - PIN4 (input pullup).
1023 * PG5 - PIN5 (input pullup).
1024 * PG6 - PIN6 (input pullup).
1025 * PG7 - PIN7 (input pullup).
1026 * PG8 - PIN8 (input pullup).
1027 * PG9 - PIN9 (input pullup).
1028 * PG10 - SPI2_CS (output pushpull maximum).
1029 * PG11 - ETH_RMII_TXEN (alternate 11).
1030 * PG12 - PIN12 (input pullup).
1031 * PG13 - ETH_RMII_TXD0 (alternate 11).
1032 * PG14 - ETH_RMII_TXD1 (alternate 11).
1033 * PG15 - PIN15 (input pullup).
1034 */
1035#define VAL_GPIOG_MODER (PIN_MODE_INPUT(GPIOG_PIN0) | \
1036 PIN_MODE_INPUT(GPIOG_PIN1) | \
1037 PIN_MODE_INPUT(GPIOG_PIN2) | \
1038 PIN_MODE_INPUT(GPIOG_PIN3) | \
1039 PIN_MODE_INPUT(GPIOG_PIN4) | \
1040 PIN_MODE_INPUT(GPIOG_PIN5) | \
1041 PIN_MODE_INPUT(GPIOG_PIN6) | \
1042 PIN_MODE_INPUT(GPIOG_PIN7) | \
1043 PIN_MODE_INPUT(GPIOG_PIN8) | \
1044 PIN_MODE_INPUT(GPIOG_PIN9) | \
1045 PIN_MODE_OUTPUT(GPIOG_SPI2_CS) | \
1046 PIN_MODE_ALTERNATE(GPIOG_ETH_RMII_TXEN) |\
1047 PIN_MODE_INPUT(GPIOG_PIN12) | \
1048 PIN_MODE_ALTERNATE(GPIOG_ETH_RMII_TXD0) |\
1049 PIN_MODE_ALTERNATE(GPIOG_ETH_RMII_TXD1) |\
1050 PIN_MODE_INPUT(GPIOG_PIN15))
1051#define VAL_GPIOG_OTYPER (PIN_OTYPE_PUSHPULL(GPIOG_PIN0) | \
1052 PIN_OTYPE_PUSHPULL(GPIOG_PIN1) | \
1053 PIN_OTYPE_PUSHPULL(GPIOG_PIN2) | \
1054 PIN_OTYPE_PUSHPULL(GPIOG_PIN3) | \
1055 PIN_OTYPE_PUSHPULL(GPIOG_PIN4) | \
1056 PIN_OTYPE_PUSHPULL(GPIOG_PIN5) | \
1057 PIN_OTYPE_PUSHPULL(GPIOG_PIN6) | \
1058 PIN_OTYPE_PUSHPULL(GPIOG_PIN7) | \
1059 PIN_OTYPE_PUSHPULL(GPIOG_PIN8) | \
1060 PIN_OTYPE_PUSHPULL(GPIOG_PIN9) | \
1061 PIN_OTYPE_PUSHPULL(GPIOG_SPI2_CS) | \
1062 PIN_OTYPE_PUSHPULL(GPIOG_ETH_RMII_TXEN) |\
1063 PIN_OTYPE_PUSHPULL(GPIOG_PIN12) | \
1064 PIN_OTYPE_PUSHPULL(GPIOG_ETH_RMII_TXD0) |\
1065 PIN_OTYPE_PUSHPULL(GPIOG_ETH_RMII_TXD1) |\
1066 PIN_OTYPE_PUSHPULL(GPIOG_PIN15))
1067#define VAL_GPIOG_OSPEEDR (PIN_OSPEED_HIGH(GPIOG_PIN0) | \
1068 PIN_OSPEED_HIGH(GPIOG_PIN1) | \
1069 PIN_OSPEED_HIGH(GPIOG_PIN2) | \
1070 PIN_OSPEED_HIGH(GPIOG_PIN3) | \
1071 PIN_OSPEED_HIGH(GPIOG_PIN4) | \
1072 PIN_OSPEED_HIGH(GPIOG_PIN5) | \
1073 PIN_OSPEED_HIGH(GPIOG_PIN6) | \
1074 PIN_OSPEED_HIGH(GPIOG_PIN7) | \
1075 PIN_OSPEED_HIGH(GPIOG_PIN8) | \
1076 PIN_OSPEED_HIGH(GPIOG_PIN9) | \
1077 PIN_OSPEED_HIGH(GPIOG_SPI2_CS) | \
1078 PIN_OSPEED_HIGH(GPIOG_ETH_RMII_TXEN) | \
1079 PIN_OSPEED_HIGH(GPIOG_PIN12) | \
1080 PIN_OSPEED_HIGH(GPIOG_ETH_RMII_TXD0) | \
1081 PIN_OSPEED_HIGH(GPIOG_ETH_RMII_TXD1) | \
1082 PIN_OSPEED_HIGH(GPIOG_PIN15))
1083#define VAL_GPIOG_PUPDR (PIN_PUPDR_PULLUP(GPIOG_PIN0) | \
1084 PIN_PUPDR_PULLUP(GPIOG_PIN1) | \
1085 PIN_PUPDR_PULLUP(GPIOG_PIN2) | \
1086 PIN_PUPDR_PULLUP(GPIOG_PIN3) | \
1087 PIN_PUPDR_PULLUP(GPIOG_PIN4) | \
1088 PIN_PUPDR_PULLUP(GPIOG_PIN5) | \
1089 PIN_PUPDR_PULLUP(GPIOG_PIN6) | \
1090 PIN_PUPDR_PULLUP(GPIOG_PIN7) | \
1091 PIN_PUPDR_PULLUP(GPIOG_PIN8) | \
1092 PIN_PUPDR_PULLUP(GPIOG_PIN9) | \
1093 PIN_PUPDR_FLOATING(GPIOG_SPI2_CS) | \
1094 PIN_PUPDR_FLOATING(GPIOG_ETH_RMII_TXEN) |\
1095 PIN_PUPDR_PULLUP(GPIOG_PIN12) | \
1096 PIN_PUPDR_FLOATING(GPIOG_ETH_RMII_TXD0) |\
1097 PIN_PUPDR_FLOATING(GPIOG_ETH_RMII_TXD1) |\
1098 PIN_PUPDR_PULLUP(GPIOG_PIN15))
1099#define VAL_GPIOG_ODR (PIN_ODR_HIGH(GPIOG_PIN0) | \
1100 PIN_ODR_HIGH(GPIOG_PIN1) | \
1101 PIN_ODR_HIGH(GPIOG_PIN2) | \
1102 PIN_ODR_HIGH(GPIOG_PIN3) | \
1103 PIN_ODR_HIGH(GPIOG_PIN4) | \
1104 PIN_ODR_HIGH(GPIOG_PIN5) | \
1105 PIN_ODR_HIGH(GPIOG_PIN6) | \
1106 PIN_ODR_HIGH(GPIOG_PIN7) | \
1107 PIN_ODR_HIGH(GPIOG_PIN8) | \
1108 PIN_ODR_HIGH(GPIOG_PIN9) | \
1109 PIN_ODR_HIGH(GPIOG_SPI2_CS) | \
1110 PIN_ODR_HIGH(GPIOG_ETH_RMII_TXEN) | \
1111 PIN_ODR_HIGH(GPIOG_PIN12) | \
1112 PIN_ODR_HIGH(GPIOG_ETH_RMII_TXD0) | \
1113 PIN_ODR_HIGH(GPIOG_ETH_RMII_TXD1) | \
1114 PIN_ODR_HIGH(GPIOG_PIN15))
1115#define VAL_GPIOG_AFRL (PIN_AFIO_AF(GPIOG_PIN0, 0U) | \
1116 PIN_AFIO_AF(GPIOG_PIN1, 0U) | \
1117 PIN_AFIO_AF(GPIOG_PIN2, 0U) | \
1118 PIN_AFIO_AF(GPIOG_PIN3, 0U) | \
1119 PIN_AFIO_AF(GPIOG_PIN4, 0U) | \
1120 PIN_AFIO_AF(GPIOG_PIN5, 0U) | \
1121 PIN_AFIO_AF(GPIOG_PIN6, 0U) | \
1122 PIN_AFIO_AF(GPIOG_PIN7, 0U))
1123#define VAL_GPIOG_AFRH (PIN_AFIO_AF(GPIOG_PIN8, 0U) | \
1124 PIN_AFIO_AF(GPIOG_PIN9, 0U) | \
1125 PIN_AFIO_AF(GPIOG_SPI2_CS, 0U) | \
1126 PIN_AFIO_AF(GPIOG_ETH_RMII_TXEN, 11U) |\
1127 PIN_AFIO_AF(GPIOG_PIN12, 0U) | \
1128 PIN_AFIO_AF(GPIOG_ETH_RMII_TXD0, 11U) |\
1129 PIN_AFIO_AF(GPIOG_ETH_RMII_TXD1, 11U) |\
1130 PIN_AFIO_AF(GPIOG_PIN15, 0U))
1131
1132/*
1133 * GPIOH setup:
1134 *
1135 * PH0 - OSC_IN (input floating).
1136 * PH1 - OSC_OUT (input floating).
1137 * PH2 - PIN2 (input pullup).
1138 * PH3 - PIN3 (input pullup).
1139 * PH4 - PIN4 (input pullup).
1140 * PH5 - PIN5 (input pullup).
1141 * PH6 - PIN6 (input pullup).
1142 * PH7 - PIN7 (input pullup).
1143 * PH8 - PIN8 (input pullup).
1144 * PH9 - PIN9 (input pullup).
1145 * PH10 - PIN10 (input pullup).
1146 * PH11 - PIN11 (input pullup).
1147 * PH12 - PIN12 (input pullup).
1148 * PH13 - PIN13 (input pullup).
1149 * PH14 - PIN14 (input pullup).
1150 * PH15 - PIN15 (input pullup).
1151 */
1152#define VAL_GPIOH_MODER (PIN_MODE_INPUT(GPIOH_OSC_IN) | \
1153 PIN_MODE_INPUT(GPIOH_OSC_OUT) | \
1154 PIN_MODE_INPUT(GPIOH_PIN2) | \
1155 PIN_MODE_INPUT(GPIOH_PIN3) | \
1156 PIN_MODE_INPUT(GPIOH_PIN4) | \
1157 PIN_MODE_INPUT(GPIOH_PIN5) | \
1158 PIN_MODE_INPUT(GPIOH_PIN6) | \
1159 PIN_MODE_INPUT(GPIOH_PIN7) | \
1160 PIN_MODE_INPUT(GPIOH_PIN8) | \
1161 PIN_MODE_INPUT(GPIOH_PIN9) | \
1162 PIN_MODE_INPUT(GPIOH_PIN10) | \
1163 PIN_MODE_INPUT(GPIOH_PIN11) | \
1164 PIN_MODE_INPUT(GPIOH_PIN12) | \
1165 PIN_MODE_INPUT(GPIOH_PIN13) | \
1166 PIN_MODE_INPUT(GPIOH_PIN14) | \
1167 PIN_MODE_INPUT(GPIOH_PIN15))
1168#define VAL_GPIOH_OTYPER (PIN_OTYPE_PUSHPULL(GPIOH_OSC_IN) | \
1169 PIN_OTYPE_PUSHPULL(GPIOH_OSC_OUT) | \
1170 PIN_OTYPE_PUSHPULL(GPIOH_PIN2) | \
1171 PIN_OTYPE_PUSHPULL(GPIOH_PIN3) | \
1172 PIN_OTYPE_PUSHPULL(GPIOH_PIN4) | \
1173 PIN_OTYPE_PUSHPULL(GPIOH_PIN5) | \
1174 PIN_OTYPE_PUSHPULL(GPIOH_PIN6) | \
1175 PIN_OTYPE_PUSHPULL(GPIOH_PIN7) | \
1176 PIN_OTYPE_PUSHPULL(GPIOH_PIN8) | \
1177 PIN_OTYPE_PUSHPULL(GPIOH_PIN9) | \
1178 PIN_OTYPE_PUSHPULL(GPIOH_PIN10) | \
1179 PIN_OTYPE_PUSHPULL(GPIOH_PIN11) | \
1180 PIN_OTYPE_PUSHPULL(GPIOH_PIN12) | \
1181 PIN_OTYPE_PUSHPULL(GPIOH_PIN13) | \
1182 PIN_OTYPE_PUSHPULL(GPIOH_PIN14) | \
1183 PIN_OTYPE_PUSHPULL(GPIOH_PIN15))
1184#define VAL_GPIOH_OSPEEDR (PIN_OSPEED_HIGH(GPIOH_OSC_IN) | \
1185 PIN_OSPEED_HIGH(GPIOH_OSC_OUT) | \
1186 PIN_OSPEED_HIGH(GPIOH_PIN2) | \
1187 PIN_OSPEED_HIGH(GPIOH_PIN3) | \
1188 PIN_OSPEED_HIGH(GPIOH_PIN4) | \
1189 PIN_OSPEED_HIGH(GPIOH_PIN5) | \
1190 PIN_OSPEED_HIGH(GPIOH_PIN6) | \
1191 PIN_OSPEED_HIGH(GPIOH_PIN7) | \
1192 PIN_OSPEED_HIGH(GPIOH_PIN8) | \
1193 PIN_OSPEED_HIGH(GPIOH_PIN9) | \
1194 PIN_OSPEED_HIGH(GPIOH_PIN10) | \
1195 PIN_OSPEED_HIGH(GPIOH_PIN11) | \
1196 PIN_OSPEED_HIGH(GPIOH_PIN12) | \
1197 PIN_OSPEED_HIGH(GPIOH_PIN13) | \
1198 PIN_OSPEED_HIGH(GPIOH_PIN14) | \
1199 PIN_OSPEED_HIGH(GPIOH_PIN15))
1200#define VAL_GPIOH_PUPDR (PIN_PUPDR_FLOATING(GPIOH_OSC_IN) | \
1201 PIN_PUPDR_FLOATING(GPIOH_OSC_OUT) | \
1202 PIN_PUPDR_PULLUP(GPIOH_PIN2) | \
1203 PIN_PUPDR_PULLUP(GPIOH_PIN3) | \
1204 PIN_PUPDR_PULLUP(GPIOH_PIN4) | \
1205 PIN_PUPDR_PULLUP(GPIOH_PIN5) | \
1206 PIN_PUPDR_PULLUP(GPIOH_PIN6) | \
1207 PIN_PUPDR_PULLUP(GPIOH_PIN7) | \
1208 PIN_PUPDR_PULLUP(GPIOH_PIN8) | \
1209 PIN_PUPDR_PULLUP(GPIOH_PIN9) | \
1210 PIN_PUPDR_PULLUP(GPIOH_PIN10) | \
1211 PIN_PUPDR_PULLUP(GPIOH_PIN11) | \
1212 PIN_PUPDR_PULLUP(GPIOH_PIN12) | \
1213 PIN_PUPDR_PULLUP(GPIOH_PIN13) | \
1214 PIN_PUPDR_PULLUP(GPIOH_PIN14) | \
1215 PIN_PUPDR_PULLUP(GPIOH_PIN15))
1216#define VAL_GPIOH_ODR (PIN_ODR_HIGH(GPIOH_OSC_IN) | \
1217 PIN_ODR_HIGH(GPIOH_OSC_OUT) | \
1218 PIN_ODR_HIGH(GPIOH_PIN2) | \
1219 PIN_ODR_HIGH(GPIOH_PIN3) | \
1220 PIN_ODR_HIGH(GPIOH_PIN4) | \
1221 PIN_ODR_HIGH(GPIOH_PIN5) | \
1222 PIN_ODR_HIGH(GPIOH_PIN6) | \
1223 PIN_ODR_HIGH(GPIOH_PIN7) | \
1224 PIN_ODR_HIGH(GPIOH_PIN8) | \
1225 PIN_ODR_HIGH(GPIOH_PIN9) | \
1226 PIN_ODR_HIGH(GPIOH_PIN10) | \
1227 PIN_ODR_HIGH(GPIOH_PIN11) | \
1228 PIN_ODR_HIGH(GPIOH_PIN12) | \
1229 PIN_ODR_HIGH(GPIOH_PIN13) | \
1230 PIN_ODR_HIGH(GPIOH_PIN14) | \
1231 PIN_ODR_HIGH(GPIOH_PIN15))
1232#define VAL_GPIOH_AFRL (PIN_AFIO_AF(GPIOH_OSC_IN, 0U) | \
1233 PIN_AFIO_AF(GPIOH_OSC_OUT, 0U) | \
1234 PIN_AFIO_AF(GPIOH_PIN2, 0U) | \
1235 PIN_AFIO_AF(GPIOH_PIN3, 0U) | \
1236 PIN_AFIO_AF(GPIOH_PIN4, 0U) | \
1237 PIN_AFIO_AF(GPIOH_PIN5, 0U) | \
1238 PIN_AFIO_AF(GPIOH_PIN6, 0U) | \
1239 PIN_AFIO_AF(GPIOH_PIN7, 0U))
1240#define VAL_GPIOH_AFRH (PIN_AFIO_AF(GPIOH_PIN8, 0U) | \
1241 PIN_AFIO_AF(GPIOH_PIN9, 0U) | \
1242 PIN_AFIO_AF(GPIOH_PIN10, 0U) | \
1243 PIN_AFIO_AF(GPIOH_PIN11, 0U) | \
1244 PIN_AFIO_AF(GPIOH_PIN12, 0U) | \
1245 PIN_AFIO_AF(GPIOH_PIN13, 0U) | \
1246 PIN_AFIO_AF(GPIOH_PIN14, 0U) | \
1247 PIN_AFIO_AF(GPIOH_PIN15, 0U))
1248
1249/*
1250 * GPIOI setup:
1251 *
1252 * PI0 - PIN0 (input pullup).
1253 * PI1 - PIN1 (input pullup).
1254 * PI2 - PIN2 (input pullup).
1255 * PI3 - PIN3 (input pullup).
1256 * PI4 - PIN4 (input pullup).
1257 * PI5 - PIN5 (input pullup).
1258 * PI6 - PIN6 (input pullup).
1259 * PI7 - PIN7 (input pullup).
1260 * PI8 - PIN8 (input pullup).
1261 * PI9 - PIN9 (input pullup).
1262 * PI10 - PIN10 (input pullup).
1263 * PI11 - PIN11 (input pullup).
1264 * PI12 - PIN12 (input pullup).
1265 * PI13 - PIN13 (input pullup).
1266 * PI14 - PIN14 (input pullup).
1267 * PI15 - PIN15 (input pullup).
1268 */
1269#define VAL_GPIOI_MODER (PIN_MODE_INPUT(GPIOI_PIN0) | \
1270 PIN_MODE_INPUT(GPIOI_PIN1) | \
1271 PIN_MODE_INPUT(GPIOI_PIN2) | \
1272 PIN_MODE_INPUT(GPIOI_PIN3) | \
1273 PIN_MODE_INPUT(GPIOI_PIN4) | \
1274 PIN_MODE_INPUT(GPIOI_PIN5) | \
1275 PIN_MODE_INPUT(GPIOI_PIN6) | \
1276 PIN_MODE_INPUT(GPIOI_PIN7) | \
1277 PIN_MODE_INPUT(GPIOI_PIN8) | \
1278 PIN_MODE_INPUT(GPIOI_PIN9) | \
1279 PIN_MODE_INPUT(GPIOI_PIN10) | \
1280 PIN_MODE_INPUT(GPIOI_PIN11) | \
1281 PIN_MODE_INPUT(GPIOI_PIN12) | \
1282 PIN_MODE_INPUT(GPIOI_PIN13) | \
1283 PIN_MODE_INPUT(GPIOI_PIN14) | \
1284 PIN_MODE_INPUT(GPIOI_PIN15))
1285#define VAL_GPIOI_OTYPER (PIN_OTYPE_PUSHPULL(GPIOI_PIN0) | \
1286 PIN_OTYPE_PUSHPULL(GPIOI_PIN1) | \
1287 PIN_OTYPE_PUSHPULL(GPIOI_PIN2) | \
1288 PIN_OTYPE_PUSHPULL(GPIOI_PIN3) | \
1289 PIN_OTYPE_PUSHPULL(GPIOI_PIN4) | \
1290 PIN_OTYPE_PUSHPULL(GPIOI_PIN5) | \
1291 PIN_OTYPE_PUSHPULL(GPIOI_PIN6) | \
1292 PIN_OTYPE_PUSHPULL(GPIOI_PIN7) | \
1293 PIN_OTYPE_PUSHPULL(GPIOI_PIN8) | \
1294 PIN_OTYPE_PUSHPULL(GPIOI_PIN9) | \
1295 PIN_OTYPE_PUSHPULL(GPIOI_PIN10) | \
1296 PIN_OTYPE_PUSHPULL(GPIOI_PIN11) | \
1297 PIN_OTYPE_PUSHPULL(GPIOI_PIN12) | \
1298 PIN_OTYPE_PUSHPULL(GPIOI_PIN13) | \
1299 PIN_OTYPE_PUSHPULL(GPIOI_PIN14) | \
1300 PIN_OTYPE_PUSHPULL(GPIOI_PIN15))
1301#define VAL_GPIOI_OSPEEDR (PIN_OSPEED_HIGH(GPIOI_PIN0) | \
1302 PIN_OSPEED_HIGH(GPIOI_PIN1) | \
1303 PIN_OSPEED_HIGH(GPIOI_PIN2) | \
1304 PIN_OSPEED_HIGH(GPIOI_PIN3) | \
1305 PIN_OSPEED_HIGH(GPIOI_PIN4) | \
1306 PIN_OSPEED_HIGH(GPIOI_PIN5) | \
1307 PIN_OSPEED_HIGH(GPIOI_PIN6) | \
1308 PIN_OSPEED_HIGH(GPIOI_PIN7) | \
1309 PIN_OSPEED_HIGH(GPIOI_PIN8) | \
1310 PIN_OSPEED_HIGH(GPIOI_PIN9) | \
1311 PIN_OSPEED_HIGH(GPIOI_PIN10) | \
1312 PIN_OSPEED_HIGH(GPIOI_PIN11) | \
1313 PIN_OSPEED_HIGH(GPIOI_PIN12) | \
1314 PIN_OSPEED_HIGH(GPIOI_PIN13) | \
1315 PIN_OSPEED_HIGH(GPIOI_PIN14) | \
1316 PIN_OSPEED_HIGH(GPIOI_PIN15))
1317#define VAL_GPIOI_PUPDR (PIN_PUPDR_PULLUP(GPIOI_PIN0) | \
1318 PIN_PUPDR_PULLUP(GPIOI_PIN1) | \
1319 PIN_PUPDR_PULLUP(GPIOI_PIN2) | \
1320 PIN_PUPDR_PULLUP(GPIOI_PIN3) | \
1321 PIN_PUPDR_PULLUP(GPIOI_PIN4) | \
1322 PIN_PUPDR_PULLUP(GPIOI_PIN5) | \
1323 PIN_PUPDR_PULLUP(GPIOI_PIN6) | \
1324 PIN_PUPDR_PULLUP(GPIOI_PIN7) | \
1325 PIN_PUPDR_PULLUP(GPIOI_PIN8) | \
1326 PIN_PUPDR_PULLUP(GPIOI_PIN9) | \
1327 PIN_PUPDR_PULLUP(GPIOI_PIN10) | \
1328 PIN_PUPDR_PULLUP(GPIOI_PIN11) | \
1329 PIN_PUPDR_PULLUP(GPIOI_PIN12) | \
1330 PIN_PUPDR_PULLUP(GPIOI_PIN13) | \
1331 PIN_PUPDR_PULLUP(GPIOI_PIN14) | \
1332 PIN_PUPDR_PULLUP(GPIOI_PIN15))
1333#define VAL_GPIOI_ODR (PIN_ODR_HIGH(GPIOI_PIN0) | \
1334 PIN_ODR_HIGH(GPIOI_PIN1) | \
1335 PIN_ODR_HIGH(GPIOI_PIN2) | \
1336 PIN_ODR_HIGH(GPIOI_PIN3) | \
1337 PIN_ODR_HIGH(GPIOI_PIN4) | \
1338 PIN_ODR_HIGH(GPIOI_PIN5) | \
1339 PIN_ODR_HIGH(GPIOI_PIN6) | \
1340 PIN_ODR_HIGH(GPIOI_PIN7) | \
1341 PIN_ODR_HIGH(GPIOI_PIN8) | \
1342 PIN_ODR_HIGH(GPIOI_PIN9) | \
1343 PIN_ODR_HIGH(GPIOI_PIN10) | \
1344 PIN_ODR_HIGH(GPIOI_PIN11) | \
1345 PIN_ODR_HIGH(GPIOI_PIN12) | \
1346 PIN_ODR_HIGH(GPIOI_PIN13) | \
1347 PIN_ODR_HIGH(GPIOI_PIN14) | \
1348 PIN_ODR_HIGH(GPIOI_PIN15))
1349#define VAL_GPIOI_AFRL (PIN_AFIO_AF(GPIOI_PIN0, 0U) | \
1350 PIN_AFIO_AF(GPIOI_PIN1, 0U) | \
1351 PIN_AFIO_AF(GPIOI_PIN2, 0U) | \
1352 PIN_AFIO_AF(GPIOI_PIN3, 0U) | \
1353 PIN_AFIO_AF(GPIOI_PIN4, 0U) | \
1354 PIN_AFIO_AF(GPIOI_PIN5, 0U) | \
1355 PIN_AFIO_AF(GPIOI_PIN6, 0U) | \
1356 PIN_AFIO_AF(GPIOI_PIN7, 0U))
1357#define VAL_GPIOI_AFRH (PIN_AFIO_AF(GPIOI_PIN8, 0U) | \
1358 PIN_AFIO_AF(GPIOI_PIN9, 0U) | \
1359 PIN_AFIO_AF(GPIOI_PIN10, 0U) | \
1360 PIN_AFIO_AF(GPIOI_PIN11, 0U) | \
1361 PIN_AFIO_AF(GPIOI_PIN12, 0U) | \
1362 PIN_AFIO_AF(GPIOI_PIN13, 0U) | \
1363 PIN_AFIO_AF(GPIOI_PIN14, 0U) | \
1364 PIN_AFIO_AF(GPIOI_PIN15, 0U))
1365
1366/*===========================================================================*/
1367/* External declarations. */
1368/*===========================================================================*/
1369
1370#if !defined(_FROM_ASM_)
1371#ifdef __cplusplus
1372extern "C" {
1373#endif
1374 void boardInit(void);
1375#ifdef __cplusplus
1376}
1377#endif
1378#endif /* _FROM_ASM_ */
1379
1380#endif /* BOARD_H */
diff --git a/lib/chibios/os/hal/boards/OLIMEX_STM32_E407/board.mk b/lib/chibios/os/hal/boards/OLIMEX_STM32_E407/board.mk
new file mode 100644
index 000000000..43e99c190
--- /dev/null
+++ b/lib/chibios/os/hal/boards/OLIMEX_STM32_E407/board.mk
@@ -0,0 +1,9 @@
1# List of all the board related files.
2BOARDSRC = $(CHIBIOS)/os/hal/boards/OLIMEX_STM32_E407/board.c
3
4# Required include directories
5BOARDINC = $(CHIBIOS)/os/hal/boards/OLIMEX_STM32_E407
6
7# Shared variables
8ALLCSRC += $(BOARDSRC)
9ALLINC += $(BOARDINC)
diff --git a/lib/chibios/os/hal/boards/OLIMEX_STM32_E407/cfg/board.chcfg b/lib/chibios/os/hal/boards/OLIMEX_STM32_E407/cfg/board.chcfg
new file mode 100644
index 000000000..8dfe5edb1
--- /dev/null
+++ b/lib/chibios/os/hal/boards/OLIMEX_STM32_E407/cfg/board.chcfg
@@ -0,0 +1,342 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<!-- STM32F4xx board Template -->
3<board xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4 xsi:noNamespaceSchemaLocation="http://www.chibios.org/xml/schema/boards/stm32f4xx_board.xsd">
5 <configuration_settings>
6 <templates_path>resources/gencfg/processors/boards/stm32f4xx/templates</templates_path>
7 <output_path>..</output_path>
8 <hal_version>5.0.x</hal_version>
9 </configuration_settings>
10 <board_name>Olimex STM32-E407</board_name>
11 <board_id>OLIMEX_STM32_E407</board_id>
12 <board_functions>
13 <sdc_lld_is_card_inserted><![CDATA[ static bool last_status = false;
14
15 if (blkIsTransferring(sdcp))
16 return last_status;
17 return last_status = (bool)palReadPad(GPIOC, GPIOC_SD_D3);]]></sdc_lld_is_card_inserted>
18 <sdc_lld_is_write_protected>
19<![CDATA[ (void)sdcp;
20 return false;]]></sdc_lld_is_write_protected>
21 </board_functions>
22 <ethernet_phy>
23 <identifier>MII_KS8721_ID</identifier>
24 <bus_type>RMII</bus_type>
25 </ethernet_phy>
26 <subtype>STM32F407xx</subtype>
27 <clocks
28 HSEFrequency="12000000"
29 HSEBypass="false"
30 LSEFrequency="32768"
31 LSEBypass="false"
32 VDD="330"
33 />
34 <ports>
35 <GPIOA>
36 <pin0 ID="BUTTON_WKUP" Type="PushPull" Speed="Maximum" Resistor="Floating"
37 Level="High" Mode="Input" Alternate="0" />
38 <pin1 ID="ETH_RMII_REF_CLK" Type="PushPull" Speed="Maximum"
39 Resistor="Floating" Level="High" Mode="Alternate" Alternate="11" />
40 <pin2 ID="ETH_RMII_MDIO" Type="PushPull" Speed="Maximum"
41 Resistor="Floating" Level="High" Mode="Alternate" Alternate="11" />
42 <pin3 ID="ETH_RMII_MDINT" Type="PushPull" Speed="Maximum"
43 Resistor="Floating" Level="High" Mode="Input" Alternate="0" />
44 <pin4 ID="" Type="PushPull" Speed="Maximum" Resistor="PullUp"
45 Level="High" Mode="Input" Alternate="0" />
46 <pin5 ID="" Type="PushPull" Speed="Maximum" Resistor="PullUp"
47 Level="High" Mode="Input" Alternate="0" />
48 <pin6 ID="" Type="PushPull" Speed="Maximum" Resistor="PullUp"
49 Level="High" Mode="Input" Alternate="0" />
50 <pin7 ID="ETH_RMII_CRS_DV" Type="PushPull" Speed="Maximum"
51 Resistor="Floating" Level="High" Mode="Alternate" Alternate="11" />
52 <pin8 ID="USB_HS_BUSON" Type="PushPull" Speed="Maximum"
53 Resistor="Floating" Level="Low" Mode="Output" Alternate="0" />
54 <pin9 ID="OTG_FS_VBUS" Type="PushPull" Speed="Maximum" Resistor="PullDown"
55 Level="High" Mode="Input" Alternate="0" />
56 <pin10 ID="OTG_FS_ID" Type="PushPull" Speed="Maximum" Resistor="Floating"
57 Level="High" Mode="Alternate" Alternate="10" />
58 <pin11 ID="OTG_FS_DM" Type="PushPull" Speed="Maximum" Resistor="Floating"
59 Level="High" Mode="Alternate" Alternate="10" />
60 <pin12 ID="OTG_FS_DP" Type="PushPull" Speed="Maximum" Resistor="Floating"
61 Level="High" Mode="Alternate" Alternate="10" />
62 <pin13 ID="JTAG_TMS" Type="PushPull" Speed="Maximum" Resistor="Floating"
63 Level="High" Mode="Alternate" Alternate="0" />
64 <pin14 ID="JTAG_TCK" Type="PushPull" Speed="Maximum" Resistor="PullDown"
65 Level="High" Mode="Alternate" Alternate="0" />
66 <pin15 ID="JTAG_TDI" Type="PushPull" Speed="Maximum" Resistor="Floating"
67 Level="High" Mode="Alternate" Alternate="0" />
68 </GPIOA>
69 <GPIOB>
70 <pin0 ID="USB_FS_BUSON" Type="PushPull" Speed="Maximum"
71 Resistor="Floating" Level="Low" Mode="Output" Alternate="0" />
72 <pin1 ID="USB_HS_FAULT" Type="PushPull" Speed="Maximum"
73 Resistor="Floating" Level="High" Mode="Input" Alternate="0" />
74 <pin2 ID="BOOT1" Type="PushPull" Speed="Maximum" Resistor="Floating"
75 Level="High" Mode="Input" Alternate="0" />
76 <pin3 ID="JTAG_TDO" Type="PushPull" Speed="Maximum" Resistor="Floating"
77 Level="High" Mode="Alternate" Alternate="0" />
78 <pin4 ID="JTAG_TRST" Type="PushPull" Speed="Maximum" Resistor="Floating"
79 Level="High" Mode="Alternate" Alternate="0" />
80 <pin5 ID="" Type="PushPull" Speed="Maximum" Resistor="PullUp"
81 Level="High" Mode="Input" Alternate="0" />
82 <pin6 ID="" Type="PushPull" Speed="Maximum" Resistor="PullUp"
83 Level="High" Mode="Input" Alternate="0" />
84 <pin7 ID="" Type="PushPull" Speed="Maximum" Resistor="PullUp"
85 Level="High" Mode="Input" Alternate="0" />
86 <pin8 ID="I2C1_SCL" Type="OpenDrain" Speed="Maximum" Resistor="Floating"
87 Level="High" Mode="Alternate" Alternate="4" />
88 <pin9 ID="I2C1_SDA" Type="OpenDrain" Speed="Maximum" Resistor="Floating"
89 Level="High" Mode="Alternate" Alternate="4" />
90 <pin10 ID="SPI2_SCK" Type="PushPull" Speed="Maximum" Resistor="Floating"
91 Level="High" Mode="Alternate" Alternate="5" />
92 <pin11 ID="" Type="PushPull" Speed="Maximum" Resistor="PullUp"
93 Level="High" Mode="Input" Alternate="0" />
94 <pin12 ID="OTG_HS_ID" Type="PushPull" Speed="Maximum" Resistor="Floating"
95 Level="High" Mode="Alternate" Alternate="12" />
96 <pin13 ID="OTG_HS_VBUS" Type="PushPull" Speed="Maximum"
97 Resistor="PullDown" Level="High" Mode="Input" Alternate="0" />
98 <pin14 ID="OTG_HS_DM" Type="PushPull" Speed="Maximum" Resistor="Floating"
99 Level="High" Mode="Alternate" Alternate="12" />
100 <pin15 ID="OTG_HS_DP" Type="PushPull" Speed="Maximum" Resistor="Floating"
101 Level="High" Mode="Alternate" Alternate="12" />
102 </GPIOB>
103 <GPIOC>
104 <pin0 ID="" Type="PushPull" Speed="Maximum" Resistor="PullUp"
105 Level="High" Mode="Input" Alternate="0" />
106 <pin1 ID="ETH_RMII_MDC" Type="PushPull" Speed="Maximum"
107 Resistor="Floating" Level="High" Mode="Alternate" Alternate="11" />
108 <pin2 ID="SPI2_MISO" Type="PushPull" Speed="Maximum" Resistor="Floating"
109 Level="High" Mode="Alternate" Alternate="5" />
110 <pin3 ID="SPI2_MOSI" Type="PushPull" Speed="Maximum" Resistor="Floating"
111 Level="High" Mode="Alternate" Alternate="5" />
112 <pin4 ID="ETH_RMII_RXD0" Type="PushPull" Speed="Maximum"
113 Resistor="Floating" Level="High" Mode="Alternate" Alternate="11" />
114 <pin5 ID="ETH_RMII_RXD1" Type="PushPull" Speed="Maximum"
115 Resistor="Floating" Level="High" Mode="Alternate" Alternate="11" />
116 <pin6 ID="USART6_TX" Type="PushPull" Speed="Maximum" Resistor="Floating"
117 Level="High" Mode="Alternate" Alternate="8" />
118 <pin7 ID="USART6_RX" Type="PushPull" Speed="Maximum" Resistor="Floating"
119 Level="High" Mode="Alternate" Alternate="8" />
120 <pin8 ID="SD_D0" Type="PushPull" Speed="Maximum" Resistor="Floating"
121 Level="High" Mode="Alternate" Alternate="12" />
122 <pin9 ID="SD_D1" Type="PushPull" Speed="Maximum" Resistor="Floating"
123 Level="High" Mode="Alternate" Alternate="12" />
124 <pin10 ID="SD_D2" Type="PushPull" Speed="Maximum" Resistor="Floating"
125 Level="High" Mode="Alternate" Alternate="12" />
126 <pin11 ID="SD_D3" Type="PushPull" Speed="Maximum" Resistor="Floating"
127 Level="High" Mode="Alternate" Alternate="12" />
128 <pin12 ID="SD_CLK" Type="PushPull" Speed="Maximum" Resistor="Floating"
129 Level="High" Mode="Alternate" Alternate="12" />
130 <pin13 ID="LED" Type="PushPull" Speed="Maximum" Resistor="Floating"
131 Level="High" Mode="Output" Alternate="0" />
132 <pin14 ID="OSC32_IN" Type="PushPull" Speed="Maximum" Resistor="Floating"
133 Level="High" Mode="Input" Alternate="0" />
134 <pin15 ID="OSC32_OUT" Type="PushPull" Speed="Maximum" Resistor="Floating"
135 Level="High" Mode="Input" Alternate="0" />
136 </GPIOC>
137 <GPIOD>
138 <pin0 ID="" Type="PushPull" Speed="Maximum" Resistor="PullUp"
139 Level="High" Mode="Input" Alternate="0" />
140 <pin1 ID="" Type="PushPull" Speed="Maximum" Resistor="PullUp"
141 Level="High" Mode="Input" Alternate="0" />
142 <pin2 ID="SD_CMD" Type="PushPull" Speed="Maximum" Resistor="Floating"
143 Level="High" Mode="Alternate" Alternate="12" />
144 <pin3 ID="" Type="PushPull" Speed="Maximum" Resistor="PullUp"
145 Level="High" Mode="Input" Alternate="0" />
146 <pin4 ID="" Type="PushPull" Speed="Maximum" Resistor="PullUp"
147 Level="High" Mode="Input" Alternate="0" />
148 <pin5 ID="" Type="PushPull" Speed="Maximum" Resistor="PullUp"
149 Level="High" Mode="Input" Alternate="0" />
150 <pin6 ID="" Type="PushPull" Speed="Maximum" Resistor="PullUp"
151 Level="High" Mode="Input" Alternate="0" />
152 <pin7 ID="" Type="PushPull" Speed="Maximum" Resistor="PullUp"
153 Level="High" Mode="Input" Alternate="0" />
154 <pin8 ID="" Type="PushPull" Speed="Maximum" Resistor="PullUp"
155 Level="High" Mode="Input" Alternate="0" />
156 <pin9 ID="" Type="PushPull" Speed="Maximum" Resistor="PullUp"
157 Level="High" Mode="Input" Alternate="0" />
158 <pin10 ID="" Type="PushPull" Speed="Maximum" Resistor="PullUp"
159 Level="High" Mode="Input" Alternate="0" />
160 <pin11 ID="" Type="PushPull" Speed="Maximum" Resistor="PullUp"
161 Level="High" Mode="Input" Alternate="0" />
162 <pin12 ID="" Type="PushPull" Speed="Maximum" Resistor="PullUp"
163 Level="High" Mode="Input" Alternate="0" />
164 <pin13 ID="" Type="PushPull" Speed="Maximum" Resistor="PullUp"
165 Level="High" Mode="Input" Alternate="0" />
166 <pin14 ID="" Type="PushPull" Speed="Maximum" Resistor="PullUp"
167 Level="High" Mode="Input" Alternate="0" />
168 <pin15 ID="" Type="PushPull" Speed="Maximum" Resistor="PullUp"
169 Level="High" Mode="Input" Alternate="0" />
170 </GPIOD>
171 <GPIOE>
172 <pin0 ID="" Type="PushPull" Speed="Maximum" Resistor="PullUp"
173 Level="High" Mode="Input" Alternate="0" />
174 <pin1 ID="" Type="PushPull" Speed="Maximum" Resistor="PullUp"
175 Level="High" Mode="Input" Alternate="0" />
176 <pin2 ID="" Type="PushPull" Speed="Maximum" Resistor="PullUp"
177 Level="High" Mode="Input" Alternate="0" />
178 <pin3 ID="" Type="PushPull" Speed="Maximum" Resistor="PullUp"
179 Level="High" Mode="Input" Alternate="0" />
180 <pin4 ID="" Type="PushPull" Speed="Maximum" Resistor="PullUp"
181 Level="High" Mode="Input" Alternate="0" />
182 <pin5 ID="" Type="PushPull" Speed="Maximum" Resistor="PullUp"
183 Level="High" Mode="Input" Alternate="0" />
184 <pin6 ID="" Type="PushPull" Speed="Maximum" Resistor="PullUp"
185 Level="High" Mode="Input" Alternate="0" />
186 <pin7 ID="" Type="PushPull" Speed="Maximum" Resistor="PullUp"
187 Level="High" Mode="Input" Alternate="0" />
188 <pin8 ID="" Type="PushPull" Speed="Maximum" Resistor="PullUp"
189 Level="High" Mode="Input" Alternate="0" />
190 <pin9 ID="" Type="PushPull" Speed="Maximum" Resistor="PullUp"
191 Level="High" Mode="Input" Alternate="0" />
192 <pin10 ID="" Type="PushPull" Speed="Maximum" Resistor="PullUp"
193 Level="High" Mode="Input" Alternate="0" />
194 <pin11 ID="" Type="PushPull" Speed="Maximum" Resistor="PullUp"
195 Level="High" Mode="Input" Alternate="0" />
196 <pin12 ID="" Type="PushPull" Speed="Maximum" Resistor="PullUp"
197 Level="High" Mode="Input" Alternate="0" />
198 <pin13 ID="" Type="PushPull" Speed="Maximum" Resistor="PullUp"
199 Level="High" Mode="Input" Alternate="0" />
200 <pin14 ID="" Type="PushPull" Speed="Maximum" Resistor="PullUp"
201 Level="High" Mode="Input" Alternate="0" />
202 <pin15 ID="" Type="PushPull" Speed="Maximum" Resistor="PullUp"
203 Level="High" Mode="Input" Alternate="0" />
204 </GPIOE>
205 <GPIOF>
206 <pin0 ID="" Type="PushPull" Speed="Maximum" Resistor="PullUp"
207 Level="High" Mode="Input" Alternate="0" />
208 <pin1 ID="" Type="PushPull" Speed="Maximum" Resistor="PullUp"
209 Level="High" Mode="Input" Alternate="0" />
210 <pin2 ID="" Type="PushPull" Speed="Maximum" Resistor="PullUp"
211 Level="High" Mode="Input" Alternate="0" />
212 <pin3 ID="" Type="PushPull" Speed="Maximum" Resistor="PullUp"
213 Level="High" Mode="Input" Alternate="0" />
214 <pin4 ID="" Type="PushPull" Speed="Maximum" Resistor="PullUp"
215 Level="High" Mode="Input" Alternate="0" />
216 <pin5 ID="" Type="PushPull" Speed="Maximum" Resistor="PullUp"
217 Level="High" Mode="Input" Alternate="0" />
218 <pin6 ID="" Type="PushPull" Speed="Maximum" Resistor="PullUp"
219 Level="High" Mode="Input" Alternate="0" />
220 <pin7 ID="" Type="PushPull" Speed="Maximum" Resistor="PullUp"
221 Level="High" Mode="Input" Alternate="0" />
222 <pin8 ID="" Type="PushPull" Speed="Maximum" Resistor="PullUp"
223 Level="High" Mode="Input" Alternate="0" />
224 <pin9 ID="" Type="PushPull" Speed="Maximum" Resistor="PullUp"
225 Level="High" Mode="Input" Alternate="0" />
226 <pin10 ID="" Type="PushPull" Speed="Maximum" Resistor="PullUp"
227 Level="High" Mode="Input" Alternate="0" />
228 <pin11 ID="USB_FS_FAULT" Type="PushPull" Speed="Maximum"
229 Resistor="Floating" Level="High" Mode="Input" Alternate="0" />
230 <pin12 ID="" Type="PushPull" Speed="Maximum" Resistor="PullUp"
231 Level="High" Mode="Input" Alternate="0" />
232 <pin13 ID="" Type="PushPull" Speed="Maximum" Resistor="PullUp"
233 Level="High" Mode="Input" Alternate="0" />
234 <pin14 ID="" Type="PushPull" Speed="Maximum" Resistor="PullUp"
235 Level="High" Mode="Input" Alternate="0" />
236 <pin15 ID="" Type="PushPull" Speed="Maximum" Resistor="PullUp"
237 Level="High" Mode="Input" Alternate="0" />
238 </GPIOF>
239 <GPIOG>
240 <pin0 ID="" Type="PushPull" Speed="Maximum" Resistor="PullUp"
241 Level="High" Mode="Input" Alternate="0" />
242 <pin1 ID="" Type="PushPull" Speed="Maximum" Resistor="PullUp"
243 Level="High" Mode="Input" Alternate="0" />
244 <pin2 ID="" Type="PushPull" Speed="Maximum" Resistor="PullUp"
245 Level="High" Mode="Input" Alternate="0" />
246 <pin3 ID="" Type="PushPull" Speed="Maximum" Resistor="PullUp"
247 Level="High" Mode="Input" Alternate="0" />
248 <pin4 ID="" Type="PushPull" Speed="Maximum" Resistor="PullUp"
249 Level="High" Mode="Input" Alternate="0" />
250 <pin5 ID="" Type="PushPull" Speed="Maximum" Resistor="PullUp"
251 Level="High" Mode="Input" Alternate="0" />
252 <pin6 ID="" Type="PushPull" Speed="Maximum" Resistor="PullUp"
253 Level="High" Mode="Input" Alternate="0" />
254 <pin7 ID="" Type="PushPull" Speed="Maximum" Resistor="PullUp"
255 Level="High" Mode="Input" Alternate="0" />
256 <pin8 ID="" Type="PushPull" Speed="Maximum" Resistor="PullUp"
257 Level="High" Mode="Input" Alternate="0" />
258 <pin9 ID="" Type="PushPull" Speed="Maximum" Resistor="PullUp"
259 Level="High" Mode="Input" Alternate="0" />
260 <pin10 ID="SPI2_CS" Type="PushPull" Speed="Maximum" Resistor="Floating"
261 Level="High" Mode="Output" Alternate="0" />
262 <pin11 ID="ETH_RMII_TXEN" Type="PushPull" Speed="Maximum"
263 Resistor="Floating" Level="High" Mode="Alternate" Alternate="11" />
264 <pin12 ID="" Type="PushPull" Speed="Maximum" Resistor="PullUp"
265 Level="High" Mode="Input" Alternate="0" />
266 <pin13 ID="ETH_RMII_TXD0" Type="PushPull" Speed="Maximum"
267 Resistor="Floating" Level="High" Mode="Alternate" Alternate="11" />
268 <pin14 ID="ETH_RMII_TXD1" Type="PushPull" Speed="Maximum"
269 Resistor="Floating" Level="High" Mode="Alternate" Alternate="11" />
270 <pin15 ID="" Type="PushPull" Speed="Maximum" Resistor="PullUp"
271 Level="High" Mode="Input" Alternate="0" />
272 </GPIOG>
273 <GPIOH>
274 <pin0 ID="OSC_IN" Type="PushPull" Speed="Maximum" Resistor="Floating"
275 Level="High" Mode="Input" Alternate="0"></pin0>
276 <pin1 ID="OSC_OUT" Type="PushPull" Speed="Maximum" Resistor="Floating"
277 Level="High" Mode="Input" Alternate="0" />
278 <pin2 ID="" Type="PushPull" Speed="Maximum" Resistor="PullUp"
279 Level="High" Mode="Input" Alternate="0" />
280 <pin3 ID="" Type="PushPull" Speed="Maximum" Resistor="PullUp"
281 Level="High" Mode="Input" Alternate="0" />
282 <pin4 ID="" Type="PushPull" Speed="Maximum" Resistor="PullUp"
283 Level="High" Mode="Input" Alternate="0" />
284 <pin5 ID="" Type="PushPull" Speed="Maximum" Resistor="PullUp"
285 Level="High" Mode="Input" Alternate="0" />
286 <pin6 ID="" Type="PushPull" Speed="Maximum" Resistor="PullUp"
287 Level="High" Mode="Input" Alternate="0" />
288 <pin7 ID="" Type="PushPull" Speed="Maximum" Resistor="PullUp"
289 Level="High" Mode="Input" Alternate="0" />
290 <pin8 ID="" Type="PushPull" Speed="Maximum" Resistor="PullUp"
291 Level="High" Mode="Input" Alternate="0" />
292 <pin9 ID="" Type="PushPull" Speed="Maximum" Resistor="PullUp"
293 Level="High" Mode="Input" Alternate="0" />
294 <pin10 ID="" Type="PushPull" Speed="Maximum" Resistor="PullUp"
295 Level="High" Mode="Input" Alternate="0" />
296 <pin11 ID="" Type="PushPull" Speed="Maximum" Resistor="PullUp"
297 Level="High" Mode="Input" Alternate="0" />
298 <pin12 ID="" Type="PushPull" Speed="Maximum" Resistor="PullUp"
299 Level="High" Mode="Input" Alternate="0" />
300 <pin13 ID="" Type="PushPull" Speed="Maximum" Resistor="PullUp"
301 Level="High" Mode="Input" Alternate="0" />
302 <pin14 ID="" Type="PushPull" Speed="Maximum" Resistor="PullUp"
303 Level="High" Mode="Input" Alternate="0" />
304 <pin15 ID="" Type="PushPull" Speed="Maximum" Resistor="PullUp"
305 Level="High" Mode="Input" Alternate="0" />
306 </GPIOH>
307 <GPIOI>
308 <pin0 ID="" Type="PushPull" Speed="Maximum" Resistor="PullUp"
309 Level="High" Mode="Input" Alternate="0" />
310 <pin1 ID="" Type="PushPull" Speed="Maximum" Resistor="PullUp"
311 Level="High" Mode="Input" Alternate="0" />
312 <pin2 ID="" Type="PushPull" Speed="Maximum" Resistor="PullUp"
313 Level="High" Mode="Input" Alternate="0" />
314 <pin3 ID="" Type="PushPull" Speed="Maximum" Resistor="PullUp"
315 Level="High" Mode="Input" Alternate="0" />
316 <pin4 ID="" Type="PushPull" Speed="Maximum" Resistor="PullUp"
317 Level="High" Mode="Input" Alternate="0" />
318 <pin5 ID="" Type="PushPull" Speed="Maximum" Resistor="PullUp"
319 Level="High" Mode="Input" Alternate="0" />
320 <pin6 ID="" Type="PushPull" Speed="Maximum" Resistor="PullUp"
321 Level="High" Mode="Input" Alternate="0" />
322 <pin7 ID="" Type="PushPull" Speed="Maximum" Resistor="PullUp"
323 Level="High" Mode="Input" Alternate="0" />
324 <pin8 ID="" Type="PushPull" Speed="Maximum" Resistor="PullUp"
325 Level="High" Mode="Input" Alternate="0" />
326 <pin9 ID="" Type="PushPull" Speed="Maximum" Resistor="PullUp"
327 Level="High" Mode="Input" Alternate="0" />
328 <pin10 ID="" Type="PushPull" Speed="Maximum" Resistor="PullUp"
329 Level="High" Mode="Input" Alternate="0" />
330 <pin11 ID="" Type="PushPull" Speed="Maximum" Resistor="PullUp"
331 Level="High" Mode="Input" Alternate="0" />
332 <pin12 ID="" Type="PushPull" Speed="Maximum" Resistor="PullUp"
333 Level="High" Mode="Input" Alternate="0" />
334 <pin13 ID="" Type="PushPull" Speed="Maximum" Resistor="PullUp"
335 Level="High" Mode="Input" Alternate="0" />
336 <pin14 ID="" Type="PushPull" Speed="Maximum" Resistor="PullUp"
337 Level="High" Mode="Input" Alternate="0" />
338 <pin15 ID="" Type="PushPull" Speed="Maximum" Resistor="PullUp"
339 Level="High" Mode="Input" Alternate="0" />
340 </GPIOI>
341 </ports>
342</board>
diff --git a/lib/chibios/os/hal/boards/OLIMEX_STM32_E407/cfg/board.fmpp b/lib/chibios/os/hal/boards/OLIMEX_STM32_E407/cfg/board.fmpp
new file mode 100644
index 000000000..41754c141
--- /dev/null
+++ b/lib/chibios/os/hal/boards/OLIMEX_STM32_E407/cfg/board.fmpp
@@ -0,0 +1,15 @@
1sourceRoot: ../../../../../tools/ftl/processors/boards/stm32f4xx/templates
2outputRoot: ..
3dataRoot: .
4
5freemarkerLinks: {
6 lib: ../../../../../tools/ftl/libs
7}
8
9data : {
10 doc1:xml (
11 board.chcfg
12 {
13 }
14 )
15}