1 /* 2 ** ################################################################### 3 ** Processors: MCXC242VFM 4 ** MCXC242VLH 5 ** 6 ** Compilers: Freescale C/C++ for Embedded ARM 7 ** GNU C Compiler 8 ** IAR ANSI C/C++ Compiler for ARM 9 ** Keil ARM C/C++ Compiler 10 ** MCUXpresso Compiler 11 ** 12 ** Reference manual: MCXC242RM, Rev.1, Mar 2024 13 ** Version: rev. 1.6, 2016-06-24 14 ** Build: b240516 15 ** 16 ** Abstract: 17 ** Provides a system configuration function and a global variable that 18 ** contains the system frequency. It configures the device and initializes 19 ** the oscillator (PLL) that is part of the microcontroller device. 20 ** 21 ** Copyright 2016 Freescale Semiconductor, Inc. 22 ** Copyright 2016-2024 NXP 23 ** SPDX-License-Identifier: BSD-3-Clause 24 ** 25 ** http: www.nxp.com 26 ** mail: support@nxp.com 27 ** 28 ** Revisions: 29 ** - rev. 1.0 (2014-05-12) 30 ** Initial version. 31 ** - rev. 1.1 (2014-07-10) 32 ** UART0 - UART0 module renamed to UART2. 33 ** - rev. 1.2 (2014-08-12) 34 ** CRC - CRC register renamed to DATA. 35 ** - rev. 1.3 (2014-09-02) 36 ** USB - USB0_CTL0 was renamed to USB0_OTGCTL register. 37 ** USB - USB0_CTL1 was renamed to USB0_CTL register. 38 ** USB - Two new bitfields (STOP_ACK_DLY_EN, AHB_DLY_EN) was added to the USB0_KEEP_ALIVE_CTRL register. 39 ** - rev. 1.4 (2014-09-22) 40 ** FLEXIO - Offsets of the SHIFTBUFBIS registers were interchanged with offsets of the SHIFTBUFBBS registers. 41 ** SIM - Changed bitfield value MCGIRCLK to LIRC_CLK of bitfield CLKOUTSEL in SOPT2 register. 42 ** SIM - Removed bitfield DIEID in SDID register. 43 ** UART2 - Removed ED register. 44 ** UART2 - Removed MODEM register. 45 ** UART2 - Removed IR register. 46 ** UART2 - Removed PFIFO register. 47 ** UART2 - Removed CFIFO register. 48 ** UART2 - Removed SFIFO register. 49 ** UART2 - Removed TWFIFO register. 50 ** UART2 - Removed TCFIFO register. 51 ** UART2 - Removed RWFIFO register. 52 ** UART2 - Removed RCFIFO register. 53 ** USB - Removed bitfield REG_EN in CLK_RECOVER_IRC_EN register. 54 ** USB - Renamed USBEN bitfield of USB0_CTL was renamed to USBENSOFEN. 55 ** - rev. 1.5 (2016-02-02) 56 ** FGPIO - Add FGPIO registers. 57 ** - rev. 1.6 (2016-06-24) 58 ** USB - OTGCTL register was removed. 59 ** USB - Bit RESUME was added in CTL register. 60 ** 61 ** ################################################################### 62 */ 63 64 /*! 65 * @file MCXC242 66 * @version 1.6 67 * @date 2016-06-24 68 * @brief Device specific configuration file for MCXC242 (header file) 69 * 70 * Provides a system configuration function and a global variable that contains 71 * the system frequency. It configures the device and initializes the oscillator 72 * (PLL) that is part of the microcontroller device. 73 */ 74 75 #ifndef _SYSTEM_MCXC242_H_ 76 #define _SYSTEM_MCXC242_H_ /**< Symbol preventing repeated inclusion */ 77 78 #ifdef __cplusplus 79 extern "C" { 80 #endif 81 82 #include <stdint.h> 83 84 85 #ifndef DISABLE_WDOG 86 #define DISABLE_WDOG 1 87 #endif 88 89 #define ACK_ISOLATION 1 90 91 /* Define clock source values */ 92 #define CPU_XTAL_CLK_HZ 32768U /* Value of the external crystal or oscillator clock frequency in Hz */ 93 #define CPU_INT_FAST_CLK_HZ 48000000U /* Value of the fast internal oscillator clock frequency in Hz */ 94 #define CPU_INT_IRC_CLK_HZ 48000000U /* Value of the 48M internal oscillator clock frequency in Hz */ 95 96 /* Low power mode enable */ 97 /* SMC_PMPROT: AVLP=1,AVLLS=1 */ 98 #define SYSTEM_SMC_PMPROT_VALUE 0x2AU /* SMC_PMPROT */ 99 100 #define DEFAULT_SYSTEM_CLOCK 8000000U /* Default System clock value */ 101 #define CPU_INT_SLOW_CLK_HZ 8000000U /* Value of the slow internal oscillator clock frequency in Hz */ 102 103 104 105 /** 106 * @brief System clock frequency (core clock) 107 * 108 * The system clock frequency supplied to the SysTick timer and the processor 109 * core clock. This variable can be used by the user application to setup the 110 * SysTick timer or configure other parameters. It may also be used by debugger to 111 * query the frequency of the debug timer or configure the trace clock speed 112 * SystemCoreClock is initialized with a correct predefined value. 113 */ 114 extern uint32_t SystemCoreClock; 115 116 /** 117 * @brief Setup the microcontroller system. 118 * 119 * Typically this function configures the oscillator (PLL) that is part of the 120 * microcontroller device. For systems with variable clock speed it also updates 121 * the variable SystemCoreClock. SystemInit is called from startup_device file. 122 */ 123 void SystemInit (void); 124 125 /** 126 * @brief Updates the SystemCoreClock variable. 127 * 128 * It must be called whenever the core clock is changed during program 129 * execution. SystemCoreClockUpdate() evaluates the clock register settings and calculates 130 * the current core clock. 131 */ 132 void SystemCoreClockUpdate (void); 133 134 /** 135 * @brief SystemInit function hook. 136 * 137 * This weak function allows to call specific initialization code during the 138 * SystemInit() execution.This can be used when an application specific code needs 139 * to be called as close to the reset entry as possible (for example the Multicore 140 * Manager MCMGR_EarlyInit() function call). 141 * NOTE: No global r/w variables can be used in this hook function because the 142 * initialization of these variables happens after this function. 143 */ 144 void SystemInitHook (void); 145 146 #ifdef __cplusplus 147 } 148 #endif 149 150 #endif /* _SYSTEM_MCXC242_H_ */ 151