1 /*
2 ** ###################################################################
3 **     Processors:          MIMXRT1189CVM8B_cm33
4 **                          MIMXRT1189XVM8B_cm33
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:    IMXRT1180RM, Rev 2, 12/2022
12 **     Version:             rev. 0.1, 2021-03-09
13 **     Build:               b231213
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-2023 NXP
22 **     SPDX-License-Identifier: BSD-3-Clause
23 **
24 **     http:                 www.nxp.com
25 **     mail:                 support@nxp.com
26 **
27 **     Revisions:
28 **     - rev. 0.1 (2021-03-09)
29 **         Initial version.
30 **
31 ** ###################################################################
32 */
33 
34 /*!
35  * @file MIMXRT1189_cm33
36  * @version 1.0
37  * @date 2023-12-13
38  * @brief Device specific configuration file for MIMXRT1189_cm33 (header file)
39  *
40  * Provides a system configuration function and a global variable that contains
41  * the system frequency. It configures the device and initializes the oscillator
42  * (PLL) that is part of the microcontroller device.
43  */
44 
45 #ifndef _SYSTEM_MIMXRT1189_cm33_H_
46 #define _SYSTEM_MIMXRT1189_cm33_H_                /**< Symbol preventing repeated inclusion */
47 
48 #ifdef __cplusplus
49 extern "C" {
50 #endif
51 
52 #include <stdint.h>
53 
54 
55 #ifndef DISABLE_WDOG
56   #define DISABLE_WDOG                 1
57 #endif
58 
59 /* Define clock source values */
60 
61 #define CPU_XTAL_CLK_HZ                24000000UL          /* Value of the external crystal or oscillator clock frequency in Hz */
62 
63 #define CPU_CLK1_HZ                    0UL                 /* Value of the CLK1 (select the CLK1_N/CLK1_P as source) frequency in Hz */
64                                                            /* If CLOCK1_P,CLOCK1_N is choose as the pll bypass clock source, please implement the CLKPN_FREQ define, otherwise 0 will be returned. */
65 
66 #define DEFAULT_SYSTEM_CLOCK           240000000UL         /* Default System clock value */
67 
68 
69 /**
70  * @brief System clock frequency (core clock)
71  *
72  * The system clock frequency supplied to the SysTick timer and the processor
73  * core clock. This variable can be used by the user application to setup the
74  * SysTick timer or configure other parameters. It may also be used by debugger to
75  * query the frequency of the debug timer or configure the trace clock speed
76  * SystemCoreClock is initialized with a correct predefined value.
77  */
78 extern uint32_t SystemCoreClock;
79 
80 /**
81  * @brief Setup the microcontroller system.
82  *
83  * Typically this function configures the oscillator (PLL) that is part of the
84  * microcontroller device. For systems with variable clock speed it also updates
85  * the variable SystemCoreClock. SystemInit is called from startup_device file.
86  */
87 void SystemInit(void);
88 
89 /**
90  * @brief Updates the SystemCoreClock variable.
91  *
92  * It must be called whenever the core clock is changed during program
93  * execution. SystemCoreClockUpdate() evaluates the clock register settings and calculates
94  * the current core clock.
95  */
96 void SystemCoreClockUpdate(void);
97 
98 /**
99  * @brief SystemInit function hook.
100  *
101  * This weak function allows to call specific initialization code during the
102  * SystemInit() execution.This can be used when an application specific code needs
103  * to be called as close to the reset entry as possible (for example the Multicore
104  * Manager MCMGR_EarlyInit() function call).
105  * NOTE: No global r/w variables can be used in this hook function because the
106  * initialization of these variables happens after this function.
107  */
108 void SystemInitHook(void);
109 
110 /**
111  * @brief Override NVIC_SystemReset
112  *
113  * This macro function is used to override CMSIS default NVIC_SystemReset
114  * The CM33 reset mask bit in SRC register should be cleared to make cold reset
115  * work
116  */
117 #undef NVIC_SystemReset
118 #define NVIC_SystemReset()                                                   \
119     {                                                                        \
120         SRC_GENERAL_REG->SRMASK &= ~SRC_GENERAL_SRMASK_CM33_RESET_MASK_MASK; \
121         __NVIC_SystemReset();                                                \
122     }
123 
124 /**
125  * @brief Prepare_CM7 for CM7 kick off preparation
126  *
127  * This function is used to release CM7, prepare the init VTOR and do its TCM memory
128  * initialization
129  */
130 void Prepare_CM7(uint32_t m7_vtor);
131 
132 #ifdef __cplusplus
133 }
134 #endif
135 
136 #endif  /* _SYSTEM_MIMXRT1189_cm33_H_ */
137