aboutsummaryrefslogtreecommitdiff
path: root/lib/chibios-contrib/ext/mcux-sdk/devices/MK22F25612/project_template
diff options
context:
space:
mode:
Diffstat (limited to 'lib/chibios-contrib/ext/mcux-sdk/devices/MK22F25612/project_template')
-rw-r--r--lib/chibios-contrib/ext/mcux-sdk/devices/MK22F25612/project_template/board.c23
-rw-r--r--lib/chibios-contrib/ext/mcux-sdk/devices/MK22F25612/project_template/board.h38
-rw-r--r--lib/chibios-contrib/ext/mcux-sdk/devices/MK22F25612/project_template/clock_config.c176
-rw-r--r--lib/chibios-contrib/ext/mcux-sdk/devices/MK22F25612/project_template/clock_config.h76
-rw-r--r--lib/chibios-contrib/ext/mcux-sdk/devices/MK22F25612/project_template/peripherals.c27
-rw-r--r--lib/chibios-contrib/ext/mcux-sdk/devices/MK22F25612/project_template/peripherals.h33
-rw-r--r--lib/chibios-contrib/ext/mcux-sdk/devices/MK22F25612/project_template/pin_mux.c60
-rw-r--r--lib/chibios-contrib/ext/mcux-sdk/devices/MK22F25612/project_template/pin_mux.h52
8 files changed, 485 insertions, 0 deletions
diff --git a/lib/chibios-contrib/ext/mcux-sdk/devices/MK22F25612/project_template/board.c b/lib/chibios-contrib/ext/mcux-sdk/devices/MK22F25612/project_template/board.c
new file mode 100644
index 000000000..daedb2d4e
--- /dev/null
+++ b/lib/chibios-contrib/ext/mcux-sdk/devices/MK22F25612/project_template/board.c
@@ -0,0 +1,23 @@
1/*
2 * Copyright 201, NXP
3 * All rights reserved.
4 *
5 * SPDX-License-Identifier: BSD-3-Clause
6 */
7
8/**
9 * @file board.c
10 * @brief Board initialization file.
11 */
12
13/* This is an empty template for board specific configuration.*/
14
15#include <stdint.h>
16#include "board.h"
17
18/**
19 * @brief Set up and initialize all required blocks and functions related to the board hardware.
20 */
21void BOARD_InitDebugConsole(void) {
22 /* The user initialization should be placed here */
23}
diff --git a/lib/chibios-contrib/ext/mcux-sdk/devices/MK22F25612/project_template/board.h b/lib/chibios-contrib/ext/mcux-sdk/devices/MK22F25612/project_template/board.h
new file mode 100644
index 000000000..bbcf0e417
--- /dev/null
+++ b/lib/chibios-contrib/ext/mcux-sdk/devices/MK22F25612/project_template/board.h
@@ -0,0 +1,38 @@
1/*
2 * Copyright 2017, NXP
3 * All rights reserved.
4 *
5 * SPDX-License-Identifier: BSD-3-Clause
6 */
7
8/**
9 * @file board.h
10 * @brief Board initialization header file.
11 */
12
13/* This is an empty template for board specific configuration.*/
14
15#ifndef _BOARD_H_
16#define _BOARD_H_
17
18/**
19 * @brief The board name
20 */
21#define BOARD_NAME "board"
22
23#if defined(__cplusplus)
24extern "C" {
25#endif /* __cplusplus */
26
27/**
28 * @brief Initialize board specific settings.
29 */
30void BOARD_InitDebugConsole(void);
31
32#if defined(__cplusplus)
33}
34#endif /* __cplusplus */
35
36#endif /* _BOARD_H_ */
37
38
diff --git a/lib/chibios-contrib/ext/mcux-sdk/devices/MK22F25612/project_template/clock_config.c b/lib/chibios-contrib/ext/mcux-sdk/devices/MK22F25612/project_template/clock_config.c
new file mode 100644
index 000000000..45fb77db2
--- /dev/null
+++ b/lib/chibios-contrib/ext/mcux-sdk/devices/MK22F25612/project_template/clock_config.c
@@ -0,0 +1,176 @@
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
43product: Clocks v5.0
44processor: MK22FN256xxx12
45mcu_data: ksdk2_0
46processor_version: 0.0.16
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. */
66extern 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**************************************************************************/
77static 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 ******************************************************************************/
89void 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
100name: BOARD_BootClockRUN
101called_from_default_init: true
102outputs:
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: LPO_clock.outFreq, value: 1 kHz}
107- {id: MCGFFCLK.outFreq, value: 32.768 kHz}
108- {id: PLLFLLCLK.outFreq, value: 20.97152 MHz}
109- {id: System_clock.outFreq, value: 20.97152 MHz}
110 * BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS **********/
111/* clang-format on */
112
113/*******************************************************************************
114 * Variables for BOARD_BootClockRUN configuration
115 ******************************************************************************/
116const mcg_config_t mcgConfig_BOARD_BootClockRUN =
117 {
118 .mcgMode = kMCG_ModeFEI, /* FEI - FLL Engaged Internal */
119 .irclkEnableMode = MCG_IRCLK_DISABLE, /* MCGIRCLK disabled */
120 .ircs = kMCG_IrcSlow, /* Slow internal reference clock selected */
121 .fcrdiv = 0x1U, /* Fast IRC divider: divided by 2 */
122 .frdiv = 0x0U, /* FLL reference clock divider: divided by 1 */
123 .drs = kMCG_DrsLow, /* Low frequency range */
124 .dmx32 = kMCG_Dmx32Default, /* DCO has a default range of 25% */
125 .oscsel = kMCG_OscselOsc, /* Selects System Oscillator (OSCCLK) */
126 .pll0Config =
127 {
128 .enableMode = MCG_PLL_DISABLE, /* MCGPLLCLK disabled */
129 .prdiv = 0x0U, /* PLL Reference divider: divided by 1 */
130 .vdiv = 0x0U, /* VCO divider: multiplied by 24 */
131 },
132 };
133const sim_clock_config_t simConfig_BOARD_BootClockRUN =
134 {
135 .pllFllSel = SIM_PLLFLLSEL_MCGFLLCLK_CLK, /* PLLFLL select: MCGFLLCLK clock */
136 .er32kSrc = SIM_OSC32KSEL_OSC32KCLK_CLK, /* OSC32KSEL select: OSC32KCLK clock */
137 .clkdiv1 = 0x10000U, /* SIM_CLKDIV1 - OUTDIV1: /1, OUTDIV2: /1, OUTDIV4: /2 */
138 };
139const osc_config_t oscConfig_BOARD_BootClockRUN =
140 {
141 .freq = 0U, /* Oscillator frequency: 0Hz */
142 .capLoad = (OSC_CAP0P), /* Oscillator capacity load: 0pF */
143 .workMode = kOSC_ModeExt, /* Use external clock */
144 .oscerConfig =
145 {
146 .enableMode = OSC_ER_CLK_DISABLE, /* Disable external reference clock */
147 .erclkDiv = 0, /* Divider for OSCERCLK: divided by 1 */
148 }
149 };
150
151/*******************************************************************************
152 * Code for BOARD_BootClockRUN configuration
153 ******************************************************************************/
154void BOARD_BootClockRUN(void)
155{
156 /* Set the system clock dividers in SIM to safe value. */
157 CLOCK_SetSimSafeDivs();
158 /* Configure the Internal Reference clock (MCGIRCLK). */
159 CLOCK_SetInternalRefClkConfig(mcgConfig_BOARD_BootClockRUN.irclkEnableMode,
160 mcgConfig_BOARD_BootClockRUN.ircs,
161 mcgConfig_BOARD_BootClockRUN.fcrdiv);
162 /* Set MCG to FEI mode. */
163#if FSL_CLOCK_DRIVER_VERSION >= MAKE_VERSION(2, 2, 0)
164 CLOCK_BootToFeiMode(mcgConfig_BOARD_BootClockRUN.dmx32,
165 mcgConfig_BOARD_BootClockRUN.drs,
166 CLOCK_CONFIG_FllStableDelay);
167#else
168 CLOCK_BootToFeiMode(mcgConfig_BOARD_BootClockRUN.drs,
169 CLOCK_CONFIG_FllStableDelay);
170#endif
171 /* Set the clock configuration in SIM module. */
172 CLOCK_SetSimConfig(&simConfig_BOARD_BootClockRUN);
173 /* Set SystemCoreClock variable. */
174 SystemCoreClock = BOARD_BOOTCLOCKRUN_CORE_CLOCK;
175}
176
diff --git a/lib/chibios-contrib/ext/mcux-sdk/devices/MK22F25612/project_template/clock_config.h b/lib/chibios-contrib/ext/mcux-sdk/devices/MK22F25612/project_template/clock_config.h
new file mode 100644
index 000000000..7ed3806e0
--- /dev/null
+++ b/lib/chibios-contrib/ext/mcux-sdk/devices/MK22F25612/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)
27extern "C" {
28#endif /* __cplusplus*/
29
30/*!
31 * @brief This function executes default configuration of clocks.
32 *
33 */
34void 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 */
50extern const mcg_config_t mcgConfig_BOARD_BootClockRUN;
51/*! @brief SIM module set for BOARD_BootClockRUN configuration.
52 */
53extern const sim_clock_config_t simConfig_BOARD_BootClockRUN;
54/*! @brief OSC set for BOARD_BootClockRUN configuration.
55 */
56extern const osc_config_t oscConfig_BOARD_BootClockRUN;
57
58/*******************************************************************************
59 * API for BOARD_BootClockRUN configuration
60 ******************************************************************************/
61#if defined(__cplusplus)
62extern "C" {
63#endif /* __cplusplus*/
64
65/*!
66 * @brief This function executes configuration of clocks.
67 *
68 */
69void 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/MK22F25612/project_template/peripherals.c b/lib/chibios-contrib/ext/mcux-sdk/devices/MK22F25612/project_template/peripherals.c
new file mode 100644
index 000000000..fb5ee60a9
--- /dev/null
+++ b/lib/chibios-contrib/ext/mcux-sdk/devices/MK22F25612/project_template/peripherals.c
@@ -0,0 +1,27 @@
1/*
2 * Copyright 2017, NXP
3 * All rights reserved.
4 *
5 * SPDX-License-Identifier: BSD-3-Clause
6 */
7
8/* TEXT BELOW IS USED AS SETTING FOR TOOLS *************************************
9!!GlobalInfo
10product: Peripherals v1.0
11* BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS **********/
12
13/**
14 * @file peripherals.c
15 * @brief Peripherals initialization file.
16 */
17
18/* This is an empty template for board specific configuration.*/
19
20#include "peripherals.h"
21
22/**
23 * @brief Set up and initialize all required blocks and functions related to the peripherals hardware.
24 */
25void BOARD_InitBootPeripherals(void) {
26 /* The user initialization should be placed here */
27}
diff --git a/lib/chibios-contrib/ext/mcux-sdk/devices/MK22F25612/project_template/peripherals.h b/lib/chibios-contrib/ext/mcux-sdk/devices/MK22F25612/project_template/peripherals.h
new file mode 100644
index 000000000..3e40d9a72
--- /dev/null
+++ b/lib/chibios-contrib/ext/mcux-sdk/devices/MK22F25612/project_template/peripherals.h
@@ -0,0 +1,33 @@
1/*
2 * Copyright 2017, NXP
3 * All rights reserved.
4 *
5 * SPDX-License-Identifier: BSD-3-Clause
6 */
7
8/**
9 * @file peripherals.h
10 * @brief Peripherals initialization header file.
11 */
12
13/* This is an empty template for board specific configuration.*/
14
15#ifndef _PERIPHERALS_H_
16#define _PERIPHERALS_H_
17
18#if defined(__cplusplus)
19extern "C" {
20#endif /* __cplusplus */
21
22/**
23 * @brief Initialize peripherals specific settings.
24 */
25void BOARD_InitBootPeripherals(void);
26
27#if defined(__cplusplus)
28}
29#endif /* __cplusplus */
30
31#endif /* _PERIPHERALS_H_ */
32
33
diff --git a/lib/chibios-contrib/ext/mcux-sdk/devices/MK22F25612/project_template/pin_mux.c b/lib/chibios-contrib/ext/mcux-sdk/devices/MK22F25612/project_template/pin_mux.c
new file mode 100644
index 000000000..0eac8f3d9
--- /dev/null
+++ b/lib/chibios-contrib/ext/mcux-sdk/devices/MK22F25612/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
17product: Pins v6.0
18processor: MK22FN256xxx12
19mcu_data: ksdk2_0
20processor_version: 0.0.18
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 ****************************************************************************************************************/
34void BOARD_InitBootPins(void)
35{
36 BOARD_InitPins();
37}
38
39/* clang-format off */
40/*
41 * TEXT BELOW IS USED AS SETTING FOR TOOLS *************************************
42BOARD_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 ****************************************************************************************************************/
55void BOARD_InitPins(void)
56{
57}
58/***********************************************************************************************************************
59 * EOF
60 **********************************************************************************************************************/
diff --git a/lib/chibios-contrib/ext/mcux-sdk/devices/MK22F25612/project_template/pin_mux.h b/lib/chibios-contrib/ext/mcux-sdk/devices/MK22F25612/project_template/pin_mux.h
new file mode 100644
index 000000000..28df85265
--- /dev/null
+++ b/lib/chibios-contrib/ext/mcux-sdk/devices/MK22F25612/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)
26extern "C" {
27#endif
28
29/*!
30 * @brief Calls initialization functions.
31 *
32 */
33void BOARD_InitBootPins(void);
34
35/*!
36 * @brief Configures pin routing and optionally pin electrical features.
37 *
38 */
39void 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 **********************************************************************************************************************/