libopencm3
A free/libre/open-source firmware library for various ARM Cortex-M3 microcontrollers.
f1/gpio.h
Go to the documentation of this file.
1/** @defgroup gpio_defines GPIO Defines
2
3@brief <b>Defined Constants and Types for the STM32F1xx General Purpose I/O</b>
4
5@ingroup STM32F1xx_defines
6
7@version 1.0.0
8
9@date 1 July 2012
10
11LGPL License Terms @ref lgpl_license
12 */
13/*
14 * This file is part of the libopencm3 project.
15 *
16 * Copyright (C) 2009 Uwe Hermann <uwe@hermann-uwe.de>
17 * Copyright (C) 2012 Piotr Esden-Tempski <piotr@esden.net>
18 * Copyright (C) 2012 Ken Sarkies <ksarkies@internode.on.net>
19 *
20 * This library is free software: you can redistribute it and/or modify
21 * it under the terms of the GNU Lesser General Public License as published by
22 * the Free Software Foundation, either version 3 of the License, or
23 * (at your option) any later version.
24 *
25 * This library is distributed in the hope that it will be useful,
26 * but WITHOUT ANY WARRANTY; without even the implied warranty of
27 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28 * GNU Lesser General Public License for more details.
29 *
30 * You should have received a copy of the GNU Lesser General Public License
31 * along with this library. If not, see <http://www.gnu.org/licenses/>.
32 */
33
34/**@{*/
35
36#ifndef LIBOPENCM3_GPIO_H
37#define LIBOPENCM3_GPIO_H
38
40
41/* --- Convenience macros -------------------------------------------------- */
42
43/* GPIO port base addresses (for convenience) */
44/** @defgroup gpio_port_id GPIO Port IDs
45@ingroup gpio_defines
46
47@{*/
48/* GPIO port base addresses (for convenience) */
49#define GPIOA GPIO_PORT_A_BASE
50#define GPIOB GPIO_PORT_B_BASE
51#define GPIOC GPIO_PORT_C_BASE
52#define GPIOD GPIO_PORT_D_BASE
53#define GPIOE GPIO_PORT_E_BASE
54#define GPIOF GPIO_PORT_F_BASE
55#define GPIOG GPIO_PORT_G_BASE
56/**@}*/
57
58/* --- Alternate function GPIOs -------------------------------------------- */
59
60/* Default alternate functions of some pins (with and without remapping) */
61
62/* CAN1 / CAN GPIO */
63#define GPIO_CAN1_RX GPIO11 /* PA11 */
64#define GPIO_CAN1_TX GPIO12 /* PA12 */
65#define GPIO_CAN_RX GPIO_CAN1_RX /* Alias */
66#define GPIO_CAN_TX GPIO_CAN1_TX /* Alias */
67
68#define GPIO_CAN_PB_RX GPIO8 /* PB8 */
69#define GPIO_CAN_PB_TX GPIO9 /* PB9 */
70#define GPIO_CAN1_PB_RX GPIO_CAN_PB_RX /* Alias */
71#define GPIO_CAN1_PB_TX GPIO_CAN_PB_TX /* Alias */
72
73#define GPIO_CAN_PD_RX GPIO0 /* PD0 */
74#define GPIO_CAN_PD_TX GPIO1 /* PD1 */
75#define GPIO_CAN1_PD_RX GPIO_CAN_PD_RX /* Alias */
76#define GPIO_CAN1_PD_TX GPIO_CAN_PD_TX /* Alias */
77
78/* CAN1 / CAN BANK */
79#define GPIO_BANK_CAN1_RX GPIOA /* PA11 */
80#define GPIO_BANK_CAN1_TX GPIOA /* PA12 */
81#define GPIO_BANK_CAN_RX GPIO_BANK_CAN1_RX /* Alias */
82#define GPIO_BANK_CAN_TX GPIO_BANK_CAN1_TX /* Alias */
83
84#define GPIO_BANK_CAN_PB_RX GPIOB /* PB8 */
85#define GPIO_BANK_CAN_PB_TX GPIOB /* PB9 */
86#define GPIO_BANK_CAN1_PB_RX GPIO_BANK_CAN_PB_RX /* Alias */
87#define GPIO_BANK_CAN1_PB_TX GPIO_BANK_CAN_PB_TX /* Alias */
88
89#define GPIO_BANK_CAN_PD_RX GPIOD /* PD0 */
90#define GPIO_BANK_CAN_PD_TX GPIOD /* PD1 */
91#define GPIO_BANK_CAN1_PD_RX GPIO_BANK_CAN_PD_RX /* Alias */
92#define GPIO_BANK_CAN1_PD_TX GPIO_BANK_CAN_PD_TX /* Alias */
93
94/* CAN2 GPIO */
95#define GPIO_CAN2_RX GPIO12 /* PB12 */
96#define GPIO_CAN2_TX GPIO13 /* PB13 */
97
98#define GPIO_CAN2_RE_RX GPIO5 /* PB5 */
99#define GPIO_CAN2_RE_TX GPIO6 /* PB6 */
100
101/* CAN2 BANK */
102#define GPIO_BANK_CAN2_RX GPIOB /* PB12 */
103#define GPIO_BANK_CAN2_TX GPIOB /* PB13 */
104
105#define GPIO_BANK_CAN2_RE_RX GPIOB /* PB5 */
106#define GPIO_BANK_CAN2_RE_TX GPIOB /* PB6 */
107
108/* JTAG/SWD GPIO */
109#define GPIO_JTMS_SWDIO GPIO13 /* PA13 */
110#define GPIO_JTCK_SWCLK GPIO14 /* PA14 */
111#define GPIO_JTDI GPIO15 /* PA15 */
112#define GPIO_JTDO_TRACESWO GPIO3 /* PB3 */
113#define GPIO_JNTRST GPIO4 /* PB4 */
114#define GPIO_TRACECK GPIO2 /* PE2 */
115#define GPIO_TRACED0 GPIO3 /* PE3 */
116#define GPIO_TRACED1 GPIO4 /* PE4 */
117#define GPIO_TRACED2 GPIO5 /* PE5 */
118#define GPIO_TRACED3 GPIO6 /* PE6 */
119
120/* JTAG/SWD BANK */
121#define GPIO_BANK_JTMS_SWDIO GPIOA /* PA13 */
122#define GPIO_BANK_JTCK_SWCLK GPIOA /* PA14 */
123#define GPIO_BANK_JTDI GPIOA /* PA15 */
124#define GPIO_BANK_JTDO_TRACESWO GPIOB /* PB3 */
125#define GPIO_BANK_JNTRST GPIOB /* PB4 */
126#define GPIO_BANK_TRACECK GPIOE /* PE2 */
127#define GPIO_BANK_TRACED0 GPIOE /* PE3 */
128#define GPIO_BANK_TRACED1 GPIOE /* PE4 */
129#define GPIO_BANK_TRACED2 GPIOE /* PE5 */
130#define GPIO_BANK_TRACED3 GPIOE /* PE6 */
131
132/* Timer5 GPIO */
133#define GPIO_TIM5_CH1 GPIO0 /* PA0 */
134#define GPIO_TIM5_CH2 GPIO1 /* PA1 */
135#define GPIO_TIM5_CH3 GPIO2 /* PA2 */
136#define GPIO_TIM5_CH4 GPIO3 /* PA3 */
137
138/* Timer5 BANK */
139#define GPIO_BANK_TIM5_CH1 GPIOA /* PA0 */
140#define GPIO_BANK_TIM5_CH2 GPIOA /* PA1 */
141#define GPIO_BANK_TIM5_CH3 GPIOA /* PA2 */
142#define GPIO_BANK_TIM5_CH4 GPIOA /* PA3 */
143#define GPIO_BANK_TIM5 GPIOA
144
145/* Timer4 GPIO */
146#define GPIO_TIM4_CH1 GPIO6 /* PB6 */
147#define GPIO_TIM4_CH2 GPIO7 /* PB7 */
148#define GPIO_TIM4_CH3 GPIO8 /* PB8 */
149#define GPIO_TIM4_CH4 GPIO9 /* PB9 */
150
151#define GPIO_TIM4_RE_CH1 GPIO12 /* PD12 */
152#define GPIO_TIM4_RE_CH2 GPIO13 /* PD13 */
153#define GPIO_TIM4_RE_CH3 GPIO14 /* PD14 */
154#define GPIO_TIM4_RE_CH4 GPIO15 /* PD15 */
155
156/* Timer4 BANK */
157#define GPIO_BANK_TIM4_CH1 GPIOB /* PB6 */
158#define GPIO_BANK_TIM4_CH2 GPIOB /* PB7 */
159#define GPIO_BANK_TIM4_CH3 GPIOB /* PB8 */
160#define GPIO_BANK_TIM4_CH4 GPIOB /* PB9 */
161#define GPIO_BANK_TIM4 GPIOB
162
163#define GPIO_BANK_TIM4_RE_CH1 GPIOD /* PD12 */
164#define GPIO_BANK_TIM4_RE_CH2 GPIOD /* PD13 */
165#define GPIO_BANK_TIM4_RE_CH3 GPIOD /* PD14 */
166#define GPIO_BANK_TIM4_RE_CH4 GPIOD /* PD15 */
167#define GPIO_BANK_TIM4_RE GPIOD
168
169/* Timer3 GPIO */
170#define GPIO_TIM3_CH1 GPIO6 /* PA6 */
171#define GPIO_TIM3_CH2 GPIO7 /* PA7 */
172#define GPIO_TIM3_CH3 GPIO0 /* PB0 */
173#define GPIO_TIM3_CH4 GPIO1 /* PB1 */
174
175#define GPIO_TIM3_PR_CH1 GPIO4 /* PB4 */
176#define GPIO_TIM3_PR_CH2 GPIO5 /* PB5 */
177#define GPIO_TIM3_PR_CH3 GPIO0 /* PB0 */
178#define GPIO_TIM3_PR_CH4 GPIO1 /* PB1 */
179
180#define GPIO_TIM3_FR_CH1 GPIO6 /* PC6 */
181#define GPIO_TIM3_FR_CH2 GPIO7 /* PC7 */
182#define GPIO_TIM3_FR_CH3 GPIO8 /* PC8 */
183#define GPIO_TIM3_FR_CH4 GPIO9 /* PC9 */
184
185/* Timer3 BANK */
186#define GPIO_BANK_TIM3_CH1 GPIOA /* PA6 */
187#define GPIO_BANK_TIM3_CH2 GPIOA /* PA7 */
188#define GPIO_BANK_TIM3_CH3 GPIOB /* PB0 */
189#define GPIO_BANK_TIM3_CH4 GPIOB /* PB1 */
190#define GPIO_BANK_TIM3_CH12 GPIOA
191#define GPIO_BANK_TIM3_CH34 GPIOB
192
193#define GPIO_BANK_TIM3_PR_CH1 GPIOB /* PB4 */
194#define GPIO_BANK_TIM3_PR_CH2 GPIOB /* PB5 */
195#define GPIO_BANK_TIM3_PR_CH3 GPIOB /* PB0 */
196#define GPIO_BANK_TIM3_PR_CH4 GPIOB /* PB1 */
197#define GPIO_BANK_TIM3_PR GPIOB
198
199#define GPIO_BANK_TIM3_FR_CH1 GPIOC /* PC6 */
200#define GPIO_BANK_TIM3_FR_CH2 GPIOC /* PC7 */
201#define GPIO_BANK_TIM3_FR_CH3 GPIOC /* PC8 */
202#define GPIO_BANK_TIM3_FR_CH4 GPIOC /* PC9 */
203#define GPIO_BANK_TIM3_FR GPIOC
204
205/* Timer2 GPIO */
206#define GPIO_TIM2_CH1_ETR GPIO0 /* PA0 */
207#define GPIO_TIM2_CH2 GPIO1 /* PA1 */
208#define GPIO_TIM2_CH3 GPIO2 /* PA2 */
209#define GPIO_TIM2_CH4 GPIO3 /* PA3 */
210
211#define GPIO_TIM2_PR1_CH1_ETR GPIO15 /* PA15 */
212#define GPIO_TIM2_PR1_CH2 GPIO3 /* PB3 */
213#define GPIO_TIM2_PR1_CH3 GPIO2 /* PA2 */
214#define GPIO_TIM2_PR1_CH4 GPIO3 /* PA3 */
215
216#define GPIO_TIM2_PR2_CH1_ETR GPIO0 /* PA0 */
217#define GPIO_TIM2_PR2_CH2 GPIO1 /* PA1 */
218#define GPIO_TIM2_PR2_CH3 GPIO10 /* PB10 */
219#define GPIO_TIM2_PR2_CH4 GPIO11 /* PB11 */
220
221#define GPIO_TIM2_FR_CH1_ETR GPIO15 /* PA15 */
222#define GPIO_TIM2_FR_CH2 GPIO3 /* PB3 */
223#define GPIO_TIM2_FR_CH3 GPIO10 /* PB10 */
224#define GPIO_TIM2_FR_CH4 GPIO11 /* PB11 */
225
226/* Timer2 BANK */
227#define GPIO_BANK_TIM2_CH1_ETR GPIOA /* PA0 */
228#define GPIO_BANK_TIM2_CH2 GPIOA /* PA1 */
229#define GPIO_BANK_TIM2_CH3 GPIOA /* PA2 */
230#define GPIO_BANK_TIM2_CH4 GPIOA /* PA3 */
231#define GPIO_BANK_TIM2 GPIOA
232
233#define GPIO_BANK_TIM2_PR1_CH1_ETR GPIOA /* PA15 */
234#define GPIO_BANK_TIM2_PR1_CH2 GPIOB /* PB3 */
235#define GPIO_BANK_TIM2_PR1_CH3 GPIOA /* PA2 */
236#define GPIO_BANK_TIM2_PR1_CH4 GPIOA /* PA3 */
237#define GPIO_BANK_TIM2_PR1_CH134 GPIOA
238
239#define GPIO_BANK_TIM2_PR2_CH1_ETR GPIOA /* PA0 */
240#define GPIO_BANK_TIM2_PR2_CH2 GPIOA /* PA1 */
241#define GPIO_BANK_TIM2_PR2_CH3 GPIOB /* PB10 */
242#define GPIO_BANK_TIM2_PR2_CH4 GPIOB /* PB11 */
243#define GPIO_BANK_TIM2_PR2_CH12 GPIOA
244#define GPIO_BANK_TIM2_PR2_CH34 GPIOB
245
246#define GPIO_BANK_TIM2_FR_CH1_ETR GPIOA /* PA15 */
247#define GPIO_BANK_TIM2_FR_CH2 GPIOB /* PB3 */
248#define GPIO_BANK_TIM2_FR_CH3 GPIOB /* PB10 */
249#define GPIO_BANK_TIM2_FR_CH4 GPIOB /* PB11 */
250#define GPIO_BANK_TIM2_FR_CH234 GPIOB
251
252/* Timer1 GPIO */
253#define GPIO_TIM1_ETR GPIO12 /* PA12 */
254#define GPIO_TIM1_CH1 GPIO8 /* PA8 */
255#define GPIO_TIM1_CH2 GPIO9 /* PA9 */
256#define GPIO_TIM1_CH3 GPIO10 /* PA10 */
257#define GPIO_TIM1_CH4 GPIO11 /* PA11 */
258#define GPIO_TIM1_BKIN GPIO12 /* PB12 */
259#define GPIO_TIM1_CH1N GPIO13 /* PB13 */
260#define GPIO_TIM1_CH2N GPIO14 /* PB14 */
261#define GPIO_TIM1_CH3N GPIO15 /* PB15 */
262
263#define GPIO_TIM1_PR_ETR GPIO12 /* PA12 */
264#define GPIO_TIM1_PR_CH1 GPIO8 /* PA8 */
265#define GPIO_TIM1_PR_CH2 GPIO9 /* PA9 */
266#define GPIO_TIM1_PR_CH3 GPIO10 /* PA10 */
267#define GPIO_TIM1_PR_CH4 GPIO11 /* PA11 */
268#define GPIO_TIM1_PR_BKIN GPIO6 /* PA6 */
269#define GPIO_TIM1_PR_CH1N GPIO7 /* PA7 */
270#define GPIO_TIM1_PR_CH2N GPIO0 /* PB0 */
271#define GPIO_TIM1_PR_CH3N GPIO1 /* PB1 */
272
273#define GPIO_TIM1_FR_ETR GPIO7 /* PE7 */
274#define GPIO_TIM1_FR_CH1 GPIO9 /* PE9 */
275#define GPIO_TIM1_FR_CH2 GPIO11 /* PE11 */
276#define GPIO_TIM1_FR_CH3 GPIO13 /* PE13 */
277#define GPIO_TIM1_FR_CH4 GPIO14 /* PE14 */
278#define GPIO_TIM1_FR_BKIN GPIO15 /* PE15 */
279#define GPIO_TIM1_FR_CH1N GPIO8 /* PE8 */
280#define GPIO_TIM1_FR_CH2N GPIO10 /* PE10 */
281#define GPIO_TIM1_FR_CH3N GPIO12 /* PE12 */
282
283/* Timer1 BANK */
284#define GPIO_BANK_TIM1_ETR GPIOA /* PA12 */
285#define GPIO_BANK_TIM1_CH1 GPIOA /* PA8 */
286#define GPIO_BANK_TIM1_CH2 GPIOA /* PA9 */
287#define GPIO_BANK_TIM1_CH3 GPIOA /* PA10 */
288#define GPIO_BANK_TIM1_CH4 GPIOA /* PA11 */
289#define GPIO_BANK_TIM1_BKIN GPIOB /* PB12 */
290#define GPIO_BANK_TIM1_CH1N GPIOB /* PB13 */
291#define GPIO_BANK_TIM1_CH2N GPIOB /* PB14 */
292#define GPIO_BANK_TIM1_CH3N GPIOB /* PB15 */
293#define GPIO_BANK_TIM1_ETR_CH1234 GPIOA
294#define GPIO_BANK_TIM1_BKIN_CH123N GPIOB
295
296#define GPIO_BANK_TIM1_PR_ETR GPIOA /* PA12 */
297#define GPIO_BANK_TIM1_PR_CH1 GPIOA /* PA8 */
298#define GPIO_BANK_TIM1_PR_CH2 GPIOA /* PA9 */
299#define GPIO_BANK_TIM1_PR_CH3 GPIOA /* PA10 */
300#define GPIO_BANK_TIM1_PR_CH4 GPIOA /* PA11 */
301#define GPIO_BANK_TIM1_PR_BKIN GPIOA /* PA6 */
302#define GPIO_BANK_TIM1_PR_CH1N GPIOA /* PA7 */
303#define GPIO_BANK_TIM1_PR_CH2N GPIOB /* PB0 */
304#define GPIO_BANK_TIM1_PR_CH3N GPIOB /* PB1 */
305#define GPIO_BANK_TIM1_PR_ETR_CH1234_BKIN_CH1N GPIOA
306#define GPIO_BANK_TIM1_PR_CH23N GPIOB
307
308#define GPIO_BANK_TIM1_FR_ETR GPIOE /* PE7 */
309#define GPIO_BANK_TIM1_FR_CH1 GPIOE /* PE9 */
310#define GPIO_BANK_TIM1_FR_CH2 GPIOE /* PE11 */
311#define GPIO_BANK_TIM1_FR_CH3 GPIOE /* PE13 */
312#define GPIO_BANK_TIM1_FR_CH4 GPIOE /* PE14 */
313#define GPIO_BANK_TIM1_FR_BKIN GPIOE /* PE15 */
314#define GPIO_BANK_TIM1_FR_CH1N GPIOE /* PE8 */
315#define GPIO_BANK_TIM1_FR_CH2N GPIOE /* PE10 */
316#define GPIO_BANK_TIM1_FR_CH3N GPIOE /* PE12 */
317#define GPIO_BANK_TIM1_FR GPIOE
318
319/* UART5 GPIO */
320#define GPIO_UART5_TX GPIO12 /* PC12 */
321#define GPIO_UART5_RX GPIO2 /* PD2 */
322
323/* UART5 BANK */
324#define GPIO_BANK_UART5_TX GPIOC /* PC12 */
325#define GPIO_BANK_UART5_RX GPIOD /* PD2 */
326
327/* UART4 GPIO */
328#define GPIO_UART4_TX GPIO10 /* PC10 */
329#define GPIO_UART4_RX GPIO11 /* PC11 */
330
331/* UART4 BANK */
332#define GPIO_BANK_UART4_TX GPIOC /* PC10 */
333#define GPIO_BANK_UART4_RX GPIOC /* PC11 */
334
335/* USART3 GPIO */
336#define GPIO_USART3_TX GPIO10 /* PB10 */
337#define GPIO_USART3_RX GPIO11 /* PB11 */
338#define GPIO_USART3_CK GPIO12 /* PB12 */
339#define GPIO_USART3_CTS GPIO13 /* PB13 */
340#define GPIO_USART3_RTS GPIO14 /* PB14 */
341
342#define GPIO_USART3_PR_TX GPIO10 /* PC10 */
343#define GPIO_USART3_PR_RX GPIO11 /* PC11 */
344#define GPIO_USART3_PR_CK GPIO12 /* PC12 */
345#define GPIO_USART3_PR_CTS GPIO13 /* PB13 */
346#define GPIO_USART3_PR_RTS GPIO14 /* PB14 */
347
348#define GPIO_USART3_FR_TX GPIO8 /* PD8 */
349#define GPIO_USART3_FR_RX GPIO9 /* PD9 */
350#define GPIO_USART3_FR_CK GPIO10 /* PD10 */
351#define GPIO_USART3_FR_CTS GPIO11 /* PD11 */
352#define GPIO_USART3_FR_RTS GPIO12 /* PD12 */
353
354/* USART3 BANK */
355#define GPIO_BANK_USART3_TX GPIOB /* PB10 */
356#define GPIO_BANK_USART3_RX GPIOB /* PB11 */
357#define GPIO_BANK_USART3_CK GPIOB /* PB12 */
358#define GPIO_BANK_USART3_CTS GPIOB /* PB13 */
359#define GPIO_BANK_USART3_RTS GPIOB /* PB14 */
360
361#define GPIO_BANK_USART3_PR_TX GPIOC /* PC10 */
362#define GPIO_BANK_USART3_PR_RX GPIOC /* PC11 */
363#define GPIO_BANK_USART3_PR_CK GPIOC /* PC12 */
364#define GPIO_BANK_USART3_PR_CTS GPIOB /* PB13 */
365#define GPIO_BANK_USART3_PR_RTS GPIOB /* PB14 */
366
367#define GPIO_BANK_USART3_FR_TX GPIOD /* PD8 */
368#define GPIO_BANK_USART3_FR_RX GPIOD /* PD9 */
369#define GPIO_BANK_USART3_FR_CK GPIOD /* PD10 */
370#define GPIO_BANK_USART3_FR_CTS GPIOD /* PD11 */
371#define GPIO_BANK_USART3_FR_RTS GPIOD /* PD12 */
372
373/* USART2 GPIO */
374#define GPIO_USART2_CTS GPIO0 /* PA0 */
375#define GPIO_USART2_RTS GPIO1 /* PA1 */
376#define GPIO_USART2_TX GPIO2 /* PA2 */
377#define GPIO_USART2_RX GPIO3 /* PA3 */
378#define GPIO_USART2_CK GPIO4 /* PA4 */
379
380#define GPIO_USART2_RE_CTS GPIO3 /* PD3 */
381#define GPIO_USART2_RE_RTS GPIO4 /* PD4 */
382#define GPIO_USART2_RE_TX GPIO5 /* PD5 */
383#define GPIO_USART2_RE_RX GPIO6 /* PD6 */
384#define GPIO_USART2_RE_CK GPIO7 /* PD7 */
385
386/* USART2 BANK */
387#define GPIO_BANK_USART2_CTS GPIOA /* PA0 */
388#define GPIO_BANK_USART2_RTS GPIOA /* PA1 */
389#define GPIO_BANK_USART2_TX GPIOA /* PA2 */
390#define GPIO_BANK_USART2_RX GPIOA /* PA3 */
391#define GPIO_BANK_USART2_CK GPIOA /* PA4 */
392
393#define GPIO_BANK_USART2_RE_CTS GPIOD /* PD3 */
394#define GPIO_BANK_USART2_RE_RTS GPIOD /* PD4 */
395#define GPIO_BANK_USART2_RE_TX GPIOD /* PD5 */
396#define GPIO_BANK_USART2_RE_RX GPIOD /* PD6 */
397#define GPIO_BANK_USART2_RE_CK GPIOD /* PD7 */
398
399/* USART1 GPIO */
400#define GPIO_USART1_CTS GPIO11 /* PA11 */
401#define GPIO_USART1_RTS GPIO12 /* PA12 */
402#define GPIO_USART1_TX GPIO9 /* PA9 */
403#define GPIO_USART1_RX GPIO10 /* PA10 */
404#define GPIO_USART1_CK GPIO8 /* PA8 */
405
406#define GPIO_USART1_RE_TX GPIO6 /* PB6 */
407#define GPIO_USART1_RE_RX GPIO7 /* PB7 */
408
409/* USART1 BANK */
410#define GPIO_BANK_USART1_CTS GPIOA /* PA11 */
411#define GPIO_BANK_USART1_RTS GPIOA /* PA12 */
412#define GPIO_BANK_USART1_TX GPIOA /* PA9 */
413#define GPIO_BANK_USART1_RX GPIOA /* PA10 */
414#define GPIO_BANK_USART1_CK GPIOA /* PA8 */
415
416#define GPIO_BANK_USART1_RE_TX GPIOB /* PB6 */
417#define GPIO_BANK_USART1_RE_RX GPIOB /* PB7 */
418
419/* I2C1 GPIO */
420#define GPIO_I2C1_SMBAI GPIO5 /* PB5 */
421#define GPIO_I2C1_SCL GPIO6 /* PB6 */
422#define GPIO_I2C1_SDA GPIO7 /* PB7 */
423
424#define GPIO_I2C1_RE_SMBAI GPIO5 /* PB5 */
425#define GPIO_I2C1_RE_SCL GPIO8 /* PB8 */
426#define GPIO_I2C1_RE_SDA GPIO9 /* PB9 */
427
428/* I2C1 BANK */
429#define GPIO_BANK_I2C1_SMBAI GPIOB /* PB5 */
430#define GPIO_BANK_I2C1_SCL GPIOB /* PB6 */
431#define GPIO_BANK_I2C1_SDA GPIOB /* PB7 */
432
433#define GPIO_BANK_I2C1_RE_SMBAI GPIOB /* PB5 */
434#define GPIO_BANK_I2C1_RE_SCL GPIOB /* PB8 */
435#define GPIO_BANK_I2C1_RE_SDA GPIOB /* PB9 */
436
437/* I2C2 GPIO */
438#define GPIO_I2C2_SCL GPIO10 /* PB10 */
439#define GPIO_I2C2_SDA GPIO11 /* PB11 */
440#define GPIO_I2C2_SMBAI GPIO12 /* PB12 */
441
442/* I2C2 BANK */
443#define GPIO_BANK_I2C2_SCL GPIOB /* PB10 */
444#define GPIO_BANK_I2C2_SDA GPIOB /* PB11 */
445#define GPIO_BANK_I2C2_SMBAI GPIOB /* PB12 */
446
447/* SPI1 GPIO */
448#define GPIO_SPI1_NSS GPIO4 /* PA4 */
449#define GPIO_SPI1_SCK GPIO5 /* PA5 */
450#define GPIO_SPI1_MISO GPIO6 /* PA6 */
451#define GPIO_SPI1_MOSI GPIO7 /* PA7 */
452
453#define GPIO_SPI1_RE_NSS GPIO15 /* PA15 */
454#define GPIO_SPI1_RE_SCK GPIO3 /* PB3 */
455#define GPIO_SPI1_RE_MISO GPIO4 /* PB4 */
456#define GPIO_SPI1_RE_MOSI GPIO5 /* PB5 */
457
458/* SPI1 BANK */
459#define GPIO_BANK_SPI1_NSS GPIOA /* PA4 */
460#define GPIO_BANK_SPI1_SCK GPIOA /* PA5 */
461#define GPIO_BANK_SPI1_MISO GPIOA /* PA6 */
462#define GPIO_BANK_SPI1_MOSI GPIOA /* PA7 */
463
464#define GPIO_BANK_SPI1_RE_NSS GPIOA /* PA15 */
465#define GPIO_BANK_SPI1_RE_SCK GPIOB /* PB3 */
466#define GPIO_BANK_SPI1_RE_MISO GPIOB /* PB4 */
467#define GPIO_BANK_SPI1_RE_MOSI GPIOB /* PB5 */
468
469/* SPI2 GPIO */
470#define GPIO_SPI2_NSS GPIO12 /* PB12 */
471#define GPIO_SPI2_SCK GPIO13 /* PB13 */
472#define GPIO_SPI2_MISO GPIO14 /* PB14 */
473#define GPIO_SPI2_MOSI GPIO15 /* PB15 */
474
475/* SPI2 BANK */
476#define GPIO_BANK_SPI2_NSS GPIOB /* PB12 */
477#define GPIO_BANK_SPI2_SCK GPIOB /* PB13 */
478#define GPIO_BANK_SPI2_MISO GPIOB /* PB14 */
479#define GPIO_BANK_SPI2_MOSI GPIOB /* PB15 */
480
481/* SPI3 GPIO */
482#define GPIO_SPI3_NSS GPIO15 /* PA15 */
483#define GPIO_SPI3_SCK GPIO3 /* PB3 */
484#define GPIO_SPI3_MISO GPIO4 /* PB4 */
485#define GPIO_SPI3_MOSI GPIO5 /* PB5 */
486
487#define GPIO_SPI3_RE_NSS GPIO4 /* PA4 */
488#define GPIO_SPI3_RE_SCK GPIO10 /* PC10 */
489#define GPIO_SPI3_RE_MISO GPIO11 /* PC11 */
490#define GPIO_SPI3_RE_MOSI GPIO12 /* PC12 */
491
492/* SPI3 BANK */
493#define GPIO_BANK_SPI3_NSS GPIOA /* PA15 */
494#define GPIO_BANK_SPI3_SCK GPIOB /* PB3 */
495#define GPIO_BANK_SPI3_MISO GPIOB /* PB4 */
496#define GPIO_BANK_SPI3_MOSI GPIOB /* PB5 */
497
498#define GPIO_BANK_SPI3_RE_NSS GPIOA /* PA4 */
499#define GPIO_BANK_SPI3_RE_SCK GPIOC /* PC10 */
500#define GPIO_BANK_SPI3_RE_MISO GPIOC /* PC11 */
501#define GPIO_BANK_SPI3_RE_MOSI GPIOC /* PC12 */
502
503/* ETH GPIO */
504#define GPIO_ETH_RX_DV_CRS_DV GPIO7 /* PA7 */
505#define GPIO_ETH_RXD0 GPIO4 /* PC4 */
506#define GPIO_ETH_RXD1 GPIO5 /* PC5 */
507#define GPIO_ETH_RXD2 GPIO0 /* PB0 */
508#define GPIO_ETH_RXD3 GPIO1 /* PB1 */
509
510#define GPIO_ETH_RE_RX_DV_CRS_DV GPIO8 /* PD8 */
511#define GPIO_ETH_RE_RXD0 GPIO9 /* PD9 */
512#define GPIO_ETH_RE_RXD1 GPIO10 /* PD10 */
513#define GPIO_ETH_RE_RXD2 GPIO11 /* PD11 */
514#define GPIO_ETH_RE_RXD3 GPIO12 /* PD12 */
515
516/* ETH BANK */
517#define GPIO_BANK_ETH_RX_DV_CRS_DV GPIOA /* PA7 */
518#define GPIO_BANK_ETH_RXD0 GPIOC /* PC4 */
519#define GPIO_BANK_ETH_RXD1 GPIOC /* PC5 */
520#define GPIO_BANK_ETH_RXD2 GPIOB /* PB0 */
521#define GPIO_BANK_ETH_RXD3 GPIOB /* PB1 */
522
523#define GPIO_BANK_ETH_RE_RX_DV_CRS_DV GPIOD /* PD8 */
524#define GPIO_BANK_ETH_RE_RXD0 GPIOD /* PD9 */
525#define GPIO_BANK_ETH_RE_RXD1 GPIOD /* PD10 */
526#define GPIO_BANK_ETH_RE_RXD2 GPIOD /* PD11 */
527#define GPIO_BANK_ETH_RE_RXD3 GPIOD /* PD12 */
528
529/* --- GPIO registers ------------------------------------------------------ */
530
531/* Port configuration register low (GPIOx_CRL) */
532#define GPIO_CRL(port) MMIO32((port) + 0x00)
533#define GPIOA_CRL GPIO_CRL(GPIOA)
534#define GPIOB_CRL GPIO_CRL(GPIOB)
535#define GPIOC_CRL GPIO_CRL(GPIOC)
536#define GPIOD_CRL GPIO_CRL(GPIOD)
537#define GPIOE_CRL GPIO_CRL(GPIOE)
538#define GPIOF_CRL GPIO_CRL(GPIOF)
539#define GPIOG_CRL GPIO_CRL(GPIOG)
540
541/* Port configuration register low (GPIOx_CRH) */
542#define GPIO_CRH(port) MMIO32((port) + 0x04)
543#define GPIOA_CRH GPIO_CRH(GPIOA)
544#define GPIOB_CRH GPIO_CRH(GPIOB)
545#define GPIOC_CRH GPIO_CRH(GPIOC)
546#define GPIOD_CRH GPIO_CRH(GPIOD)
547#define GPIOE_CRH GPIO_CRH(GPIOE)
548#define GPIOF_CRH GPIO_CRH(GPIOF)
549#define GPIOG_CRH GPIO_CRH(GPIOG)
550
551/* Port input data register (GPIOx_IDR) */
552#define GPIO_IDR(port) MMIO32((port) + 0x08)
553#define GPIOA_IDR GPIO_IDR(GPIOA)
554#define GPIOB_IDR GPIO_IDR(GPIOB)
555#define GPIOC_IDR GPIO_IDR(GPIOC)
556#define GPIOD_IDR GPIO_IDR(GPIOD)
557#define GPIOE_IDR GPIO_IDR(GPIOE)
558#define GPIOF_IDR GPIO_IDR(GPIOF)
559#define GPIOG_IDR GPIO_IDR(GPIOG)
560
561/* Port output data register (GPIOx_ODR) */
562#define GPIO_ODR(port) MMIO32((port) + 0x0c)
563#define GPIOA_ODR GPIO_ODR(GPIOA)
564#define GPIOB_ODR GPIO_ODR(GPIOB)
565#define GPIOC_ODR GPIO_ODR(GPIOC)
566#define GPIOD_ODR GPIO_ODR(GPIOD)
567#define GPIOE_ODR GPIO_ODR(GPIOE)
568#define GPIOF_ODR GPIO_ODR(GPIOF)
569#define GPIOG_ODR GPIO_ODR(GPIOG)
570
571/* Port bit set/reset register (GPIOx_BSRR) */
572#define GPIO_BSRR(port) MMIO32((port) + 0x10)
573#define GPIOA_BSRR GPIO_BSRR(GPIOA)
574#define GPIOB_BSRR GPIO_BSRR(GPIOB)
575#define GPIOC_BSRR GPIO_BSRR(GPIOC)
576#define GPIOD_BSRR GPIO_BSRR(GPIOD)
577#define GPIOE_BSRR GPIO_BSRR(GPIOE)
578#define GPIOF_BSRR GPIO_BSRR(GPIOF)
579#define GPIOG_BSRR GPIO_BSRR(GPIOG)
580
581/* Port bit reset register (GPIOx_BRR) */
582#define GPIO_BRR(port) MMIO16((port) + 0x14)
583#define GPIOA_BRR GPIO_BRR(GPIOA)
584#define GPIOB_BRR GPIO_BRR(GPIOB)
585#define GPIOC_BRR GPIO_BRR(GPIOC)
586#define GPIOD_BRR GPIO_BRR(GPIOD)
587#define GPIOE_BRR GPIO_BRR(GPIOE)
588#define GPIOF_BRR GPIO_BRR(GPIOF)
589#define GPIOG_BRR GPIO_BRR(GPIOG)
590
591/* Port configuration lock register (GPIOx_LCKR) */
592#define GPIO_LCKR(port) MMIO32((port) + 0x18)
593#define GPIOA_LCKR GPIO_LCKR(GPIOA)
594#define GPIOB_LCKR GPIO_LCKR(GPIOB)
595#define GPIOC_LCKR GPIO_LCKR(GPIOC)
596#define GPIOD_LCKR GPIO_LCKR(GPIOD)
597#define GPIOE_LCKR GPIO_LCKR(GPIOE)
598#define GPIOF_LCKR GPIO_LCKR(GPIOF)
599#define GPIOG_LCKR GPIO_LCKR(GPIOG)
600
601/* --- GPIO_CRL/GPIO_CRH values -------------------------------------------- */
602
603/** @defgroup gpio_cnf GPIO Pin Configuration
604@ingroup gpio_defines
605If mode specifies input, configuration can be
606@li Analog input
607@li Floating input
608@li Pull up/down input
609
610If mode specifies output, configuration can be
611@li Digital push-pull
612@li Digital open drain
613@li Alternate function push-pull or analog output
614@li Alternate function open drain or analog output
615@{*/
616/* CNF[1:0] values when MODE[1:0] is 00 (input mode) */
617/** Analog Input */
618#define GPIO_CNF_INPUT_ANALOG 0x00
619/** Digital Input Floating */
620#define GPIO_CNF_INPUT_FLOAT 0x01 /* Default */
621/** Digital Input Pull Up and Down */
622#define GPIO_CNF_INPUT_PULL_UPDOWN 0x02
623/* CNF[1:0] values when MODE[1:0] is != 00 (one of the output modes) */
624/** Digital Output Pushpull */
625#define GPIO_CNF_OUTPUT_PUSHPULL 0x00
626/** Digital Output Open Drain */
627#define GPIO_CNF_OUTPUT_OPENDRAIN 0x01
628/** Alternate Function Output Pushpull */
629#define GPIO_CNF_OUTPUT_ALTFN_PUSHPULL 0x02
630/** Alternate Function Output Open Drain */
631#define GPIO_CNF_OUTPUT_ALTFN_OPENDRAIN 0x03
632/**@}*/
633
634/* Pin mode (MODE[1:0]) values */
635/** @defgroup gpio_mode GPIO Pin Mode
636@ingroup gpio_defines
637@li Input (default after reset)
638@li Output mode at 10 MHz maximum speed
639@li Output mode at 2 MHz maximum speed
640@li Output mode at 50 MHz maximum speed
641@{*/
642#define GPIO_MODE_INPUT 0x00 /* Default */
643#define GPIO_MODE_OUTPUT_10_MHZ 0x01
644#define GPIO_MODE_OUTPUT_2_MHZ 0x02
645#define GPIO_MODE_OUTPUT_50_MHZ 0x03
646/**@}*/
647
648/* --- GPIO_IDR values ----------------------------------------------------- */
649
650/* GPIO_IDR[15:0]: IDRy[15:0]: Port input data (y = 0..15) */
651
652/* --- GPIO_ODR values ----------------------------------------------------- */
653
654/* GPIO_ODR[15:0]: ODRy[15:0]: Port output data (y = 0..15) */
655
656/* --- GPIO_BSRR values ---------------------------------------------------- */
657
658/* GPIO_BSRR[31:16]: BRy: Port x reset bit y (y = 0..15) */
659/* GPIO_BSRR[15:0]: BSy: Port x set bit y (y = 0..15) */
660
661/* --- GPIO_BRR values ----------------------------------------------------- */
662
663/* GPIO_BRR[15:0]: BRy: Port x reset bit y (y = 0..15) */
664
665/* --- AFIO registers ------------------------------------------------------ */
666
667/* Event control register (AFIO_EVCR) */
668#define AFIO_EVCR MMIO32(AFIO_BASE + 0x00)
669
670/* AF remap and debug I/O configuration register (AFIO_MAPR) */
671#define AFIO_MAPR MMIO32(AFIO_BASE + 0x04)
672
673/* External interrupt configuration register [0..3] (AFIO_EXTICR[1..4])*/
674#define AFIO_EXTICR(i) MMIO32(AFIO_BASE + 0x08 + (i)*4)
675#define AFIO_EXTICR1 AFIO_EXTICR(0)
676#define AFIO_EXTICR2 AFIO_EXTICR(1)
677#define AFIO_EXTICR3 AFIO_EXTICR(2)
678#define AFIO_EXTICR4 AFIO_EXTICR(3)
679
680/* AF remap and debug I/O configuration register (AFIO_MAPR) */
681#define AFIO_MAPR2 MMIO32(AFIO_BASE + 0x1C)
682
683/* --- AFIO_EVCR values ---------------------------------------------------- */
684
685/* EVOE: Event output enable */
686#define AFIO_EVCR_EVOE (1 << 7)
687
688/* PORT[2:0]: Port selection */
689/** @defgroup afio_evcr_port EVENTOUT Port selection
690@ingroup gpio_defines
691
692@{*/
693#define AFIO_EVCR_PORT_PA (0x0 << 4)
694#define AFIO_EVCR_PORT_PB (0x1 << 4)
695#define AFIO_EVCR_PORT_PC (0x2 << 4)
696#define AFIO_EVCR_PORT_PD (0x3 << 4)
697#define AFIO_EVCR_PORT_PE (0x4 << 4)
698/**@}*/
699
700/* PIN[3:0]: Pin selection */
701/** @defgroup afio_evcr_pin EVENTOUT Pin selection
702@ingroup gpio_defines
703
704@{*/
705#define AFIO_EVCR_PIN_Px0 (0x0 << 0)
706#define AFIO_EVCR_PIN_Px1 (0x1 << 0)
707#define AFIO_EVCR_PIN_Px2 (0x2 << 0)
708#define AFIO_EVCR_PIN_Px3 (0x3 << 0)
709#define AFIO_EVCR_PIN_Px4 (0x4 << 0)
710#define AFIO_EVCR_PIN_Px5 (0x5 << 0)
711#define AFIO_EVCR_PIN_Px6 (0x6 << 0)
712#define AFIO_EVCR_PIN_Px7 (0x7 << 0)
713#define AFIO_EVCR_PIN_Px8 (0x8 << 0)
714#define AFIO_EVCR_PIN_Px9 (0x9 << 0)
715#define AFIO_EVCR_PIN_Px10 (0xA << 0)
716#define AFIO_EVCR_PIN_Px11 (0xB << 0)
717#define AFIO_EVCR_PIN_Px12 (0xC << 0)
718#define AFIO_EVCR_PIN_Px13 (0xD << 0)
719#define AFIO_EVCR_PIN_Px14 (0xE << 0)
720#define AFIO_EVCR_PIN_Px15 (0xF << 0)
721/**@}*/
722
723/* --- AFIO_MAPR values ---------------------------------------------------- */
724
725/* 31 reserved */
726
727/** @defgroup afio_remap_cld Alternate Function Remap Controls for Connectivity
728Line Devices only
729@ingroup gpio_defines
730
731@{*/
732/* PTP_PPS_REMAP: */
733/** Ethernet PTP PPS remapping (only connectivity line devices) */
734#define AFIO_MAPR_PTP_PPS_REMAP (1 << 30)
735
736/* TIM2ITR1_IREMAP: */
737/** TIM2 internal trigger 1 remapping (only connectivity line devices) */
738#define AFIO_MAPR_TIM2ITR1_IREMAP (1 << 29)
739
740/* SPI3_REMAP: */
741/** SPI3/I2S3 remapping (only connectivity line devices) */
742#define AFIO_MAPR_SPI3_REMAP (1 << 28)
743
744/* MII_REMAP: */
745/** MII or RMII selection (only connectivity line devices) */
746#define AFIO_MAPR_MII_RMII_SEL (1 << 23)
747
748/* CAN2_REMAP: */
749/** CAN2 I/O remapping (only connectivity line devices) */
750#define AFIO_MAPR_CAN2_REMAP (1 << 22)
751
752/* ETH_REMAP: */
753/** Ethernet MAC I/O remapping (only connectivity line devices) */
754#define AFIO_MAPR_ETH_REMAP (1 << 21)
755
756/**@}*/
757
758/* 27 reserved */
759
760/* SWJ_CFG[2:0]: Serial wire JTAG configuration */
761/** @defgroup afio_swj_disable Serial Wire JTAG disables
762@ingroup gpio_defines
763
764@{*/
765#define AFIO_MAPR_SWJ_MASK (0x7 << 24)
766/** Full Serial Wire JTAG capability */
767#define AFIO_MAPR_SWJ_CFG_FULL_SWJ (0x0 << 24)
768/** Full Serial Wire JTAG capability without JNTRST */
769#define AFIO_MAPR_SWJ_CFG_FULL_SWJ_NO_JNTRST (0x1 << 24)
770/** JTAG-DP disabled with SW-DP enabled */
771#define AFIO_MAPR_SWJ_CFG_JTAG_OFF_SW_ON (0x2 << 24)
772/** JTAG-DP disabled and SW-DP disabled */
773#define AFIO_MAPR_SWJ_CFG_JTAG_OFF_SW_OFF (0x4 << 24)
774/**@}*/
775
776/** @defgroup afio_remap Alternate Function Remap Controls
777@ingroup gpio_defines
778
779@{*/
780/* ADC2_ETRGREG_REMAP: */
781/**
782 * ADC2 external trigger regulator conversion remapping
783 * (only low-, medium-, high- and XL-density devices)
784 */
785#define AFIO_MAPR_ADC2_ETRGREG_REMAP (1 << 20)
786
787/* ADC2_ETRGINJ_REMAP: */
788/**
789 * ADC2 external trigger injected conversion remapping
790 * (only low-, medium-, high- and XL-density devices)
791 */
792#define AFIO_MAPR_ADC2_ETRGINJ_REMAP (1 << 19)
793
794/* ADC1_ETRGREG_REMAP: */
795/**
796 * ADC1 external trigger regulator conversion remapping
797 * (only low-, medium-, high- and XL-density devices)
798 */
799#define AFIO_MAPR_ADC1_ETRGREG_REMAP (1 << 18)
800
801/* ADC1_ETRGINJ_REMAP: */
802/**
803 * ADC1 external trigger injected conversion remapping
804 * (only low-, medium-, high- and XL-density devices)
805 */
806#define AFIO_MAPR_ADC1_ETRGINJ_REMAP (1 << 17)
807
808/* TIM5CH4_IREMAP: */
809/** TIM5 channel 4 internal remap */
810#define AFIO_MAPR_TIM5CH4_IREMAP (1 << 16)
811
812/* PD01_REMAP: */
813/** Port D0/Port D1 mapping on OSC_IN/OSC_OUT */
814#define AFIO_MAPR_PD01_REMAP (1 << 15)
815
816/* TIM4_REMAP: */
817/** TIM4 remapping */
818#define AFIO_MAPR_TIM4_REMAP (1 << 12)
819
820/* USART2_REMAP[1:0]: */
821/** USART2 remapping */
822#define AFIO_MAPR_USART2_REMAP (1 << 3)
823
824/* USART1_REMAP[1:0]: */
825/** USART1 remapping */
826#define AFIO_MAPR_USART1_REMAP (1 << 2)
827
828/* I2C1_REMAP[1:0]: */
829/** I2C1 remapping */
830#define AFIO_MAPR_I2C1_REMAP (1 << 1)
831
832/* SPI1_REMAP[1:0]: */
833/** SPI1 remapping */
834#define AFIO_MAPR_SPI1_REMAP (1 << 0)
835/**@}*/
836
837/* CAN_REMAP[1:0]: CAN1 alternate function remapping */
838/** @defgroup afio_remap_can1 Alternate Function Remap Controls for CAN 1
839@ingroup gpio_defines
840
841@{*/
842#define AFIO_MAPR_CAN1_REMAP_PORTA (0x0 << 13)
843#define AFIO_MAPR_CAN1_REMAP_PORTB (0x2 << 13) /* Not 36pin pkg */
844#define AFIO_MAPR_CAN1_REMAP_PORTD (0x3 << 13)
845/**@}*/
846
847/* TIM3_REMAP[1:0]: TIM3 remapping */
848/** @defgroup afio_remap_tim3 Alternate Function Remap Controls for Timer 3
849@ingroup gpio_defines
850
851@{*/
852#define AFIO_MAPR_TIM3_REMAP_NO_REMAP (0x0 << 10)
853#define AFIO_MAPR_TIM3_REMAP_PARTIAL_REMAP (0x2 << 10)
854#define AFIO_MAPR_TIM3_REMAP_FULL_REMAP (0x3 << 10)
855/**@}*/
856
857/* TIM2_REMAP[1:0]: TIM2 remapping */
858/** @defgroup afio_remap_tim2 Alternate Function Remap Controls for Timer 2
859@ingroup gpio_defines
860
861@{*/
862#define AFIO_MAPR_TIM2_REMAP_NO_REMAP (0x0 << 8)
863#define AFIO_MAPR_TIM2_REMAP_PARTIAL_REMAP1 (0x1 << 8)
864#define AFIO_MAPR_TIM2_REMAP_PARTIAL_REMAP2 (0x2 << 8)
865#define AFIO_MAPR_TIM2_REMAP_FULL_REMAP (0x3 << 8)
866/**@}*/
867
868/* TIM1_REMAP[1:0]: TIM1 remapping */
869/** @defgroup afio_remap_tim1 Alternate Function Remap Controls for Timer 1
870@ingroup gpio_defines
871
872@{*/
873#define AFIO_MAPR_TIM1_REMAP_NO_REMAP (0x0 << 6)
874#define AFIO_MAPR_TIM1_REMAP_PARTIAL_REMAP (0x1 << 6)
875#define AFIO_MAPR_TIM1_REMAP_FULL_REMAP (0x3 << 6)
876/**@}*/
877
878/* USART3_REMAP[1:0]: USART3 remapping */
879/** @defgroup afio_remap_usart3 Alternate Function Remap Controls for USART 3
880@ingroup gpio_defines
881
882@{*/
883#define AFIO_MAPR_USART3_REMAP_NO_REMAP (0x0 << 4)
884#define AFIO_MAPR_USART3_REMAP_PARTIAL_REMAP (0x1 << 4)
885#define AFIO_MAPR_USART3_REMAP_FULL_REMAP (0x3 << 4)
886/**@}*/
887
888/** @defgroup afio_remap2 Alternate Function Remap Controls Secondary Set
889@ingroup gpio_defines
890
891@{*/
892/** various remaps, dma/dac/timer triggers (HD only) */
893#define AFIO_MAPR2_MISC_REMAP (1 << 13)
894
895/** TIM12_CH1 and TIM12_CH2 remapping (HD only) */
896#define AFIO_MAPR2_TIM12_REMAP (1 << 12)
897
898/** TIM76_DAC_DMA remap to DMA1/DMA2 */
899#define AFIO_MAPR2_TIM76_DAC_DMA_REMAPE (1 << 11)
900
901/* FSMC_NADV_DISCONNECT: */
902/** The NADV is disconnected from its allocated pin */
903#define AFIO_MAPR2_FSMC_NADV_DISCONNECT (1 << 10)
904
905/** TIM14 CH1 remapping (Clear: PA7 vs Set: PF9 */
906#define AFIO_MAPR2_TIM14_REMAP (1 << 9)
907
908/** TIM13 CH1 remapping (Clear: PA6 vs Set: PF8 */
909#define AFIO_MAPR2_TIM13_REMAP (1 << 8)
910
911/** TIM11 CH1 remapping (Clear: PB7 vs Set: PF7 */
912#define AFIO_MAPR2_TIM11_REMAP (1 << 7)
913
914/** TIM10 CH1 remapping (Clear: PB8 vs Set: PF6 */
915#define AFIO_MAPR2_TIM10_REMAP (1 << 6)
916
917/** TIM9 Ch1/2 remapping (Clear: PA2,PA3 vs Set: PE5,PE6 */
918#define AFIO_MAPR2_TIM9_REMAP (1 << 5)
919
920/** TIM1_DMA channel remapping
921 * Clear: CH1->DMA1-ch2, CH2->DM1-ch3
922 * Set: CH1->DMA1-ch6, CH2->DMA1-ch6
923 */
924#define AFIO_MAPR2_TIM1_DMA_REMAP (1 << 4)
925
926/** CEC remapping (Clear: PB8 vs Set: PB10) */
927#define AFIO_MAPR2_CEC_REMAP (1 << 3)
928
929/** TIM17 remapping (Clear: PB9 vs Set: PB7) */
930#define AFIO_MAPR2_TIM17_REMAP (1 << 2)
931
932/** TIM16 remapping (Clear: PB8 vs Set: PA6) */
933#define AFIO_MAPR2_TIM16_REMAP (1 << 1)
934
935/** TIM15 remapping (Clear: PA2, PA3 vs Set: PB14, PB15) */
936#define AFIO_MAPR2_TIM15_REMAP (1 << 0)
937
938/**@}*/
939
940/* --- AFIO_EXTICRx values ------------------------------------------------- */
941
942/** EXTICR port selection bits */
943#define AFIO_EXTICR_FIELDSIZE 4
944
945/** @defgroup afio_exti Alternate Function EXTI pin number
946@ingroup gpio_defines
947
948@{*/
949
950#define AFIO_EXTI0 0
951#define AFIO_EXTI1 1
952#define AFIO_EXTI2 2
953#define AFIO_EXTI3 3
954#define AFIO_EXTI4 4
955#define AFIO_EXTI5 5
956#define AFIO_EXTI6 6
957#define AFIO_EXTI7 7
958#define AFIO_EXTI8 8
959#define AFIO_EXTI9 9
960#define AFIO_EXTI10 10
961#define AFIO_EXTI11 11
962#define AFIO_EXTI12 12
963#define AFIO_EXTI13 13
964#define AFIO_EXTI14 14
965#define AFIO_EXTI15 15
966
967/**@}*/
968
969/* --- Function prototypes ------------------------------------------------- */
970
972
973void gpio_set_mode(uint32_t gpioport, uint8_t mode, uint8_t cnf,
974 uint16_t gpios);
975void gpio_set_eventout(uint8_t evoutport, uint8_t evoutpin);
976void gpio_primary_remap(uint32_t swjenable, uint32_t maps);
977void gpio_secondary_remap(uint32_t maps);
978
980
981#endif
982/**@}*/
983
#define END_DECLS
Definition: common.h:34
#define BEGIN_DECLS
Definition: common.h:33
void gpio_secondary_remap(uint32_t maps)
Map Alternate Function Port Bits (Secondary Set)
Definition: gpio.c:192
void gpio_primary_remap(uint32_t swjenable, uint32_t maps)
Map Alternate Function Port Bits (Main Set)
Definition: gpio.c:167
void gpio_set_eventout(uint8_t evoutport, uint8_t evoutpin)
Map the EVENTOUT signal.
Definition: gpio.c:139
void gpio_set_mode(uint32_t gpioport, uint8_t mode, uint8_t cnf, uint16_t gpios)
Set GPIO Pin Mode.
Definition: gpio.c:93