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. call CLOCK_SetSimSafeDivs() to set the system clock dividers in SIM to safe value.
16  *
17  * 2. If external oscillator is used Call CLOCK_SetXtal0Freq() to set XTAL0 frequency based on board settings and
18  *    call CLOCK_InitOsc0() to init the OSC.
19  *
20  * 3. Call CLOCK_BootToXxxMode()/CLOCK_SetXxxMode() to set ICS run at the target mode.
21  *
22  * 4. If ICSIRCLK is needed, call CLOCK_SetInternalRefClkConfig() to enable the clock.
23  *
24  * 5. call CLOCK_SetSimConfig() to configure the divider in sim.
25  */
26 
27 /* clang-format off */
28 /* TEXT BELOW IS USED AS SETTING FOR TOOLS *************************************
29 !!GlobalInfo
30 product: Clocks v5.0
31 processor: MKE06Z128xxx4
32 mcu_data: ksdk2_0
33 processor_version: 0.0.14
34  * BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS **********/
35 /* clang-format on */
36 
37 #include "clock_config.h"
38 
39 /*******************************************************************************
40  * Definitions
41  ******************************************************************************/
42 
43 /*******************************************************************************
44  * Variables
45  ******************************************************************************/
46 /* System clock frequency. */
47 extern uint32_t SystemCoreClock;
48 
49 /*******************************************************************************
50  ************************ BOARD_InitBootClocks function ************************
51  ******************************************************************************/
BOARD_InitBootClocks(void)52 void BOARD_InitBootClocks(void)
53 {
54     BOARD_BootClockRUN();
55 }
56 
57 /*******************************************************************************
58  ********************** Configuration BOARD_BootClockRUN ***********************
59  ******************************************************************************/
60 /* clang-format off */
61 /* TEXT BELOW IS USED AS SETTING FOR TOOLS *************************************
62 !!Configuration
63 name: BOARD_BootClockRUN
64 called_from_default_init: true
65 outputs:
66 - {id: Bus_clock.outFreq, value: 24 MHz}
67 - {id: Core_clock.outFreq, value: 24 MHz}
68 - {id: Flash_clock.outFreq, value: 24 MHz}
69 - {id: ICSFF_clock.outFreq, value: 37.5 kHz}
70 - {id: LPO_clock.outFreq, value: 1 kHz}
71 - {id: Plat_clock.outFreq, value: 24 MHz}
72 - {id: System_clock.outFreq, value: 24 MHz}
73 - {id: Timer_clock.outFreq, value: 24 MHz}
74  * BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS **********/
75 /* clang-format on */
76 
77 /*******************************************************************************
78  * Variables for BOARD_BootClockRUN configuration
79  ******************************************************************************/
80 const ics_config_t icsConfig_BOARD_BootClockRUN =
81     {
82         .icsMode = kICS_ModeFEI,                  /* FEI - FLL Engaged Internal */
83         .irClkEnableMode = 0,                     /* ICSIRCLK disabled */
84         .bDiv = 0x1U,                             /* Bus clock divider: divided by 2 */
85         .rDiv = 0x0U,                             /* FLL external reference clock divider: divided by 1 */
86     };
87 const sim_clock_config_t simConfig_BOARD_BootClockRUN =
88     {
89         .outDiv1 = 0x0U,                          /* DIV1 clock divider: divided by 1 */
90         .outDiv2 = 0x0U,                          /* DIV2 clock divider: divided by 1 */
91         .outDiv3 = 0x0U,                          /* DIV3 clock divider: divided by 1 */
92         .busClkPrescaler = 0x0U,                  /* bus clock optional prescaler */
93     };
94 const osc_config_t oscConfig_BOARD_BootClockRUN =
95     {
96         .freq = 0U,                               /* Oscillator frequency: 0Hz */
97         .workMode = 0,                            /* Use external clock */
98         .enableMode = 0,                          /* Disable external reference clock */
99     };
100 
101 /*******************************************************************************
102  * Code for BOARD_BootClockRUN configuration
103  ******************************************************************************/
BOARD_BootClockRUN(void)104 void BOARD_BootClockRUN(void)
105 {
106     /* Set the system clock dividers in SIM to safe value. */
107     CLOCK_SetSimSafeDivs();
108     /* Set ICS to FEI mode. */
109     CLOCK_BootToFeiMode(icsConfig_BOARD_BootClockRUN.bDiv);
110     /* Configure the Internal Reference clock (ICSIRCLK). */
111     CLOCK_SetInternalRefClkConfig(icsConfig_BOARD_BootClockRUN.irClkEnableMode);
112     /* Set the clock configuration in SIM module. */
113     CLOCK_SetSimConfig(&simConfig_BOARD_BootClockRUN);
114     /* Set SystemCoreClock variable. */
115     SystemCoreClock = BOARD_BOOTCLOCKRUN_CORE_CLOCK;
116 }
117 
118