Go to the documentation of this file.
32 #if !(defined(FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL))
33 #define FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL 0
43 #define FSL_CLOCK_DRIVER_VERSION (MAKE_VERSION(2, 3, 2))
46 #ifndef SDK_DEVICE_MAXIMUM_CPU_CLOCK_FREQUENCY
47 #define SDK_DEVICE_MAXIMUM_CPU_CLOCK_FREQUENCY (600000000UL)
51 #define CCM_ANALOG_PLL_BYPASS_SHIFT (16U)
52 #define CCM_ANALOG_PLL_BYPASS_CLK_SRC_MASK (0xC000U)
53 #define CCM_ANALOG_PLL_BYPASS_CLK_SRC_SHIFT (14U)
60 #define CCSR_OFFSET 0x0C
61 #define CBCDR_OFFSET 0x14
62 #define CBCMR_OFFSET 0x18
63 #define CSCMR1_OFFSET 0x1C
64 #define CSCMR2_OFFSET 0x20
65 #define CSCDR1_OFFSET 0x24
66 #define CDCDR_OFFSET 0x30
67 #define CSCDR2_OFFSET 0x38
68 #define CSCDR3_OFFSET 0x3C
69 #define CACRR_OFFSET 0x10
70 #define CS1CDR_OFFSET 0x28
71 #define CS2CDR_OFFSET 0x2C
76 #define PLL_ARM_OFFSET 0x00
77 #define PLL_SYS_OFFSET 0x30
78 #define PLL_USB1_OFFSET 0x10
79 #define PLL_AUDIO_OFFSET 0x70
80 #define PLL_VIDEO_OFFSET 0xA0
81 #define PLL_ENET_OFFSET 0xE0
82 #define PLL_USB2_OFFSET 0x20
84 #define CCM_TUPLE(reg, shift, mask, busyShift) \
85 (int)(((reg)&0xFFU) | ((shift) << 8U) | ((((mask) >> (shift)) & 0x1FFFU) << 13U) | ((busyShift) << 26U))
86 #define CCM_TUPLE_REG(base, tuple) (*((volatile uint32_t *)(((uint32_t)(base)) + ((uint32_t)(tuple)&0xFFU))))
87 #define CCM_TUPLE_SHIFT(tuple) ((((uint32_t)tuple) >> 8U) & 0x1FU)
88 #define CCM_TUPLE_MASK(tuple) \
89 ((uint32_t)((((uint32_t)(tuple) >> 13U) & 0x1FFFU) << (((((uint32_t)tuple) >> 8U) & 0x1FU))))
90 #define CCM_TUPLE_BUSY_SHIFT(tuple) ((((uint32_t)tuple) >> 26U) & 0x3FU)
92 #define CCM_NO_BUSY_WAIT (0x20U)
97 #define CCM_ANALOG_TUPLE(reg, shift) ((((reg)&0xFFFU) << 16U) | (shift))
98 #define CCM_ANALOG_TUPLE_SHIFT(tuple) (((uint32_t)tuple) & 0x1FU)
99 #define CCM_ANALOG_TUPLE_REG_OFF(base, tuple, off) \
100 (*((volatile uint32_t *)((uint32_t)(base) + (((uint32_t)(tuple) >> 16U) & 0xFFFU) + (off))))
101 #define CCM_ANALOG_TUPLE_REG(base, tuple) CCM_ANALOG_TUPLE_REG_OFF(base, tuple, 0U)
104 #if (defined(FSL_FEATURE_CCM_HAS_ERRATA_50235) && FSL_FEATURE_CCM_HAS_ERRATA_50235)
105 #define CAN_CLOCK_CHECK_NO_AFFECTS \
106 ((CCM_CSCMR2_CAN_CLK_SEL(2U) != (CCM->CSCMR2 & CCM_CSCMR2_CAN_CLK_SEL_MASK)) || \
107 (CCM_CCGR5_CG12(0) != (CCM->CCGR5 & CCM_CCGR5_CG12_MASK)))
113 #define CLKPN_FREQ 0U
135 #define CLOCK_SetXtal0Freq CLOCK_SetXtalFreq
136 #define CLOCK_SetXtal32Freq CLOCK_SetRtcXtalFreq
141 kCLOCK_IpInvalid, kCLOCK_Adc1, kCLOCK_Adc2 \
147 kCLOCK_IpInvalid, kCLOCK_Aoi1, kCLOCK_Aoi2 \
159 kCLOCK_IpInvalid, kCLOCK_Acmp1, kCLOCK_Acmp2, kCLOCK_Acmp3, kCLOCK_Acmp4 \
169 #define DCDC_CLOCKS \
181 #define DMAMUX_CLOCKS \
187 #define EDMA_CLOCKS \
195 kCLOCK_IpInvalid, kCLOCK_Enc1, kCLOCK_Enc2, kCLOCK_Enc3, kCLOCK_Enc4 \
199 #define ENET_CLOCKS \
211 #define FLEXCAN_CLOCKS \
213 kCLOCK_IpInvalid, kCLOCK_Can1, kCLOCK_Can2 \
217 #define FLEXCAN_PERIPH_CLOCKS \
219 kCLOCK_IpInvalid, kCLOCK_Can1S, kCLOCK_Can2S \
223 #define FLEXIO_CLOCKS \
225 kCLOCK_IpInvalid, kCLOCK_Flexio1, kCLOCK_Flexio2 \
229 #define FLEXRAM_CLOCKS \
235 #define FLEXSPI_CLOCKS \
241 #define FLEXSPI_EXSC_CLOCKS \
247 #define GPIO_CLOCKS \
249 kCLOCK_IpInvalid, kCLOCK_Gpio1, kCLOCK_Gpio2, kCLOCK_Gpio3, kCLOCK_Gpio4, kCLOCK_Gpio5 \
255 kCLOCK_IpInvalid, kCLOCK_Gpt1, kCLOCK_Gpt2 \
265 #define LCDIF_CLOCKS \
271 #define LCDIF_PERIPH_CLOCKS \
277 #define LPI2C_CLOCKS \
279 kCLOCK_IpInvalid, kCLOCK_Lpi2c1, kCLOCK_Lpi2c2, kCLOCK_Lpi2c3, kCLOCK_Lpi2c4 \
283 #define LPSPI_CLOCKS \
285 kCLOCK_IpInvalid, kCLOCK_Lpspi1, kCLOCK_Lpspi2, kCLOCK_Lpspi3, kCLOCK_Lpspi4 \
289 #define LPUART_CLOCKS \
291 kCLOCK_IpInvalid, kCLOCK_Lpuart1, kCLOCK_Lpuart2, kCLOCK_Lpuart3, kCLOCK_Lpuart4, kCLOCK_Lpuart5, \
292 kCLOCK_Lpuart6, kCLOCK_Lpuart7, kCLOCK_Lpuart8 \
302 #define OCRAM_EXSC_CLOCKS \
316 {kCLOCK_IpInvalid, kCLOCK_IpInvalid, kCLOCK_IpInvalid, kCLOCK_IpInvalid}, \
317 {kCLOCK_Pwm1, kCLOCK_Pwm1, kCLOCK_Pwm1, kCLOCK_Pwm1}, \
318 {kCLOCK_Pwm2, kCLOCK_Pwm2, kCLOCK_Pwm2, kCLOCK_Pwm2}, \
319 {kCLOCK_Pwm3, kCLOCK_Pwm3, kCLOCK_Pwm3, kCLOCK_Pwm3}, \
321 kCLOCK_Pwm4, kCLOCK_Pwm4, kCLOCK_Pwm4, kCLOCK_Pwm4 \
332 #define RTWDOG_CLOCKS \
340 kCLOCK_IpInvalid, kCLOCK_Sai1, kCLOCK_Sai2, kCLOCK_Sai3 \
344 #define SEMC_CLOCKS \
350 #define SEMC_EXSC_CLOCKS \
358 kCLOCK_IpInvalid, kCLOCK_Timer1, kCLOCK_Timer2, kCLOCK_Timer3, kCLOCK_Timer4 \
362 #define TRNG_CLOCKS \
374 #define WDOG_CLOCKS \
376 kCLOCK_IpInvalid, kCLOCK_Wdog1, kCLOCK_Wdog2 \
380 #define USDHC_CLOCKS \
382 kCLOCK_IpInvalid, kCLOCK_Usdhc1, kCLOCK_Usdhc2 \
386 #define SPDIF_CLOCKS \
392 #define XBARA_CLOCKS \
398 #define XBARB_CLOCKS \
400 kCLOCK_IpInvalid, kCLOCK_IpInvalid, kCLOCK_Xbar2, kCLOCK_Xbar3 \
438 #define kCLOCK_CoreSysClk kCLOCK_CpuClk
439 #define CLOCK_GetCoreSysClkFreq CLOCK_GetCpuClkFreq
444 typedef enum _clock_ip_name
959 #if defined(__cplusplus)
983 while ((
CCM->CDHIPR & ((1UL << busyShift))) != 0UL)
1020 while ((
CCM->CDHIPR & ((uint32_t)(1UL << busyShift))) != 0UL)
1044 uint32_t index = ((uint32_t)
name) >> 8U;
1045 uint32_t shift = ((uint32_t)
name) & 0x1FU;
1046 volatile uint32_t *reg;
1048 assert(index <= 6UL);
1050 reg = (
volatile uint32_t *)(&(((
volatile uint32_t *)&
CCM->CCGR0)[index]));
1051 *reg = ((*reg) & ~((uint32_t)(3UL << shift))) | (((uint32_t)value) << shift);
1544 #if defined(__cplusplus)
#define CCM_ANALOG_PLL_BYPASS_SHIFT
#define CCM_ANALOG_PLL_BYPASS_CLK_SRC_MASK
#define CCM_CCGR2_CG8_SHIFT
#define CCM_CCGR2_CG9_SHIFT
_clock_div
DIV control names for clock div setting.
volatile uint32_t g_xtalFreq
External XTAL (24M OSC/SYSOSC) clock frequency.
#define CCM_CCGR0_CG6_SHIFT
#define CCM_CSCDR2_LPI2C_CLK_SEL_MASK
PLL configuration for AUDIO and VIDEO.
#define CCM_CDCDR_SPDIF0_CLK_PRED_SHIFT
#define CCM_CCGR4_CG6_SHIFT
#define CCM_CS1CDR_SAI3_CLK_PODF_MASK
_clock_name
Clock name used to get clock frequency.
uint32_t CLOCK_GetAhbFreq(void)
Gets the AHB clock frequency.
#define CCM_CS1CDR_SAI1_CLK_PODF_MASK
#define CCM_CCGR0_CG11_SHIFT
#define CCM_CS1CDR_SAI3_CLK_PRED_SHIFT
#define CCM_CCGR4_CG3_SHIFT
#define CCM_CCGR1_CG15_SHIFT
enum _clock_pfd clock_pfd_t
PLL PFD name.
#define CCM_CCGR6_CG5_SHIFT
#define CCM_CCGR1_CG8_SHIFT
#define CCM_CBCMR_LCDIF_PODF_MASK
#define CCM_CCGR4_CG13_SHIFT
enum _clock_gate_value clock_gate_value_t
Clock gate value.
#define CCM_TUPLE_REG(base, tuple)
#define CCM_CCGR5_CG12_SHIFT
#define CCM_CBCMR_TRACE_CLK_SEL_SHIFT
#define CCM_ANALOG_PLL_ENET_ENET_25M_REF_EN_SHIFT
#define CCM_CCGR1_CG5_SHIFT
void CLOCK_DeinitAudioPll(void)
De-initialize the Audio PLL.
#define CCM_CS2CDR_SAI2_CLK_PODF_MASK
static uint32_t CLOCK_GetPllBypassRefClk(CCM_ANALOG_Type *base, clock_pll_t pll)
Get PLL bypass clock value, it is PLL reference clock actually. If CLOCK1_P,CLOCK1_N is choose as the...
enum _clock_osc clock_osc_t
OSC 24M sorce select.
struct _clock_audio_pll_config clock_audio_pll_config_t
PLL configuration for AUDIO and VIDEO.
#define CCM_CCSR_PLL3_SW_CLK_SEL_MASK
#define CCM_CBCDR_AHB_PODF_SHIFT
#define CCM_CS2CDR_SAI2_CLK_PRED_MASK
void CLOCK_DisableUsbhs0PhyPllClock(void)
Disable USB HS PHY PLL clock.
#define PLL_ARM_OFFSET
CCM Analog registers offset.
#define CCM_CDCDR_SPDIF0_CLK_PODF_SHIFT
#define CCM_CDHIPR_PERIPH_CLK_SEL_BUSY_SHIFT
#define CCM_CCGR1_CG9_SHIFT
#define CCM_CDCDR_FLEXIO1_CLK_PRED_SHIFT
static void CLOCK_SetPllBypass(CCM_ANALOG_Type *base, clock_pll_t pll, bool bypass)
PLL bypass setting.
void CLOCK_DeinitUsb1Pfd(clock_pfd_t pfd)
De-initialize the USB1 PLL PFD.
uint32_t CLOCK_GetPerClkFreq(void)
Gets the PER clock frequency.
static uint32_t CLOCK_GetRtcFreq(void)
Gets the RTC clock frequency.
#define CCM_CCGR3_CG7_SHIFT
#define CCM_CCGR3_CG5_SHIFT
#define CCM_CCGR5_CG7_SHIFT
#define CCM_CCGR3_CG15_SHIFT
#define CCM_CS1CDR_FLEXIO2_CLK_PRED_MASK
#define CCM_ANALOG_PLL_ARM_ENABLE_SHIFT
#define CCM_CS1CDR_SAI1_CLK_PRED_SHIFT
#define CCM_CBCDR_PERIPH_CLK_SEL_MASK
#define CCM_CCGR6_CG11_SHIFT
#define CCM_CSCMR2_FLEXIO2_CLK_SEL_MASK
#define CCM_CCGR4_CG15_SHIFT
#define CCM_CDHIPR_SEMC_PODF_BUSY_SHIFT
#define CCM_CBCMR_PRE_PERIPH_CLK_SEL_MASK
#define CCM_CSCMR1_PERCLK_PODF_MASK
#define CCM_CCGR1_CG3_SHIFT
uint32_t CLOCK_GetUsb1PfdFreq(clock_pfd_t pfd)
Get current USB1 PLL PFD output frequency.
_clock_usb_phy_src
Source of the USB HS PHY.
#define CCM_CBCDR_SEMC_PODF_MASK
#define CCM_CCGR6_CG2_SHIFT
#define CCM_CBCDR_SEMC_CLK_SEL_MASK
#define CCM_CBCDR_PERIPH_CLK2_PODF_MASK
#define CCM_CCGR5_CG4_SHIFT
#define CCM_CCGR5_CG8_SHIFT
#define CCM_CCGR6_CG4_SHIFT
#define CCM_CSCDR3_CSI_CLK_SEL_SHIFT
#define CCM_CBCDR_IPG_PODF_SHIFT
#define CCM_CCGR2_CG3_SHIFT
#define CCM_CCGR3_CG2_SHIFT
bool CLOCK_EnableUsbhs1Clock(clock_usb_src_t src, uint32_t freq)
Enable USB HS clock.
#define CCM_CCGR3_CG13_SHIFT
void CLOCK_InitVideoPll(const clock_video_pll_config_t *config)
Initialize the video PLL.
#define CCM_CLPCR_LPM_MASK
#define CCM_CSCMR1_USDHC1_CLK_SEL_MASK
enum _clock_div clock_div_t
DIV control names for clock div setting.
#define CCM_CCGR1_CG11_SHIFT
#define CCM_CCGR4_CG2_SHIFT
uint32_t CLOCK_GetPllFreq(clock_pll_t pll)
Get current PLL output frequency.
struct _clock_arm_pll_config clock_arm_pll_config_t
PLL configuration for ARM.
#define CCSR_OFFSET
CCM registers offset.
void CLOCK_InitUsb2Pll(const clock_usb_pll_config_t *config)
Initialize the USB2 PLL.
void CLOCK_DeinitSysPfd(clock_pfd_t pfd)
De-initialize the System PLL PFD.
#define CCM_CCGR2_CG2_SHIFT
#define CCM_CSCDR1_TRACE_PODF_MASK
#define CCM_CCGR6_CG15_SHIFT
#define CCM_TUPLE_BUSY_SHIFT(tuple)
#define CCM_CBCDR_IPG_PODF_MASK
#define CCM_CCGR6_CG9_SHIFT
#define CCM_CSCDR3_CSI_PODF_MASK
#define CCM_CCGR5_CG2_SHIFT
#define CCM_CSCMR1_SAI1_CLK_SEL_MASK
void CLOCK_DeinitSysPll(void)
De-initialize the System PLL.
#define CCM_CSCMR1_SAI3_CLK_SEL_MASK
#define CCM_CS2CDR_SAI2_CLK_PRED_SHIFT
#define CCM_CCGR4_CG5_SHIFT
#define CCM_CCGR1_CG14_SHIFT
#define CCM_CBCMR_PERIPH_CLK2_SEL_MASK
#define CCM_CCGR3_CG11_SHIFT
enum _clock_usb_phy_src clock_usb_phy_src_t
Source of the USB HS PHY.
#define CCM_CSCDR2_LCDIF_PRED_SHIFT
#define CCM_TUPLE_MASK(tuple)
#define CCM_CCGR4_CG12_SHIFT
#define CCM_CDCDR_FLEXIO1_CLK_SEL_SHIFT
#define CCM_CSCMR1_PERCLK_CLK_SEL_MASK
void CLOCK_InitAudioPll(const clock_audio_pll_config_t *config)
Initializes the Audio PLL.
#define CCM_CCGR4_CG9_SHIFT
#define CCM_CSCDR1_UART_CLK_SEL_MASK
#define CCM_CCGR6_CG8_SHIFT
#define CCM_ANALOG_TUPLE_REG_OFF(base, tuple, off)
void CLOCK_DisableUsbhs1PhyPllClock(void)
Disable USB HS PHY PLL clock.
#define CCM_CSCDR1_UART_CLK_PODF_SHIFT
#define CCM_CDCDR_SPDIF0_CLK_SEL_SHIFT
#define CCM_CSCDR2_LPI2C_CLK_SEL_SHIFT
#define CCM_CSCMR1_SAI1_CLK_SEL_SHIFT
#define CCM_CSCDR3_CSI_PODF_SHIFT
#define CCM_CCGR6_CG14_SHIFT
#define CCM_CCGR6_CG1_SHIFT
void CLOCK_InitUsb1Pfd(clock_pfd_t pfd, uint8_t pfdFrac)
Initialize the USB1 PLL PFD.
#define CCM_CCGR0_CG1_SHIFT
#define CCM_CCGR1_CG10_SHIFT
#define CCM_CCGR4_CG14_SHIFT
#define CCM_CBCDR_AHB_PODF_MASK
#define CCM_CCGR1_CG1_SHIFT
#define CCM_CCGR3_CG0_SHIFT
PLL configuration for ARM.
#define CCM_CSCDR2_LCDIF_PRE_CLK_SEL_SHIFT
void CLOCK_DeinitUsb2Pll(void)
Deinitialize the USB2 PLL.
static uint32_t CLOCK_GetCpuClkFreq(void)
Get the CCM CPU/core/system frequency.
#define CCM_CCGR3_CG9_SHIFT
#define CCM_ANALOG_PLL_BYPASS_CLK_SRC_SHIFT
#define CCM_CCGR1_CG13_SHIFT
#define CCM_CCGR5_CG15_SHIFT
#define CCM_CCGR3_CG10_SHIFT
#define CCM_CDCDR_SPDIF0_CLK_SEL_MASK
#define CCM_ANALOG_PLL_USB2_ENABLE_SHIFT
#define CCM_CBCDR_SEMC_ALT_CLK_SEL_MASK
#define CCM_CBCMR_LPSPI_CLK_SEL_SHIFT
#define CCM_CBCMR_LCDIF_PODF_SHIFT
#define CCM_ANALOG_TUPLE(reg, shift)
CCM ANALOG tuple macros to map corresponding registers and bit fields.
#define CCM_CCGR3_CG14_SHIFT
#define CCM_CCGR0_CG9_SHIFT
#define CCM_CCGR5_CG9_SHIFT
#define CCM_CDHIPR_AHB_PODF_BUSY_SHIFT
#define CCM_CSCMR1_USDHC2_CLK_SEL_MASK
#define CCM_CCGR0_CG15_SHIFT
#define CCM_CSCMR1_SAI2_CLK_SEL_MASK
#define CCM_CS1CDR_SAI3_CLK_PRED_MASK
_clock_osc
OSC 24M sorce select.
#define CCM_CSCMR1_PERCLK_CLK_SEL_SHIFT
#define CCM_CS1CDR_SAI1_CLK_PRED_MASK
void CLOCK_DeinitArmPll(void)
De-initialize the ARM PLL.
#define CCM_CCGR3_CG3_SHIFT
#define CCM_CCGR5_CG6_SHIFT
#define CCM_CCGR1_CG6_SHIFT
#define CCM_CCGR6_CG0_SHIFT
static void CLOCK_SetRtcXtalFreq(uint32_t freq)
Set the RTC XTAL (32K OSC) frequency based on board setting.
#define CCM_CCGR5_CG13_SHIFT
void CLOCK_InitSysPfd(clock_pfd_t pfd, uint8_t pfdFrac)
Initialize the System PLL PFD.
#define CCM_CBCMR_PERIPH_CLK2_SEL_SHIFT
PLL configuration for AUDIO and VIDEO.
static void CLOCK_SetPllBypassRefClkSrc(CCM_ANALOG_Type *base, clock_pll_t pll, uint32_t src)
PLL bypass clock source setting. Note: change the bypass clock source also change the pll reference c...
#define CCM_CCGR0_CG3_SHIFT
#define CCM_CSCMR1_SAI2_CLK_SEL_SHIFT
#define CCM_CCGR0_CG7_SHIFT
static uint32_t CLOCK_GetMux(clock_mux_t mux)
Get CCM MUX value.
#define CCM_CCGR5_CG14_SHIFT
struct _clock_video_pll_config clock_video_pll_config_t
PLL configuration for AUDIO and VIDEO.
void CLOCK_InitRcOsc24M(void)
Initialize the RC oscillator 24MHz clock.
static void CLOCK_SetMux(clock_mux_t mux, uint32_t value)
Set CCM MUX node to certain value.
bool CLOCK_EnableUsbhs0Clock(clock_usb_src_t src, uint32_t freq)
Enable USB HS clock.
#define CCM_ANALOG_PLL_SYS_ENABLE_SHIFT
#define CCM_CCGR2_CG12_SHIFT
#define CCM_CSCMR1_FLEXSPI_CLK_SEL_SHIFT
#define CCM_CSCDR1_UART_CLK_SEL_SHIFT
#define CCM_CBCDR_SEMC_ALT_CLK_SEL_SHIFT
#define CCM_CCGR6_CG10_SHIFT
void CLOCK_InitEnetPll(const clock_enet_pll_config_t *config)
Initialize the ENET PLL.
#define CCM_CSCMR1_FLEXSPI_PODF_MASK
#define CCM_CCGR6_CG12_SHIFT
#define CCM_CCGR6_CG6_SHIFT
#define CCM_TUPLE_SHIFT(tuple)
static uint32_t CLOCK_GetDiv(clock_div_t divider)
Get CCM DIV node value.
#define CCM_CSCMR2_CAN_CLK_SEL_SHIFT
#define CCM_CCGR3_CG1_SHIFT
#define CCM_CCGR2_CG11_SHIFT
_clock_mux
MUX control names for clock mux setting.
bool CLOCK_EnableUsbhs1PhyPllClock(clock_usb_phy_src_t src, uint32_t freq)
Enable USB HS PHY PLL clock.
#define CCM_CDCDR_SPDIF0_CLK_PRED_MASK
#define CCM_CDCDR_FLEXIO1_CLK_PODF_SHIFT
#define CCM_CCGR4_CG7_SHIFT
#define CCM_CCGR4_CG10_SHIFT
#define CCM_CCGR0_CG5_SHIFT
#define CCM_CSCMR1_PERCLK_PODF_SHIFT
#define CCM_CCGR0_CG0_SHIFT
void CLOCK_DeinitRcOsc24M(void)
Power down the RCOSC 24M clock.
#define CCM_CCGR3_CG6_SHIFT
struct _clock_enet_pll_config clock_enet_pll_config_t
PLL configuration for ENET.
#define CCM_CCGR4_CG8_SHIFT
#define CCM_ANALOG_PLL_USB1_ENABLE_SHIFT
#define CCM_CCGR2_CG7_SHIFT
#define CCM_CCGR2_CG1_SHIFT
#define CCM_CCGR2_CG10_SHIFT
static void CLOCK_EnableClock(clock_ip_name_t name)
Enable the clock for specific IP.
enum _clock_mux clock_mux_t
MUX control names for clock mux setting.
_clock_pll_clk_src
PLL clock source, bypass cloco source also.
struct _clock_sys_pll_config clock_sys_pll_config_t
PLL configuration for System.
#define CCM_CCGR2_CG0_SHIFT
#define CCM_CDCDR_SPDIF0_CLK_PODF_MASK
#define CCM_CCGR2_CG6_SHIFT
#define CCM_CSCDR3_CSI_CLK_SEL_MASK
#define XTALOSC24M_LOWPWR_CTRL_OSC_SEL_MASK
#define CCM_CCGR0_CG13_SHIFT
void CLOCK_DeinitVideoPll(void)
De-initialize the Video PLL.
_clock_usb_src
USB clock source definition.
#define CCM_CDCDR_FLEXIO1_CLK_PODF_MASK
#define CCM_CCGR1_CG2_SHIFT
PLL configuration for USB.
void CLOCK_InitUsb1Pll(const clock_usb_pll_config_t *config)
Initialize the USB1 PLL.
#define CCM_CACRR_ARM_PODF_SHIFT
#define CCM_TUPLE(reg, shift, mask, busyShift)
#define CCM_CS1CDR_FLEXIO2_CLK_PODF_MASK
#define CCM_CBCMR_LPSPI_PODF_SHIFT
#define CCM_CSCDR2_LPI2C_CLK_PODF_SHIFT
enum _clock_usb_src clock_usb_src_t
USB clock source definition.
#define CCM_CSCDR1_UART_CLK_PODF_MASK
enum _clock_pll clock_pll_t
PLL name.
#define CCM_CCSR_PLL3_SW_CLK_SEL_SHIFT
#define CCM_CCGR3_CG8_SHIFT
static void CLOCK_SetDiv(clock_div_t divider, uint32_t value)
Set CCM DIV node to certain value.
#define CCM_CSCMR2_FLEXIO2_CLK_SEL_SHIFT
#define CCM_CCGR6_CG3_SHIFT
#define CCM_CCGR0_CG2_SHIFT
#define CCM_CCGR2_CG4_SHIFT
#define CCM_CSCMR1_USDHC2_CLK_SEL_SHIFT
#define CCM_CDCDR_FLEXIO1_CLK_PRED_MASK
#define CCM_CCGR1_CG7_SHIFT
#define CCM_CSCMR2_CAN_CLK_PODF_SHIFT
#define CCM_CSCMR1_FLEXSPI_PODF_SHIFT
void CLOCK_SwitchOsc(clock_osc_t osc)
Switch the OSC.
#define CCM_CCGR3_CG12_SHIFT
#define CCM_CS1CDR_FLEXIO2_CLK_PODF_SHIFT
void CLOCK_InitSysPll(const clock_sys_pll_config_t *config)
Initialize the System PLL.
void CLOCK_DeinitEnetPll(void)
Deinitialize the ENET PLL.
uint32_t CLOCK_GetSemcFreq(void)
Gets the SEMC clock frequency.
#define CCM_CCGR5_CG11_SHIFT
static void CLOCK_ControlGate(clock_ip_name_t name, clock_gate_value_t value)
Control the clock gate for specific IP.
#define CCM_CSCDR2_LCDIF_PRED_MASK
#define CCM_CBCMR_LPSPI_PODF_MASK
enum _clock_mode_t clock_mode_t
System clock mode.
#define CCM_CCGR5_CG1_SHIFT
#define CCM_CCGR5_CG10_SHIFT
#define CCM_CS1CDR_SAI1_CLK_PODF_SHIFT
void CLOCK_DeinitExternalClk(void)
Deinitialize the external 24MHz clock.
enum _clock_name clock_name_t
Clock name used to get clock frequency.
bool CLOCK_EnableUsbhs0PhyPllClock(clock_usb_phy_src_t src, uint32_t freq)
Enable USB HS PHY PLL clock.
#define CCM_CSCMR2_CAN_CLK_PODF_MASK
#define CCM_CCGR5_CG5_SHIFT
#define CCM_CBCMR_TRACE_CLK_SEL_MASK
#define CCM_CBCDR_PERIPH_CLK_SEL_SHIFT
#define CCM_CCGR1_CG4_SHIFT
#define CCM_CDCDR_FLEXIO1_CLK_SEL_MASK
static void CLOCK_DisableClock(clock_ip_name_t name)
Disable the clock for specific IP.
#define CCM_CACRR_ARM_PODF_MASK
#define CCM_CCGR5_CG0_SHIFT
#define CCM_CSCDR1_USDHC2_PODF_MASK
#define CCM_CBCDR_SEMC_CLK_SEL_SHIFT
#define CCM_CCGR2_CG13_SHIFT
#define CCM_CCGR6_CG7_SHIFT
static uint32_t CLOCK_GetOscFreq(void)
Gets the OSC clock frequency.
#define CCM_ANALOG_TUPLE_REG(base, tuple)
void CLOCK_InitExternalClk(bool bypassXtalOsc)
Initialize the external 24MHz clock.
struct _clock_usb_pll_config clock_usb_pll_config_t
PLL configuration for USB.
_clock_gate_value
Clock gate value.
#define CCM_CSCDR1_TRACE_PODF_SHIFT
#define CCM_CS1CDR_FLEXIO2_CLK_PRED_SHIFT
#define CCM_CS2CDR_SAI2_CLK_PODF_SHIFT
#define CCM_CSCMR1_SAI3_CLK_SEL_SHIFT
#define CCM_CSCDR2_LCDIF_PRE_CLK_SEL_MASK
void CLOCK_DeinitUsb1Pll(void)
Deinitialize the USB1 PLL.
#define CCM_CCGR5_CG3_SHIFT
#define CCM_CS1CDR_SAI3_CLK_PODF_SHIFT
static void CLOCK_SetXtalFreq(uint32_t freq)
Set the XTAL (24M OSC) frequency based on board setting.
static bool CLOCK_IsPllEnabled(CCM_ANALOG_Type *base, clock_pll_t pll)
Check if PLL is enabled.
#define CCM_CCGR4_CG4_SHIFT
#define CCM_ANALOG_PLL_VIDEO_ENABLE_SHIFT
static sai_transceiver_t config
#define CCM_CSCDR1_USDHC1_PODF_MASK
enum _clock_ip_name clock_ip_name_t
CCM CCGR gate control for each module independently.
uint32_t CLOCK_GetSysPfdFreq(clock_pfd_t pfd)
Get current System PLL PFD output frequency.
void CLOCK_InitArmPll(const clock_arm_pll_config_t *config)
Initialize the ARM PLL.
#define CCM_CDHIPR_ARM_PODF_BUSY_SHIFT
#define CCM_CBCMR_LPSPI_CLK_SEL_MASK
@ kCLOCK_ClockNeededRunWait
#define CCM_CBCDR_PERIPH_CLK2_PODF_SHIFT
#define CCM_ANALOG_PLL_AUDIO_ENABLE_SHIFT
#define CCM_CSCMR2_CAN_CLK_SEL_MASK
#define CCM_CCGR4_CG11_SHIFT
#define CCM_CCGR2_CG14_SHIFT
#define CCM_CCGR0_CG12_SHIFT
#define CCM_CSCDR1_USDHC2_PODF_SHIFT
PLL configuration for ENET.
#define CCM_CCGR0_CG4_SHIFT
#define CCM_CCGR1_CG12_SHIFT
#define CCM_CBCDR_SEMC_PODF_SHIFT
volatile uint32_t g_rtcXtalFreq
External RTC XTAL (32K OSC) clock frequency.
#define CCM_CCGR2_CG5_SHIFT
PLL configuration for System.
#define CCM_CCGR1_CG0_SHIFT
static bool CLOCK_IsPllBypassed(CCM_ANALOG_Type *base, clock_pll_t pll)
Check if PLL is bypassed.
#define CCM_CCGR3_CG4_SHIFT
#define CCM_CCGR0_CG8_SHIFT
#define CCM_ANALOG_TUPLE_SHIFT(tuple)
static void CLOCK_SetMode(clock_mode_t mode)
Setting the low power mode that system will enter on next assertion of dsm_request signal.
_clock_mode_t
System clock mode.
#define CCM_CCGR0_CG14_SHIFT
uint32_t CLOCK_GetFreq(clock_name_t name)
Gets the clock frequency for a specific clock name.
#define CLKPN_FREQ
clock1PN frequency.
#define CCM_CCGR0_CG10_SHIFT
#define CCM_CSCDR2_LPI2C_CLK_PODF_MASK
#define CCM_CCGR6_CG13_SHIFT
#define CCM_CSCMR1_USDHC1_CLK_SEL_SHIFT
#define CCM_CBCMR_PRE_PERIPH_CLK_SEL_SHIFT
#define CCM_CSCMR1_FLEXSPI_CLK_SEL_MASK
#define CCM_CSCDR1_USDHC1_PODF_SHIFT
#define CCM_ANALOG_PLL_ENET_ENABLE_SHIFT
#define CCM_CCGR2_CG15_SHIFT
#define CCM_CCGR4_CG1_SHIFT
uint32_t CLOCK_GetIpgFreq(void)
Gets the IPG clock frequency.