1 /*
2 ** ###################################################################
3 **     Processors:          RW610ETA2I
4 **                          RW610HNA2I
5 **                          RW610UKA2I
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:    RW61X User manual Rev. 0.95, June 2022
13 **     Version:             rev. 1.0, 2021-03-16
14 **     Build:               b231201
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. 1.0 (2021-03-16)
30 **         Initial version.
31 **
32 ** ###################################################################
33 */
34 
35 /*!
36  * @file RW610
37  * @version 1.0
38  * @date 2023-12-01
39  * @brief Device specific configuration file for RW610 (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 #ifndef _SYSTEM_RW610_H_
46 #define _SYSTEM_RW610_H_                    /**< Symbol preventing repeated inclusion */
47 
48 #ifdef __cplusplus
49 extern "C" {
50 #endif
51 
52 #include <stdint.h>
53 
54 #define CLK_XTAL_OSC_CLK_38400KHZ 38400000u /* XTAL OSC frequency 38.4MHz */
55 #define CLK_XTAL_OSC_CLK_40000KHZ 40000000u /* XTAL OSC frequency 40MHz */
56 
57 #ifndef CLK_XTAL_OSC_CLK
58 #define CLK_XTAL_OSC_CLK \
59     (((AON_SOC_CIU->STRAP_RDBK & 0x20U) == 0U) ? CLK_XTAL_OSC_CLK_38400KHZ : CLK_XTAL_OSC_CLK_40000KHZ)
60 #endif
61 #define CLK_RTC_32K_CLK 32768u /* RTC oscillator 32 kHz (32k_clk) */
62 #ifndef CLK_EXT_CLKIN
63 #define CLK_EXT_CLKIN 0u /* Default external CLKIN pin clock */
64 #endif
65 #define DEFAULT_SYSTEM_CLOCK 260000000u /* Default System clock value */
66 
67 /**
68  * @brief System clock frequency (core clock)
69  *
70  * The system clock frequency supplied to the SysTick timer and the processor
71  * core clock. This variable can be used by the user application to setup the
72  * SysTick timer or configure other parameters. It may also be used by debugger to
73  * query the frequency of the debug timer or configure the trace clock speed
74  * SystemCoreClock is initialized with a correct predefined value.
75  */
76 extern uint32_t SystemCoreClock;
77 
78 /**
79  * @brief Setup the microcontroller system.
80  *
81  * Typically this function configures the oscillator (PLL) that is part of the
82  * microcontroller device. For systems with variable clock speed it also updates
83  * the variable SystemCoreClock. SystemInit is called from startup_device file.
84  */
85 void SystemInit(void);
86 
87 /**
88  * @brief Updates the SystemCoreClock variable.
89  *
90  * It must be called whenever the core clock is changed during program
91  * execution. SystemCoreClockUpdate() evaluates the clock register settings and calculates
92  * the current core clock.
93  */
94 void SystemCoreClockUpdate(void);
95 
96 /**
97  * @brief SystemInit function hook.
98  *
99  * This weak function allows to call specific initialization code during the
100  * SystemInit() execution.This can be used when an application specific code needs
101  * to be called as close to the reset entry as possible (for example the Multicore
102  * Manager MCMGR_EarlyInit() function call).
103  * NOTE: No global r/w variables can be used in this hook function because the
104  * initialization of these variables happens after this function.
105  */
106 void SystemInitHook(void);
107 
108 #ifdef __cplusplus
109 }
110 #endif
111 
112 #endif /* _SYSTEM_RW610_H_ */
113