diff options
Diffstat (limited to 'lib/chibios-contrib/ext/mcux-sdk/devices/MIMX8QX1/project_template')
8 files changed, 525 insertions, 0 deletions
diff --git a/lib/chibios-contrib/ext/mcux-sdk/devices/MIMX8QX1/project_template/board.c b/lib/chibios-contrib/ext/mcux-sdk/devices/MIMX8QX1/project_template/board.c new file mode 100644 index 000000000..3af0905d8 --- /dev/null +++ b/lib/chibios-contrib/ext/mcux-sdk/devices/MIMX8QX1/project_template/board.c | |||
@@ -0,0 +1,213 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2016, Freescale Semiconductor, Inc. | ||
3 | * Copyright 2017-2018 NXP | ||
4 | * | ||
5 | * SPDX-License-Identifier: BSD-3-Clause | ||
6 | */ | ||
7 | |||
8 | #include "fsl_common.h" | ||
9 | #include "fsl_debug_console.h" | ||
10 | #include "board.h" | ||
11 | #include "fsl_gpio.h" | ||
12 | |||
13 | /******************************************************************************* | ||
14 | * Variables | ||
15 | ******************************************************************************/ | ||
16 | static sc_ipc_t ipcHandle; /* ipc handle */ | ||
17 | |||
18 | /******************************************************************************* | ||
19 | * Code | ||
20 | ******************************************************************************/ | ||
21 | sc_ipc_t BOARD_InitRpc(void) | ||
22 | { | ||
23 | /* Initialize the IPC channel to communicate with SCFW */ | ||
24 | SystemInitScfwIpc(); | ||
25 | |||
26 | ipcHandle = SystemGetScfwIpcHandle(); | ||
27 | if (ipcHandle) | ||
28 | { | ||
29 | CLOCK_Init(ipcHandle); | ||
30 | } | ||
31 | return ipcHandle; | ||
32 | } | ||
33 | |||
34 | sc_ipc_t BOARD_GetRpcHandle(void) | ||
35 | { | ||
36 | return ipcHandle; | ||
37 | } | ||
38 | |||
39 | /* | ||
40 | * Pre Configuration of some pins | ||
41 | * - Some physical pins default map to the same functionality and has priority, avoid such conflict | ||
42 | * at the beginning. | ||
43 | */ | ||
44 | void BOARD_InitPinsPre(void) | ||
45 | { | ||
46 | sc_err_t err = SC_ERR_NONE; | ||
47 | |||
48 | err = sc_pad_set_mux(ipcHandle, SC_P_USB_SS3_TC0, 3U, SC_PAD_CONFIG_NORMAL, SC_PAD_ISO_OFF); | ||
49 | if (SC_ERR_NONE != err) | ||
50 | { | ||
51 | assert(false); | ||
52 | } | ||
53 | |||
54 | err = sc_pad_set_mux(ipcHandle, SC_P_USB_SS3_TC1, 3U, SC_PAD_CONFIG_NORMAL, SC_PAD_ISO_OFF); | ||
55 | if (SC_ERR_NONE != err) | ||
56 | { | ||
57 | assert(false); | ||
58 | } | ||
59 | |||
60 | err = sc_pad_set_mux(ipcHandle, SC_P_USB_SS3_TC2, 3U, SC_PAD_CONFIG_NORMAL, SC_PAD_ISO_OFF); | ||
61 | if (SC_ERR_NONE != err) | ||
62 | { | ||
63 | assert(false); | ||
64 | } | ||
65 | |||
66 | err = sc_pad_set_mux(ipcHandle, SC_P_USB_SS3_TC3, 3U, SC_PAD_CONFIG_NORMAL, SC_PAD_ISO_OFF); | ||
67 | if (SC_ERR_NONE != err) | ||
68 | { | ||
69 | assert(false); | ||
70 | } | ||
71 | } | ||
72 | |||
73 | /* Initialize debug console. */ | ||
74 | void BOARD_InitDebugConsole(void) | ||
75 | { | ||
76 | uint32_t freq = SC_133MHZ; | ||
77 | |||
78 | /* Power on Local LPUART for M4 Core0. */ | ||
79 | sc_pm_set_resource_power_mode(ipcHandle, SC_R_M4_0_UART, SC_PM_PW_MODE_ON); | ||
80 | /* Enable clock of Local LPUART for M4 Core0. */ | ||
81 | CLOCK_EnableClockExt(kCLOCK_M4_0_Lpuart, 0); | ||
82 | /* Set clock Frequncy of Local LPUART for M4 Core0. */ | ||
83 | freq = CLOCK_SetIpFreq(kCLOCK_M4_0_Lpuart, freq); | ||
84 | |||
85 | /* Initialize Debug Console using local LPUART for M4 Core0. */ | ||
86 | DbgConsole_Init(BOARD_DEBUG_UART_BASEADDR, BOARD_DEBUG_UART_BAUDRATE, BOARD_DEBUG_UART_TYPE, freq); | ||
87 | } | ||
88 | |||
89 | /* Power on base board*/ | ||
90 | void BOARD_PowerOnBaseBoard(void) | ||
91 | { | ||
92 | sc_err_t err = SC_ERR_NONE; | ||
93 | gpio_pin_config_t pin_config; | ||
94 | |||
95 | if (sc_pm_set_resource_power_mode(ipcHandle, SC_R_GPIO_5, SC_PM_PW_MODE_ON) != SC_ERR_NONE) | ||
96 | { | ||
97 | assert(false); | ||
98 | } | ||
99 | |||
100 | if (!CLOCK_EnableClockExt(kCLOCK_LSIO_Gpio5, 0)) | ||
101 | assert(false); | ||
102 | |||
103 | /*Configure BB_PWR_EN GPIO pin*/ | ||
104 | pin_config.direction = kGPIO_DigitalOutput; | ||
105 | pin_config.outputLogic = 1U; | ||
106 | pin_config.interruptMode = kGPIO_NoIntmode; | ||
107 | |||
108 | err = sc_pad_set_mux(ipcHandle, SC_P_ENET0_REFCLK_125M_25M, 4U, SC_PAD_CONFIG_NORMAL, SC_PAD_ISO_OFF); | ||
109 | if (SC_ERR_NONE != err) | ||
110 | { | ||
111 | assert(false); | ||
112 | } | ||
113 | |||
114 | GPIO_PinInit(BOARD_BASEBOARD_PWR_GPIO, BOARD_BASEBOARD_PWR_GPIO_PIN, &pin_config); | ||
115 | GPIO_PinWrite(BOARD_BASEBOARD_PWR_GPIO, BOARD_BASEBOARD_PWR_GPIO_PIN, 1U); | ||
116 | } | ||
117 | |||
118 | /* Initialize MPU, configure non-cacheable memory */ | ||
119 | void BOARD_InitMemory(void) | ||
120 | { | ||
121 | extern uint32_t __CACHE_REGION_START[]; | ||
122 | extern uint32_t __CACHE_REGION_SIZE[]; | ||
123 | uint32_t cacheStart = (uint32_t)__CACHE_REGION_START; | ||
124 | uint32_t size = (uint32_t)__CACHE_REGION_SIZE; | ||
125 | uint32_t i = 0; | ||
126 | /* Make sure outstanding transfers are done. */ | ||
127 | __DMB(); | ||
128 | /* Disable the MPU. */ | ||
129 | MPU->CTRL = 0; | ||
130 | |||
131 | /* | ||
132 | The ARMv7-M default address map define the address space 0x20000000 to 0x3FFFFFFF as SRAM with Normal type, but there the address | ||
133 | space 0x28000000 ~ 0x3FFFFFFF has been physically mapped to smart subsystems, so there need change the default memory attributes. | ||
134 | Since the base address of MPU region should be multiples of region size, to make it simple, the MPU region 0 set the all 512M of SRAM space | ||
135 | with device attributes, then disable subregion 0 and 1 (address space 0x20000000 ~ 0x27FFFFFF) to use the background memory attributes。 | ||
136 | */ | ||
137 | |||
138 | /* Select Region 0 and set its base address to the M4 code bus start address. */ | ||
139 | MPU->RBAR = (0x20000000U & MPU_RBAR_ADDR_Msk) | MPU_RBAR_VALID_Msk | (0 << MPU_RBAR_REGION_Pos); | ||
140 | |||
141 | /* Region 0 setting: | ||
142 | * 1) Enable Instruction Access; | ||
143 | * 2) AP = 011b, full access; | ||
144 | * 3) Non-shared device; | ||
145 | * 4) Region Not Shared; | ||
146 | * 5) Sub-Region 0,1 Disabled; | ||
147 | * 6) MPU Protection Region size = 512M byte; | ||
148 | * 7) Enable Region 0. | ||
149 | */ | ||
150 | MPU->RASR = (0x1 << MPU_RASR_XN_Pos) | (0x3 << MPU_RASR_AP_Pos) | (0x2 << MPU_RASR_TEX_Pos) | | ||
151 | (0x3 << MPU_RASR_SRD_Pos) | (28 << MPU_RASR_SIZE_Pos) | MPU_RASR_ENABLE_Msk; | ||
152 | |||
153 | /* | ||
154 | Non-cacheable area is provided in DDR memory, the DDR region 2MB - 128MB totally 126MB is revserved for CM4 cores. | ||
155 | You can put global or static uninitialized variables in NonCacheable section(initialized variables in NonCacheable.init section) | ||
156 | to make them uncacheable. Since the base address of MPU region should be multiples of region size, to make it simple, | ||
157 | the MPU region 1 set the address space 0x80000000 ~ 0xFFFFFFFF to be non-cacheable(disable sub-region 6,7 to use the background memory | ||
158 | attributes for address space 0xE0000000 ~ 0xFFFFFFFF). Then MPU region 2 set the text and data section to be cacheable if the program running | ||
159 | on DDR. The cacheable area base address should be multiples of its size in linker file, they can be modified per your needs. | ||
160 | */ | ||
161 | |||
162 | /* Select Region 1 and set its base address to the DDR start address. */ | ||
163 | MPU->RBAR = (0x80000000U & MPU_RBAR_ADDR_Msk) | MPU_RBAR_VALID_Msk | (1 << MPU_RBAR_REGION_Pos); | ||
164 | |||
165 | /* Region 1 setting: | ||
166 | * 1) Enable Instruction Access; | ||
167 | * 2) AP = 011b, full access; | ||
168 | * 3) Shared Device; | ||
169 | * 4) Sub-Region 6,7 Disabled; | ||
170 | * 5) MPU Protection Region size = 2048M byte; | ||
171 | * 6) Enable Region 1. | ||
172 | */ | ||
173 | MPU->RASR = (0x3 << MPU_RASR_AP_Pos) | (0x1 << MPU_RASR_B_Pos) | (0xC0 << MPU_RASR_SRD_Pos) | | ||
174 | (30 << MPU_RASR_SIZE_Pos) | MPU_RASR_ENABLE_Msk; | ||
175 | |||
176 | while ((size >> i) > 0x1U) | ||
177 | { | ||
178 | i++; | ||
179 | } | ||
180 | |||
181 | /* If run on DDR, configure text and data section to be cacheable */ | ||
182 | if (i != 0) | ||
183 | { | ||
184 | /* The MPU region size should be 2^N, 5<=N<=32, region base should be multiples of size. */ | ||
185 | assert((size & (size - 1)) == 0); | ||
186 | assert(!(cacheStart % size)); | ||
187 | assert(size == (uint32_t)(1 << i)); | ||
188 | assert(i >= 5); | ||
189 | |||
190 | /* Select Region 2 and set its base address to the cache able region start address. */ | ||
191 | MPU->RBAR = (cacheStart & MPU_RBAR_ADDR_Msk) | MPU_RBAR_VALID_Msk | (2 << MPU_RBAR_REGION_Pos); | ||
192 | |||
193 | /* Region 2 setting: | ||
194 | * 1) Enable Instruction Access; | ||
195 | * 2) AP = 011b, full access; | ||
196 | * 3) Outer and inner Cacheable, write and read allocate; | ||
197 | * 4) Region Not Shared; | ||
198 | * 5) All Sub-Region Enabled; | ||
199 | * 6) MPU Protection Region size get from linker file; | ||
200 | * 7) Enable Region 2. | ||
201 | */ | ||
202 | MPU->RASR = (0x3 << MPU_RASR_AP_Pos) | (0x1 << MPU_RASR_TEX_Pos) | (0x1 << MPU_RASR_C_Pos) | | ||
203 | (0x1 << MPU_RASR_B_Pos) | ((i - 1) << MPU_RASR_SIZE_Pos) | MPU_RASR_ENABLE_Msk; | ||
204 | } | ||
205 | |||
206 | /* Enable Privileged default memory map and the MPU. */ | ||
207 | MPU->CTRL = MPU_CTRL_ENABLE_Msk | MPU_CTRL_PRIVDEFENA_Msk; | ||
208 | /* Memory barriers to ensure subsequence data & instruction | ||
209 | * transfers using updated MPU settings. | ||
210 | */ | ||
211 | __DSB(); | ||
212 | __ISB(); | ||
213 | } | ||
diff --git a/lib/chibios-contrib/ext/mcux-sdk/devices/MIMX8QX1/project_template/board.h b/lib/chibios-contrib/ext/mcux-sdk/devices/MIMX8QX1/project_template/board.h new file mode 100644 index 000000000..2320361b8 --- /dev/null +++ b/lib/chibios-contrib/ext/mcux-sdk/devices/MIMX8QX1/project_template/board.h | |||
@@ -0,0 +1,56 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2016, Freescale Semiconductor, Inc. | ||
3 | * Copyright 2017-2018 NXP | ||
4 | * | ||
5 | * SPDX-License-Identifier: BSD-3-Clause | ||
6 | */ | ||
7 | |||
8 | #ifndef _BOARD_H_ | ||
9 | #define _BOARD_H_ | ||
10 | |||
11 | #include "clock_config.h" | ||
12 | |||
13 | /* SCFW includes */ | ||
14 | #include "main/rpc.h" | ||
15 | #include "svc/pm/pm_api.h" | ||
16 | |||
17 | #include "main/imx8qx_pads.h" | ||
18 | #include "svc/pad/pad_api.h" | ||
19 | |||
20 | /******************************************************************************* | ||
21 | * Definitions | ||
22 | ******************************************************************************/ | ||
23 | /*! @brief The board name */ | ||
24 | #define BOARD_NAME "VALMIMX8QX6" | ||
25 | |||
26 | /* The UART to use for debug messages. */ | ||
27 | #define BOARD_DEBUG_UART_TYPE DEBUG_CONSOLE_DEVICE_TYPE_LPUART | ||
28 | #define BOARD_DEBUG_UART_BAUDRATE 115200u | ||
29 | #define BOARD_DEBUG_UART_BASEADDR (uint32_t) CM4__LPUART | ||
30 | #define BOARD_DEBUG_UART_INSTANCE 0U | ||
31 | #define BOARD_DEBUG_UART_CLK_FREQ 6000000u | ||
32 | #define BOARD_UART_IRQ LPUART_CM_0_IRQn | ||
33 | #define BOARD_UART_IRQ_HANDLER LPUART0_IRQHandler | ||
34 | #define BOARD_DEBUG_UART_CLKSRC kCLOCK_IpSrcDummy | ||
35 | #define BOARD_BASEBOARD_PWR_GPIO LSIO__GPIO5 | ||
36 | #define BOARD_BASEBOARD_PWR_GPIO_PIN 9U | ||
37 | |||
38 | #if defined(__cplusplus) | ||
39 | extern "C" { | ||
40 | #endif /* __cplusplus */ | ||
41 | |||
42 | /******************************************************************************* | ||
43 | * API | ||
44 | ******************************************************************************/ | ||
45 | sc_ipc_t BOARD_InitRpc(void); | ||
46 | sc_ipc_t BOARD_GetRpcHandle(void); | ||
47 | void BOARD_InitDebugConsole(void); | ||
48 | void BOARD_InitPinsPre(void); | ||
49 | void BOARD_PowerOnBaseBoard(void); | ||
50 | void BOARD_InitMemory(void); | ||
51 | |||
52 | #if defined(__cplusplus) | ||
53 | } | ||
54 | #endif /* __cplusplus */ | ||
55 | |||
56 | #endif /* _BOARD_H_ */ | ||
diff --git a/lib/chibios-contrib/ext/mcux-sdk/devices/MIMX8QX1/project_template/clock_config.c b/lib/chibios-contrib/ext/mcux-sdk/devices/MIMX8QX1/project_template/clock_config.c new file mode 100644 index 000000000..9e3505c68 --- /dev/null +++ b/lib/chibios-contrib/ext/mcux-sdk/devices/MIMX8QX1/project_template/clock_config.c | |||
@@ -0,0 +1,73 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2016, Freescale Semiconductor, Inc. | ||
3 | * Copyright 2017-2018 NXP | ||
4 | * | ||
5 | * SPDX-License-Identifier: BSD-3-Clause | ||
6 | */ | ||
7 | |||
8 | #include "fsl_common.h" | ||
9 | #include "clock_config.h" | ||
10 | |||
11 | /******************************************************************************* | ||
12 | * Definitions | ||
13 | ******************************************************************************/ | ||
14 | // /*! @brief Clock configuration structure. */ | ||
15 | // typedef struct _clock_config | ||
16 | // { | ||
17 | // mcg_config_t mcgConfig; /*!< MCG configuration. */ | ||
18 | // sim_clock_config_t simConfig; /*!< SIM configuration. */ | ||
19 | // osc_config_t oscConfig; /*!< OSC configuration. */ | ||
20 | // uint32_t coreClock; /*!< core clock frequency. */ | ||
21 | // } clock_config_t; | ||
22 | |||
23 | /******************************************************************************* | ||
24 | * Variables | ||
25 | ******************************************************************************/ | ||
26 | /* System clock frequency. */ | ||
27 | extern uint32_t SystemCoreClock; | ||
28 | |||
29 | /******************************************************************************* | ||
30 | * Code | ||
31 | ******************************************************************************/ | ||
32 | /* | ||
33 | * How to setup clock using clock driver functions: | ||
34 | * | ||
35 | * 1. CLOCK_SetSimSafeDivs, to make sure core clock, bus clock, flexbus clock | ||
36 | * and flash clock are in allowed range during clock mode switch. | ||
37 | * | ||
38 | * 2. Call CLOCK_Osc0Init to setup OSC clock, if it is used in target mode. | ||
39 | * | ||
40 | * 3. Set MCG configuration, MCG includes three parts: FLL clock, PLL clock and | ||
41 | * internal reference clock(MCGIRCLK). Follow the steps to setup: | ||
42 | * | ||
43 | * 1). Call CLOCK_BootToXxxMode to set MCG to target mode. | ||
44 | * | ||
45 | * 2). If target mode is FBI/BLPI/PBI mode, the MCGIRCLK has been configured | ||
46 | * correctly. For other modes, need to call CLOCK_SetInternalRefClkConfig | ||
47 | * explicitly to setup MCGIRCLK. | ||
48 | * | ||
49 | * 3). Don't need to configure FLL explicitly, because if target mode is FLL | ||
50 | * mode, then FLL has been configured by the function CLOCK_BootToXxxMode, | ||
51 | * if the target mode is not FLL mode, the FLL is disabled. | ||
52 | * | ||
53 | * 4). If target mode is PEE/PBE/PEI/PBI mode, then the related PLL has been | ||
54 | * setup by CLOCK_BootToXxxMode. In FBE/FBI/FEE/FBE mode, the PLL could | ||
55 | * be enabled independently, call CLOCK_EnablePll0 explicitly in this case. | ||
56 | * | ||
57 | * 4. Call CLOCK_SetSimConfig to set the clock configuration in SIM. | ||
58 | */ | ||
59 | |||
60 | void BOARD_BootClockVLPR(void) | ||
61 | { | ||
62 | SystemCoreClockUpdate(); | ||
63 | } | ||
64 | |||
65 | void BOARD_BootClockRUN(void) | ||
66 | { | ||
67 | SystemCoreClockUpdate(); | ||
68 | } | ||
69 | |||
70 | void BOARD_BootClockHSRUN(void) | ||
71 | { | ||
72 | SystemCoreClockUpdate(); | ||
73 | } | ||
diff --git a/lib/chibios-contrib/ext/mcux-sdk/devices/MIMX8QX1/project_template/clock_config.h b/lib/chibios-contrib/ext/mcux-sdk/devices/MIMX8QX1/project_template/clock_config.h new file mode 100644 index 000000000..758db2fc8 --- /dev/null +++ b/lib/chibios-contrib/ext/mcux-sdk/devices/MIMX8QX1/project_template/clock_config.h | |||
@@ -0,0 +1,29 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2016, Freescale Semiconductor, Inc. | ||
3 | * Copyright 2017-2018 NXP | ||
4 | * | ||
5 | * SPDX-License-Identifier: BSD-3-Clause | ||
6 | */ | ||
7 | #ifndef _CLOCK_CONFIG_H_ | ||
8 | #define _CLOCK_CONFIG_H_ | ||
9 | |||
10 | /******************************************************************************* | ||
11 | * Definitions | ||
12 | ******************************************************************************/ | ||
13 | |||
14 | /******************************************************************************* | ||
15 | * API | ||
16 | ******************************************************************************/ | ||
17 | #if defined(__cplusplus) | ||
18 | extern "C" { | ||
19 | #endif /* __cplusplus*/ | ||
20 | |||
21 | void BOARD_BootClockVLPR(void); | ||
22 | void BOARD_BootClockRUN(void); | ||
23 | void BOARD_BootClockHSRUN(void); | ||
24 | |||
25 | #if defined(__cplusplus) | ||
26 | } | ||
27 | #endif /* __cplusplus*/ | ||
28 | |||
29 | #endif /* _CLOCK_CONFIG_H_ */ | ||
diff --git a/lib/chibios-contrib/ext/mcux-sdk/devices/MIMX8QX1/project_template/peripherals.c b/lib/chibios-contrib/ext/mcux-sdk/devices/MIMX8QX1/project_template/peripherals.c new file mode 100644 index 000000000..81c9cb63e --- /dev/null +++ b/lib/chibios-contrib/ext/mcux-sdk/devices/MIMX8QX1/project_template/peripherals.c | |||
@@ -0,0 +1,24 @@ | |||
1 | /* | ||
2 | * Copyright 2018 NXP | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * SPDX-License-Identifier: BSD-3-Clause | ||
6 | * | ||
7 | */ | ||
8 | |||
9 | /* TEXT BELOW IS USED AS SETTING FOR TOOLS ************************************* | ||
10 | !!GlobalInfo | ||
11 | product: Peripherals v1.0 | ||
12 | * BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS **********/ | ||
13 | |||
14 | /******************************************************************************* | ||
15 | * Included files | ||
16 | ******************************************************************************/ | ||
17 | #include "peripherals.h" | ||
18 | |||
19 | /******************************************************************************* | ||
20 | * BOARD_InitBootPeripherals function | ||
21 | ******************************************************************************/ | ||
22 | void BOARD_InitBootPeripherals(void) | ||
23 | { | ||
24 | } | ||
diff --git a/lib/chibios-contrib/ext/mcux-sdk/devices/MIMX8QX1/project_template/peripherals.h b/lib/chibios-contrib/ext/mcux-sdk/devices/MIMX8QX1/project_template/peripherals.h new file mode 100644 index 000000000..2c81ea5eb --- /dev/null +++ b/lib/chibios-contrib/ext/mcux-sdk/devices/MIMX8QX1/project_template/peripherals.h | |||
@@ -0,0 +1,25 @@ | |||
1 | /* | ||
2 | * Copyright 2018 NXP | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * SPDX-License-Identifier: BSD-3-Clause | ||
6 | * | ||
7 | */ | ||
8 | |||
9 | #ifndef _PERIPHERALS_H_ | ||
10 | #define _PERIPHERALS_H_ | ||
11 | |||
12 | #if defined(__cplusplus) | ||
13 | extern "C" { | ||
14 | #endif /*_cplusplus. */ | ||
15 | |||
16 | /******************************************************************************* | ||
17 | * BOARD_InitBootPeripherals function | ||
18 | ******************************************************************************/ | ||
19 | void BOARD_InitBootPeripherals(void); | ||
20 | |||
21 | #if defined(__cplusplus) | ||
22 | } | ||
23 | #endif /*_cplusplus. */ | ||
24 | |||
25 | #endif /* _PERIPHERALS_H_ */ | ||
diff --git a/lib/chibios-contrib/ext/mcux-sdk/devices/MIMX8QX1/project_template/pin_mux.c b/lib/chibios-contrib/ext/mcux-sdk/devices/MIMX8QX1/project_template/pin_mux.c new file mode 100644 index 000000000..fed658434 --- /dev/null +++ b/lib/chibios-contrib/ext/mcux-sdk/devices/MIMX8QX1/project_template/pin_mux.c | |||
@@ -0,0 +1,58 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2016, Freescale Semiconductor, Inc. | ||
3 | * Copyright 2017-2018 NXP | ||
4 | * | ||
5 | * SPDX-License-Identifier: BSD-3-Clause | ||
6 | */ | ||
7 | |||
8 | /* | ||
9 | * TEXT BELOW IS USED AS SETTING FOR TOOLS ************************************* | ||
10 | !!GlobalInfo | ||
11 | product: Pins v3.0 | ||
12 | processor: MIMX8QX6xxxFZ | ||
13 | mcu_data: i_mx_1_0 | ||
14 | processor_version: 0.0.0 | ||
15 | * BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS *********** | ||
16 | */ | ||
17 | |||
18 | #include "pin_mux.h" | ||
19 | #include "fsl_common.h" | ||
20 | #include "main/imx8qx_pads.h" | ||
21 | #include "svc/pad/pad_api.h" | ||
22 | |||
23 | /* | ||
24 | * TEXT BELOW IS USED AS SETTING FOR TOOLS ************************************* | ||
25 | BOARD_InitPins: | ||
26 | - options: {callFromInitBoot: 'true', coreID: m4} | ||
27 | - pin_list: | ||
28 | - {pin_num: V30, peripheral: M40__UART0, signal: uart_tx, pin_signal: ADC_IN3, sw_config: sw_config_0} | ||
29 | - {pin_num: V32, peripheral: M40__UART0, signal: uart_rx, pin_signal: ADC_IN2, sw_config: sw_config_0} | ||
30 | * BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS *********** | ||
31 | */ | ||
32 | |||
33 | /*FUNCTION********************************************************************** | ||
34 | * | ||
35 | * Function Name : BOARD_InitPins | ||
36 | * Description : Configures pin routing and optionally pin electrical features. | ||
37 | * | ||
38 | *END**************************************************************************/ | ||
39 | void BOARD_InitPins(void) { /*!< Function assigned for the core: Cortex-M4F[m4] */ | ||
40 | sc_ipc_t ipc; | ||
41 | sc_err_t err = SC_ERR_NONE; | ||
42 | ipc = SystemGetScfwIpcHandle(); | ||
43 | |||
44 | err = sc_pad_set_all(ipc, SC_P_ADC_IN2, 1U, SC_PAD_CONFIG_NORMAL, SC_PAD_ISO_OFF, 0x0 ,SC_PAD_WAKEUP_OFF);/* IOMUXD_REG_ADC_IN2 register modification value */ | ||
45 | if (SC_ERR_NONE != err) | ||
46 | { | ||
47 | assert(false); | ||
48 | } | ||
49 | err = sc_pad_set_all(ipc, SC_P_ADC_IN3, 1U, SC_PAD_CONFIG_NORMAL, SC_PAD_ISO_OFF, 0x0 ,SC_PAD_WAKEUP_OFF);/* IOMUXD_REG_ADC_IN3 register modification value */ | ||
50 | if (SC_ERR_NONE != err) | ||
51 | { | ||
52 | assert(false); | ||
53 | } | ||
54 | } | ||
55 | |||
56 | /******************************************************************************* | ||
57 | * EOF | ||
58 | ******************************************************************************/ | ||
diff --git a/lib/chibios-contrib/ext/mcux-sdk/devices/MIMX8QX1/project_template/pin_mux.h b/lib/chibios-contrib/ext/mcux-sdk/devices/MIMX8QX1/project_template/pin_mux.h new file mode 100644 index 000000000..ffa2ad356 --- /dev/null +++ b/lib/chibios-contrib/ext/mcux-sdk/devices/MIMX8QX1/project_template/pin_mux.h | |||
@@ -0,0 +1,47 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2016, Freescale Semiconductor, Inc. | ||
3 | * Copyright 2017-2018 NXP | ||
4 | * | ||
5 | * SPDX-License-Identifier: BSD-3-Clause | ||
6 | */ | ||
7 | |||
8 | #ifndef _PIN_MUX_H_ | ||
9 | #define _PIN_MUX_H_ | ||
10 | |||
11 | #include "board.h" | ||
12 | |||
13 | /******************************************************************************* | ||
14 | * Definitions | ||
15 | ******************************************************************************/ | ||
16 | |||
17 | /*! | ||
18 | * @addtogroup pin_mux | ||
19 | * @{ | ||
20 | */ | ||
21 | |||
22 | /******************************************************************************* | ||
23 | * API | ||
24 | ******************************************************************************/ | ||
25 | |||
26 | #if defined(__cplusplus) | ||
27 | extern "C" { | ||
28 | #endif | ||
29 | |||
30 | /*! | ||
31 | * @brief Configures pin routing and optionally pin electrical features. | ||
32 | * | ||
33 | */ | ||
34 | void BOARD_InitPins(void); /*!< Function assigned for the core: Cortex-M4F[m4] */ | ||
35 | |||
36 | #if defined(__cplusplus) | ||
37 | } | ||
38 | #endif | ||
39 | |||
40 | /*! | ||
41 | * @} | ||
42 | */ | ||
43 | #endif /* _PIN_MUX_H_ */ | ||
44 | |||
45 | /******************************************************************************* | ||
46 | * EOF | ||
47 | ******************************************************************************/ | ||