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