1 /**************************************************************************//** 2 * @file system_M2L31.h 3 * @version V0.10 4 * @brief System Setting Header File 5 * 6 * @note 7 * SPDX-License-Identifier: Apache-2.0 8 * @copyright (C) 2023 Nuvoton Technology Corp. All rights reserved. 9 ****************************************************************************/ 10 11 #ifndef __SYSTEM_M2L31_H__ 12 #define __SYSTEM_M2L31_H__ 13 14 #ifdef __cplusplus 15 extern "C" { 16 #endif 17 18 #include <stdint.h> 19 20 /*---------------------------------------------------------------------------------------------------------*/ 21 /* Macro Definition */ 22 /*---------------------------------------------------------------------------------------------------------*/ 23 #ifndef DEBUG_PORT 24 #define DEBUG_PORT UART0 /*!< Select Debug Port which is used for retarget.c to output debug message to UART */ 25 #endif 26 27 /*---------------------------------------------------------------------------- 28 Define clocks 29 *----------------------------------------------------------------------------*/ 30 #define __HXT (12000000UL) /*!< External Crystal Clock Frequency */ 31 #define __LIRC ( 32000UL) /*!< Internal 32.0KHz RC Oscillator Frequency */ 32 #define __HIRC (12000000UL) /*!< Internal 48M RC Oscillator Frequency */ 33 #define __HIRC48 (48000000UL) /*!< Internal 48M RC Oscillator Frequency */ 34 #define __MIRC ( 4000000UL) /*!< Internal 4M RC Oscillator Frequency */ 35 #define __LXT ( 32768UL) /*!< External Crystal Clock Frequency 32.768KHz */ 36 #define __HSI (72000000UL) /*!< Default output is 72MHz for PLL */ 37 38 extern uint32_t SystemCoreClock; /*!< System Clock Frequency (Core Clock) */ 39 extern uint32_t CyclesPerUs; /*!< Cycles per micro second */ 40 extern uint32_t PllClock; /*!< PLL Output Clock Frequency */ 41 42 43 /** 44 * Initialize the system 45 * 46 * @param none 47 * @return none 48 * 49 * @brief Setup the micro controller system. 50 * Initialize the System and update the SystemCoreClock variable. 51 */ 52 extern void SystemInit(void); 53 54 /** 55 * Update SystemCoreClock variable 56 * 57 * @param none 58 * @return none 59 * 60 * @brief Updates the SystemCoreClock with current core Clock 61 * retrieved from cpu registers. 62 */ 63 extern void SystemCoreClockUpdate(void); 64 65 /** 66 * Set UART0 default multi function pin 67 * 68 * @param none 69 * @return none 70 * 71 * @brief The initialization of uart0 default multiple-function pin. 72 */ 73 extern void Uart0DefaultMPF(void); 74 75 /** 76 * Check if debug message finished 77 * 78 * @param None 79 * 80 * @retval 1: Message is finished 81 * @retval 0: Message is transmitting. 82 * 83 * @details Check if message finished (FIFO empty of debug port) 84 */ 85 extern int IsDebugFifoEmpty(void); 86 87 88 #ifdef __cplusplus 89 } 90 #endif 91 92 #endif /* __SYSTEM_M2L31_H__ */ 93