74 void CLK_EnableCKO(uint32_t u32ClkSrc, uint32_t u32ClkDiv, uint32_t u32ClkDivBy1En)
96 void CLK_EnableCKO0(uint32_t u32ClkSrc, uint32_t u32ClkDiv, uint32_t u32ClkDivBy1En)
126 void CLK_EnableCKO1(uint32_t u32ClkSrc, uint32_t u32ClkDiv, uint32_t u32ClkDivBy1En)
145 SCB->SCR = SCB_SCR_SLEEPDEEP_Msk;
205 uint32_t Div[]= {1,2,4,8,16,1,1,1};
230 uint32_t u32Freq =0, u32PLLSrc;
231 uint32_t u32SRC_N,u32PLL_M,u32PllReg;
233 u32PllReg =
CLK->PLLCTL;
251 u32Freq = u32PLLSrc * u32PLL_M / (u32SRC_N+1);
385 uint32_t u32tmp=0,u32sel=0,u32div=0;
390 u32tmp = *(
volatile uint32_t *)(u32div);
392 *(
volatile uint32_t *)(u32div) = u32tmp;
398 u32tmp = *(
volatile uint32_t *)(u32sel);
400 *(
volatile uint32_t *)(u32sel) = u32tmp;
415 CLK->PWRCTL |= u32ClkMask;
429 CLK->PWRCTL &= ~u32ClkMask;
518 uint32_t u32PllCr,u32PLL_N,u32PLL_M,u32PLLReg;
541 u32PLL_N=u32PllCr/1000000;
542 u32PLL_M=u32PllFreq/1000000;
545 if(u32PLL_M<=32 && u32PLL_N<=16 )
break;
583 SysTick->VAL = (0x00);
584 SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk | SysTick_CTRL_ENABLE_Msk;
587 while((SysTick->CTRL & SysTick_CTRL_COUNTFLAG_Msk) == 0);
605 SysTick->CTRL |= SysTick_CTRL_CLKSOURCE_Msk;
608 SysTick->CTRL &= ~SysTick_CTRL_CLKSOURCE_Msk;
610 SysTick->LOAD = u32Count;
612 SysTick->CTRL |= SysTick_CTRL_ENABLE_Msk;
641 int32_t i32TimeOutCnt=2160000;
643 while((
CLK->CLKSTATUS & u32ClkMask) != u32ClkMask)
645 if(i32TimeOutCnt-- <= 0)
void CLK_PowerDown(void)
This function let system enter to Power-down mode.
#define CLK_PWRCTL_HXT_EN
void CLK_SetModuleClock(uint32_t u32ModuleIdx, uint32_t u32ClkSrc, uint32_t u32ClkDiv)
This function set selected module clock source and module clock divider.
void CLK_EnableCKO(uint32_t u32ClkSrc, uint32_t u32ClkDiv, uint32_t u32ClkDivBy1En)
This function enable frequency divider module clock, enable frequency divider clock function and conf...
uint32_t CLK_GetHXTFreq(void)
This function get external high frequency crystal frequency. The frequency unit is Hz.
#define CLK_PLLCTL_PLL_SRC_N_Pos
uint32_t CLK_WaitClockReady(uint32_t u32ClkMask)
This function check selected clock source status.
#define CLK
Pointer to CLK register structure.
void CLK_Idle(void)
This function let system enter to Idle mode.
void CLK_DisableXtalRC(uint32_t u32ClkMask)
This function disable clock source.
#define CLK_PWRCTL_WK_DLY_Msk
#define CLK_PLLCTL_PLL_MLP_Msk
#define MODULE_IP_EN_Pos(x)
void CLK_DisableCKO(void)
This function disable frequency output function.
#define CLK_CLKSTATUS_PLL_STB_Msk
uint32_t CLK_GetPLLClockFreq(void)
This function get PLL frequency. The frequency unit is Hz.
void CLK_EnableCKO1(uint32_t u32ClkSrc, uint32_t u32ClkDiv, uint32_t u32ClkDivBy1En)
This function enable frequency divider module clock, enable frequency divider clock function and conf...
void CLK_DisableCKO1(void)
This function disable frequency output function(1).
uint32_t CLK_SetCoreClock(uint32_t u32Hclk)
This function set HCLK frequency. The frequency unit is Hz. The range of u32Hclk is 16 ~ 32 MHz.
#define CLK_PWRCTL_HIRC_FSEL_Msk
#define MODULE_CLKSEL_Msk(x)
uint32_t CLK_GetCPUFreq(void)
This function get CPU frequency. The frequency unit is Hz.
#define CLK_CLKSEL2_FRQDIV0_S_Msk
#define CLK_CLKSEL0_HCLK_S_PLL
Nano102/112 peripheral access layer header file. This file contains all the peripheral register's def...
#define CLK_FRQDIV1_DIV1_Pos
void CLK_DisableCKO0(void)
This function disable frequency output function.
#define MODULE_CLKDIV_Msk(x)
#define CLK_CLKSEL0_HCLK_S_Msk
void CLK_DisablePLL(void)
This function disable PLL.
#define CLK_FRQDIV1_FDIV_EN_Msk
void CLK_DisableModuleClock(uint32_t u32ModuleIdx)
This function disable module clock.
#define MODULE_CLKDIV_Pos(x)
#define CLK_FRQDIV0_FDIV_EN_Msk
#define CLK_HCLK_CLK_DIVIDER(x)
#define MODULE_CLKSEL_Pos(x)
#define CLK_APB_DIV_APBDIV_Msk
#define CLK_PLLCTL_PLL_MLP_Pos
void SystemCoreClockUpdate(void)
Updates the SystemCoreClock with current core Clock retrieved from CPU registers.
#define CLK_PWRCTL_PD_EN_Msk
void CLK_EnableCKO0(uint32_t u32ClkSrc, uint32_t u32ClkDiv, uint32_t u32ClkDivBy1En)
This function enable frequency divider module clock, enable frequency divider clock function and conf...
#define CLK_APBCLK_FDIV0_EN_Msk
#define CLK_CLKSEL2_FRQDIV1_S_Msk
void CLK_DisableSysTick(void)
Disable System Tick counter.
uint32_t CLK_GetHCLKFreq(void)
This function get HCLK frequency. The frequency unit is Hz.
void CLK_EnableXtalRC(uint32_t u32ClkMask)
This function enable clock source.
void CLK_SysTickDelay(uint32_t us)
This function execute delay function.
#define CLK_PLLCTL_PLL_SRC_HIRC
uint32_t CLK_GetLXTFreq(void)
This function get external low frequency crystal frequency. The frequency unit is Hz.
#define CLK_PWRCTL_LXT_EN
void CLK_EnableModuleClock(uint32_t u32ModuleIdx)
This function enable module clock.
#define CLK_PLLCTL_PLL_SRC_N_Msk
#define CLK_PLLCTL_PLL_SRC_HXT
void CLK_EnableSysTick(uint32_t u32ClkSrc, uint32_t u32Count)
Enable System Tick counter.
uint32_t CLK_EnablePLL(uint32_t u32PllClkSrc, uint32_t u32PllFreq)
This function set PLL frequency.
#define CLK_CLKDIV0_HCLK_N_Msk
#define CLK_PLLCTL_PD_Msk
#define CLK_APBCLK_FDIV1_EN_Msk
void CLK_SetHCLK(uint32_t u32ClkSrc, uint32_t u32ClkDiv)
This function set HCLK clock source and HCLK clock divider.
#define CLK_CLKSEL0_STCLKSEL_HCLK
uint32_t CLK_GetPCLKFreq(void)
This function get PCLK frequency. The frequency unit is Hz.
#define CLK_FRQDIV0_DIV1_Pos