aboutsummaryrefslogtreecommitdiff
path: root/lib/chibios-contrib/ext/mcux-sdk/devices/MIMX8QX2/project_template/clock_config.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/chibios-contrib/ext/mcux-sdk/devices/MIMX8QX2/project_template/clock_config.c')
-rw-r--r--lib/chibios-contrib/ext/mcux-sdk/devices/MIMX8QX2/project_template/clock_config.c73
1 files changed, 73 insertions, 0 deletions
diff --git a/lib/chibios-contrib/ext/mcux-sdk/devices/MIMX8QX2/project_template/clock_config.c b/lib/chibios-contrib/ext/mcux-sdk/devices/MIMX8QX2/project_template/clock_config.c
new file mode 100644
index 000000000..9e3505c68
--- /dev/null
+++ b/lib/chibios-contrib/ext/mcux-sdk/devices/MIMX8QX2/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. */
27extern 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
60void BOARD_BootClockVLPR(void)
61{
62 SystemCoreClockUpdate();
63}
64
65void BOARD_BootClockRUN(void)
66{
67 SystemCoreClockUpdate();
68}
69
70void BOARD_BootClockHSRUN(void)
71{
72 SystemCoreClockUpdate();
73}