1 /*
2 * Copyright 2017-2019 NXP
3 * All rights reserved.
4 *
5 * SPDX-License-Identifier: BSD-3-Clause
6 */
7 /***********************************************************************************************************************
8 * This file was generated by the MCUXpresso Config Tools. Any manual edits made to this file
9 * will be overwritten if the respective MCUXpresso Config Tools is used to update this file.
10 **********************************************************************************************************************/
11 /*
12 * How to set up clock using clock driver functions:
13 *
14 * 1. Setup clock sources.
15 *
16 * 2. Set up wait states of the flash.
17 *
18 * 3. Set up all dividers.
19 *
20 * 4. Set up all selectors to provide selected clocks.
21 */
22
23 /* clang-format off */
24 /* TEXT BELOW IS USED AS SETTING FOR TOOLS *************************************
25 !!GlobalInfo
26 product: Clocks v7.0
27 processor: LPC55S69
28 package_id: LPC55S69JBD100
29 mcu_data: ksdk2_0
30 processor_version: 0.7.2
31 * BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS **********/
32 /* clang-format on */
33
34 #include "fsl_power.h"
35 #include "fsl_clock.h"
36 #include "clock_config.h"
37
38 /*******************************************************************************
39 * Definitions
40 ******************************************************************************/
41
42 /*******************************************************************************
43 * Variables
44 ******************************************************************************/
45 /* System clock frequency. */
46 extern uint32_t SystemCoreClock;
47
48 /*******************************************************************************
49 ************************ BOARD_InitBootClocks function ************************
50 ******************************************************************************/
BOARD_InitBootClocks(void)51 void BOARD_InitBootClocks(void)
52 {
53 BOARD_BootClockFROHF96M();
54 }
55
56 /*******************************************************************************
57 ******************* Configuration BOARD_BootClockFROHF96M *********************
58 ******************************************************************************/
59 /* clang-format off */
60 /* TEXT BELOW IS USED AS SETTING FOR TOOLS *************************************
61 !!Configuration
62 name: BOARD_BootClockFROHF96M
63 outputs:
64 - {id: System_clock.outFreq, value: 96 MHz}
65 settings:
66 - {id: ANALOG_CONTROL_FRO192M_CTRL_ENDI_FRO_96M_CFG, value: Enable}
67 - {id: SYSCON.MAINCLKSELA.sel, value: ANACTRL.fro_hf_clk}
68 sources:
69 - {id: ANACTRL.fro_hf.outFreq, value: 96 MHz}
70 * BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS **********/
71 /* clang-format on */
72
73 /*******************************************************************************
74 * Variables for BOARD_BootClockFROHF96M configuration
75 ******************************************************************************/
76 /*******************************************************************************
77 * Code for BOARD_BootClockFROHF96M configuration
78 ******************************************************************************/
BOARD_BootClockFROHF96M(void)79 void BOARD_BootClockFROHF96M(void)
80 {
81 #ifndef SDK_SECONDARY_CORE
82 /*!< Set up the clock sources */
83 /*!< Configure FRO192M */
84 /*!< Ensure FRO is on */
85 POWER_DisablePD(kPDRUNCFG_PD_FRO192M);
86 /*!< Set up FRO to the 12 MHz, just for sure */
87 CLOCK_SetupFROClocking(12000000U);
88 /*!< Switch to FRO 12MHz first to ensure we can change the clock */
89 CLOCK_AttachClk(kFRO12M_to_MAIN_CLK);
90 /* Enable FRO HF(96MHz) output */
91 CLOCK_SetupFROClocking(96000000U);
92 /*!< Set FLASH wait states for core */
93 CLOCK_SetFLASHAccessCyclesForFreq(96000000U);
94 /*!< Set up dividers */
95 CLOCK_SetClkDiv(kCLOCK_DivAhbClk, 1U, false);
96 /*!< Set up clock selectors - Attach clocks to the peripheries */
97 CLOCK_AttachClk(kFRO_HF_to_MAIN_CLK);
98 /* Enables the clock for the I/O controller.: Enable Clock. */
99 CLOCK_EnableClock(kCLOCK_Iocon);
100 /*< Set SystemCoreClock variable. */
101 SystemCoreClock = BOARD_BOOTCLOCKFROHF96M_CORE_CLOCK;
102 #endif
103 }
104