| Mini51 BSP V3.02.002 The Board Support Package for Mini51 Series

Macros | Functions
clk.h File Reference

Mini51 series CLK driver header file. More...

Go to the source code of this file.

## Macros
#define | CLK_PWRCON_XTL12M 0x01UL
#define | CLK_PWRCON_HXT 0x01UL
#define | CLK_PWRCON_XTL32K 0x02UL
#define | CLK_PWRCON_LXT 0x02UL
#define | CLK_CLKSEL0_HCLK_S_XTAL 0x00UL
#define | CLK_CLKSEL0_HCLK_S_IRC10K 0x03UL
#define | CLK_CLKSEL0_HCLK_S_LIRC 0x03UL
#define | CLK_CLKSEL0_HCLK_S_IRC22M 0x07UL
#define | CLK_CLKSEL0_HCLK_S_HIRC 0x07UL
#define | CLK_CLKSEL0_STCLK_S_XTAL 0x00UL
#define | CLK_CLKSEL0_STCLK_S_XTAL_DIV2 0x10UL
#define | CLK_CLKSEL0_STCLK_S_HCLK_DIV2 0x18UL
#define | CLK_CLKSEL0_STCLK_S_IRC22M_DIV2 0x38UL
#define | CLK_CLKSEL0_STCLK_S_HIRC_DIV2 0x38UL
#define | CLK_CLKSEL0_STCLK_S_HCLK 0x08UL
#define | CLK_CLKSEL1_WDT_S_XTAL 0x00000000UL
#define | CLK_CLKSEL1_WDT_S_HCLK_DIV2048 0x00000002UL
#define | CLK_CLKSEL1_WDT_S_IRC10K 0x00000003UL
#define | CLK_CLKSEL1_WDT_S_LIRC 0x00000003UL
#define | CLK_CLKSEL1_ADC_S_XTAL 0x00000000UL
#define | CLK_CLKSEL1_ADC_S_HCLK 0x00000008UL
#define | CLK_CLKSEL1_ADC_S_IRC22M 0x0000000CUL
#define | CLK_CLKSEL1_ADC_S_HIRC 0x0000000CUL
#define | CLK_CLKSEL1_SPI_S_HXTorLXT 0x00000000UL
#define | CLK_CLKSEL1_SPI_S_HCLK 0x00000010UL
#define | CLK_CLKSEL1_TMR0_S_XTAL 0x00000000UL
#define | CLK_CLKSEL1_TMR0_S_IRC10K 0x00000100UL
#define | CLK_CLKSEL1_TMR0_S_LIRC 0x00000100UL
#define | CLK_CLKSEL1_TMR0_S_HCLK 0x00000200UL
#define | CLK_CLKSEL1_TMR0_S_IRC22M 0x00000700UL
#define | CLK_CLKSEL1_TMR0_S_HIRC 0x00000700UL
#define | CLK_CLKSEL1_TMR1_S_XTAL 0x00000000UL
#define | CLK_CLKSEL1_TMR1_S_IRC10K 0x00001000UL
#define | CLK_CLKSEL1_TMR1_S_LIRC 0x00001000UL
#define | CLK_CLKSEL1_TMR1_S_HCLK 0x00002000UL
#define | CLK_CLKSEL1_TMR1_S_IRC22M 0x00007000UL
#define | CLK_CLKSEL1_TMR1_S_HIRC 0x00007000UL
#define | CLK_CLKSEL1_UART_S_XTAL 0x00000000UL
#define | CLK_CLKSEL1_UART_S_IRC22M 0x02000000UL
#define | CLK_CLKSEL1_UART_S_HIRC 0x02000000UL
#define | CLK_CLKSEL1_PWM01_S_HCLK 0x20000000UL
#define | CLK_CLKSEL1_PWM23_S_HCLK 0x80000000UL
#define | CLK_CLKSEL2_FRQDIV_XTAL 0x00000000UL
#define | CLK_CLKSEL2_FRQDIV_HXT 0x00000000UL
#define | CLK_CLKSEL2_FRQDIV_LXT 0x00000000UL
#define | CLK_CLKSEL2_FRQDIV_HCLK 0x00000008UL
#define | CLK_CLKSEL2_FRQDIV_IRC22M 0x0000000CUL
#define | CLK_CLKSEL2_FRQDIV_HIRC 0x0000000CUL
#define | CLK_CLKSEL2_PWM45_S_HCLK 0x00000020UL
#define | CLK_CLKDIV_ADC(x) (((x)-1) << 16)
#define | CLK_CLKDIV_UART(x) (((x)-1) << 8)
#define | CLK_CLKDIV_HCLK(x) ((x)-1)
#define | MODULE_APBCLK(x) ((x >>31) & 0x1)
#define | MODULE_CLKSEL(x) ((x >>29) & 0x3)
#define | MODULE_CLKSEL_Msk(x) ((x >>25) & 0xf)
#define | MODULE_CLKSEL_Pos(x) ((x >>20) & 0x1f)
#define | MODULE_CLKDIV(x) ((x >>18) & 0x3)
#define | MODULE_CLKDIV_Msk(x) ((x >>10) & 0xff)
#define | MODULE_CLKDIV_Pos(x) ((x >>5 ) & 0x1f)
#define | MODULE_IP_EN_Pos(x) ((x >>0 ) & 0x1f)
#define | MODULE_NoMsk 0x0
#define | NA MODULE_NoMsk
#define | MODULE_APBCLK_ENC(x) (((x) & 0x01) << 31)
#define | MODULE_CLKSEL_ENC(x) (((x) & 0x03) << 29)
#define | MODULE_CLKSEL_Msk_ENC(x) (((x) & 0x0f) << 25)
#define | MODULE_CLKSEL_Pos_ENC(x) (((x) & 0x1f) << 20)
#define | MODULE_CLKDIV_ENC(x) (((x) & 0x03) << 18)
#define | MODULE_CLKDIV_Msk_ENC(x) (((x) & 0xff) << 10)
#define | MODULE_CLKDIV_Pos_ENC(x) (((x) & 0x1f) << 5)
#define | MODULE_IP_EN_Pos_ENC(x) (((x) & 0x1f) << 0)
#define | WDT_MODULE ((0x0<<31)|(0x1<<29)|(0x3<<25)|( 0<<20)|(0x3<<18)|(MODULE_NoMsk<<10)|(31<<5)|CLK_APBCLK_WDT_EN_Pos )
#define | TMR0_MODULE ((0x0<<31)|(0x1<<29)|(0x7<<25)|( 8<<20)|(0x3<<18)|(MODULE_NoMsk<<10)|(31<<5)|CLK_APBCLK_TMR0_EN_Pos)
#define | TMR1_MODULE ((0x0<<31)|(0x1<<29)|(0x7<<25)|(12<<20)|(0x3<<18)|(MODULE_NoMsk<<10)|(31<<5)|CLK_APBCLK_TMR1_EN_Pos)
#define | FDIV_MODULE ((0x0<<31)|(0x3<<29)|(0x3<<25)|( 2<<20)|(0x3<<18)|(MODULE_NoMsk<<10)|(31<<5)|CLK_APBCLK_FDIV_EN_Pos)
#define | I2C_MODULE ((0x0<<31)|(0x3<<29)|(MODULE_NoMsk<<25)|(31<<20)|(0x3<<18)|(MODULE_NoMsk<<10)|(31<<5)|CLK_APBCLK_I2C_EN_Pos)
#define | SPI_MODULE ((0x0<<31)|(0x1<<29)|(0x1<<25)|( 4<<20)|(0x3<<18)|(MODULE_NoMsk<<10)|(31<<5)|CLK_APBCLK_SPI_EN_Pos)
#define | UART_MODULE ((0x0<<31)|(0x1<<29)|(0x3<<25)|(24<<20)|(0x0<<18)|(0x0F<<10)|( 8<<5)|CLK_APBCLK_UART_EN_Pos)
#define | PWM01_MODULE ((0x0<<31)|(0x1<<29)|(0x3<<25)|(28<<20)|(0x3<<18)|(MODULE_NoMsk<<10)|(31<<5)|CLK_APBCLK_PWM01_EN_Pos)
#define | PWM23_MODULE ((0x0<<31)|(0x1<<29)|(0x3<<25)|(30<<20)|(0x3<<18)|(MODULE_NoMsk<<10)|(31<<5)|CLK_APBCLK_PWM23_EN_Pos)
#define | PWM45_MODULE ((0x0<<31)|(0x3<<29)|(0x3<<25)|( 4<<20)|(0x3<<18)|(MODULE_NoMsk<<10)|(31<<5)|CLK_APBCLK_PWM45_EN_Pos)
#define | ADC_MODULE ((0x0<<31)|(0x1<<29)|(0x3<<25)|( 2<<20)|(0x0<<18)|(0xFF<<10)|(16<<5)|CLK_APBCLK_ADC_EN_Pos)
#define | ACMP_MODULE ((0x0<<31)|(0x3<<29)|(MODULE_NoMsk<<25)|(31<<20)|(0x3<<18)|(MODULE_NoMsk<<10)|(31<<5)|CLK_APBCLK_ACMP_EN_Pos)

