diff options
Diffstat (limited to 'lib/chibios-contrib/ext/mcux-sdk/devices/MK66F18/project_template')
8 files changed, 671 insertions, 0 deletions
diff --git a/lib/chibios-contrib/ext/mcux-sdk/devices/MK66F18/project_template/board.c b/lib/chibios-contrib/ext/mcux-sdk/devices/MK66F18/project_template/board.c new file mode 100644 index 000000000..3f4fe3150 --- /dev/null +++ b/lib/chibios-contrib/ext/mcux-sdk/devices/MK66F18/project_template/board.c | |||
@@ -0,0 +1,27 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2015, Freescale Semiconductor, Inc. | ||
3 | * Copyright 2016-2017 NXP | ||
4 | * All rights reserved. | ||
5 | * | ||
6 | * SPDX-License-Identifier: BSD-3-Clause | ||
7 | */ | ||
8 | |||
9 | #include <stdint.h> | ||
10 | #include "fsl_device_registers.h" | ||
11 | #include "board.h" | ||
12 | #include "fsl_debug_console.h" | ||
13 | |||
14 | /******************************************************************************* | ||
15 | * Variables | ||
16 | ******************************************************************************/ | ||
17 | |||
18 | /******************************************************************************* | ||
19 | * Code | ||
20 | ******************************************************************************/ | ||
21 | |||
22 | /* Initialize debug console. */ | ||
23 | void BOARD_InitDebugConsole(void) | ||
24 | { | ||
25 | uint32_t uartClkSrcFreq = BOARD_DEBUG_UART_CLK_FREQ; | ||
26 | DbgConsole_Init(BOARD_DEBUG_UART_BASEADDR, BOARD_DEBUG_UART_BAUDRATE, BOARD_DEBUG_UART_TYPE, uartClkSrcFreq); | ||
27 | } | ||
diff --git a/lib/chibios-contrib/ext/mcux-sdk/devices/MK66F18/project_template/board.h b/lib/chibios-contrib/ext/mcux-sdk/devices/MK66F18/project_template/board.h new file mode 100644 index 000000000..f68f00c82 --- /dev/null +++ b/lib/chibios-contrib/ext/mcux-sdk/devices/MK66F18/project_template/board.h | |||
@@ -0,0 +1,191 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2015, Freescale Semiconductor, Inc. | ||
3 | * Copyright 2016-2017 NXP | ||
4 | * All rights reserved. | ||
5 | * | ||
6 | * SPDX-License-Identifier: BSD-3-Clause | ||
7 | */ | ||
8 | |||
9 | #ifndef _BOARD_H_ | ||
10 | #define _BOARD_H_ | ||
11 | |||
12 | #include "clock_config.h" | ||
13 | #include "fsl_gpio.h" | ||
14 | |||
15 | /******************************************************************************* | ||
16 | * Definitions | ||
17 | ******************************************************************************/ | ||
18 | |||
19 | /*! @brief The board name */ | ||
20 | #define BOARD_NAME "FRDM-K66F" | ||
21 | |||
22 | /*! @brief The UART to use for debug messages. */ | ||
23 | #define BOARD_DEBUG_UART_TYPE DEBUG_CONSOLE_DEVICE_TYPE_UART | ||
24 | #define BOARD_DEBUG_UART_BASEADDR (uint32_t) UART0 | ||
25 | #define BOARD_DEBUG_UART_INSTANCE 0U | ||
26 | #define BOARD_DEBUG_UART_CLKSRC SYS_CLK | ||
27 | #define BOARD_DEBUG_UART_CLK_FREQ CLOCK_GetCoreSysClkFreq() | ||
28 | #define BOARD_UART_IRQ UART0_RX_TX_IRQn | ||
29 | #define BOARD_UART_IRQ_HANDLER UART0_RX_TX_IRQHandler | ||
30 | |||
31 | #ifndef BOARD_DEBUG_UART_BAUDRATE | ||
32 | #define BOARD_DEBUG_UART_BAUDRATE 115200 | ||
33 | #endif /* BOARD_DEBUG_UART_BAUDRATE */ | ||
34 | |||
35 | #define BOARD_ACCEL_I2C_BASE I2C0 | ||
36 | |||
37 | /*! @brief The CAN instance used for board. */ | ||
38 | #define BOARD_CAN_BASEADDR CAN0 | ||
39 | |||
40 | /*! @brief The i2c instance used for i2c connection by default */ | ||
41 | #define BOARD_I2C_BASEADDR I2C1 | ||
42 | |||
43 | /*! @brief The TPM instance/channel used for board */ | ||
44 | #define BOARD_TPM_BASEADDR TPM2 | ||
45 | #define BOARD_TPM_CHANNEL 1U | ||
46 | |||
47 | #define BOARD_FTM_BASEADDR FTM3 | ||
48 | #define BOARD_FTM_X_CHANNEL 0U | ||
49 | #define BOARD_FTM_Y_CHANNEL 1U | ||
50 | #define BOARD_FTM_PERIOD_HZ 100 | ||
51 | #define BOARD_FTM_IRQ_HANDLER FTM0_IRQHandler | ||
52 | #define BOARD_FTM_IRQ_VECTOR FTM0_IRQn | ||
53 | |||
54 | /*! @brief The bubble level demo information */ | ||
55 | #define BOARD_FXOS8700_ADDR 0x1D | ||
56 | #define BOARD_ACCEL_ADDR BOARD_FXOS8700_ADDR | ||
57 | #define BOARD_ACCEL_BAUDRATE 100 | ||
58 | #define BOARD_ACCEL_I2C_BASEADDR I2C0 | ||
59 | |||
60 | /*! @brief The Enet instance used for board */ | ||
61 | #define BOARD_ENET_BASEADDR ENET | ||
62 | |||
63 | /*! @brief The FlexBus instance used for board.*/ | ||
64 | #define BOARD_FLEXBUS_BASEADDR FB | ||
65 | |||
66 | /*! @brief The SDHC instance/channel used for board. */ | ||
67 | #define BOARD_SDHC_BASEADDR SDHC | ||
68 | #define BOARD_SDHC_CD_GPIO_IRQ_HANDLER PORTD_IRQHandler | ||
69 | |||
70 | /*! @brief The CMP instance/channel used for board. */ | ||
71 | #define BOARD_CMP_BASEADDR CMP2 | ||
72 | #define BOARD_CMP_CHANNEL 2U | ||
73 | |||
74 | /*! @brief The i2c instance used for board. */ | ||
75 | #define BOARD_SAI_DEMO_I2C_BASEADDR I2C0 | ||
76 | |||
77 | /*! @brief The rtc instance used for board. */ | ||
78 | #define BOARD_RTC_FUNC_BASEADDR RTC | ||
79 | |||
80 | /*! @brief If connected the TWR_MEM, this is spi sd card */ | ||
81 | #define BOARD_SDCARD_CARD_DETECTION_GPIO_PORT GPIOD | ||
82 | #define SDCARD_CARD_DETECTION_GPIO_PIN 10U | ||
83 | #define SDCARD_CARD_INSERTED 0U | ||
84 | |||
85 | /* Board led color mapping */ | ||
86 | #define LOGIC_LED_ON 0U | ||
87 | #define LOGIC_LED_OFF 1U | ||
88 | #ifndef BOARD_LED_RED_GPIO | ||
89 | #define BOARD_LED_RED_GPIO GPIOC | ||
90 | #endif | ||
91 | #define BOARD_LED_RED_GPIO_PORT PORTC | ||
92 | #ifndef BOARD_LED_RED_GPIO_PIN | ||
93 | #define BOARD_LED_RED_GPIO_PIN 9U | ||
94 | #endif | ||
95 | #ifndef BOARD_LED_GREEN_GPIO | ||
96 | #define BOARD_LED_GREEN_GPIO GPIOE | ||
97 | #endif | ||
98 | #define BOARD_LED_GREEN_GPIO_PORT PORTE | ||
99 | #ifndef BOARD_LED_GREEN_GPIO_PIN | ||
100 | #define BOARD_LED_GREEN_GPIO_PIN 6U | ||
101 | #endif | ||
102 | #ifndef BOARD_LED_BLUE_GPIO | ||
103 | #define BOARD_LED_BLUE_GPIO GPIOA | ||
104 | #endif | ||
105 | #define BOARD_LED_BLUE_GPIO_PORT PORTA | ||
106 | #ifndef BOARD_LED_BLUE_GPIO_PIN | ||
107 | #define BOARD_LED_BLUE_GPIO_PIN 11U | ||
108 | #endif | ||
109 | |||
110 | #define LED_RED_INIT(output) \ | ||
111 | GPIO_PinWrite(BOARD_LED_RED_GPIO, BOARD_LED_RED_GPIO_PIN, output); \ | ||
112 | BOARD_LED_RED_GPIO->PDDR |= (1U << BOARD_LED_RED_GPIO_PIN) /*!< Enable target LED_RED */ | ||
113 | #define LED_RED_ON() \ | ||
114 | GPIO_PortClear(BOARD_LED_RED_GPIO, 1U << BOARD_LED_RED_GPIO_PIN) /*!< Turn on target LED_RED */ | ||
115 | #define LED_RED_OFF() \ | ||
116 | GPIO_PortSet(BOARD_LED_RED_GPIO, 1U << BOARD_LED_RED_GPIO_PIN) /*!< Turn off target LED_RED */ | ||
117 | #define LED_RED_TOGGLE() \ | ||
118 | GPIO_PortToggle(BOARD_LED_RED_GPIO, 1U << BOARD_LED_RED_GPIO_PIN) /*!< Toggle on target LED_RED */ | ||
119 | |||
120 | #define LED_GREEN_INIT(output) \ | ||
121 | GPIO_PinWrite(BOARD_LED_GREEN_GPIO, BOARD_LED_GREEN_GPIO_PIN, output); \ | ||
122 | BOARD_LED_GREEN_GPIO->PDDR |= (1U << BOARD_LED_GREEN_GPIO_PIN) /*!< Enable target LED_GREEN */ | ||
123 | #define LED_GREEN_ON() \ | ||
124 | GPIO_PortClear(BOARD_LED_GREEN_GPIO, 1U << BOARD_LED_GREEN_GPIO_PIN) /*!< Turn on target LED_GREEN */ | ||
125 | #define LED_GREEN_OFF() \ | ||
126 | GPIO_PortSet(BOARD_LED_GREEN_GPIO, 1U << BOARD_LED_GREEN_GPIO_PIN) /*!< Turn off target LED_GREEN */ | ||
127 | #define LED_GREEN_TOGGLE() \ | ||
128 | GPIO_PortToggle(BOARD_LED_GREEN_GPIO, 1U << BOARD_LED_GREEN_GPIO_PIN) /*!< Toggle on target LED_GREEN */ | ||
129 | |||
130 | #define LED_BLUE_INIT(output) \ | ||
131 | GPIO_PinWrite(BOARD_LED_BLUE_GPIO, BOARD_LED_BLUE_GPIO_PIN, output); \ | ||
132 | BOARD_LED_BLUE_GPIO->PDDR |= (1U << BOARD_LED_BLUE_GPIO_PIN) /*!< Enable target LED_BLUE */ | ||
133 | #define LED_BLUE_ON() \ | ||
134 | GPIO_PortClear(BOARD_LED_BLUE_GPIO, 1U << BOARD_LED_BLUE_GPIO_PIN) /*!< Turn on target LED_BLUE */ | ||
135 | #define LED_BLUE_OFF() \ | ||
136 | GPIO_PortSet(BOARD_LED_BLUE_GPIO, 1U << BOARD_LED_BLUE_GPIO_PIN) /*!< Turn off target LED_BLUE */ | ||
137 | #define LED_BLUE_TOGGLE() \ | ||
138 | GPIO_PortToggle(BOARD_LED_BLUE_GPIO, 1U << BOARD_LED_BLUE_GPIO_PIN) /*!< Toggle on target LED_BLUE */ | ||
139 | |||
140 | /*! @brief Define the port interrupt number for the usb id gpio pin */ | ||
141 | #define BOARD_ID_GPIO GPIOE | ||
142 | #define BOARD_ID_PORT PORTE | ||
143 | #define BOARD_ID_GPIO_PIN 10U | ||
144 | #define BOARD_ID_IRQ PORTE_IRQn | ||
145 | |||
146 | /* SDHC base address, clock and card detection pin */ | ||
147 | #define BOARD_SDHC_BASEADDR SDHC | ||
148 | #define BOARD_SDHC_CLKSRC kCLOCK_CoreSysClk | ||
149 | #define BOARD_SDHC_CLK_FREQ CLOCK_GetFreq(kCLOCK_CoreSysClk) | ||
150 | #define BOARD_SDHC_IRQ SDHC_IRQn | ||
151 | #define BOARD_SDHC_CD_GPIO_BASE GPIOD | ||
152 | #ifndef BOARD_SDHC_CD_GPIO_PIN | ||
153 | #define BOARD_SDHC_CD_GPIO_PIN 10U | ||
154 | #endif | ||
155 | #define BOARD_SDHC_CD_PORT_BASE PORTD | ||
156 | #define BOARD_SDHC_CD_PORT_IRQ PORTD_IRQn | ||
157 | #define BOARD_SDHC_CD_PORT_IRQ_HANDLER PORTD_IRQHandler | ||
158 | #define BOARD_SDHC_CD_LOGIC_RISING | ||
159 | |||
160 | /* ERPC DSPI configuration */ | ||
161 | #define ERPC_BOARD_DSPI_BASEADDR SPI0 | ||
162 | #define ERPC_BOARD_DSPI_BAUDRATE 500000U | ||
163 | #define ERPC_BOARD_DSPI_CLKSRC DSPI0_CLK_SRC | ||
164 | #define ERPC_BOARD_DSPI_CLK_FREQ CLOCK_GetFreq(DSPI0_CLK_SRC) | ||
165 | #define ERPC_BOARD_DSPI_INT_GPIO GPIOB | ||
166 | #define ERPC_BOARD_DSPI_INT_PORT PORTB | ||
167 | #define ERPC_BOARD_DSPI_INT_PIN 2U | ||
168 | #define ERPC_BOARD_DSPI_INT_PIN_IRQ PORTB_IRQn | ||
169 | #define ERPC_BOARD_DSPI_INT_PIN_IRQ_HANDLER PORTB_IRQHandler | ||
170 | |||
171 | /* DAC base address */ | ||
172 | #define BOARD_DAC_BASEADDR DAC0 | ||
173 | |||
174 | /* Board accelerometer driver */ | ||
175 | #define BOARD_ACCEL_FXOS | ||
176 | |||
177 | #if defined(__cplusplus) | ||
178 | extern "C" { | ||
179 | #endif /* __cplusplus */ | ||
180 | |||
181 | /******************************************************************************* | ||
182 | * API | ||
183 | ******************************************************************************/ | ||
184 | |||
185 | void BOARD_InitDebugConsole(void); | ||
186 | |||
187 | #if defined(__cplusplus) | ||
188 | } | ||
189 | #endif /* __cplusplus */ | ||
190 | |||
191 | #endif /* _BOARD_H_ */ | ||
diff --git a/lib/chibios-contrib/ext/mcux-sdk/devices/MK66F18/project_template/clock_config.c b/lib/chibios-contrib/ext/mcux-sdk/devices/MK66F18/project_template/clock_config.c new file mode 100644 index 000000000..152a30c0f --- /dev/null +++ b/lib/chibios-contrib/ext/mcux-sdk/devices/MK66F18/project_template/clock_config.c | |||
@@ -0,0 +1,180 @@ | |||
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 | * How to setup clock using clock driver functions: | ||
14 | * | ||
15 | * 1. CLOCK_SetSimSafeDivs, to make sure core clock, bus clock, flexbus clock | ||
16 | * and flash clock are in allowed range during clock mode switch. | ||
17 | * | ||
18 | * 2. Call CLOCK_Osc0Init to setup OSC clock, if it is used in target mode. | ||
19 | * | ||
20 | * 3. Set MCG configuration, MCG includes three parts: FLL clock, PLL clock and | ||
21 | * internal reference clock(MCGIRCLK). Follow the steps to setup: | ||
22 | * | ||
23 | * 1). Call CLOCK_BootToXxxMode to set MCG to target mode. | ||
24 | * | ||
25 | * 2). If target mode is FBI/BLPI/PBI mode, the MCGIRCLK has been configured | ||
26 | * correctly. For other modes, need to call CLOCK_SetInternalRefClkConfig | ||
27 | * explicitly to setup MCGIRCLK. | ||
28 | * | ||
29 | * 3). Don't need to configure FLL explicitly, because if target mode is FLL | ||
30 | * mode, then FLL has been configured by the function CLOCK_BootToXxxMode, | ||
31 | * if the target mode is not FLL mode, the FLL is disabled. | ||
32 | * | ||
33 | * 4). If target mode is PEE/PBE/PEI/PBI mode, then the related PLL has been | ||
34 | * setup by CLOCK_BootToXxxMode. In FBE/FBI/FEE/FBE mode, the PLL could | ||
35 | * be enabled independently, call CLOCK_EnablePll0 explicitly in this case. | ||
36 | * | ||
37 | * 4. Call CLOCK_SetSimConfig to set the clock configuration in SIM. | ||
38 | */ | ||
39 | |||
40 | /* clang-format off */ | ||
41 | /* TEXT BELOW IS USED AS SETTING FOR TOOLS ************************************* | ||
42 | !!GlobalInfo | ||
43 | product: Clocks v5.0 | ||
44 | processor: MK66FN2M0xxx18 | ||
45 | mcu_data: ksdk2_0 | ||
46 | processor_version: 0.0.17 | ||
47 | * BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS **********/ | ||
48 | /* clang-format on */ | ||
49 | |||
50 | #include "clock_config.h" | ||
51 | |||
52 | /******************************************************************************* | ||
53 | * Definitions | ||
54 | ******************************************************************************/ | ||
55 | #define MCG_IRCLK_DISABLE 0U /*!< MCGIRCLK disabled */ | ||
56 | #define MCG_PLL_DISABLE 0U /*!< MCGPLLCLK disabled */ | ||
57 | #define OSC_CAP0P 0U /*!< Oscillator 0pF capacitor load */ | ||
58 | #define OSC_ER_CLK_DISABLE 0U /*!< Disable external reference clock */ | ||
59 | #define SIM_OSC32KSEL_OSC32KCLK_CLK 0U /*!< OSC32KSEL select: OSC32KCLK clock */ | ||
60 | #define SIM_PLLFLLSEL_MCGFLLCLK_CLK 0U /*!< PLLFLL select: MCGFLLCLK clock */ | ||
61 | |||
62 | /******************************************************************************* | ||
63 | * Variables | ||
64 | ******************************************************************************/ | ||
65 | /* System clock frequency. */ | ||
66 | extern uint32_t SystemCoreClock; | ||
67 | |||
68 | /******************************************************************************* | ||
69 | * Code | ||
70 | ******************************************************************************/ | ||
71 | /*FUNCTION********************************************************************** | ||
72 | * | ||
73 | * Function Name : CLOCK_CONFIG_FllStableDelay | ||
74 | * Description : This function is used to delay for FLL stable. | ||
75 | * | ||
76 | *END**************************************************************************/ | ||
77 | static void CLOCK_CONFIG_FllStableDelay(void) | ||
78 | { | ||
79 | uint32_t i = 30000U; | ||
80 | while (i--) | ||
81 | { | ||
82 | __NOP(); | ||
83 | } | ||
84 | } | ||
85 | |||
86 | /******************************************************************************* | ||
87 | ************************ BOARD_InitBootClocks function ************************ | ||
88 | ******************************************************************************/ | ||
89 | void BOARD_InitBootClocks(void) | ||
90 | { | ||
91 | BOARD_BootClockRUN(); | ||
92 | } | ||
93 | |||
94 | /******************************************************************************* | ||
95 | ********************** Configuration BOARD_BootClockRUN *********************** | ||
96 | ******************************************************************************/ | ||
97 | /* clang-format off */ | ||
98 | /* TEXT BELOW IS USED AS SETTING FOR TOOLS ************************************* | ||
99 | !!Configuration | ||
100 | name: BOARD_BootClockRUN | ||
101 | called_from_default_init: true | ||
102 | outputs: | ||
103 | - {id: Bus_clock.outFreq, value: 20.97152 MHz} | ||
104 | - {id: Core_clock.outFreq, value: 20.97152 MHz} | ||
105 | - {id: Flash_clock.outFreq, value: 10.48576 MHz} | ||
106 | - {id: FlexBus_clock.outFreq, value: 10.48576 MHz} | ||
107 | - {id: LPO_clock.outFreq, value: 1 kHz} | ||
108 | - {id: MCGFFCLK.outFreq, value: 32.768 kHz} | ||
109 | - {id: PLLFLLCLK.outFreq, value: 20.97152 MHz} | ||
110 | - {id: System_clock.outFreq, value: 20.97152 MHz} | ||
111 | * BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS **********/ | ||
112 | /* clang-format on */ | ||
113 | |||
114 | /******************************************************************************* | ||
115 | * Variables for BOARD_BootClockRUN configuration | ||
116 | ******************************************************************************/ | ||
117 | const mcg_config_t mcgConfig_BOARD_BootClockRUN = | ||
118 | { | ||
119 | .mcgMode = kMCG_ModeFEI, /* FEI - FLL Engaged Internal */ | ||
120 | .irclkEnableMode = MCG_IRCLK_DISABLE, /* MCGIRCLK disabled */ | ||
121 | .ircs = kMCG_IrcSlow, /* Slow internal reference clock selected */ | ||
122 | .fcrdiv = 0x1U, /* Fast IRC divider: divided by 2 */ | ||
123 | .frdiv = 0x0U, /* FLL reference clock divider: divided by 1 */ | ||
124 | .drs = kMCG_DrsLow, /* Low frequency range */ | ||
125 | .dmx32 = kMCG_Dmx32Default, /* DCO has a default range of 25% */ | ||
126 | .oscsel = kMCG_OscselOsc, /* Selects System Oscillator (OSCCLK) */ | ||
127 | .pll0Config = | ||
128 | { | ||
129 | .enableMode = MCG_PLL_DISABLE, /* MCGPLLCLK disabled */ | ||
130 | .prdiv = 0x0U, /* PLL Reference divider: divided by 1 */ | ||
131 | .vdiv = 0x0U, /* VCO divider: multiplied by 16 */ | ||
132 | }, | ||
133 | .pllcs = kMCG_PllClkSelPll0, /* PLL0 output clock is selected */ | ||
134 | }; | ||
135 | const sim_clock_config_t simConfig_BOARD_BootClockRUN = | ||
136 | { | ||
137 | .pllFllSel = SIM_PLLFLLSEL_MCGFLLCLK_CLK, /* PLLFLL select: MCGFLLCLK clock */ | ||
138 | .pllFllDiv = 0, /* PLLFLLSEL clock divider divisor: divided by 1 */ | ||
139 | .pllFllFrac = 0, /* PLLFLLSEL clock divider fraction: multiplied by 1 */ | ||
140 | .er32kSrc = SIM_OSC32KSEL_OSC32KCLK_CLK, /* OSC32KSEL select: OSC32KCLK clock */ | ||
141 | .clkdiv1 = 0x110000U, /* SIM_CLKDIV1 - OUTDIV1: /1, OUTDIV2: /1, OUTDIV3: /2, OUTDIV4: /2 */ | ||
142 | }; | ||
143 | const osc_config_t oscConfig_BOARD_BootClockRUN = | ||
144 | { | ||
145 | .freq = 0U, /* Oscillator frequency: 0Hz */ | ||
146 | .capLoad = (OSC_CAP0P), /* Oscillator capacity load: 0pF */ | ||
147 | .workMode = kOSC_ModeExt, /* Use external clock */ | ||
148 | .oscerConfig = | ||
149 | { | ||
150 | .enableMode = OSC_ER_CLK_DISABLE, /* Disable external reference clock */ | ||
151 | .erclkDiv = 0, /* Divider for OSCERCLK: divided by 1 */ | ||
152 | } | ||
153 | }; | ||
154 | |||
155 | /******************************************************************************* | ||
156 | * Code for BOARD_BootClockRUN configuration | ||
157 | ******************************************************************************/ | ||
158 | void BOARD_BootClockRUN(void) | ||
159 | { | ||
160 | /* Set the system clock dividers in SIM to safe value. */ | ||
161 | CLOCK_SetSimSafeDivs(); | ||
162 | /* Configure the Internal Reference clock (MCGIRCLK). */ | ||
163 | CLOCK_SetInternalRefClkConfig(mcgConfig_BOARD_BootClockRUN.irclkEnableMode, | ||
164 | mcgConfig_BOARD_BootClockRUN.ircs, | ||
165 | mcgConfig_BOARD_BootClockRUN.fcrdiv); | ||
166 | /* Set MCG to FEI mode. */ | ||
167 | #if FSL_CLOCK_DRIVER_VERSION >= MAKE_VERSION(2, 2, 0) | ||
168 | CLOCK_BootToFeiMode(mcgConfig_BOARD_BootClockRUN.dmx32, | ||
169 | mcgConfig_BOARD_BootClockRUN.drs, | ||
170 | CLOCK_CONFIG_FllStableDelay); | ||
171 | #else | ||
172 | CLOCK_BootToFeiMode(mcgConfig_BOARD_BootClockRUN.drs, | ||
173 | CLOCK_CONFIG_FllStableDelay); | ||
174 | #endif | ||
175 | /* Set the clock configuration in SIM module. */ | ||
176 | CLOCK_SetSimConfig(&simConfig_BOARD_BootClockRUN); | ||
177 | /* Set SystemCoreClock variable. */ | ||
178 | SystemCoreClock = BOARD_BOOTCLOCKRUN_CORE_CLOCK; | ||
179 | } | ||
180 | |||
diff --git a/lib/chibios-contrib/ext/mcux-sdk/devices/MK66F18/project_template/clock_config.h b/lib/chibios-contrib/ext/mcux-sdk/devices/MK66F18/project_template/clock_config.h new file mode 100644 index 000000000..7ed3806e0 --- /dev/null +++ b/lib/chibios-contrib/ext/mcux-sdk/devices/MK66F18/project_template/clock_config.h | |||
@@ -0,0 +1,76 @@ | |||
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 | #ifndef _CLOCK_CONFIG_H_ | ||
14 | #define _CLOCK_CONFIG_H_ | ||
15 | |||
16 | #include "fsl_common.h" | ||
17 | |||
18 | /******************************************************************************* | ||
19 | * Definitions | ||
20 | ******************************************************************************/ | ||
21 | |||
22 | /******************************************************************************* | ||
23 | ************************ BOARD_InitBootClocks function ************************ | ||
24 | ******************************************************************************/ | ||
25 | |||
26 | #if defined(__cplusplus) | ||
27 | extern "C" { | ||
28 | #endif /* __cplusplus*/ | ||
29 | |||
30 | /*! | ||
31 | * @brief This function executes default configuration of clocks. | ||
32 | * | ||
33 | */ | ||
34 | void BOARD_InitBootClocks(void); | ||
35 | |||
36 | #if defined(__cplusplus) | ||
37 | } | ||
38 | #endif /* __cplusplus*/ | ||
39 | |||
40 | /******************************************************************************* | ||
41 | ********************** Configuration BOARD_BootClockRUN *********************** | ||
42 | ******************************************************************************/ | ||
43 | /******************************************************************************* | ||
44 | * Definitions for BOARD_BootClockRUN configuration | ||
45 | ******************************************************************************/ | ||
46 | #define BOARD_BOOTCLOCKRUN_CORE_CLOCK 20971520U /*!< Core clock frequency: 20971520Hz */ | ||
47 | |||
48 | /*! @brief MCG set for BOARD_BootClockRUN configuration. | ||
49 | */ | ||
50 | extern const mcg_config_t mcgConfig_BOARD_BootClockRUN; | ||
51 | /*! @brief SIM module set for BOARD_BootClockRUN configuration. | ||
52 | */ | ||
53 | extern const sim_clock_config_t simConfig_BOARD_BootClockRUN; | ||
54 | /*! @brief OSC set for BOARD_BootClockRUN configuration. | ||
55 | */ | ||
56 | extern const osc_config_t oscConfig_BOARD_BootClockRUN; | ||
57 | |||
58 | /******************************************************************************* | ||
59 | * API for BOARD_BootClockRUN configuration | ||
60 | ******************************************************************************/ | ||
61 | #if defined(__cplusplus) | ||
62 | extern "C" { | ||
63 | #endif /* __cplusplus*/ | ||
64 | |||
65 | /*! | ||
66 | * @brief This function executes configuration of clocks. | ||
67 | * | ||
68 | */ | ||
69 | void BOARD_BootClockRUN(void); | ||
70 | |||
71 | #if defined(__cplusplus) | ||
72 | } | ||
73 | #endif /* __cplusplus*/ | ||
74 | |||
75 | #endif /* _CLOCK_CONFIG_H_ */ | ||
76 | |||
diff --git a/lib/chibios-contrib/ext/mcux-sdk/devices/MK66F18/project_template/peripherals.c b/lib/chibios-contrib/ext/mcux-sdk/devices/MK66F18/project_template/peripherals.c new file mode 100644 index 000000000..25ca0c4b6 --- /dev/null +++ b/lib/chibios-contrib/ext/mcux-sdk/devices/MK66F18/project_template/peripherals.c | |||
@@ -0,0 +1,51 @@ | |||
1 | /* | ||
2 | * Copyright 2019 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 | /* TEXT BELOW IS USED AS SETTING FOR TOOLS ************************************* | ||
15 | !!GlobalInfo | ||
16 | product: Peripherals v6.0 | ||
17 | processor: MK66FN2M0xxx18 | ||
18 | mcu_data: ksdk2_0 | ||
19 | processor_version: 0.0.19 | ||
20 | functionalGroups: | ||
21 | - name: BOARD_InitPeripherals | ||
22 | called_from_default_init: true | ||
23 | * BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS **********/ | ||
24 | |||
25 | /* TEXT BELOW IS USED AS SETTING FOR TOOLS ************************************* | ||
26 | component: | ||
27 | - type: 'system' | ||
28 | - type_id: 'system_54b53072540eeeb8f8e9343e71f28176' | ||
29 | - global_system_definitions: [] | ||
30 | * BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS **********/ | ||
31 | /* clang-format on */ | ||
32 | |||
33 | /*********************************************************************************************************************** | ||
34 | * Included files | ||
35 | **********************************************************************************************************************/ | ||
36 | #include "peripherals.h" | ||
37 | |||
38 | /*********************************************************************************************************************** | ||
39 | * Initialization functions | ||
40 | **********************************************************************************************************************/ | ||
41 | void BOARD_InitPeripherals(void) | ||
42 | { | ||
43 | } | ||
44 | |||
45 | /*********************************************************************************************************************** | ||
46 | * BOARD_InitBootPeripherals function | ||
47 | **********************************************************************************************************************/ | ||
48 | void BOARD_InitBootPeripherals(void) | ||
49 | { | ||
50 | BOARD_InitPeripherals(); | ||
51 | } | ||
diff --git a/lib/chibios-contrib/ext/mcux-sdk/devices/MK66F18/project_template/peripherals.h b/lib/chibios-contrib/ext/mcux-sdk/devices/MK66F18/project_template/peripherals.h new file mode 100644 index 000000000..150360637 --- /dev/null +++ b/lib/chibios-contrib/ext/mcux-sdk/devices/MK66F18/project_template/peripherals.h | |||
@@ -0,0 +1,34 @@ | |||
1 | /* | ||
2 | * Copyright 2019 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 | #ifndef _PERIPHERALS_H_ | ||
14 | #define _PERIPHERALS_H_ | ||
15 | |||
16 | #if defined(__cplusplus) | ||
17 | extern "C" { | ||
18 | #endif /* __cplusplus */ | ||
19 | |||
20 | /*********************************************************************************************************************** | ||
21 | * Initialization functions | ||
22 | **********************************************************************************************************************/ | ||
23 | void BOARD_InitPeripherals(void); | ||
24 | |||
25 | /*********************************************************************************************************************** | ||
26 | * BOARD_InitBootPeripherals function | ||
27 | **********************************************************************************************************************/ | ||
28 | void BOARD_InitBootPeripherals(void); | ||
29 | |||
30 | #if defined(__cplusplus) | ||
31 | } | ||
32 | #endif | ||
33 | |||
34 | #endif /* _PERIPHERALS_H_ */ | ||
diff --git a/lib/chibios-contrib/ext/mcux-sdk/devices/MK66F18/project_template/pin_mux.c b/lib/chibios-contrib/ext/mcux-sdk/devices/MK66F18/project_template/pin_mux.c new file mode 100644 index 000000000..e59f51db4 --- /dev/null +++ b/lib/chibios-contrib/ext/mcux-sdk/devices/MK66F18/project_template/pin_mux.c | |||
@@ -0,0 +1,60 @@ | |||
1 | /* | ||
2 | * Copyright 2019 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 | ||
17 | product: Pins v6.0 | ||
18 | processor: MK66FN2M0xxx18 | ||
19 | mcu_data: ksdk2_0 | ||
20 | processor_version: 0.0.19 | ||
21 | * BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS *********** | ||
22 | */ | ||
23 | /* clang-format on */ | ||
24 | |||
25 | #include "fsl_common.h" | ||
26 | #include "pin_mux.h" | ||
27 | |||
28 | /* FUNCTION ************************************************************************************************************ | ||
29 | * | ||
30 | * Function Name : BOARD_InitBootPins | ||
31 | * Description : Calls initialization functions. | ||
32 | * | ||
33 | * END ****************************************************************************************************************/ | ||
34 | void BOARD_InitBootPins(void) | ||
35 | { | ||
36 | BOARD_InitPins(); | ||
37 | } | ||
38 | |||
39 | /* clang-format off */ | ||
40 | /* | ||
41 | * TEXT BELOW IS USED AS SETTING FOR TOOLS ************************************* | ||
42 | BOARD_InitPins: | ||
43 | - options: {callFromInitBoot: 'true', enableClock: 'true'} | ||
44 | - pin_list: [] | ||
45 | * BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS *********** | ||
46 | */ | ||
47 | /* clang-format on */ | ||
48 | |||
49 | /* FUNCTION ************************************************************************************************************ | ||
50 | * | ||
51 | * Function Name : BOARD_InitPins | ||
52 | * Description : Configures pin routing and optionally pin electrical features. | ||
53 | * | ||
54 | * END ****************************************************************************************************************/ | ||
55 | void BOARD_InitPins(void) | ||
56 | { | ||
57 | } | ||
58 | /*********************************************************************************************************************** | ||
59 | * EOF | ||
60 | **********************************************************************************************************************/ | ||
diff --git a/lib/chibios-contrib/ext/mcux-sdk/devices/MK66F18/project_template/pin_mux.h b/lib/chibios-contrib/ext/mcux-sdk/devices/MK66F18/project_template/pin_mux.h new file mode 100644 index 000000000..28df85265 --- /dev/null +++ b/lib/chibios-contrib/ext/mcux-sdk/devices/MK66F18/project_template/pin_mux.h | |||
@@ -0,0 +1,52 @@ | |||
1 | /* | ||
2 | * Copyright 2019 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 | #ifndef _PIN_MUX_H_ | ||
14 | #define _PIN_MUX_H_ | ||
15 | |||
16 | /*! | ||
17 | * @addtogroup pin_mux | ||
18 | * @{ | ||
19 | */ | ||
20 | |||
21 | /*********************************************************************************************************************** | ||
22 | * API | ||
23 | **********************************************************************************************************************/ | ||
24 | |||
25 | #if defined(__cplusplus) | ||
26 | extern "C" { | ||
27 | #endif | ||
28 | |||
29 | /*! | ||
30 | * @brief Calls initialization functions. | ||
31 | * | ||
32 | */ | ||
33 | void BOARD_InitBootPins(void); | ||
34 | |||
35 | /*! | ||
36 | * @brief Configures pin routing and optionally pin electrical features. | ||
37 | * | ||
38 | */ | ||
39 | void BOARD_InitPins(void); | ||
40 | |||
41 | #if defined(__cplusplus) | ||
42 | } | ||
43 | #endif | ||
44 | |||
45 | /*! | ||
46 | * @} | ||
47 | */ | ||
48 | #endif /* _PIN_MUX_H_ */ | ||
49 | |||
50 | /*********************************************************************************************************************** | ||
51 | * EOF | ||
52 | **********************************************************************************************************************/ | ||