#ifndef _CPU_CLOCK_ #define _CPU_CLOCK_ #include "typedef.h" #include "clock_hw.h" ///原生时钟源作系统时钟源 #define SYS_CLOCK_INPUT_RC_250k 0 #define SYS_CLOCK_INPUT_PAT 1 #define SYS_CLOCK_INPUT_RTC_OSC 2 #define SYS_CLOCK_INPUT_RC_16M 3 #define SYS_CLOCK_INPUT_BT_OSC 4 //BTOSC 双脚(12-26M) #define SYS_CLOCK_INPUT_BT_OSC_X2 5 //BTOSC 双脚(12-26M) ///衍生时钟源作系统时钟源 #define SYS_CLOCK_INPUT_PLL_LRC 6 #define SYS_CLOCK_INPUT_PLL_RC_16M 7 #define SYS_CLOCK_INPUT_PLL_BT_OSC 8 #define SYS_CLOCK_INPUT_PLL_PAT 9 #define SYS_CLOCK_INPUT_PLL_RCL 10 typedef int SYS_CLOCK_INPUT; typedef enum { SYS_ICLOCK_INPUT_BTOSC, //BTOSC 双脚(12-26M) SYS_ICLOCK_INPUT_BTOSC_X2, //BTOSC 双脚(12-26M) SYS_ICLOCK_INPUT_STD24M, SYS_ICLOCK_INPUT_RTC_OSC, SYS_ICLOCK_INPUT_LRC, SYS_ICLOCK_INPUT_PAT, } SYS_ICLOCK_INPUT; /* * system enter critical and exit critical handle * */ struct clock_critical_handler { void (*enter)(); void (*exit)(); }; #define CLOCK_CRITICAL_HANDLE_REG(name, enter, exit) \ const struct clock_critical_handler clock_##name \ SEC_USED(.clock_critical_txt) = {enter, exit}; extern struct clock_critical_handler clock_critical_handler_begin[]; extern struct clock_critical_handler clock_critical_handler_end[]; #define list_for_each_loop_clock_critical(h) \ for (h=clock_critical_handler_begin; h