1 /***************************************************************************//** 2 * @file 3 * @brief CMSIS Cortex-M System Layer for EFM32 devices. 4 ******************************************************************************* 5 * # License 6 * <b>Copyright 2020 Silicon Laboratories Inc. www.silabs.com</b> 7 ******************************************************************************* 8 * 9 * SPDX-License-Identifier: Zlib 10 * 11 * The licensor of this software is Silicon Laboratories Inc. 12 * 13 * This software is provided 'as-is', without any express or implied 14 * warranty. In no event will the authors be held liable for any damages 15 * arising from the use of this software. 16 * 17 * Permission is granted to anyone to use this software for any purpose, 18 * including commercial applications, and to alter it and redistribute it 19 * freely, subject to the following restrictions: 20 * 21 * 1. The origin of this software must not be misrepresented; you must not 22 * claim that you wrote the original software. If you use this software 23 * in a product, an acknowledgment in the product documentation would be 24 * appreciated but is not required. 25 * 2. Altered source versions must be plainly marked as such, and must not be 26 * misrepresented as being the original software. 27 * 3. This notice may not be removed or altered from any source distribution. 28 * 29 ******************************************************************************/ 30 31 #ifndef SYSTEM_EFM32HG_H 32 #define SYSTEM_EFM32HG_H 33 34 #ifdef __cplusplus 35 extern "C" { 36 #endif 37 38 #include <stdint.h> 39 40 /***************************************************************************//** 41 * @addtogroup Parts 42 * @{ 43 ******************************************************************************/ 44 /***************************************************************************//** 45 * @addtogroup EFM32HG EFM32HG 46 * @{ 47 ******************************************************************************/ 48 49 /******************************************************************************* 50 ****************************** TYPEDEFS *********************************** 51 ******************************************************************************/ 52 53 /* Interrupt vectortable entry */ 54 typedef union { 55 void (*pFunc)(void); 56 void *topOfStack; 57 } tVectorEntry; 58 59 /******************************************************************************* 60 ************************** GLOBAL VARIABLES ******************************* 61 ******************************************************************************/ 62 63 extern uint32_t SystemCoreClock; /**< System Clock Frequency (Core Clock) */ 64 65 #if defined(__VTOR_PRESENT) && (__VTOR_PRESENT == 1U) 66 #if defined(__ICCARM__) /* IAR requires the __vector_table symbol */ 67 #define __Vectors __vector_table 68 #endif 69 extern const tVectorEntry __Vectors[]; 70 #endif 71 72 /******************************************************************************* 73 ***************************** PROTOTYPES ********************************** 74 ******************************************************************************/ 75 76 /* Interrupt routines - prototypes */ 77 void Reset_Handler(void); /**< Reset Handler */ 78 void NMI_Handler(void); /**< NMI Handler */ 79 void HardFault_Handler(void); /**< Hard Fault Handler */ 80 void SVC_Handler(void); /**< SVCall Handler */ 81 void PendSV_Handler(void); /**< PendSV Handler */ 82 void SysTick_Handler(void); /**< SysTick Handler */ 83 84 void DMA_IRQHandler(void); /**< DMA IRQ Handler */ 85 void GPIO_EVEN_IRQHandler(void); /**< GPIO EVEN IRQ Handler */ 86 void TIMER0_IRQHandler(void); /**< TIMER0 IRQ Handler */ 87 void ACMP0_IRQHandler(void); /**< ACMP0 IRQ Handler */ 88 void ADC0_IRQHandler(void); /**< ADC0 IRQ Handler */ 89 void I2C0_IRQHandler(void); /**< I2C0 IRQ Handler */ 90 void GPIO_ODD_IRQHandler(void); /**< GPIO ODD IRQ Handler */ 91 void TIMER1_IRQHandler(void); /**< TIMER1 IRQ Handler */ 92 void USART1_RX_IRQHandler(void); /**< USART1 RX IRQ Handler */ 93 void USART1_TX_IRQHandler(void); /**< USART1 TX IRQ Handler */ 94 void LEUART0_IRQHandler(void); /**< LEUART0 IRQ Handler */ 95 void PCNT0_IRQHandler(void); /**< PCNT0 IRQ Handler */ 96 void RTC_IRQHandler(void); /**< RTC IRQ Handler */ 97 void CMU_IRQHandler(void); /**< CMU IRQ Handler */ 98 void VCMP_IRQHandler(void); /**< VCMP IRQ Handler */ 99 void MSC_IRQHandler(void); /**< MSC IRQ Handler */ 100 void AES_IRQHandler(void); /**< AES IRQ Handler */ 101 void USART0_RX_IRQHandler(void); /**< USART0 RX IRQ Handler */ 102 void USART0_TX_IRQHandler(void); /**< USART0 TX IRQ Handler */ 103 void USB_IRQHandler(void); /**< USB IRQ Handler */ 104 void TIMER2_IRQHandler(void); /**< TIMER2 IRQ Handler */ 105 106 uint32_t SystemCoreClockGet(void); 107 uint32_t SystemMaxCoreClockGet(void); 108 109 /***************************************************************************//** 110 * @brief 111 * Update CMSIS SystemCoreClock variable. 112 * 113 * @details 114 * CMSIS defines a global variable SystemCoreClock that shall hold the 115 * core frequency in Hz. If the core frequency is dynamically changed, the 116 * variable must be kept updated in order to be CMSIS compliant. 117 * 118 * Notice that if only changing core clock frequency through the EFM32 CMU 119 * API, this variable will be kept updated. This function is only provided 120 * for CMSIS compliance and if a user modifies the the core clock outside 121 * the CMU API. 122 ******************************************************************************/ SystemCoreClockUpdate(void)123static __INLINE void SystemCoreClockUpdate(void) 124 { 125 (void)SystemCoreClockGet(); 126 } 127 128 void SystemInit(void); 129 uint32_t SystemHFClockGet(void); 130 uint32_t SystemHFXOClockGet(void); 131 void SystemHFXOClockSet(uint32_t freq); 132 uint32_t SystemLFRCOClockGet(void); 133 uint32_t SystemULFRCOClockGet(void); 134 uint32_t SystemLFXOClockGet(void); 135 void SystemLFXOClockSet(uint32_t freq); 136 137 /** @} End of group EFM32HG */ 138 /** @} End of group Parts */ 139 140 #ifdef __cplusplus 141 } 142 #endif 143 144 #endif /* SYSTEM_EFM32HG_H */ 145