1 /* 2 ** ################################################################### 3 ** Processors: MIMXRT758SGAWAR_cm33_core1 4 ** MIMXRT758SGFOA_cm33_core1 5 ** 6 ** Compilers: GNU C Compiler 7 ** IAR ANSI C/C++ Compiler for ARM 8 ** Keil ARM C/C++ Compiler 9 ** MCUXpresso Compiler 10 ** 11 ** Reference manual: iMXRT700RM Rev.2 DraftA, 05/2024 12 ** Version: rev. 2.0, 2024-05-28 13 ** Build: b240528 14 ** 15 ** Abstract: 16 ** Provides a system configuration function and a global variable that 17 ** contains the system frequency. It configures the device and initializes 18 ** the oscillator (PLL) that is part of the microcontroller device. 19 ** 20 ** Copyright 2016 Freescale Semiconductor, Inc. 21 ** Copyright 2016-2024 NXP 22 ** SPDX-License-Identifier: BSD-3-Clause 23 ** 24 ** http: www.nxp.com 25 ** mail: support@nxp.com 26 ** 27 ** Revisions: 28 ** - rev. 1.0 (2022-09-15) 29 ** Initial version. 30 ** - rev. 2.0 (2024-05-28) 31 ** Rev2 DraftA. 32 ** 33 ** ################################################################### 34 */ 35 36 /*! 37 * @file MIMXRT758S_cm33_core1 38 * @version 1.0 39 * @date 2024-05-28 40 * @brief Device specific configuration file for MIMXRT758S_cm33_core1 (header file) 41 * 42 * Provides a system configuration function and a global variable that contains 43 * the system frequency. It configures the device and initializes the oscillator 44 * (PLL) that is part of the microcontroller device. 45 */ 46 47 #ifndef _SYSTEM_MIMXRT758S_cm33_core1_H_ 48 #define _SYSTEM_MIMXRT758S_cm33_core1_H_ /**< Symbol preventing repeated inclusion */ 49 50 #ifdef __cplusplus 51 extern "C" { 52 #endif 53 54 #include <stdint.h> 55 56 #define DEFAULT_SYSTEM_CLOCK 64000000u /* Default System clock value */ 57 #ifndef CLK_XTAL_OSC_CLK 58 #define CLK_XTAL_OSC_CLK 24000000u /* Default XTAL OSC clock, set to 0 when external CLKIN is used */ 59 #endif 60 #ifndef CLK_EXT_CLKIN 61 #define CLK_EXT_CLKIN 0u /* Default external CLKIN pin clock, set to 0 when XTAL OSC is used */ 62 #endif 63 #define CLK_OSC_CLK ((CLK_XTAL_OSC_CLK != 0U) ? CLK_XTAL_OSC_CLK : CLK_EXT_CLKIN) 64 65 #define CLK_RTC_32K_CLK 32768u /* RTC oscillator 32 kHz (32k_clk) */ 66 #define CLK_LPOSC_1MHZ 1000000u /* Low power oscillator 1 MHz (1m_lposc) */ 67 #define CLK_FRO1_MAX_CLK 192000000u /* FRO1 max clock frequency (fro1) */ 68 #define CLK_FRO2_DEFAULT_CLK 196000000u /* FRO2 default clock frequency (fro2_max) */ 69 70 #define FRO_TUNER_USED(base) ((base->TEXPCNT.RW & FRO_TEXPCNT_TEXPCNT_MASK) != 0u) 71 /* FRO frequency = TRIMCNT * (divided ref clock frequency) / REFCLKCNT. */ 72 #define FRO_FREQ_GET_FROM_TUNER(base) \ 73 ((uint32_t)((uint64_t)(base->TRIMCNT.RW) * \ 74 (uint64_t)(CLK_OSC_CLK / ((base->CNFG1.RW & FRO_CNFG1_REFDIV_MASK) + 1U)) / \ 75 ((base->CNFG1.RW & FRO_CNFG1_RFCLKCNT_MASK) >> FRO_CNFG1_RFCLKCNT_SHIFT))) 76 #define CLK_FRO2_CLK (FRO_TUNER_USED(FRO2) ? FRO_FREQ_GET_FROM_TUNER(FRO2) : CLK_FRO2_DEFAULT_CLK) 77 78 /** 79 * @brief System clock frequency (core clock) 80 * 81 * The system clock frequency supplied to the SysTick timer and the processor 82 * core clock. This variable can be used by the user application to setup the 83 * SysTick timer or configure other parameters. It may also be used by debugger to 84 * query the frequency of the debug timer or configure the trace clock speed 85 * SystemCoreClock is initialized with a correct predefined value. 86 */ 87 extern uint32_t SystemCoreClock; 88 89 /** 90 * @brief Setup the microcontroller system. 91 * 92 * Typically this function configures the oscillator (PLL) that is part of the 93 * microcontroller device. For systems with variable clock speed it also updates 94 * the variable SystemCoreClock. SystemInit is called from startup_device file. 95 */ 96 void SystemInit(void); 97 98 /** 99 * @brief Updates the SystemCoreClock variable. 100 * 101 * It must be called whenever the core clock is changed during program 102 * execution. SystemCoreClockUpdate() evaluates the clock register settings and calculates 103 * the current core clock. 104 */ 105 void SystemCoreClockUpdate(void); 106 107 /** 108 * @brief SystemInit function hook. 109 * 110 * This weak function allows to call specific initialization code during the 111 * SystemInit() execution.This can be used when an application specific code needs 112 * to be called as close to the reset entry as possible (for example the Multicore 113 * Manager MCMGR_EarlyInit() function call). 114 * NOTE: No global r/w variables can be used in this hook function because the 115 * initialization of these variables happens after this function. 116 */ 117 void SystemInitHook(void); 118 119 #ifdef __cplusplus 120 } 121 #endif 122 123 #endif /* _SYSTEM_MIMXRT758S_cm33_core1_H_ */ 124