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