Zephyr API Documentation  2.7.0-rc2
A Scalable Open Source RTOS
stm32-pinctrl-common.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2017 Linaro Limited
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7#ifndef ZEPHYR_STM32_PINCTRL_COMMON_H_
8#define ZEPHYR_STM32_PINCTRL_COMMON_H_
9
14#define STM32_PORTA 0 /* IO port A */
15#define STM32_PORTB 1 /* .. */
16#define STM32_PORTC 2
17#define STM32_PORTD 3
18#define STM32_PORTE 4
19#define STM32_PORTF 5
20#define STM32_PORTG 6
21#define STM32_PORTH 7
22#define STM32_PORTI 8
23#define STM32_PORTJ 9
24#define STM32_PORTK 10 /* IO port K */
25
26#ifndef STM32_PORTS_MAX
27#define STM32_PORTS_MAX (STM32_PORTK + 1)
28#endif
29
30#define STM32_PINMUX_FUNC_GPIO 0
31#define STM32_PINMUX_FUNC_ANALOG (STM32_PINMUX_FUNC_ALT_MAX)
32
36#define STM32PIN(_port, _pin) \
37 (_port << 4 | _pin)
38
39#define STM32_PIN_PA0 STM32PIN(STM32_PORTA, 0)
40#define STM32_PIN_PA1 STM32PIN(STM32_PORTA, 1)
41#define STM32_PIN_PA2 STM32PIN(STM32_PORTA, 2)
42#define STM32_PIN_PA3 STM32PIN(STM32_PORTA, 3)
43#define STM32_PIN_PA4 STM32PIN(STM32_PORTA, 4)
44#define STM32_PIN_PA5 STM32PIN(STM32_PORTA, 5)
45#define STM32_PIN_PA6 STM32PIN(STM32_PORTA, 6)
46#define STM32_PIN_PA7 STM32PIN(STM32_PORTA, 7)
47#define STM32_PIN_PA8 STM32PIN(STM32_PORTA, 8)
48#define STM32_PIN_PA9 STM32PIN(STM32_PORTA, 9)
49#define STM32_PIN_PA10 STM32PIN(STM32_PORTA, 10)
50#define STM32_PIN_PA11 STM32PIN(STM32_PORTA, 11)
51#define STM32_PIN_PA12 STM32PIN(STM32_PORTA, 12)
52#define STM32_PIN_PA13 STM32PIN(STM32_PORTA, 13)
53#define STM32_PIN_PA14 STM32PIN(STM32_PORTA, 14)
54#define STM32_PIN_PA15 STM32PIN(STM32_PORTA, 15)
55
56#define STM32_PIN_PB0 STM32PIN(STM32_PORTB, 0)
57#define STM32_PIN_PB1 STM32PIN(STM32_PORTB, 1)
58#define STM32_PIN_PB2 STM32PIN(STM32_PORTB, 2)
59#define STM32_PIN_PB3 STM32PIN(STM32_PORTB, 3)
60#define STM32_PIN_PB4 STM32PIN(STM32_PORTB, 4)
61#define STM32_PIN_PB5 STM32PIN(STM32_PORTB, 5)
62#define STM32_PIN_PB6 STM32PIN(STM32_PORTB, 6)
63#define STM32_PIN_PB7 STM32PIN(STM32_PORTB, 7)
64#define STM32_PIN_PB8 STM32PIN(STM32_PORTB, 8)
65#define STM32_PIN_PB9 STM32PIN(STM32_PORTB, 9)
66#define STM32_PIN_PB10 STM32PIN(STM32_PORTB, 10)
67#define STM32_PIN_PB11 STM32PIN(STM32_PORTB, 11)
68#define STM32_PIN_PB12 STM32PIN(STM32_PORTB, 12)
69#define STM32_PIN_PB13 STM32PIN(STM32_PORTB, 13)
70#define STM32_PIN_PB14 STM32PIN(STM32_PORTB, 14)
71#define STM32_PIN_PB15 STM32PIN(STM32_PORTB, 15)
72
73#define STM32_PIN_PC0 STM32PIN(STM32_PORTC, 0)
74#define STM32_PIN_PC1 STM32PIN(STM32_PORTC, 1)
75#define STM32_PIN_PC2 STM32PIN(STM32_PORTC, 2)
76#define STM32_PIN_PC3 STM32PIN(STM32_PORTC, 3)
77#define STM32_PIN_PC4 STM32PIN(STM32_PORTC, 4)
78#define STM32_PIN_PC5 STM32PIN(STM32_PORTC, 5)
79#define STM32_PIN_PC6 STM32PIN(STM32_PORTC, 6)
80#define STM32_PIN_PC7 STM32PIN(STM32_PORTC, 7)
81#define STM32_PIN_PC8 STM32PIN(STM32_PORTC, 8)
82#define STM32_PIN_PC9 STM32PIN(STM32_PORTC, 9)
83#define STM32_PIN_PC10 STM32PIN(STM32_PORTC, 10)
84#define STM32_PIN_PC11 STM32PIN(STM32_PORTC, 11)
85#define STM32_PIN_PC12 STM32PIN(STM32_PORTC, 12)
86#define STM32_PIN_PC13 STM32PIN(STM32_PORTC, 13)
87#define STM32_PIN_PC14 STM32PIN(STM32_PORTC, 14)
88#define STM32_PIN_PC15 STM32PIN(STM32_PORTC, 15)
89
90#define STM32_PIN_PD0 STM32PIN(STM32_PORTD, 0)
91#define STM32_PIN_PD1 STM32PIN(STM32_PORTD, 1)
92#define STM32_PIN_PD2 STM32PIN(STM32_PORTD, 2)
93#define STM32_PIN_PD3 STM32PIN(STM32_PORTD, 3)
94#define STM32_PIN_PD4 STM32PIN(STM32_PORTD, 4)
95#define STM32_PIN_PD5 STM32PIN(STM32_PORTD, 5)
96#define STM32_PIN_PD6 STM32PIN(STM32_PORTD, 6)
97#define STM32_PIN_PD7 STM32PIN(STM32_PORTD, 7)
98#define STM32_PIN_PD8 STM32PIN(STM32_PORTD, 8)
99#define STM32_PIN_PD9 STM32PIN(STM32_PORTD, 9)
100#define STM32_PIN_PD10 STM32PIN(STM32_PORTD, 10)
101#define STM32_PIN_PD11 STM32PIN(STM32_PORTD, 11)
102#define STM32_PIN_PD12 STM32PIN(STM32_PORTD, 12)
103#define STM32_PIN_PD13 STM32PIN(STM32_PORTD, 13)
104#define STM32_PIN_PD14 STM32PIN(STM32_PORTD, 14)
105#define STM32_PIN_PD15 STM32PIN(STM32_PORTD, 15)
106
107#define STM32_PIN_PE0 STM32PIN(STM32_PORTE, 0)
108#define STM32_PIN_PE1 STM32PIN(STM32_PORTE, 1)
109#define STM32_PIN_PE2 STM32PIN(STM32_PORTE, 2)
110#define STM32_PIN_PE3 STM32PIN(STM32_PORTE, 3)
111#define STM32_PIN_PE4 STM32PIN(STM32_PORTE, 4)
112#define STM32_PIN_PE5 STM32PIN(STM32_PORTE, 5)
113#define STM32_PIN_PE6 STM32PIN(STM32_PORTE, 6)
114#define STM32_PIN_PE7 STM32PIN(STM32_PORTE, 7)
115#define STM32_PIN_PE8 STM32PIN(STM32_PORTE, 8)
116#define STM32_PIN_PE9 STM32PIN(STM32_PORTE, 9)
117#define STM32_PIN_PE10 STM32PIN(STM32_PORTE, 10)
118#define STM32_PIN_PE11 STM32PIN(STM32_PORTE, 11)
119#define STM32_PIN_PE12 STM32PIN(STM32_PORTE, 12)
120#define STM32_PIN_PE13 STM32PIN(STM32_PORTE, 13)
121#define STM32_PIN_PE14 STM32PIN(STM32_PORTE, 14)
122#define STM32_PIN_PE15 STM32PIN(STM32_PORTE, 15)
123
124#define STM32_PIN_PF0 STM32PIN(STM32_PORTF, 0)
125#define STM32_PIN_PF1 STM32PIN(STM32_PORTF, 1)
126#define STM32_PIN_PF2 STM32PIN(STM32_PORTF, 2)
127#define STM32_PIN_PF3 STM32PIN(STM32_PORTF, 3)
128#define STM32_PIN_PF4 STM32PIN(STM32_PORTF, 4)
129#define STM32_PIN_PF5 STM32PIN(STM32_PORTF, 5)
130#define STM32_PIN_PF6 STM32PIN(STM32_PORTF, 6)
131#define STM32_PIN_PF7 STM32PIN(STM32_PORTF, 7)
132#define STM32_PIN_PF8 STM32PIN(STM32_PORTF, 8)
133#define STM32_PIN_PF9 STM32PIN(STM32_PORTF, 9)
134#define STM32_PIN_PF10 STM32PIN(STM32_PORTF, 10)
135#define STM32_PIN_PF11 STM32PIN(STM32_PORTF, 11)
136#define STM32_PIN_PF12 STM32PIN(STM32_PORTF, 12)
137#define STM32_PIN_PF13 STM32PIN(STM32_PORTF, 13)
138#define STM32_PIN_PF14 STM32PIN(STM32_PORTF, 14)
139#define STM32_PIN_PF15 STM32PIN(STM32_PORTF, 15)
140
141#define STM32_PIN_PG0 STM32PIN(STM32_PORTG, 0)
142#define STM32_PIN_PG1 STM32PIN(STM32_PORTG, 1)
143#define STM32_PIN_PG2 STM32PIN(STM32_PORTG, 2)
144#define STM32_PIN_PG3 STM32PIN(STM32_PORTG, 3)
145#define STM32_PIN_PG4 STM32PIN(STM32_PORTG, 4)
146#define STM32_PIN_PG5 STM32PIN(STM32_PORTG, 5)
147#define STM32_PIN_PG6 STM32PIN(STM32_PORTG, 6)
148#define STM32_PIN_PG7 STM32PIN(STM32_PORTG, 7)
149#define STM32_PIN_PG8 STM32PIN(STM32_PORTG, 8)
150#define STM32_PIN_PG9 STM32PIN(STM32_PORTG, 9)
151#define STM32_PIN_PG10 STM32PIN(STM32_PORTG, 10)
152#define STM32_PIN_PG11 STM32PIN(STM32_PORTG, 11)
153#define STM32_PIN_PG12 STM32PIN(STM32_PORTG, 12)
154#define STM32_PIN_PG13 STM32PIN(STM32_PORTG, 13)
155#define STM32_PIN_PG14 STM32PIN(STM32_PORTG, 14)
156#define STM32_PIN_PG15 STM32PIN(STM32_PORTG, 15)
157
158#define STM32_PIN_PH0 STM32PIN(STM32_PORTH, 0)
159#define STM32_PIN_PH1 STM32PIN(STM32_PORTH, 1)
160#define STM32_PIN_PH2 STM32PIN(STM32_PORTH, 2)
161#define STM32_PIN_PH3 STM32PIN(STM32_PORTH, 3)
162#define STM32_PIN_PH4 STM32PIN(STM32_PORTH, 4)
163#define STM32_PIN_PH5 STM32PIN(STM32_PORTH, 5)
164#define STM32_PIN_PH6 STM32PIN(STM32_PORTH, 6)
165#define STM32_PIN_PH7 STM32PIN(STM32_PORTH, 7)
166#define STM32_PIN_PH8 STM32PIN(STM32_PORTH, 8)
167#define STM32_PIN_PH9 STM32PIN(STM32_PORTH, 9)
168#define STM32_PIN_PH10 STM32PIN(STM32_PORTH, 10)
169#define STM32_PIN_PH11 STM32PIN(STM32_PORTH, 11)
170#define STM32_PIN_PH12 STM32PIN(STM32_PORTH, 12)
171#define STM32_PIN_PH13 STM32PIN(STM32_PORTH, 13)
172#define STM32_PIN_PH14 STM32PIN(STM32_PORTH, 14)
173#define STM32_PIN_PH15 STM32PIN(STM32_PORTH, 15)
174
175#define STM32_PIN_PI0 STM32PIN(STM32_PORTI, 0)
176#define STM32_PIN_PI1 STM32PIN(STM32_PORTI, 1)
177#define STM32_PIN_PI2 STM32PIN(STM32_PORTI, 2)
178#define STM32_PIN_PI3 STM32PIN(STM32_PORTI, 3)
179#define STM32_PIN_PI4 STM32PIN(STM32_PORTI, 4)
180#define STM32_PIN_PI5 STM32PIN(STM32_PORTI, 5)
181#define STM32_PIN_PI6 STM32PIN(STM32_PORTI, 6)
182#define STM32_PIN_PI7 STM32PIN(STM32_PORTI, 7)
183#define STM32_PIN_PI8 STM32PIN(STM32_PORTI, 8)
184#define STM32_PIN_PI9 STM32PIN(STM32_PORTI, 9)
185#define STM32_PIN_PI10 STM32PIN(STM32_PORTI, 10)
186#define STM32_PIN_PI11 STM32PIN(STM32_PORTI, 11)
187#define STM32_PIN_PI12 STM32PIN(STM32_PORTI, 12)
188#define STM32_PIN_PI13 STM32PIN(STM32_PORTI, 13)
189#define STM32_PIN_PI14 STM32PIN(STM32_PORTI, 14)
190#define STM32_PIN_PI15 STM32PIN(STM32_PORTI, 15)
191
192#define STM32_PIN_PJ0 STM32PIN(STM32_PORTJ, 0)
193#define STM32_PIN_PJ1 STM32PIN(STM32_PORTJ, 1)
194#define STM32_PIN_PJ2 STM32PIN(STM32_PORTJ, 2)
195#define STM32_PIN_PJ3 STM32PIN(STM32_PORTJ, 3)
196#define STM32_PIN_PJ4 STM32PIN(STM32_PORTJ, 4)
197#define STM32_PIN_PJ5 STM32PIN(STM32_PORTJ, 5)
198#define STM32_PIN_PJ6 STM32PIN(STM32_PORTJ, 6)
199#define STM32_PIN_PJ7 STM32PIN(STM32_PORTJ, 7)
200#define STM32_PIN_PJ8 STM32PIN(STM32_PORTJ, 8)
201#define STM32_PIN_PJ9 STM32PIN(STM32_PORTJ, 9)
202#define STM32_PIN_PJ10 STM32PIN(STM32_PORTJ, 10)
203#define STM32_PIN_PJ11 STM32PIN(STM32_PORTJ, 11)
204#define STM32_PIN_PJ12 STM32PIN(STM32_PORTJ, 12)
205#define STM32_PIN_PJ13 STM32PIN(STM32_PORTJ, 13)
206#define STM32_PIN_PJ14 STM32PIN(STM32_PORTJ, 14)
207#define STM32_PIN_PJ15 STM32PIN(STM32_PORTJ, 15)
208
209#define STM32_PIN_PK0 STM32PIN(STM32_PORTK, 0)
210#define STM32_PIN_PK1 STM32PIN(STM32_PORTK, 1)
211#define STM32_PIN_PK2 STM32PIN(STM32_PORTK, 2)
212#define STM32_PIN_PK3 STM32PIN(STM32_PORTK, 3)
213#define STM32_PIN_PK4 STM32PIN(STM32_PORTK, 4)
214#define STM32_PIN_PK5 STM32PIN(STM32_PORTK, 5)
215#define STM32_PIN_PK6 STM32PIN(STM32_PORTK, 6)
216#define STM32_PIN_PK7 STM32PIN(STM32_PORTK, 7)
217#define STM32_PIN_PK8 STM32PIN(STM32_PORTK, 8)
218#define STM32_PIN_PK9 STM32PIN(STM32_PORTK, 9)
219#define STM32_PIN_PK10 STM32PIN(STM32_PORTK, 10)
220#define STM32_PIN_PK11 STM32PIN(STM32_PORTK, 11)
221#define STM32_PIN_PK12 STM32PIN(STM32_PORTK, 12)
222#define STM32_PIN_PK13 STM32PIN(STM32_PORTK, 13)
223#define STM32_PIN_PK14 STM32PIN(STM32_PORTK, 14)
224#define STM32_PIN_PK15 STM32PIN(STM32_PORTK, 15)
225
226#endif /* ZEPHYR_STM32_PINCTRL_COMMON_H_ */