aboutsummaryrefslogtreecommitdiff
path: root/lib/chibios-contrib/ext/mcux-sdk/boards/lpcxpresso804/project_template/pin_mux.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/chibios-contrib/ext/mcux-sdk/boards/lpcxpresso804/project_template/pin_mux.c')
-rw-r--r--lib/chibios-contrib/ext/mcux-sdk/boards/lpcxpresso804/project_template/pin_mux.c394
1 files changed, 394 insertions, 0 deletions
diff --git a/lib/chibios-contrib/ext/mcux-sdk/boards/lpcxpresso804/project_template/pin_mux.c b/lib/chibios-contrib/ext/mcux-sdk/boards/lpcxpresso804/project_template/pin_mux.c
new file mode 100644
index 000000000..a0389c23c
--- /dev/null
+++ b/lib/chibios-contrib/ext/mcux-sdk/boards/lpcxpresso804/project_template/pin_mux.c
@@ -0,0 +1,394 @@
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: LPC804
19package_id: LPC804M101JDH24
20mcu_data: ksdk2_0
21processor_version: 4.0.1
22board: LPCXpresso804
23pin_labels:
24- {pin_num: '10', pin_signal: PIO0_11/ADC_6/WKTCLKIN, label: 'CN6[10]/CN8[3]/D4/PIO0_11/M_PIO0_11', identifier: LED_BLUE}
25- {pin_num: '5', pin_signal: PIO0_12, label: 'S2/CN8[6]/CN6[5]/D3/M_PIO0_12/PIO0_12', identifier: LED_GREEN;S2}
26- {pin_num: '4', pin_signal: PIO0_13/ADC_10, label: 'S1/CN8[4]/CN6[4]/D2/M_PIO0_13/PIO0_13', identifier: LED_RED;S1}
27- {pin_num: '22', pin_signal: PIO0_0/ACMP_I1, label: 'CN7[3]/CN8[8]/JP2/PIO0_0', identifier: DEBUG_UART_RX}
28- {pin_num: '7', pin_signal: PIO0_4/ADC_11, label: 'CN6[7]/CN8[7]/CN5[5]/JP24/PIO0_4', identifier: DEBUG_UART_TX}
29- {pin_num: '9', pin_signal: SWDIO/PIO0_2, label: 'CN6[9]/CN1[2]/U1[17]/SWDIO_PIO0_2', identifier: DEBUG_SWD_SWDIO}
30- {pin_num: '8', pin_signal: SWCLK/PIO0_3, label: 'CN6[8]/CN1[4]/U1[16]/SWCLK_PIO0_3', identifier: DEBUG_SWD_SWDCLK}
31- {pin_num: '23', pin_signal: PIO0_14/ACMP_I3/ADC_2, label: 'CN7[2]/CN3[1]/JP4/PIO0_14', identifier: I2C_SCL}
32- {pin_num: '20', pin_signal: PIO0_7/ADC_1/ACMPVREF, label: 'CN7[5]/CN3[2]/JP23/CN5[4]/PIO0_7', identifier: I2C_SDA}
33- {pin_num: '6', pin_signal: RESETN/PIO0_5, label: 'CN6[6]/CN1[10]/S3/CN4[3]/U1[3]/U1[8]/TRST_P0_5', identifier: DEBUG_SWD_RESETN}
34- {pin_num: '1', pin_signal: PIO0_18, label: 'CN6[1]/CN3[9]/PIO0_18'}
35- {pin_num: '2', pin_signal: PIO0_16/ACMP_I4/ADC_3, label: 'CN6[2]/CN5[2]/U4[1]/PIO0_16'}
36- {pin_num: '3', pin_signal: PIO0_17/ADC_9, label: 'CN6[3]/CN5[3]/PIO0_17'}
37- {pin_num: '11', pin_signal: PIO0_10/ADC_7, label: 'CN6[11]/VR1/CN5[1]/PIO0_10'}
38- {pin_num: '12', pin_signal: PIO0_21/ACMP_I5, label: 'CN6[12]/CN8[5]/PIO0_21'}
39- {pin_num: '13', pin_signal: PIO0_20, label: 'CN7[12]/CN3[10]/PIO0_20'}
40- {pin_num: '14', pin_signal: PIO0_15/ADC_8, label: 'CN7[11]/CN3[8]/PIO0_15'}
41- {pin_num: '15', pin_signal: PIO0_1/ADC_0/ACMP_I2/CLKIN, label: 'CN7[10]/CN3[5]/CN5[6]/U4[6]/PIO0_1'}
42- {pin_num: '16', pin_signal: PIO0_9/ADC_4, label: 'CN7[9]/CN3[6]/R13/U4[2]/PIO0_9/ISP_U0_TXD_DS'}
43- {pin_num: '17', pin_signal: PIO0_8/ADC_5, label: 'CN7[8]/CN3[7]/R20/U4[5]/PIO0_8/ISP_U0_RXD_DS'}
44- {pin_num: '18', pin_signal: VDD, label: 'CN7[7]/JP5/R37/VDD'}
45- {pin_num: '19', pin_signal: VSS, label: GND}
46- {pin_num: '21', pin_signal: VREFP, label: 'CN7[4]/JP7/MCU_VREFP'}
47- {pin_num: '24', pin_signal: PIO0_19/DACOUT, label: 'CN7[1]/CN8[2]/PIO0_19'}
48 * BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS ***********
49 */
50/* clang-format on */
51
52#include "fsl_common.h"
53#include "fsl_iocon.h"
54#include "fsl_swm.h"
55#include "pin_mux.h"
56
57/* FUNCTION ************************************************************************************************************
58 *
59 * Function Name : BOARD_InitBootPins
60 * Description : Calls initialization functions.
61 *
62 * END ****************************************************************************************************************/
63void BOARD_InitBootPins(void)
64{
65 BOARD_InitPins();
66 BOARD_InitDEBUG_UARTPins();
67}
68
69/* clang-format off */
70/*
71 * TEXT BELOW IS USED AS SETTING FOR TOOLS *************************************
72BOARD_InitPins:
73- options: {callFromInitBoot: 'true', coreID: core0, enableClock: 'true'}
74- pin_list: []
75 * BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS ***********
76 */
77/* clang-format on */
78
79/* FUNCTION ************************************************************************************************************
80 *
81 * Function Name : BOARD_InitPins
82 * Description : Configures pin routing and optionally pin electrical features.
83 *
84 * END ****************************************************************************************************************/
85/* Function assigned for the Cortex-M0P */
86void BOARD_InitPins(void)
87{
88}
89
90/* clang-format off */
91/*
92 * TEXT BELOW IS USED AS SETTING FOR TOOLS *************************************
93BOARD_InitLEDsPins:
94- options: {callFromInitBoot: 'false', coreID: core0, enableClock: 'true'}
95- pin_list:
96 - {pin_num: '10', peripheral: GPIO, signal: 'PIO0, 11', pin_signal: PIO0_11/ADC_6/WKTCLKIN, direction: OUTPUT, mode: pullUp, invert: disabled, hysteresis: enabled,
97 opendrain: disabled}
98 - {pin_num: '5', peripheral: GPIO, signal: 'PIO0, 12', pin_signal: PIO0_12, identifier: LED_GREEN, direction: OUTPUT, mode: pullUp, invert: disabled, hysteresis: enabled,
99 opendrain: disabled}
100 - {pin_num: '4', peripheral: GPIO, signal: 'PIO0, 13', pin_signal: PIO0_13/ADC_10, identifier: LED_RED, direction: OUTPUT, mode: pullUp, invert: disabled, hysteresis: enabled,
101 opendrain: disabled}
102 * BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS ***********
103 */
104/* clang-format on */
105
106/* FUNCTION ************************************************************************************************************
107 *
108 * Function Name : BOARD_InitLEDsPins
109 * Description : Configures pin routing and optionally pin electrical features.
110 *
111 * END ****************************************************************************************************************/
112/* Function assigned for the Cortex-M0P */
113void BOARD_InitLEDsPins(void)
114{
115 /* Enables clock for IOCON.: enable */
116 CLOCK_EnableClock(kCLOCK_Iocon);
117
118 const uint32_t IOCON_INDEX_PIO0_13_config = (/* Selects pull-up function */
119 IOCON_PIO_MODE_PULLUP |
120 /* Enable hysteresis */
121 IOCON_PIO_HYS_EN |
122 /* Input not invert */
123 IOCON_PIO_INV_DI |
124 /* Disables Open-drain function */
125 IOCON_PIO_OD_DI);
126 /* PORT1 PIN (coords: ) is configured as */
127 IOCON_PinMuxSet(IOCON, IOCON_INDEX_PIO0_13, IOCON_INDEX_PIO0_13_config);
128
129 const uint32_t IOCON_INDEX_PIO0_12_config = (/* Selects pull-up function */
130 IOCON_PIO_MODE_PULLUP |
131 /* Enable hysteresis */
132 IOCON_PIO_HYS_EN |
133 /* Input not invert */
134 IOCON_PIO_INV_DI |
135 /* Disables Open-drain function */
136 IOCON_PIO_OD_DI);
137 /* PORT2 PIN (coords: ) is configured as */
138 IOCON_PinMuxSet(IOCON, IOCON_INDEX_PIO0_12, IOCON_INDEX_PIO0_12_config);
139
140 const uint32_t IOCON_INDEX_PIO0_11_config = (/* Selects pull-up function */
141 IOCON_PIO_MODE_PULLUP |
142 /* Enable hysteresis */
143 IOCON_PIO_HYS_EN |
144 /* Input not invert */
145 IOCON_PIO_INV_DI |
146 /* Disables Open-drain function */
147 IOCON_PIO_OD_DI);
148 /* PORT7 PIN (coords: ) is configured as */
149 IOCON_PinMuxSet(IOCON, IOCON_INDEX_PIO0_11, IOCON_INDEX_PIO0_11_config);
150}
151
152/* clang-format off */
153/*
154 * TEXT BELOW IS USED AS SETTING FOR TOOLS *************************************
155BOARD_InitDEBUG_UARTPins:
156- options: {callFromInitBoot: 'true', coreID: core0, enableClock: 'true'}
157- pin_list:
158 - {pin_num: '22', peripheral: USART0, signal: RXD, pin_signal: PIO0_0/ACMP_I1, mode: pullUp, invert: disabled, hysteresis: enabled, opendrain: disabled}
159 - {pin_num: '7', peripheral: USART0, signal: TXD, pin_signal: PIO0_4/ADC_11, mode: pullUp, invert: disabled, hysteresis: enabled, opendrain: disabled}
160 * BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS ***********
161 */
162/* clang-format on */
163
164/* FUNCTION ************************************************************************************************************
165 *
166 * Function Name : BOARD_InitDEBUG_UARTPins
167 * Description : Configures pin routing and optionally pin electrical features.
168 *
169 * END ****************************************************************************************************************/
170/* Function assigned for the Cortex-M0P */
171void BOARD_InitDEBUG_UARTPins(void)
172{
173 /* Enables clock for IOCON.: enable */
174 CLOCK_EnableClock(kCLOCK_Iocon);
175 /* Enables clock for switch matrix.: enable */
176 CLOCK_EnableClock(kCLOCK_Swm);
177
178 const uint32_t IOCON_INDEX_PIO0_0_config = (/* Selects pull-up function */
179 IOCON_PIO_MODE_PULLUP |
180 /* Enable hysteresis */
181 IOCON_PIO_HYS_EN |
182 /* Input not invert */
183 IOCON_PIO_INV_DI |
184 /* Disables Open-drain function */
185 IOCON_PIO_OD_DI);
186 /* PORT1 PIN7 (coords: ) is configured as */
187 IOCON_PinMuxSet(IOCON, IOCON_INDEX_PIO0_0, IOCON_INDEX_PIO0_0_config);
188
189 const uint32_t IOCON_INDEX_PIO0_4_config = (/* Selects pull-up function */
190 IOCON_PIO_MODE_PULLUP |
191 /* Enable hysteresis */
192 IOCON_PIO_HYS_EN |
193 /* Input not invert */
194 IOCON_PIO_INV_DI |
195 /* Disables Open-drain function */
196 IOCON_PIO_OD_DI);
197 /* PORT4 PIN (coords: ) is configured as */
198 IOCON_PinMuxSet(IOCON, IOCON_INDEX_PIO0_4, IOCON_INDEX_PIO0_4_config);
199
200 /* USART0_TXD connect to P0_4 */
201 SWM_SetMovablePinSelect(SWM0, kSWM_USART0_TXD, kSWM_PortPin_P0_4);
202
203 /* USART0_RXD connect to P0_0 */
204 SWM_SetMovablePinSelect(SWM0, kSWM_USART0_RXD, kSWM_PortPin_P0_0);
205
206 /* Disable clock for switch matrix. */
207 CLOCK_DisableClock(kCLOCK_Swm);
208}
209
210/* clang-format off */
211/*
212 * TEXT BELOW IS USED AS SETTING FOR TOOLS *************************************
213BOARD_InitSWD_DEBUGPins:
214- options: {callFromInitBoot: 'false', coreID: core0, enableClock: 'true'}
215- pin_list:
216 - {pin_num: '8', peripheral: SWD, signal: SWCLK, pin_signal: SWCLK/PIO0_3, mode: pullUp, invert: disabled, hysteresis: enabled, opendrain: disabled}
217 - {pin_num: '9', peripheral: SWD, signal: SWDIO, pin_signal: SWDIO/PIO0_2, mode: pullUp, invert: disabled, hysteresis: enabled, opendrain: disabled}
218 - {pin_num: '6', peripheral: SYSCON, signal: RESETN, pin_signal: RESETN/PIO0_5, mode: pullUp, invert: disabled, hysteresis: enabled, opendrain: disabled}
219 * BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS ***********
220 */
221/* clang-format on */
222
223/* FUNCTION ************************************************************************************************************
224 *
225 * Function Name : BOARD_InitSWD_DEBUGPins
226 * Description : Configures pin routing and optionally pin electrical features.
227 *
228 * END ****************************************************************************************************************/
229/* Function assigned for the Cortex-M0P */
230void BOARD_InitSWD_DEBUGPins(void)
231{
232 /* Enables clock for IOCON.: enable */
233 CLOCK_EnableClock(kCLOCK_Iocon);
234 /* Enables clock for switch matrix.: enable */
235 CLOCK_EnableClock(kCLOCK_Swm);
236
237 const uint32_t IOCON_INDEX_PIO0_5_config = (/* Selects pull-up function */
238 IOCON_PIO_MODE_PULLUP |
239 /* Enable hysteresis */
240 IOCON_PIO_HYS_EN |
241 /* Input not invert */
242 IOCON_PIO_INV_DI |
243 /* Disables Open-drain function */
244 IOCON_PIO_OD_DI);
245 /* PORT3 PIN (coords: ) is configured as */
246 IOCON_PinMuxSet(IOCON, IOCON_INDEX_PIO0_5, IOCON_INDEX_PIO0_5_config);
247
248 const uint32_t IOCON_INDEX_PIO0_3_config = (/* Selects pull-up function */
249 IOCON_PIO_MODE_PULLUP |
250 /* Enable hysteresis */
251 IOCON_PIO_HYS_EN |
252 /* Input not invert */
253 IOCON_PIO_INV_DI |
254 /* Disables Open-drain function */
255 IOCON_PIO_OD_DI);
256 /* PORT5 PIN (coords: ) is configured as */
257 IOCON_PinMuxSet(IOCON, IOCON_INDEX_PIO0_3, IOCON_INDEX_PIO0_3_config);
258
259 const uint32_t IOCON_INDEX_PIO0_2_config = (/* Selects pull-up function */
260 IOCON_PIO_MODE_PULLUP |
261 /* Enable hysteresis */
262 IOCON_PIO_HYS_EN |
263 /* Input not invert */
264 IOCON_PIO_INV_DI |
265 /* Disables Open-drain function */
266 IOCON_PIO_OD_DI);
267 /* PORT6 PIN (coords: ) is configured as */
268 IOCON_PinMuxSet(IOCON, IOCON_INDEX_PIO0_2, IOCON_INDEX_PIO0_2_config);
269
270 /* SWCLK connect to P0_3 */
271 SWM_SetFixedPinSelect(SWM0, kSWM_SWCLK, true);
272
273 /* SWDIO connect to P0_2 */
274 SWM_SetFixedPinSelect(SWM0, kSWM_SWDIO, true);
275
276 /* RESETN connect to P0_5 */
277 SWM_SetFixedPinSelect(SWM0, kSWM_RESETN, true);
278
279 /* Disable clock for switch matrix. */
280 CLOCK_DisableClock(kCLOCK_Swm);
281}
282
283/* clang-format off */
284/*
285 * TEXT BELOW IS USED AS SETTING FOR TOOLS *************************************
286BOARD_InitI2CPins:
287- options: {callFromInitBoot: 'false', coreID: core0, enableClock: 'true'}
288- pin_list:
289 - {pin_num: '23', peripheral: I2C0, signal: SCL, pin_signal: PIO0_14/ACMP_I3/ADC_2, mode: pullUp, invert: disabled, hysteresis: enabled, opendrain: disabled}
290 - {pin_num: '20', peripheral: I2C0, signal: SDA, pin_signal: PIO0_7/ADC_1/ACMPVREF, mode: pullUp, invert: disabled, hysteresis: enabled, opendrain: disabled}
291 * BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS ***********
292 */
293/* clang-format on */
294
295/* FUNCTION ************************************************************************************************************
296 *
297 * Function Name : BOARD_InitI2CPins
298 * Description : Configures pin routing and optionally pin electrical features.
299 *
300 * END ****************************************************************************************************************/
301/* Function assigned for the Cortex-M0P */
302void BOARD_InitI2CPins(void)
303{
304 /* Enables clock for IOCON.: enable */
305 CLOCK_EnableClock(kCLOCK_Iocon);
306 /* Enables clock for switch matrix.: enable */
307 CLOCK_EnableClock(kCLOCK_Swm);
308
309 const uint32_t IOCON_INDEX_PIO0_7_config = (/* Selects pull-up function */
310 IOCON_PIO_MODE_PULLUP |
311 /* Enable hysteresis */
312 IOCON_PIO_HYS_EN |
313 /* Input not invert */
314 IOCON_PIO_INV_DI |
315 /* Disables Open-drain function */
316 IOCON_PIO_OD_DI);
317 /* PORT1 PIN5 (coords: ) is configured as */
318 IOCON_PinMuxSet(IOCON, IOCON_INDEX_PIO0_7, IOCON_INDEX_PIO0_7_config);
319
320 const uint32_t IOCON_INDEX_PIO0_14_config = (/* Selects pull-up function */
321 IOCON_PIO_MODE_PULLUP |
322 /* Enable hysteresis */
323 IOCON_PIO_HYS_EN |
324 /* Input not invert */
325 IOCON_PIO_INV_DI |
326 /* Disables Open-drain function */
327 IOCON_PIO_OD_DI);
328 /* PORT1 PIN8 (coords: ) is configured as */
329 IOCON_PinMuxSet(IOCON, IOCON_INDEX_PIO0_14, IOCON_INDEX_PIO0_14_config);
330
331 /* I2C0_SDA connect to P0_7 */
332 SWM_SetMovablePinSelect(SWM0, kSWM_I2C0_SDA, kSWM_PortPin_P0_7);
333
334 /* I2C0_SCL connect to P0_14 */
335 SWM_SetMovablePinSelect(SWM0, kSWM_I2C0_SCL, kSWM_PortPin_P0_14);
336
337 /* Disable clock for switch matrix. */
338 CLOCK_DisableClock(kCLOCK_Swm);
339}
340
341/* clang-format off */
342/*
343 * TEXT BELOW IS USED AS SETTING FOR TOOLS *************************************
344BOARD_InitBUTTONsPins:
345- options: {callFromInitBoot: 'false', coreID: core0, enableClock: 'true'}
346- pin_list:
347 - {pin_num: '4', peripheral: GPIO, signal: 'PIO0, 13', pin_signal: PIO0_13/ADC_10, identifier: S1, direction: INPUT, mode: pullUp, invert: disabled, hysteresis: enabled,
348 opendrain: disabled}
349 - {pin_num: '5', peripheral: GPIO, signal: 'PIO0, 12', pin_signal: PIO0_12, identifier: S2, direction: INPUT, mode: pullUp, invert: disabled, hysteresis: enabled,
350 opendrain: disabled}
351 * BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS ***********
352 */
353/* clang-format on */
354
355/* FUNCTION ************************************************************************************************************
356 *
357 * Function Name : BOARD_InitBUTTONsPins
358 * Description : Configures pin routing and optionally pin electrical features.
359 *
360 * END ****************************************************************************************************************/
361/* Function assigned for the Cortex-M0P */
362void BOARD_InitBUTTONsPins(void)
363{
364 /* Enables clock for IOCON.: enable */
365 CLOCK_EnableClock(kCLOCK_Iocon);
366
367 const uint32_t IOCON_INDEX_PIO0_13_config = (/* Selects pull-up function */
368 IOCON_PIO_MODE_PULLUP |
369 /* Enable hysteresis */
370 IOCON_PIO_HYS_EN |
371 /* Input not invert */
372 IOCON_PIO_INV_DI |
373 /* Disables Open-drain function */
374 IOCON_PIO_OD_DI);
375 /* PORT1 PIN (coords: ) is configured as */
376 IOCON_PinMuxSet(IOCON, IOCON_INDEX_PIO0_13, IOCON_INDEX_PIO0_13_config);
377
378 const uint32_t IOCON_INDEX_PIO0_12_config = (/* Selects pull-up function */
379 IOCON_PIO_MODE_PULLUP |
380 /* Enable hysteresis */
381 IOCON_PIO_HYS_EN |
382 /* Input not invert */
383 IOCON_PIO_INV_DI |
384 /* Disables Open-drain function */
385 IOCON_PIO_OD_DI);
386 /* PORT2 PIN (coords: ) is configured as */
387 IOCON_PinMuxSet(IOCON, IOCON_INDEX_PIO0_12, IOCON_INDEX_PIO0_12_config);
388
389 /* Disable clock for switch matrix. */
390 CLOCK_DisableClock(kCLOCK_Swm);
391}
392/***********************************************************************************************************************
393 * EOF
394 **********************************************************************************************************************/