aboutsummaryrefslogtreecommitdiff
path: root/lib/chibios-contrib/ext/mcux-sdk/boards/lpcxpresso824max/project_template/pin_mux.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/chibios-contrib/ext/mcux-sdk/boards/lpcxpresso824max/project_template/pin_mux.c')
-rw-r--r--lib/chibios-contrib/ext/mcux-sdk/boards/lpcxpresso824max/project_template/pin_mux.c405
1 files changed, 405 insertions, 0 deletions
diff --git a/lib/chibios-contrib/ext/mcux-sdk/boards/lpcxpresso824max/project_template/pin_mux.c b/lib/chibios-contrib/ext/mcux-sdk/boards/lpcxpresso824max/project_template/pin_mux.c
new file mode 100644
index 000000000..d8fb06242
--- /dev/null
+++ b/lib/chibios-contrib/ext/mcux-sdk/boards/lpcxpresso824max/project_template/pin_mux.c
@@ -0,0 +1,405 @@
1/*
2 * Copyright 2018 NXP.
3 * All rights reserved.
4 *
5 * SPDX-License-Identifier: BSD-3-Clause
6 */
7
8/***********************************************************************************************************************
9 * This file was generated by the MCUXpresso Config Tools. Any manual edits made to this file
10 * will be overwritten if the respective MCUXpresso Config Tools is used to update this file.
11 **********************************************************************************************************************/
12
13/* clang-format off */
14/*
15 * TEXT BELOW IS USED AS SETTING FOR TOOLS *************************************
16!!GlobalInfo
17product: Pins v4.1
18processor: LPC824
19package_id: LPC824M201JHI33
20mcu_data: ksdk2_0
21processor_version: 4.0.1
22board: LPCXpresso824
23pin_labels:
24- {pin_num: '11', pin_signal: PIO0_27, label: 'D1[3]/P3[42]/J1[9]/P0_27-BLUE', identifier: LED_BLUE}
25- {pin_num: '10', pin_signal: PIO0_16, label: 'D1[4]/P3[43]/J2[2]/P0_16-GREEN', identifier: LED_GREEN}
26- {pin_num: '2', pin_signal: PIO0_12, label: 'SW2/D1[1]/P3[45]/J2[5]/P0_12-RED-ISP', identifier: LED_RED;SW2}
27- {pin_num: '22', pin_signal: PIO0_7/ADC_0, label: 'P3[14]/U2[31]/TARGET_TX-P0_7', identifier: DEBUG_UART_TX}
28- {pin_num: '31', pin_signal: PIO0_18/ADC_8, label: 'P3[21]/J2[4]/U2[32]/TARGET_RX-P0_18', identifier: DEBUG_UART_RX}
29- {pin_num: '6', pin_signal: SWCLK/PIO0_3, label: 'P5[4]/U2[16]/TARGET_SWCLK', identifier: DEBUG_SWD_SWDCLK}
30- {pin_num: '7', pin_signal: SWDIO/PIO0_2, label: 'P5[2]/U2[17]/TARGET_SWDIO', identifier: DEBUG_SWD_SWDIO}
31- {pin_num: '3', pin_signal: RESETN/PIO0_5, label: 'J4[3]/P3[4]/U2[3]/P5[10]/SW3[1]/TARGET_nRESET-P0_5', identifier: DEBUG_SWD_RESETN}
32- {pin_num: '4', pin_signal: PIO0_4/ADC_11, label: 'SW1/P3[9]/J2[7]/P0_4-ISP_U_TXD-WAKEUP', identifier: SW1}
33- {pin_num: '1', pin_signal: PIO0_13/ADC_10, label: 'P4[2]/P3[46]/J1[10]/P0_13'}
34- {pin_num: '5', pin_signal: PIO0_28, label: 'P3[44]/J2[3]/P0_28-WKTCLKIN'}
35- {pin_num: '8', pin_signal: PIO0_11/I2C0_SDA, label: 'P3[40]/J1[2]/P4[8]/P0_11-I2C0_SDA'}
36- {pin_num: '9', pin_signal: PIO0_10/I2C0_SCL, label: 'P3[41]/J1[1]/P4[6]/P0_10-I2C0_SCL'}
37- {pin_num: '12', pin_signal: PIO0_26, label: 'P3[5]/J1[7]/P4[3]/P0_26-MOSI'}
38- {pin_num: '13', pin_signal: PIO0_25, label: 'P3[6]/J1[6]/P4[5]/P0_25-MISO'}
39- {pin_num: '14', pin_signal: PIO0_24, label: 'P3[7]/J1[5]/P4[7]/P0_24-SCK'}
40- {pin_num: '15', pin_signal: PIO0_15, label: 'P3[8]/J1[8]/P4[1]/P0_15-SSEL'}
41- {pin_num: '16', pin_signal: PIO0_1/ACMP_I2/CLKIN, label: 'P3[11]/P0_1-CLKIN'}
42- {pin_num: '17', pin_signal: PIO0_9/XTALOUT, label: 'P3[12]/U2[26]/P0_9-LINK_nWAKE'}
43- {pin_num: '18', pin_signal: PIO0_8/XTALIN, label: 'P3[13]/U2[27]/P0_8-LINK_nSLEEP'}
44- {pin_num: '23', pin_signal: PIO0_6/ADC_1/VDDCMP, label: 'P3[15]/J5[1]/P0_6-ADC1-VDDCMP'}
45- {pin_num: '24', pin_signal: PIO0_0/ACMP_I1, label: 'P3[10]/J2[8]/P0_0-ISP_U_RXD'}
46- {pin_num: '25', pin_signal: PIO0_14/ACMP_I3/ADC_2, label: 'P3[16]/J5[2]/P0_14-ADC2-ACMP_I3'}
47- {pin_num: '26', pin_signal: PIO0_23/ADC_3/ACMP_I4, label: 'P3[17]/J5[3]/P0_23-ADC3-ACMP_I4'}
48- {pin_num: '27', pin_signal: PIO0_22/ADC_4, label: 'P3[18]/J5[4]/P0_22-ADC4'}
49- {pin_num: '28', pin_signal: PIO0_21/ADC_5, label: 'P3[19]/J5[5]/P0_21-ADC5'}
50- {pin_num: '29', pin_signal: PIO0_20/ADC_6, label: 'P3[20]/J5[6]/P0_20-ADC6'}
51- {pin_num: '30', pin_signal: PIO0_19/ADC_7, label: 'P3[22]/J2[6]/P0_19'}
52- {pin_num: '32', pin_signal: PIO0_17/ADC_9, label: 'P4[4]/P3[47]/J2[1]/P0_17'}
53- {pin_num: '19', pin_signal: VDD, label: C11/C12/FB4/VDD}
54- {pin_num: '21', pin_signal: VREFP, label: C13/FB3/VREFP}
55- {pin_num: '20', pin_signal: VREFN, label: FB2/VREFN}
56 * BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS ***********
57 */
58/* clang-format on */
59
60#include "fsl_common.h"
61#include "fsl_iocon.h"
62#include "fsl_swm.h"
63#include "pin_mux.h"
64
65/* FUNCTION ************************************************************************************************************
66 *
67 * Function Name : BOARD_InitBootPins
68 * Description : Calls initialization functions.
69 *
70 * END ****************************************************************************************************************/
71void BOARD_InitBootPins(void)
72{
73 BOARD_InitPins();
74 BOARD_InitDEBUG_UARTPins();
75}
76
77/* clang-format off */
78/*
79 * TEXT BELOW IS USED AS SETTING FOR TOOLS *************************************
80BOARD_InitPins:
81- options: {callFromInitBoot: 'true', coreID: core0, enableClock: 'true'}
82- pin_list: []
83 * BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS ***********
84 */
85/* clang-format on */
86
87/* FUNCTION ************************************************************************************************************
88 *
89 * Function Name : BOARD_InitPins
90 * Description : Configures pin routing and optionally pin electrical features.
91 *
92 * END ****************************************************************************************************************/
93/* Function assigned for the Cortex-M0P */
94void BOARD_InitPins(void)
95{
96}
97
98/* clang-format off */
99/*
100 * TEXT BELOW IS USED AS SETTING FOR TOOLS *************************************
101BOARD_InitLEDsPins:
102- options: {callFromInitBoot: 'false', coreID: core0, enableClock: 'true'}
103- pin_list:
104 - {pin_num: '11', peripheral: GPIO, signal: 'PIO0, 27', pin_signal: PIO0_27, direction: OUTPUT, mode: pullUp, invert: disabled, hysteresis: disabled, opendrain: disabled,
105 smode: bypass, clkdiv: div0}
106 - {pin_num: '10', peripheral: GPIO, signal: 'PIO0, 16', pin_signal: PIO0_16, direction: OUTPUT, mode: pullUp, invert: disabled, hysteresis: disabled, opendrain: disabled,
107 smode: bypass, clkdiv: div0}
108 - {pin_num: '2', peripheral: GPIO, signal: 'PIO0, 12', pin_signal: PIO0_12, identifier: LED_RED, direction: OUTPUT, mode: pullUp, invert: disabled, hysteresis: disabled,
109 opendrain: disabled, smode: bypass, clkdiv: div0}
110 * BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS ***********
111 */
112/* clang-format on */
113
114/* FUNCTION ************************************************************************************************************
115 *
116 * Function Name : BOARD_InitLEDsPins
117 * Description : Configures pin routing and optionally pin electrical features.
118 *
119 * END ****************************************************************************************************************/
120/* Function assigned for the Cortex-M0P */
121void BOARD_InitLEDsPins(void)
122{
123 /* Enables clock for IOCON block.: 0x01u */
124 CLOCK_EnableClock(kCLOCK_Iocon);
125
126 GPIO->DIR[0] = ((GPIO->DIR[0] &
127 /* Mask bits to zero which are setting */
128 (~(GPIO_DIR_DIRP_MASK)))
129
130 /* Selects pin direction for pin PIOm_n (bit 0 = PIOn_0, bit 1 = PIOn_1, etc.). Supported pins
131 * depends on the specific device and package. 0 = input. 1 = output.: 0x08011000u */
132 | GPIO_DIR_DIRP(0x08011000u));
133
134 const uint32_t pio2_config = (/* Selects pull-up function */
135 IOCON_PIO_MODE_PULLUP |
136 /* Disable hysteresis */
137 IOCON_PIO_HYS_DI |
138 /* Input not invert */
139 IOCON_PIO_INV_DI |
140 /* Disables Open-drain function */
141 IOCON_PIO_OD_DI |
142 /* Bypass input filter */
143 IOCON_PIO_SMODE_BYPASS |
144 /* IOCONCLKDIV0 */
145 IOCON_PIO_CLKDIV0);
146 /* PORT2 PIN (coords: ) is configured as */
147 IOCON_PinMuxSet(IOCON, 2, pio2_config);
148
149 const uint32_t pio21_config = (/* Selects pull-up function */
150 IOCON_PIO_MODE_PULLUP |
151 /* Disable hysteresis */
152 IOCON_PIO_HYS_DI |
153 /* Input not invert */
154 IOCON_PIO_INV_DI |
155 /* Disables Open-drain function */
156 IOCON_PIO_OD_DI |
157 /* Bypass input filter */
158 IOCON_PIO_SMODE_BYPASS |
159 /* IOCONCLKDIV0 */
160 IOCON_PIO_CLKDIV0);
161 /* PORT2 PIN1 (coords: ) is configured as */
162 IOCON_PinMuxSet(IOCON, 21, pio21_config);
163
164 const uint32_t pio9_config = (/* Selects pull-up function */
165 IOCON_PIO_MODE_PULLUP |
166 /* Disable hysteresis */
167 IOCON_PIO_HYS_DI |
168 /* Input not invert */
169 IOCON_PIO_INV_DI |
170 /* Disables Open-drain function */
171 IOCON_PIO_OD_DI |
172 /* Bypass input filter */
173 IOCON_PIO_SMODE_BYPASS |
174 /* IOCONCLKDIV0 */
175 IOCON_PIO_CLKDIV0);
176 /* PORT9 PIN (coords: ) is configured as */
177 IOCON_PinMuxSet(IOCON, 9, pio9_config);
178}
179
180/* clang-format off */
181/*
182 * TEXT BELOW IS USED AS SETTING FOR TOOLS *************************************
183BOARD_InitDEBUG_UARTPins:
184- options: {callFromInitBoot: 'true', coreID: core0, enableClock: 'true'}
185- pin_list:
186 - {pin_num: '22', peripheral: USART0, signal: TXD, pin_signal: PIO0_7/ADC_0, mode: pullUp, invert: disabled, hysteresis: disabled, opendrain: disabled, smode: bypass,
187 clkdiv: div0}
188 - {pin_num: '31', peripheral: USART0, signal: RXD, pin_signal: PIO0_18/ADC_8, mode: pullUp, invert: disabled, hysteresis: disabled, opendrain: disabled, smode: bypass,
189 clkdiv: div0}
190 * BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS ***********
191 */
192/* clang-format on */
193
194/* FUNCTION ************************************************************************************************************
195 *
196 * Function Name : BOARD_InitDEBUG_UARTPins
197 * Description : Configures pin routing and optionally pin electrical features.
198 *
199 * END ****************************************************************************************************************/
200/* Function assigned for the Cortex-M0P */
201void BOARD_InitDEBUG_UARTPins(void)
202{
203 /* Enables clock for IOCON block.: 0x01u */
204 CLOCK_EnableClock(kCLOCK_Iocon);
205 /* Enables clock for switch matrix.: 0x01u */
206 CLOCK_EnableClock(kCLOCK_Swm);
207
208 const uint32_t pio15_config = (/* Selects pull-up function */
209 IOCON_PIO_MODE_PULLUP |
210 /* Disable hysteresis */
211 IOCON_PIO_HYS_DI |
212 /* Input not invert */
213 IOCON_PIO_INV_DI |
214 /* Disables Open-drain function */
215 IOCON_PIO_OD_DI |
216 /* Bypass input filter */
217 IOCON_PIO_SMODE_BYPASS |
218 /* IOCONCLKDIV0 */
219 IOCON_PIO_CLKDIV0);
220 /* PORT1 PIN5 (coords: ) is configured as */
221 IOCON_PinMuxSet(IOCON, 15, pio15_config);
222
223 const uint32_t pio30_config = (/* Selects pull-up function */
224 IOCON_PIO_MODE_PULLUP |
225 /* Disable hysteresis */
226 IOCON_PIO_HYS_DI |
227 /* Input not invert */
228 IOCON_PIO_INV_DI |
229 /* Disables Open-drain function */
230 IOCON_PIO_OD_DI |
231 /* Bypass input filter */
232 IOCON_PIO_SMODE_BYPASS |
233 /* IOCONCLKDIV0 */
234 IOCON_PIO_CLKDIV0);
235 /* PORT3 PIN0 (coords: ) is configured as */
236 IOCON_PinMuxSet(IOCON, 30, pio30_config);
237
238 /* USART0_TXD connect to P0_7 */
239 SWM_SetMovablePinSelect(SWM0, kSWM_USART0_TXD, kSWM_PortPin_P0_7);
240
241 /* USART0_RXD connect to P0_18 */
242 SWM_SetMovablePinSelect(SWM0, kSWM_USART0_RXD, kSWM_PortPin_P0_18);
243
244 /* Disable clock for switch matrix. */
245 CLOCK_DisableClock(kCLOCK_Swm);
246}
247
248/* clang-format off */
249/*
250 * TEXT BELOW IS USED AS SETTING FOR TOOLS *************************************
251BOARD_InitSWD_DEBUGPins:
252- options: {callFromInitBoot: 'false', coreID: core0, enableClock: 'true'}
253- pin_list:
254 - {pin_num: '6', peripheral: SWD, signal: SWCLK, pin_signal: SWCLK/PIO0_3, mode: pullUp, invert: disabled, hysteresis: disabled, opendrain: disabled, smode: bypass,
255 clkdiv: div0}
256 - {pin_num: '7', peripheral: SWD, signal: SWDIO, pin_signal: SWDIO/PIO0_2, mode: pullUp, invert: disabled, hysteresis: disabled, opendrain: disabled, smode: bypass,
257 clkdiv: div0}
258 - {pin_num: '3', peripheral: SYSCON, signal: RESETN, pin_signal: RESETN/PIO0_5, mode: pullUp, invert: disabled, hysteresis: disabled, opendrain: disabled, smode: bypass,
259 clkdiv: div0}
260 * BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS ***********
261 */
262/* clang-format on */
263
264/* FUNCTION ************************************************************************************************************
265 *
266 * Function Name : BOARD_InitSWD_DEBUGPins
267 * Description : Configures pin routing and optionally pin electrical features.
268 *
269 * END ****************************************************************************************************************/
270/* Function assigned for the Cortex-M0P */
271void BOARD_InitSWD_DEBUGPins(void)
272{
273 /* Enables clock for IOCON block.: 0x01u */
274 CLOCK_EnableClock(kCLOCK_Iocon);
275 /* Enables clock for switch matrix.: 0x01u */
276 CLOCK_EnableClock(kCLOCK_Swm);
277
278 const uint32_t pio3_config = (/* Selects pull-up function */
279 IOCON_PIO_MODE_PULLUP |
280 /* Disable hysteresis */
281 IOCON_PIO_HYS_DI |
282 /* Input not invert */
283 IOCON_PIO_INV_DI |
284 /* Disables Open-drain function */
285 IOCON_PIO_OD_DI |
286 /* Bypass input filter */
287 IOCON_PIO_SMODE_BYPASS |
288 /* IOCONCLKDIV0 */
289 IOCON_PIO_CLKDIV0);
290 /* PORT3 PIN (coords: ) is configured as */
291 IOCON_PinMuxSet(IOCON, 3, pio3_config);
292
293 const uint32_t pio5_config = (/* Selects pull-up function */
294 IOCON_PIO_MODE_PULLUP |
295 /* Disable hysteresis */
296 IOCON_PIO_HYS_DI |
297 /* Input not invert */
298 IOCON_PIO_INV_DI |
299 /* Disables Open-drain function */
300 IOCON_PIO_OD_DI |
301 /* Bypass input filter */
302 IOCON_PIO_SMODE_BYPASS |
303 /* IOCONCLKDIV0 */
304 IOCON_PIO_CLKDIV0);
305 /* PORT5 PIN (coords: ) is configured as */
306 IOCON_PinMuxSet(IOCON, 5, pio5_config);
307
308 const uint32_t pio6_config = (/* Selects pull-up function */
309 IOCON_PIO_MODE_PULLUP |
310 /* Disable hysteresis */
311 IOCON_PIO_HYS_DI |
312 /* Input not invert */
313 IOCON_PIO_INV_DI |
314 /* Disables Open-drain function */
315 IOCON_PIO_OD_DI |
316 /* Bypass input filter */
317 IOCON_PIO_SMODE_BYPASS |
318 /* IOCONCLKDIV0 */
319 IOCON_PIO_CLKDIV0);
320 /* PORT6 PIN (coords: ) is configured as */
321 IOCON_PinMuxSet(IOCON, 6, pio6_config);
322
323 /* SWCLK connect to P0_3 */
324 SWM_SetFixedPinSelect(SWM0, kSWM_SWCLK, true);
325
326 /* SWDIO connect to P0_2 */
327 SWM_SetFixedPinSelect(SWM0, kSWM_SWDIO, true);
328
329 /* RESETN connect to P0_5 */
330 SWM_SetFixedPinSelect(SWM0, kSWM_RESETN, true);
331
332 /* Disable clock for switch matrix. */
333 CLOCK_DisableClock(kCLOCK_Swm);
334}
335
336/* clang-format off */
337/*
338 * TEXT BELOW IS USED AS SETTING FOR TOOLS *************************************
339BOARD_InitBUTTONsPins:
340- options: {callFromInitBoot: 'false', coreID: core0, enableClock: 'true'}
341- pin_list:
342 - {pin_num: '4', peripheral: GPIO, signal: 'PIO0, 4', pin_signal: PIO0_4/ADC_11, direction: INPUT, mode: pullUp, invert: disabled, hysteresis: disabled, opendrain: disabled,
343 smode: bypass, clkdiv: div0}
344 - {pin_num: '2', peripheral: GPIO, signal: 'PIO0, 12', pin_signal: PIO0_12, identifier: SW2, direction: INPUT, mode: pullUp, invert: disabled, hysteresis: disabled,
345 opendrain: disabled, smode: bypass, clkdiv: div0}
346 * BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS ***********
347 */
348/* clang-format on */
349
350/* FUNCTION ************************************************************************************************************
351 *
352 * Function Name : BOARD_InitBUTTONsPins
353 * Description : Configures pin routing and optionally pin electrical features.
354 *
355 * END ****************************************************************************************************************/
356/* Function assigned for the Cortex-M0P */
357void BOARD_InitBUTTONsPins(void)
358{
359 /* Enables clock for IOCON block.: 0x01u */
360 CLOCK_EnableClock(kCLOCK_Iocon);
361
362 GPIO->DIR[0] = ((GPIO->DIR[0] &
363 /* Mask bits to zero which are setting */
364 (~(GPIO_DIR_DIRP_MASK)))
365
366 /* Selects pin direction for pin PIOm_n (bit 0 = PIOn_0, bit 1 = PIOn_1, etc.). Supported pins
367 * depends on the specific device and package. 0 = input. 1 = output.: 0x00u */
368 | GPIO_DIR_DIRP(0x00u));
369
370 const uint32_t pio2_config = (/* Selects pull-up function */
371 IOCON_PIO_MODE_PULLUP |
372 /* Disable hysteresis */
373 IOCON_PIO_HYS_DI |
374 /* Input not invert */
375 IOCON_PIO_INV_DI |
376 /* Disables Open-drain function */
377 IOCON_PIO_OD_DI |
378 /* Bypass input filter */
379 IOCON_PIO_SMODE_BYPASS |
380 /* IOCONCLKDIV0 */
381 IOCON_PIO_CLKDIV0);
382 /* PORT2 PIN (coords: ) is configured as */
383 IOCON_PinMuxSet(IOCON, 2, pio2_config);
384
385 const uint32_t pio4_config = (/* Selects pull-up function */
386 IOCON_PIO_MODE_PULLUP |
387 /* Disable hysteresis */
388 IOCON_PIO_HYS_DI |
389 /* Input not invert */
390 IOCON_PIO_INV_DI |
391 /* Disables Open-drain function */
392 IOCON_PIO_OD_DI |
393 /* Bypass input filter */
394 IOCON_PIO_SMODE_BYPASS |
395 /* IOCONCLKDIV0 */
396 IOCON_PIO_CLKDIV0);
397 /* PORT4 PIN (coords: ) is configured as */
398 IOCON_PinMuxSet(IOCON, 4, pio4_config);
399
400 /* Disable clock for switch matrix. */
401 CLOCK_DisableClock(kCLOCK_Swm);
402}
403/***********************************************************************************************************************
404 * EOF
405 **********************************************************************************************************************/