aboutsummaryrefslogtreecommitdiff
path: root/lib/chibios-contrib/ext/mcux-sdk/devices/LPC802/project_template/clock_config.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/chibios-contrib/ext/mcux-sdk/devices/LPC802/project_template/clock_config.c')
-rw-r--r--lib/chibios-contrib/ext/mcux-sdk/devices/LPC802/project_template/clock_config.c83
1 files changed, 83 insertions, 0 deletions
diff --git a/lib/chibios-contrib/ext/mcux-sdk/devices/LPC802/project_template/clock_config.c b/lib/chibios-contrib/ext/mcux-sdk/devices/LPC802/project_template/clock_config.c
new file mode 100644
index 000000000..cf9a9b461
--- /dev/null
+++ b/lib/chibios-contrib/ext/mcux-sdk/devices/LPC802/project_template/clock_config.c
@@ -0,0 +1,83 @@
1/*
2 * Copyright 2018 NXP.
3 * All rights reserved.
4 *
5 * SPDX-License-Identifier: BSD-3-Clause
6 */
7
8/*
9 * How to set up clock using clock driver functions:
10 *
11 * 1. Setup clock sources.
12 *
13 * 2. Set up all dividers.
14 *
15 * 3. Set up all selectors to provide selected clocks.
16 */
17
18/* TEXT BELOW IS USED AS SETTING FOR TOOLS *************************************
19!!GlobalInfo
20product: Clocks v5.0
21processor: LPC802
22mcu_data: ksdk2_0
23processor_version: 0.0.10
24 * BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS **********/
25
26#include "fsl_power.h"
27#include "fsl_clock.h"
28#include "clock_config.h"
29
30/*******************************************************************************
31 * Definitions
32 ******************************************************************************/
33
34/*******************************************************************************
35 * Variables
36 ******************************************************************************/
37/* System clock frequency. */
38extern uint32_t SystemCoreClock;
39
40/*******************************************************************************
41 ************************ BOARD_InitBootClocks function ************************
42 ******************************************************************************/
43void BOARD_InitBootClocks(void)
44{
45 BOARD_BootClockRUN();
46}
47
48/*******************************************************************************
49 ********************** Configuration BOARD_BootClockRUN ***********************
50 ******************************************************************************/
51/* TEXT BELOW IS USED AS SETTING FOR TOOLS *************************************
52!!Configuration
53name: BOARD_BootClockRUN
54called_from_default_init: true
55outputs:
56- {id: FROHF_clock.outFreq, value: 30 MHz}
57- {id: System_clock.outFreq, value: 15 MHz}
58 * BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS **********/
59
60/*******************************************************************************
61 * Variables for BOARD_BootClockRUN configuration
62 ******************************************************************************/
63/*******************************************************************************
64 * Code for BOARD_BootClockRUN configuration
65 ******************************************************************************/
66void BOARD_BootClockRUN(void)
67{
68 /*!< Set up the clock sources */
69 /*!< Set up FRO */
70 POWER_DisablePD(kPDRUNCFG_PD_FRO_OUT); /*!< Ensure FRO is on */
71 POWER_DisablePD(kPDRUNCFG_PD_FRO); /*!< Ensure FRO is on */
72 CLOCK_SetFroOscFreq(kCLOCK_FroOscOut30M); /*!< Set up FRO freq */
73 POWER_DisablePD(kPDRUNCFG_PD_LPOSC); /*!< Ensure Main osc is on */
74 CLOCK_SetMainClkSrc(kCLOCK_MainClkSrcFro); /*!< select fro for main clock */
75 CLOCK_Select(kFRG0_Clk_From_Fro); /*!< select fro for frg0 */
76 CLOCK_SetFRGClkFreq(15000000U); /*!< select frg0 freq */
77 CLOCK_Select(kCLKOUT_From_Fro); /*!< select FRO for CLKOUT */
78 CLOCK_Select(kADC_Clk_From_Fro); /*!< select FRO for ADC */
79 CLOCK_SetCoreSysClkDiv(1U);
80 /*!< Set SystemCoreClock variable. */
81 SystemCoreClock = BOARD_BOOTCLOCKRUN_CORE_CLOCK;
82}
83