37 #ifndef CHIP_OSC_H_INCLUDED 38 #define CHIP_OSC_H_INCLUDED 55 #if !defined(BOARD_FREQ_SLCK_XTAL) 56 # warning The board slow clock xtal frequency has not been defined. 57 # define BOARD_FREQ_SLCK_XTAL (32768UL) 60 #if !defined(BOARD_FREQ_SLCK_BYPASS) 61 # warning The board slow clock bypass frequency has not been defined. 62 # define BOARD_FREQ_SLCK_BYPASS (32768UL) 65 #if !defined(BOARD_FREQ_MAINCK_XTAL) 66 # warning The board main clock xtal frequency has not been defined. 67 # define BOARD_FREQ_MAINCK_XTAL (12000000UL) 70 #if !defined(BOARD_FREQ_MAINCK_BYPASS) 71 # warning The board main clock bypass frequency has not been defined. 72 # define BOARD_FREQ_MAINCK_BYPASS (12000000UL) 75 #if !defined(BOARD_OSC_STARTUP_US) 76 # warning The board main clock xtal startup time has not been defined. 77 # define BOARD_OSC_STARTUP_US (15625UL) 87 #define OSC_SLCK_32K_RC 0 88 #define OSC_SLCK_32K_XTAL 1 89 #define OSC_SLCK_32K_BYPASS 2 90 #define OSC_MAINCK_4M_RC 3 91 #define OSC_MAINCK_8M_RC 4 92 #define OSC_MAINCK_12M_RC 5 93 #define OSC_MAINCK_XTAL 6 94 #define OSC_MAINCK_BYPASS 7 99 #define OSC_SLCK_32K_RC_HZ CHIP_FREQ_SLCK_RC 100 #define OSC_SLCK_32K_XTAL_HZ BOARD_FREQ_SLCK_XTAL 101 #define OSC_SLCK_32K_BYPASS_HZ BOARD_FREQ_SLCK_BYPASS 102 #define OSC_MAINCK_4M_RC_HZ CHIP_FREQ_MAINCK_RC_4MHZ 103 #define OSC_MAINCK_8M_RC_HZ CHIP_FREQ_MAINCK_RC_8MHZ 104 #define OSC_MAINCK_12M_RC_HZ CHIP_FREQ_MAINCK_RC_12MHZ 105 #define OSC_MAINCK_XTAL_HZ BOARD_FREQ_MAINCK_XTAL 106 #define OSC_MAINCK_BYPASS_HZ BOARD_FREQ_MAINCK_BYPASS void pmc_switch_mainck_to_xtal(uint32_t ul_bypass, uint32_t ul_xtal_startup_time)
Switch main clock source selection to external Xtal/Bypass.
static void osc_disable(uint32_t ul_id)
#define CKGR_MOR_MOSCRCF_4_MHz
(CKGR_MOR) Fast RC oscillator frequency is at 4 MHz (default)
#define OSC_SLCK_32K_RC
Internal 32kHz RC oscillator.
uint32_t pmc_osc_is_ready_32kxtal(void)
Check if the external 32k Xtal is ready.
static uint32_t osc_get_rate(uint32_t ul_id)
#define BOARD_OSC_STARTUP_US
#define OSC_SLCK_32K_BYPASS
External 32kHz bypass oscillator.
#define OSC_MAINCK_12M_RC
Internal 12MHz RC oscillator.
void pmc_switch_sclk_to_32kxtal(uint32_t ul_bypass)
Switch slow clock source selection to external 32k (Xtal or Bypass).
#define OSC_MAINCK_12M_RC_HZ
Internal 12MHz RC oscillator.
uint32_t pmc_osc_is_ready_mainck(void)
Check if the MAINCK is ready. Depending on MOSCEL, MAINCK can be one of Xtal, bypass or internal RC...
#define OSC_MAINCK_8M_RC_HZ
Internal 8MHz RC oscillator.
static void osc_enable(uint32_t ul_id)
#define BOARD_FREQ_MAINCK_XTAL
#define CKGR_MOR_MOSCRCF_12_MHz
(CKGR_MOR) Fast RC oscillator frequency is at 12 MHz
#define BOARD_FREQ_MAINCK_BYPASS
#define OSC_SLCK_32K_RC_HZ
Internal 32kHz RC oscillator.
void pmc_switch_mainck_to_fastrc(uint32_t ul_moscrcf)
Switch main clock source selection to internal fast RC.
#define OSC_MAINCK_BYPASS
External bypass oscillator.
void pmc_osc_disable_xtal(uint32_t ul_bypass)
Disable the external Xtal.
#define OSC_MAINCK_4M_RC_HZ
Internal 4MHz RC oscillator.
#define OSC_MAINCK_8M_RC
Internal 8MHz RC oscillator.
#define OSC_MAINCK_4M_RC
Internal 4MHz RC oscillator.
#define pmc_us_to_moscxtst(startup_us, slowck_freq)
#define OSC_MAINCK_XTAL
External crystal oscillator.
void pmc_osc_disable_fastrc(void)
Disable the internal fast RC.
#define BOARD_FREQ_SLCK_BYPASS
#define CKGR_MOR_MOSCRCF_8_MHz
(CKGR_MOR) Fast RC oscillator frequency is at 8 MHz
static bool osc_is_ready(uint32_t ul_id)
Standard board header file.
#define BOARD_FREQ_SLCK_XTAL
#define OSC_SLCK_32K_XTAL
External 32kHz crystal oscillator.