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