## Functions
void | CLK_DisableCKO (void)
| This function disable frequency output function. More...
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 configure frequency divider. More...
void | CLK_PowerDown (void)
| This function let system enter to Power-down mode. More...
void | CLK_Idle (void)
| This function let system enter to Idle mode. More...
uint32_t | CLK_GetHXTFreq (void)
| This function get external high frequency crystal frequency. The frequency unit is Hz. More...
uint32_t | CLK_GetLXTFreq (void)
| This function get external low frequency crystal frequency. The frequency unit is Hz. More...
uint32_t | CLK_GetHCLKFreq (void)
| This function get HCLK frequency. The frequency unit is Hz. More...
uint32_t | CLK_GetPCLKFreq (void)
uint32_t | CLK_GetCPUFreq (void)
| This function get CPU frequency. The frequency unit is Hz. More...
void | CLK_SetHCLK (uint32_t u32ClkSrc, uint32_t u32ClkDiv)
| This function set HCLK clock source and HCLK clock divider. More...
void | CLK_SetModuleClock (uint32_t u32ModuleIdx, uint32_t u32ClkSrc, uint32_t u32ClkDiv)
| This function set selected module clock source and module clock divider. More...
void | CLK_SetSysTickClockSrc (uint32_t u32ClkSrc)
| This function set SysTick clock source. More...
void | CLK_EnableSysTick (uint32_t u32ClkSrc, uint32_t u32Count)
| Enable System Tick counter. More...
void | CLK_DisableSysTick (void)
| Disable System Tick counter. More...
void | CLK_EnableXtalRC (uint32_t u32ClkMask)
| This function enable clock source. More...
void | CLK_DisableXtalRC (uint32_t u32ClkMask)
| This function disable clock source. More...
void | CLK_EnableModuleClock (uint32_t u32ModuleIdx)
| This function enable module clock. More...
void | CLK_DisableModuleClock (uint32_t u32ModuleIdx)
| This function disable module clock. More...
void | CLK_SysTickDelay (uint32_t us)
| This function execute delay function. More...
uint32_t | CLK_WaitClockReady (uint32_t u32ClkMask)
| This function check selected clock source status. More...

## Detailed Description

Mini51 series CLK driver header file.

Version
  V1.00

Revision
  19

Date
  15/09/25 9:19a

Note
  SPDX-License-Identifier: Apache-2.0 Copyright (C) 2013 Nuvoton Technology Corp. All rights reserved.

Definition in file clk.h.