1 /**
2  * @file    system_max32662.h
3  * @brief   System-specific header file
4  */
5 
6 /******************************************************************************
7  *
8  * Copyright (C) 2022-2023 Maxim Integrated Products, Inc. (now owned by
9  * Analog Devices, Inc.),
10  * Copyright (C) 2023-2024 Analog Devices, Inc.
11  *
12  * Licensed under the Apache License, Version 2.0 (the "License");
13  * you may not use this file except in compliance with the License.
14  * You may obtain a copy of the License at
15  *
16  *     http://www.apache.org/licenses/LICENSE-2.0
17  *
18  * Unless required by applicable law or agreed to in writing, software
19  * distributed under the License is distributed on an "AS IS" BASIS,
20  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21  * See the License for the specific language governing permissions and
22  * limitations under the License.
23  *
24  ******************************************************************************/
25 
26 #ifndef LIBRARIES_CMSIS_DEVICE_MAXIM_MAX32662_INCLUDE_SYSTEM_MAX32662_H_
27 #define LIBRARIES_CMSIS_DEVICE_MAXIM_MAX32662_INCLUDE_SYSTEM_MAX32662_H_
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
33 #include <stdint.h>
34 
35 /*----------------------------------------------------------------------------
36   Define clocks
37  *----------------------------------------------------------------------------*/
38 
39 /*  This define is included to prevent build errors in existing code.
40     New code should update HF_EXTCLK_FREQ to match the frequency of the external clock. */
41 #ifndef EXTCLK_FREQ
42 #define EXTCLK_FREQ 75000000
43 #endif
44 
45 /* NOTE: HF_EXTCLK_FREQ needs to be defined by user based on the clock they supply */
46 #ifndef HF_EXTCLK_FREQ
47 #define HF_EXTCLK_FREQ EXTCLK_FREQ
48 #endif
49 
50 /* NOTE: LP_EXTCLK_FREQ needs to be defined by user based on the clock they supply */
51 #ifndef LP_EXTCLK_FREQ
52 #define LP_EXTCLK_FREQ 12500000
53 #endif
54 
55 /* NOTE: This is the nominal value for INRO. The actual value may vary from chip to chip.
56          Update if use of this oscillator requires precise timing.*/
57 /* NOTE: INRO was previously named NANORING */
58 #ifndef INRO_FREQ
59 #define INRO_FREQ 80000
60 #endif
61 
62 #ifndef IPO_FREQ
63 #define IPO_FREQ 100000000
64 #endif
65 
66 #ifndef ERFO_FREQ
67 #define ERFO_FREQ 24576000
68 #endif
69 
70 #ifndef IBRO_FREQ
71 #define IBRO_FREQ 7372800
72 #endif
73 
74 #ifndef ERTCO_FREQ
75 #define ERTCO_FREQ 32768
76 #endif
77 
78 #ifndef HIRC_FREQ
79 #define HIRC_FREQ IPO_FREQ
80 #endif
81 
82 #ifndef HFX_FREQ
83 #define HFX_FREQ 32768
84 #endif
85 
86 /* NOTE: This is the nominal value for NANORING. The actual value may vary from chip to chip.
87          Update if use of this oscillator requires precise timing.*/
88 #ifndef NANORING_FREQ
89 #define NANORING_FREQ 8000
90 #endif
91 
92 #ifndef HIRC96_FREQ
93 #define HIRC96_FREQ 96000000
94 #endif
95 
96 extern uint32_t SystemCoreClock; /*!< System Clock Frequency (Core Clock)  */
97 #ifndef PeripheralClock
98 #define PeripheralClock (SystemCoreClock / 2) /*!< Peripheral Clock Frequency */
99 #endif
100 
101 /*
102  * Initialize the system
103  *
104  * @brief  Setup the microcontroller system.
105  *         Initialize the System and update the SystemCoreClock variable.
106  */
107 void SystemInit(void);
108 
109 /*
110  * Update SystemCoreClock variable
111  *
112  * @brief  Updates the SystemCoreClock with current core Clock
113  *         retrieved from cpu registers.
114  */
115 void SystemCoreClockUpdate(void);
116 
117 #ifdef __cplusplus
118 }
119 #endif
120 
121 #endif // LIBRARIES_CMSIS_DEVICE_MAXIM_MAX32662_INCLUDE_SYSTEM_MAX32662_H_
122