MCUXpresso SDK API Reference Manual  Rev. 0
NXP Semiconductors
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
Clock Driver

Overview

The MCUXpresso SDK provides APIs for MCUXpresso SDK devices' clock operation.

Modules

 System Clock Generator (SCG)
 

Files

file  fsl_clock.h
 

Data Structures

struct  scg_sys_clk_config_t
 SCG system clock configuration. More...
 
struct  scg_sosc_config_t
 SCG system OSC configuration. More...
 
struct  scg_sirc_config_t
 SCG slow IRC clock configuration. More...
 
struct  scg_firc_trim_config_t
 SCG fast IRC clock trim configuration. More...
 
struct  scg_firc_config_t
 SCG fast IRC clock configuration. More...
 
struct  scg_spll_config_t
 SCG system PLL configuration. More...
 
struct  scg_rosc_config_t
 SCG RTC OSC configuration. More...
 
struct  scg_apll_config_t
 SCG auxiliary PLL configuration. More...
 

Macros

#define FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL   0
 Configure whether driver controls clock. More...
 
#define SCG   SCG0
 Re-map the SCG peripheral base address for i.MX 7ULP. More...
 
#define SCG_PLLPFD_PFD_VAL(pfdClkout, fracValue)   ((uint32_t)((uint32_t)(fracValue) << (uint32_t)(pfdClkout)))
 SCG (A/S)PLLPFD[PFDx] value.
 
#define SCG_PLLPFD_PFD_MASK(pfdClkout)   ((uint32_t)((uint32_t)(SCG_APLLPFD_PFD0_MASK) << (uint32_t)(pfdClkout)))
 SCG (A/S)PLLPFD[PFD] mask.
 
#define SCG_PLLPFD_PFD_VALID_MASK(pfdClkout)   ((uint32_t)((uint32_t)SCG_APLLPFD_PFD0_VALID_MASK << (uint32_t)(pfdClkout)))
 SCG (A/S)PLLPFD[PFDx_VALID] mask.
 
#define SCG_PLLPFD_PFD_CLKGATE_MASK(pfdClkout)   ((uint32_t)((uint32_t)SCG_APLLPFD_PFD0_CLKGATE_MASK << (uint32_t)(pfdClkout)))
 SCG (A/S)PLLPFD[PFDx_CLKGATE] mask.
 
#define PCC_CLKCFG_PCD_MASK   (0x7U)
 Re-define PCC register masks and bitfield operations to unify the different namings in the soc header file.
 
#define DMAMUX_CLOCKS
 Clock ip name array for DMAMUX. More...
 
#define RGPIO2P_CLOCKS
 Clock ip name array for RGPIO2P. More...
 
#define SAI_CLOCKS
 Clock ip name array for SAI. More...
 
#define PCTL_CLOCKS
 Clock ip name array for PCTL. More...
 
#define LPI2C_CLOCKS
 Clock ip name array for LPI2C. More...
 
#define FLEXIO_CLOCKS
 Clock ip name array for FLEXIO. More...
 
#define EDMA_CLOCKS
 Clock ip name array for EDMA. More...
 
#define LPUART_CLOCKS
 Clock ip name array for LPUART. More...
 
#define DAC_CLOCKS
 Clock ip name array for DAC. More...
 
#define SNVS_HP_CLOCKS
 Clock ip name array for DAC. More...
 
#define LPTMR_CLOCKS
 Clock ip name array for LPTMR. More...
 
#define LPADC_CLOCKS
 Clock ip name array for LPADC. More...
 
#define TRNG_CLOCKS
 Clock ip name array for TRNG. More...
 
#define LPSPI_CLOCKS
 Clock ip name array for LPSPI. More...
 
#define TPM_CLOCKS
 Clock ip name array for TPM. More...
 
#define LPIT_CLOCKS
 Clock ip name array for LPIT. More...
 
#define CRC_CLOCKS
 Clock ip name array for CRC. More...
 
#define CMP_CLOCKS
 Clock ip name array for CMP. More...
 
#define XRDC_CLOCKS
 Clock ip name array for XRDC. More...
 
#define MU_CLOCKS
 Clock ip name array for MU. More...
 
#define WDOG_CLOCKS
 Clock ip name array for WDOG. More...
 
#define LTC_CLOCKS
 Clock ip name array for LTC. More...
 
#define DPM_CLOCKS
 Clock ip name array for DPM. More...
 
#define SEMA42_CLOCKS
 Clock ip name array for SEMA42. More...
 
#define TPIU_CLOCKS
 Clock ip name array for TPIU. More...
 
#define QSPI_CLOCKS
 Clock ip name array for QSPI. More...
 
#define LPO_CLK_FREQ   1000U
 LPO clock frequency.
 
#define TPIU_CLK_FREQ   100000000U
 TPIU clock frequency.
 
#define kCLOCK_Osc0ErClk   kCLOCK_ErClk
 For compatible with other MCG platforms. More...
 
#define kCLOCK_Er32kClk   kCLOCK_Osc32kClk
 For compatible with other MCG platforms. More...
 
#define CLOCK_GetOsc0ErClkFreq   CLOCK_GetErClkFreq
 For compatible with other MCG platforms. More...
 
#define CLOCK_GetEr32kClkFreq   CLOCK_GetOsc32kClkFreq
 For compatible with other MCG platforms. More...
 

Enumerations

enum  clock_name_t {
  kCLOCK_CoreSysClk,
  kCLOCK_PlatClk,
  kCLOCK_ExtClk,
  kCLOCK_BusClk,
  kCLOCK_SlowClk,
  kCLOCK_ScgSysOscClk,
  kCLOCK_ScgSircClk,
  kCLOCK_ScgFircClk,
  kCLOCK_ScgRtcOscClk,
  kCLOCK_ScgAuxPllClk,
  kCLOCK_ScgSysPllClk,
  kCLOCK_ScgSysOscAsyncDiv1Clk,
  kCLOCK_ScgSysOscAsyncDiv2Clk,
  kCLOCK_ScgSysOscAsyncDiv3Clk,
  kCLOCK_ScgSircAsyncDiv1Clk,
  kCLOCK_ScgSircAsyncDiv2Clk,
  kCLOCK_ScgSircAsyncDiv3Clk,
  kCLOCK_ScgFircAsyncDiv1Clk,
  kCLOCK_ScgFircAsyncDiv2Clk,
  kCLOCK_ScgFircAsyncDiv3Clk,
  kCLOCK_ScgSysPllPfd0Clk,
  kCLOCK_ScgSysPllPfd1Clk,
  kCLOCK_ScgSysPllPfd2Clk,
  kCLOCK_ScgSysPllPfd3Clk,
  kCLOCK_ScgAuxPllPfd0Clk,
  kCLOCK_ScgAuxPllPfd1Clk,
  kCLOCK_ScgAuxPllPfd2Clk,
  kCLOCK_ScgAuxPllPfd3Clk,
  kCLOCK_ScgSysPllAsyncDiv1Clk,
  kCLOCK_ScgSysPllAsyncDiv2Clk,
  kCLOCK_ScgSysPllAsyncDiv3Clk,
  kCLOCK_ScgAuxPllAsyncDiv1Clk,
  kCLOCK_ScgAuxPllAsyncDiv2Clk,
  kCLOCK_ScgAuxPllAsyncDiv3Clk,
  kCLOCK_LpoClk,
  kCLOCK_Osc32kClk,
  kCLOCK_ErClk,
  kCLOCK_LvdsClk
}
 Clock name used to get clock frequency. More...
 
enum  clock_ip_src_t {
  kCLOCK_IpSrcNone = 0U,
  kCLOCK_IpSrcSysOscAsync = 1U,
  kCLOCK_IpSrcSircAsync = 2U,
  kCLOCK_IpSrcFircAsync = 3U,
  kCLOCK_IpSrcRtcAuxPllAsync = 4U,
  kCLOCK_IpSrcSystem = 5U,
  kCLOCK_IpSrcSysPllAsync = 6U,
  kCLOCK_IpSrcPllPfdAsync = 7U
}
 Clock source for peripherals that support various clock selections. More...
 
enum  clock_lptmr_src_t {
  kCLOCK_LptmrSrcSircAsync = 0U,
  kCLOCK_LptmrSrcLPO1K = 1U,
  kCLOCK_LptmrSrcXTAL32K = 2U,
  kCLOCK_LptmrSrcExternal = 3U
}
 Clock source for LPTMR. More...
 
enum  clock_ip_name_t
 Peripheral clock name difinition used for clock gate, clock source and clock divider setting. More...
 
enum  {
  kStatus_SCG_Busy = MAKE_STATUS(kStatusGroup_SCG, 1),
  kStatus_SCG_InvalidSrc = MAKE_STATUS(kStatusGroup_SCG, 2)
}
 SCG status return codes. More...
 
enum  scg_sys_clk_t {
  kSCG_SysClkSlow,
  kSCG_SysClkBus,
  kSCG_SysClkExt,
  kSCG_SysClkPlat,
  kSCG_SysClkCore
}
 SCG system clock type. More...
 
enum  scg_sys_clk_src_t {
  kSCG_SysClkSrcSysOsc = 1U,
  kSCG_SysClkSrcSirc = 2U,
  kSCG_SysClkSrcFirc = 3U,
  kSCG_SysClkSrcRosc = 4U,
  kSCG_SysClkSrcAuxPll = 5U,
  kSCG_SysClkSrcSysPll = 6U
}
 SCG system clock source. More...
 
enum  scg_sys_clk_div_t {
  kSCG_SysClkDivBy1 = 0U,
  kSCG_SysClkDivBy2 = 1U,
  kSCG_SysClkDivBy3 = 2U,
  kSCG_SysClkDivBy4 = 3U,
  kSCG_SysClkDivBy5 = 4U,
  kSCG_SysClkDivBy6 = 5U,
  kSCG_SysClkDivBy7 = 6U,
  kSCG_SysClkDivBy8 = 7U,
  kSCG_SysClkDivBy9 = 8U,
  kSCG_SysClkDivBy10 = 9U,
  kSCG_SysClkDivBy11 = 10U,
  kSCG_SysClkDivBy12 = 11U,
  kSCG_SysClkDivBy13 = 12U,
  kSCG_SysClkDivBy14 = 13U,
  kSCG_SysClkDivBy15 = 14U,
  kSCG_SysClkDivBy16 = 15U
}
 SCG system clock divider value. More...
 
enum  clock_clkout_src_t {
  kClockClkoutSelScgExt = 0U,
  kClockClkoutSelSysOsc = 1U,
  kClockClkoutSelSirc = 2U,
  kClockClkoutSelFirc = 3U,
  kClockClkoutSelScgRtcOsc = 4U,
  kClockClkoutSelScgAuxPll = 5U,
  kClockClkoutSelSysPll = 6U
}
 SCG clock out configuration (CLKOUTSEL). More...
 
enum  scg_async_clk_t {
  kSCG_AsyncDiv1Clk,
  kSCG_AsyncDiv2Clk,
  kSCG_AsyncDiv3Clk
}
 SCG asynchronous clock type. More...
 
enum  scg_async_clk_div_t {
  kSCG_AsyncClkDisable = 0U,
  kSCG_AsyncClkDivBy1 = 1U,
  kSCG_AsyncClkDivBy2 = 2U,
  kSCG_AsyncClkDivBy4 = 3U,
  kSCG_AsyncClkDivBy8 = 4U,
  kSCG_AsyncClkDivBy16 = 5U,
  kSCG_AsyncClkDivBy32 = 6U,
  kSCG_AsyncClkDivBy64 = 7U
}
 SCG asynchronous clock divider value. More...
 
enum  scg_sosc_monitor_mode_t {
  kSCG_SysOscMonitorDisable = 0U,
  kSCG_SysOscMonitorInt = SCG_SOSCCSR_SOSCCM_MASK,
  kSCG_SysOscMonitorReset
}
 SCG system OSC monitor mode. More...
 
enum  scg_sosc_mode_t {
  kSCG_SysOscModeExt = 0U,
  kSCG_SysOscModeOscLowPower = SCG_SOSCCFG_EREFS_MASK,
  kSCG_SysOscModeOscHighGain = SCG_SOSCCFG_EREFS_MASK | SCG_SOSCCFG_HGO_MASK
}
 OSC work mode. More...
 
enum  _scg_sosc_enable_mode {
  kSCG_SysOscEnable = SCG_SOSCCSR_SOSCEN_MASK,
  kSCG_SysOscEnableInStop = SCG_SOSCCSR_SOSCSTEN_MASK,
  kSCG_SysOscEnableInLowPower = SCG_SOSCCSR_SOSCLPEN_MASK
}
 OSC enable mode. More...
 
enum  scg_sirc_range_t {
  kSCG_SircRangeLow,
  kSCG_SircRangeHigh
}
 SCG slow IRC clock frequency range. More...
 
enum  _scg_sirc_enable_mode {
  kSCG_SircEnable = SCG_SIRCCSR_SIRCEN_MASK,
  kSCG_SircEnableInStop = SCG_SIRCCSR_SIRCSTEN_MASK,
  kSCG_SircEnableInLowPower = SCG_SIRCCSR_SIRCLPEN_MASK
}
 SIRC enable mode. More...
 
enum  scg_firc_trim_mode_t {
  kSCG_FircTrimNonUpdate = SCG_FIRCCSR_FIRCTREN_MASK,
  kSCG_FircTrimUpdate = SCG_FIRCCSR_FIRCTREN_MASK | SCG_FIRCCSR_FIRCTRUP_MASK
}
 SCG fast IRC trim mode. More...
 
enum  scg_firc_trim_div_t {
  kSCG_FircTrimDivBy1,
  kSCG_FircTrimDivBy128,
  kSCG_FircTrimDivBy256,
  kSCG_FircTrimDivBy512,
  kSCG_FircTrimDivBy1024,
  kSCG_FircTrimDivBy2048
}
 SCG fast IRC trim predivided value for system OSC. More...
 
enum  scg_firc_trim_src_t {
  kSCG_FircTrimSrcUsb0 = 0U,
  kSCG_FircTrimSrcUsb1 = 1U,
  kSCG_FircTrimSrcSysOsc = 2U,
  kSCG_FircTrimSrcRtcOsc = 3U
}
 SCG fast IRC trim source. More...
 
enum  scg_firc_range_t {
  kSCG_FircRange48M,
  kSCG_FircRange52M,
  kSCG_FircRange56M,
  kSCG_FircRange60M
}
 SCG fast IRC clock frequency range. More...
 
enum  _scg_firc_enable_mode {
  kSCG_FircEnable = SCG_FIRCCSR_FIRCEN_MASK,
  kSCG_FircEnableInStop = SCG_FIRCCSR_FIRCSTEN_MASK
}
 FIRC enable mode. More...
 
enum  scg_spll_src_t {
  kSCG_SysPllSrcSysOsc,
  kSCG_SysPllSrcFirc
}
 SCG system PLL clock source. More...
 
enum  _scg_spll_enable_mode {
  kSCG_SysPllEnable = SCG_SPLLCSR_SPLLEN_MASK,
  kSCG_SysPllEnableInStop = SCG_SPLLCSR_SPLLSTEN_MASK
}
 SPLL enable mode. More...
 
enum  scg_spll_pfd_clkout_t {
  kSCG_SysPllPfd0Clk = 0U,
  kSCG_SysPllPfd1Clk = 8U,
  kSCG_SysPllPfd2Clk = 16U,
  kSCG_SysPllPfd3Clk = 24U
}
 SCG system PLL PFD clouk out select. More...
 
enum  scg_rosc_monitor_mode_t {
  kSCG_rtcOscMonitorDisable = 0U,
  kSCG_rtcOscMonitorInt = SCG_ROSCCSR_ROSCCM_MASK,
  kSCG_rtcOscMonitorReset
}
 SCG RTC OSC monitor mode. More...
 
enum  scg_apll_src_t {
  kSCG_AuxPllSrcSysOsc,
  kSCG_AuxPllSrcFirc
}
 SCG auxiliary PLL clock source. More...
 
enum  _scg_apll_enable_mode {
  kSCG_AuxPllEnable = SCG_APLLCSR_APLLEN_MASK,
  kSCG_AuxPllEnableInStop = SCG_APLLCSR_APLLSTEN_MASK
}
 APLL enable mode. More...
 
enum  scg_apll_pfd_clkout_t {
  kSCG_AuxPllPfd0Clk = 0U,
  kSCG_AuxPllPfd1Clk = 8U,
  kSCG_AuxPllPfd2Clk = 16U,
  kSCG_AuxPllPfd3Clk = 24U
}
 SCG auxiliary PLL PFD clouk out select. More...
 

Functions

static void CLOCK_EnableClock (clock_ip_name_t name)
 Enable the clock for specific IP. More...
 
static void CLOCK_DisableClock (clock_ip_name_t name)
 Disable the clock for specific IP. More...
 
static bool CLOCK_IsEnabledByOtherCore (clock_ip_name_t name)
 Check whether the clock is already enabled and configured by any other core. More...
 
static void CLOCK_SetIpSrc (clock_ip_name_t name, clock_ip_src_t src)
 Set the clock source for specific IP module. More...
 
static void CLOCK_SetIpSrcDiv (clock_ip_name_t name, clock_ip_src_t src, uint8_t divValue, uint8_t fracValue)
 Set the clock source and divider for specific IP module. More...
 
uint32_t CLOCK_GetFreq (clock_name_t clockName)
 Gets the clock frequency for a specific clock name. More...
 
uint32_t CLOCK_GetCoreSysClkFreq (void)
 Get the core clock or system clock frequency. More...
 
uint32_t CLOCK_GetPlatClkFreq (void)
 Get the platform clock frequency. More...
 
uint32_t CLOCK_GetExtClkFreq (void)
 Get the external clock frequency. More...
 
uint32_t CLOCK_GetBusClkFreq (void)
 Get the bus clock frequency. More...
 
uint32_t CLOCK_GetSlowClkFreq (void)
 Get the slow clock frequency. More...
 
uint32_t CLOCK_GetOsc32kClkFreq (void)
 Get the OSC 32K clock frequency (OSC32KCLK). More...
 
uint32_t CLOCK_GetErClkFreq (void)
 Get the external reference clock frequency (ERCLK). More...
 
uint32_t CLOCK_GetLvdsClkFreq (void)
 Get the external LVDS pad clock frequency (LVDS). More...
 
uint32_t CLOCK_GetIpFreq (clock_ip_name_t name)
 Gets the clock frequency for a specific IP module. More...
 
uint32_t CLOCK_GetRtcOscFreq (void)
 Gets the SCG RTC OSC clock frequency. More...
 
static bool CLOCK_IsRtcOscErr (void)
 Checks whether the RTC OSC clock error occurs. More...
 
static void CLOCK_ClearRtcOscErr (void)
 Clears the RTC OSC clock error.
 
static void CLOCK_SetRtcOscMonitorMode (scg_rosc_monitor_mode_t mode)
 Sets the RTC OSC monitor mode. More...
 
static bool CLOCK_IsRtcOscValid (void)
 Checks whether the RTC OSC clock is valid. More...
 

Variables

volatile uint32_t g_xtal0Freq
 External XTAL0 (OSC0/SYSOSC) clock frequency. More...
 
volatile uint32_t g_xtal32Freq
 External XTAL32/EXTAL32 clock frequency. More...
 
volatile uint32_t g_lvdsFreq
 External LVDS pad clock frequency. More...
 

Driver version

#define FSL_CLOCK_DRIVER_VERSION   (MAKE_VERSION(2, 3, 1))
 CLOCK driver version 2.3.1. More...
 

MCU System Clock.

uint32_t CLOCK_GetSysClkFreq (scg_sys_clk_t type)
 Gets the SCG system clock frequency. More...
 
static void CLOCK_SetVlprModeSysClkConfig (const scg_sys_clk_config_t *config)
 Sets the system clock configuration for VLPR mode. More...
 
static void CLOCK_SetRunModeSysClkConfig (const scg_sys_clk_config_t *config)
 Sets the system clock configuration for RUN mode. More...
 
static void CLOCK_SetHsrunModeSysClkConfig (const scg_sys_clk_config_t *config)
 Sets the system clock configuration for HSRUN mode. More...
 
static void CLOCK_GetCurSysClkConfig (scg_sys_clk_config_t *config)
 Gets the system clock configuration in the current power mode. More...
 
static void CLOCK_SetClkOutSel (clock_clkout_src_t setting)
 Sets the clock out selection. More...
 

SCG System OSC Clock.

status_t CLOCK_InitSysOsc (const scg_sosc_config_t *config)
 Initializes the SCG system OSC. More...
 
status_t CLOCK_DeinitSysOsc (void)
 De-initializes the SCG system OSC. More...
 
static void CLOCK_SetSysOscAsyncClkDiv (scg_async_clk_t asyncClk, scg_async_clk_div_t divider)
 Set the asynchronous clock divider. More...
 
uint32_t CLOCK_GetSysOscFreq (void)
 Gets the SCG system OSC clock frequency (SYSOSC). More...
 
uint32_t CLOCK_GetSysOscAsyncFreq (scg_async_clk_t type)
 Gets the SCG asynchronous clock frequency from the system OSC. More...
 
static bool CLOCK_IsSysOscErr (void)
 Checks whether the system OSC clock error occurs. More...
 
static void CLOCK_ClearSysOscErr (void)
 Clears the system OSC clock error.
 
static void CLOCK_SetSysOscMonitorMode (scg_sosc_monitor_mode_t mode)
 Sets the system OSC monitor mode. More...
 
static bool CLOCK_IsSysOscValid (void)
 Checks whether the system OSC clock is valid. More...
 

SCG Slow IRC Clock.

status_t CLOCK_InitSirc (const scg_sirc_config_t *config)
 Initializes the SCG slow IRC clock. More...
 
status_t CLOCK_DeinitSirc (void)
 De-initializes the SCG slow IRC. More...
 
static void CLOCK_SetSircAsyncClkDiv (scg_async_clk_t asyncClk, scg_async_clk_div_t divider)
 Set the asynchronous clock divider. More...
 
static void CLOCK_EnableLpoPowerOption (bool enable)
 Enables/disables the SCG slow IRC 1khz LPO clock in LLS/VLLSx modes. More...
 
uint32_t CLOCK_GetSircFreq (void)
 Gets the SCG SIRC clock frequency. More...
 
uint32_t CLOCK_GetSircAsyncFreq (scg_async_clk_t type)
 Gets the SCG asynchronous clock frequency from the SIRC. More...
 
static bool CLOCK_IsSircValid (void)
 Checks whether the SIRC clock is valid. More...
 

SCG Fast IRC Clock.

status_t CLOCK_InitFirc (const scg_firc_config_t *config)
 Initializes the SCG fast IRC clock. More...
 
status_t CLOCK_DeinitFirc (void)
 De-initializes the SCG fast IRC. More...
 
static void CLOCK_SetFircAsyncClkDiv (scg_async_clk_t asyncClk, scg_async_clk_div_t divider)
 Set the asynchronous clock divider. More...
 
uint32_t CLOCK_GetFircFreq (void)
 Gets the SCG FIRC clock frequency. More...
 
uint32_t CLOCK_GetFircAsyncFreq (scg_async_clk_t type)
 Gets the SCG asynchronous clock frequency from the FIRC. More...
 
static bool CLOCK_IsFircErr (void)
 Checks whether the FIRC clock error occurs. More...
 
static void CLOCK_ClearFircErr (void)
 Clears the FIRC clock error.
 
static bool CLOCK_IsFircValid (void)
 Checks whether the FIRC clock is valid. More...
 

Data Structure Documentation

struct scg_sys_clk_config_t

Data Fields

uint32_t divSlow: 4
 Slow clock divider, see scg_sys_clk_div_t. More...
 
uint32_t divBus: 4
 Bus clock divider, see scg_sys_clk_div_t. More...
 
uint32_t __pad0__: 4
 Reserved. More...
 
uint32_t divPlat: 4
 Platform clock divider, which can only be divided by 1. More...
 
uint32_t divCore: 4
 Core clock divider, see scg_sys_clk_div_t. More...
 
uint32_t __pad1__: 4
 Reserved. More...
 
uint32_t src: 4
 System clock source, see scg_sys_clk_src_t. More...
 
uint32_t __pad2__: 4
 reserved. More...
 

Field Documentation

uint32_t scg_sys_clk_config_t::divSlow
uint32_t scg_sys_clk_config_t::divBus
uint32_t scg_sys_clk_config_t::__pad0__
uint32_t scg_sys_clk_config_t::divPlat
uint32_t scg_sys_clk_config_t::divCore
uint32_t scg_sys_clk_config_t::__pad1__
uint32_t scg_sys_clk_config_t::src
uint32_t scg_sys_clk_config_t::__pad2__
struct scg_sosc_config_t

Data Fields

uint32_t freq
 System OSC frequency. More...
 
scg_sosc_monitor_mode_t monitorMode
 Clock monitor mode selected. More...
 
uint8_t enableMode
 Enable mode, OR'ed value of _scg_sosc_enable_mode. More...
 
scg_async_clk_div_t div1
 SOSCDIV1 value. More...
 
scg_async_clk_div_t div2
 SOSCDIV2 value. More...
 
scg_async_clk_div_t div3
 SOSCDIV3 value. More...
 
scg_sosc_mode_t workMode
 OSC work mode. More...
 

Field Documentation

uint32_t scg_sosc_config_t::freq
scg_sosc_monitor_mode_t scg_sosc_config_t::monitorMode
uint8_t scg_sosc_config_t::enableMode
scg_async_clk_div_t scg_sosc_config_t::div1
scg_async_clk_div_t scg_sosc_config_t::div2
scg_async_clk_div_t scg_sosc_config_t::div3
scg_sosc_mode_t scg_sosc_config_t::workMode
struct scg_sirc_config_t

Data Fields

uint32_t enableMode
 Enable mode, OR'ed value of _scg_sirc_enable_mode. More...
 
scg_async_clk_div_t div1
 SIRCDIV1 value. More...
 
scg_async_clk_div_t div2
 SIRCDIV2 value. More...
 
scg_async_clk_div_t div3
 SIRCDIV3 value. More...
 
scg_sirc_range_t range
 Slow IRC frequency range. More...
 

Field Documentation

uint32_t scg_sirc_config_t::enableMode
scg_async_clk_div_t scg_sirc_config_t::div1
scg_async_clk_div_t scg_sirc_config_t::div2
scg_async_clk_div_t scg_sirc_config_t::div3
scg_sirc_range_t scg_sirc_config_t::range
struct scg_firc_trim_config_t

Data Fields

scg_firc_trim_mode_t trimMode
 FIRC trim mode. More...
 
scg_firc_trim_src_t trimSrc
 Trim source. More...
 
scg_firc_trim_div_t trimDiv
 Trim predivided value for the system OSC. More...
 
uint8_t trimCoar
 Trim coarse value; Irrelevant if trimMode is kSCG_FircTrimUpdate. More...
 
uint8_t trimFine
 Trim fine value; Irrelevant if trimMode is kSCG_FircTrimUpdate. More...
 

Field Documentation

scg_firc_trim_mode_t scg_firc_trim_config_t::trimMode
scg_firc_trim_src_t scg_firc_trim_config_t::trimSrc
scg_firc_trim_div_t scg_firc_trim_config_t::trimDiv
uint8_t scg_firc_trim_config_t::trimCoar
uint8_t scg_firc_trim_config_t::trimFine
struct scg_firc_config_t

Data Fields

uint32_t enableMode
 Enable mode, OR'ed value of _scg_firc_enable_mode. More...
 
scg_async_clk_div_t div1
 FIRCDIV1 value. More...
 
scg_async_clk_div_t div2
 FIRCDIV2 value. More...
 
scg_async_clk_div_t div3
 FIRCDIV3 value. More...
 
scg_firc_range_t range
 Fast IRC frequency range. More...
 
const scg_firc_trim_config_ttrimConfig
 Pointer to the FIRC trim configuration; set NULL to disable trim. More...
 

Field Documentation

uint32_t scg_firc_config_t::enableMode
scg_async_clk_div_t scg_firc_config_t::div1
scg_async_clk_div_t scg_firc_config_t::div2
scg_async_clk_div_t scg_firc_config_t::div3
scg_firc_range_t scg_firc_config_t::range
const scg_firc_trim_config_t* scg_firc_config_t::trimConfig
struct scg_spll_config_t

Data Fields

uint8_t enableMode
 Enable mode, OR'ed value of _scg_spll_enable_mode.
 
scg_async_clk_div_t div1
 SPLLDIV1 value. More...
 
scg_async_clk_div_t div2
 SPLLDIV2 value. More...
 
scg_async_clk_div_t div3
 SPLLDIV3 value. More...
 
scg_spll_src_t src
 Clock source. More...
 
bool isPfdSelected
 SPLL PFD output clock selected. More...
 
uint8_t prediv
 PLL reference clock divider. More...
 
scg_spll_pfd_clkout_t pfdClkout
 PLL PFD clouk out select. More...
 
uint8_t mult
 System PLL multiplier. More...
 

Field Documentation

scg_async_clk_div_t scg_spll_config_t::div1
scg_async_clk_div_t scg_spll_config_t::div2
scg_async_clk_div_t scg_spll_config_t::div3
scg_spll_src_t scg_spll_config_t::src
bool scg_spll_config_t::isPfdSelected
uint8_t scg_spll_config_t::prediv
scg_spll_pfd_clkout_t scg_spll_config_t::pfdClkout
uint8_t scg_spll_config_t::mult
struct scg_rosc_config_t

Data Fields

scg_rosc_monitor_mode_t monitorMode
 Clock monitor mode selected. More...
 

Field Documentation

scg_rosc_monitor_mode_t scg_rosc_config_t::monitorMode
struct scg_apll_config_t

Data Fields

uint8_t enableMode
 Enable mode, OR'ed value of _scg_apll_enable_mode.
 
scg_async_clk_div_t div1
 APLLDIV1 value. More...
 
scg_async_clk_div_t div2
 APLLDIV2 value. More...
 
scg_async_clk_div_t div3
 APLLDIV3 value. More...
 
scg_apll_src_t src
 Clock source. More...
 
bool isPfdSelected
 APLL PFD output clock selected. More...
 
uint8_t prediv
 PLL reference clock divider. More...
 
scg_apll_pfd_clkout_t pfdClkout
 SCG auxiliary PLL PFD clouk out select. More...
 
uint8_t mult
 Auxiliary PLL multiplier. More...
 
scg_sys_clk_div_t pllPostdiv1
 Auxiliary PLL Post Clock Divide1 Ratio. More...
 
scg_sys_clk_div_t pllPostdiv2
 Auxiliary PLL Post Clock Divide2 Ratio. More...
 
uint32_t num: 30
 30-bit numerator of the Auxiliary PLL Fractional-Loop divider. More...
 
uint32_t denom: 30
 30-bit denominator of the Auxiliary PLL Fractional-Loop divider. More...
 

Field Documentation

scg_async_clk_div_t scg_apll_config_t::div1
scg_async_clk_div_t scg_apll_config_t::div2
scg_async_clk_div_t scg_apll_config_t::div3
scg_apll_src_t scg_apll_config_t::src
bool scg_apll_config_t::isPfdSelected
uint8_t scg_apll_config_t::prediv
scg_apll_pfd_clkout_t scg_apll_config_t::pfdClkout
uint8_t scg_apll_config_t::mult
scg_sys_clk_div_t scg_apll_config_t::pllPostdiv1
scg_sys_clk_div_t scg_apll_config_t::pllPostdiv2
uint32_t scg_apll_config_t::num
uint32_t scg_apll_config_t::denom

Macro Definition Documentation

#define FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL   0

When set to 0, peripheral drivers will enable clock in initialize function and disable clock in de-initialize function. When set to 1, peripheral driver will not control the clock, application could control the clock out of the driver.

Note
All drivers share this feature switcher. If it is set to 1, application should handle clock enable and disable for all drivers.
#define FSL_CLOCK_DRIVER_VERSION   (MAKE_VERSION(2, 3, 1))
#define SCG   SCG0

This driver is for SCG 0 on Core 0 of i.MX 7ULP only.

#define DMAMUX_CLOCKS
Value:
{ \
kCLOCK_Dmamux0, kCLOCK_Dmamux1 \
}
#define RGPIO2P_CLOCKS
Value:
{ \
kCLOCK_Rgpio2p0, kCLOCK_Rgpio2p0, kCLOCK_Rgpio2p1, kCLOCK_Rgpio2p1, kCLOCK_Rgpio2p1, kCLOCK_Rgpio2p1 \
}
#define SAI_CLOCKS
Value:
{ \
kCLOCK_Sai0, kCLOCK_Sai1 \
}
#define PCTL_CLOCKS
Value:
{ \
kCLOCK_PctlA, kCLOCK_PctlB, kCLOCK_PctlC, kCLOCK_PctlD, kCLOCK_PctlE, kCLOCK_PctlF \
}
#define LPI2C_CLOCKS
Value:
{ \
kCLOCK_Lpi2c0, kCLOCK_Lpi2c1, kCLOCK_Lpi2c2, kCLOCK_Lpi2c3, kCLOCK_Lpi2c4, kCLOCK_Lpi2c5, kCLOCK_Lpi2c6, \
kCLOCK_Lpi2c7 \
}
#define FLEXIO_CLOCKS
Value:
{ \
kCLOCK_Flexio0, kCLOCK_Flexio1 \
}
#define EDMA_CLOCKS
Value:
{ \
kCLOCK_Dma0, kCLOCK_Dma1 \
}
#define LPUART_CLOCKS
Value:
{ \
kCLOCK_Lpuart0, kCLOCK_Lpuart1, kCLOCK_Lpuart2, kCLOCK_Lpuart3, kCLOCK_Lpuart4, kCLOCK_Lpuart5, \
kCLOCK_Lpuart6, kCLOCK_Lpuart7 \
}
#define DAC_CLOCKS
Value:
{ \
kCLOCK_Dac0, kCLOCK_Dac1 \
}
#define SNVS_HP_CLOCKS
Value:
{ \
kCLOCK_Snvs \
}
#define LPTMR_CLOCKS
Value:
{ \
kCLOCK_Lptmr0, kCLOCK_Lptmr1 \
}
#define LPADC_CLOCKS
Value:
{ \
kCLOCK_Adc0, kCLOCK_Adc1 \
}
#define TRNG_CLOCKS
Value:
{ \
kCLOCK_Trng0 \
}
#define LPSPI_CLOCKS
Value:
{ \
kCLOCK_Lpspi0, kCLOCK_Lpspi1, kCLOCK_Lpspi2, kCLOCK_Lpspi3 \
}
#define TPM_CLOCKS
Value:
{ \
kCLOCK_Tpm0, kCLOCK_Tpm1, kCLOCK_Tpm2, kCLOCK_Tpm3, kCLOCK_Tpm4, kCLOCK_Tpm5, kCLOCK_Tpm6, kCLOCK_Tpm7 \
}
#define LPIT_CLOCKS
Value:
{ \
kCLOCK_Lpit0, kCLOCK_Lpit1 \
}
#define CRC_CLOCKS
Value:
{ \
kCLOCK_Crc0 \
}
#define CMP_CLOCKS
Value:
{ \
kCLOCK_Cmp0, kCLOCK_Cmp1 \
}
#define XRDC_CLOCKS
Value:
{ \
kCLOCK_Xrdc0 \
}
#define MU_CLOCKS
Value:
{ \
kCLOCK_MuA \
}
#define WDOG_CLOCKS
Value:
{ \
kCLOCK_Wdog0, kCLOCK_Wdog1, kCLOCK_Wdog2 \
}
#define LTC_CLOCKS
Value:
{ \
kCLOCK_Ltc0 \
}
#define DPM_CLOCKS
Value:
{ \
kCLOCK_Dpm \
}
#define SEMA42_CLOCKS
Value:
{ \
kCLOCK_Sema420, kCLOCK_Sema421 \
}
#define TPIU_CLOCKS
Value:
{ \
kCLOCK_Tpiu \
}
#define QSPI_CLOCKS
Value:
{ \
kCLOCK_Qspi \
}
#define kCLOCK_Osc0ErClk   kCLOCK_ErClk
#define kCLOCK_Er32kClk   kCLOCK_Osc32kClk
#define CLOCK_GetOsc0ErClkFreq   CLOCK_GetErClkFreq
#define CLOCK_GetEr32kClkFreq   CLOCK_GetOsc32kClkFreq

Enumeration Type Documentation

Enumerator
kCLOCK_CoreSysClk 

Core/system clock.

kCLOCK_PlatClk 

Platform clock.

kCLOCK_ExtClk 

External clock.

kCLOCK_BusClk 

Bus clock.

kCLOCK_SlowClk 

Slow clock.

kCLOCK_ScgSysOscClk 

SCG system OSC clock.

(SYSOSC)

kCLOCK_ScgSircClk 

SCG SIRC clock.

kCLOCK_ScgFircClk 

SCG FIRC clock.

kCLOCK_ScgRtcOscClk 

SCG RTC OSC clock.

(ROSC)

kCLOCK_ScgAuxPllClk 

SCG auxiliary PLL clock.

(AUXPLL)

kCLOCK_ScgSysPllClk 

SCG system PLL clock.

(SYSPLL)

kCLOCK_ScgSysOscAsyncDiv1Clk 

SOSCDIV1_CLK.

kCLOCK_ScgSysOscAsyncDiv2Clk 

SOSCDIV2_CLK.

kCLOCK_ScgSysOscAsyncDiv3Clk 

SOSCDIV3_CLK.

kCLOCK_ScgSircAsyncDiv1Clk 

SIRCDIV1_CLK.

kCLOCK_ScgSircAsyncDiv2Clk 

SIRCDIV2_CLK.

kCLOCK_ScgSircAsyncDiv3Clk 

SIRCDIV3_CLK.

kCLOCK_ScgFircAsyncDiv1Clk 

FIRCDIV1_CLK.

kCLOCK_ScgFircAsyncDiv2Clk 

FIRCDIV2_CLK.

kCLOCK_ScgFircAsyncDiv3Clk 

FIRCDIV3_CLK.

kCLOCK_ScgSysPllPfd0Clk 

spll pfd0.

kCLOCK_ScgSysPllPfd1Clk 

spll pfd1.

kCLOCK_ScgSysPllPfd2Clk 

spll pfd2.

kCLOCK_ScgSysPllPfd3Clk 

spll pfd3.

kCLOCK_ScgAuxPllPfd0Clk 

apll pfd0.

kCLOCK_ScgAuxPllPfd1Clk 

apll pfd1.

kCLOCK_ScgAuxPllPfd2Clk 

apll pfd2.

kCLOCK_ScgAuxPllPfd3Clk 

apll pfd3.

kCLOCK_ScgSysPllAsyncDiv1Clk 

SPLLDIV1_CLK.

kCLOCK_ScgSysPllAsyncDiv2Clk 

SPLLDIV2_CLK.

kCLOCK_ScgSysPllAsyncDiv3Clk 

SPLLDIV3_CLK.

kCLOCK_ScgAuxPllAsyncDiv1Clk 

APLLDIV1_CLK.

kCLOCK_ScgAuxPllAsyncDiv2Clk 

APLLDIV2_CLK.

kCLOCK_ScgAuxPllAsyncDiv3Clk 

APLLDIV3_CLK.

kCLOCK_LpoClk 

LPO clock.

kCLOCK_Osc32kClk 

External OSC 32K clock (OSC32KCLK)

kCLOCK_ErClk 

ERCLK.

The external reference clock from SCG.

kCLOCK_LvdsClk 

LVDS pad input clock frequency.

Enumerator
kCLOCK_IpSrcNone 

Clock is off.

kCLOCK_IpSrcSysOscAsync 

SYSOSC platform or bus clock, depending on clock IP.

kCLOCK_IpSrcSircAsync 

SIRC platform or bus clock, depending on clock IP.

kCLOCK_IpSrcFircAsync 

FIRC platform or bus clock, depending on clock IP.

kCLOCK_IpSrcRtcAuxPllAsync 

RTC OSC clock or AUXPLL main clock, depending on clock IP.

kCLOCK_IpSrcSystem 

System platform or bus clock, depending on clock IP.

kCLOCK_IpSrcSysPllAsync 

SYSPLL platform or bus clock, depending on clock IP.

kCLOCK_IpSrcPllPfdAsync 

SYSPLL PFD3 or AUXPLL PFD0 clock, depending on clock IP.

Enumerator
kCLOCK_LptmrSrcSircAsync 

SIRC clock.

kCLOCK_LptmrSrcLPO1K 

LPO 1KHz clock.

kCLOCK_LptmrSrcXTAL32K 

RTC XTAL clock.

kCLOCK_LptmrSrcExternal 

External clock.

It is defined as the corresponding register address.

anonymous enum
Enumerator
kStatus_SCG_Busy 

Clock is busy.

kStatus_SCG_InvalidSrc 

Invalid source.

Enumerator
kSCG_SysClkSlow 

System slow clock.

kSCG_SysClkBus 

Bus clock.

kSCG_SysClkExt 

External clock.

kSCG_SysClkPlat 

Platform clock.

kSCG_SysClkCore 

Core clock.

Enumerator
kSCG_SysClkSrcSysOsc 

System OSC.

kSCG_SysClkSrcSirc 

Slow IRC.

kSCG_SysClkSrcFirc 

Fast IRC.

kSCG_SysClkSrcRosc 

RTC OSC.

kSCG_SysClkSrcAuxPll 

Auxiliary PLL.

kSCG_SysClkSrcSysPll 

System PLL.

Enumerator
kSCG_SysClkDivBy1 

Divided by 1.

kSCG_SysClkDivBy2 

Divided by 2.

kSCG_SysClkDivBy3 

Divided by 3.

kSCG_SysClkDivBy4 

Divided by 4.

kSCG_SysClkDivBy5 

Divided by 5.

kSCG_SysClkDivBy6 

Divided by 6.

kSCG_SysClkDivBy7 

Divided by 7.

kSCG_SysClkDivBy8 

Divided by 8.

kSCG_SysClkDivBy9 

Divided by 9.

kSCG_SysClkDivBy10 

Divided by 10.

kSCG_SysClkDivBy11 

Divided by 11.

kSCG_SysClkDivBy12 

Divided by 12.

kSCG_SysClkDivBy13 

Divided by 13.

kSCG_SysClkDivBy14 

Divided by 14.

kSCG_SysClkDivBy15 

Divided by 15.

kSCG_SysClkDivBy16 

Divided by 16.

Enumerator
kClockClkoutSelScgExt 

SCG external clock.

kClockClkoutSelSysOsc 

System OSC.

kClockClkoutSelSirc 

Slow IRC.

kClockClkoutSelFirc 

Fast IRC.

kClockClkoutSelScgRtcOsc 

SCG RTC OSC clock.

kClockClkoutSelScgAuxPll 

SCG Auxiliary PLL clock.

kClockClkoutSelSysPll 

System PLL.

Enumerator
kSCG_AsyncDiv1Clk 

The async clock by DIV1, e.g.

SOSCDIV1_CLK, SIRCDIV1_CLK.

kSCG_AsyncDiv2Clk 

The async clock by DIV2, e.g.

SOSCDIV2_CLK, SIRCDIV2_CLK.

kSCG_AsyncDiv3Clk 

The async clock by DIV3, e.g.

SOSCDIV3_CLK, SIRCDIV3_CLK.

Enumerator
kSCG_AsyncClkDisable 

Clock output is disabled.

kSCG_AsyncClkDivBy1 

Divided by 1.

kSCG_AsyncClkDivBy2 

Divided by 2.

kSCG_AsyncClkDivBy4 

Divided by 4.

kSCG_AsyncClkDivBy8 

Divided by 8.

kSCG_AsyncClkDivBy16 

Divided by 16.

kSCG_AsyncClkDivBy32 

Divided by 32.

kSCG_AsyncClkDivBy64 

Divided by 64.

Enumerator
kSCG_SysOscMonitorDisable 

Monitor disabled.

kSCG_SysOscMonitorInt 

Interrupt when the system OSC error is detected.

kSCG_SysOscMonitorReset 

Reset when the system OSC error is detected.

Enumerator
kSCG_SysOscModeExt 

Use external clock.

kSCG_SysOscModeOscLowPower 

Oscillator low power.

kSCG_SysOscModeOscHighGain 

Oscillator high gain.

Enumerator
kSCG_SysOscEnable 

Enable OSC clock.

kSCG_SysOscEnableInStop 

Enable OSC in stop mode.

kSCG_SysOscEnableInLowPower 

Enable OSC in low power mode.

Enumerator
kSCG_SircRangeLow 

Slow IRC low range clock (2 MHz, 4 MHz for i.MX 7ULP).

kSCG_SircRangeHigh 

Slow IRC high range clock (8 MHz, 16 MHz for i.MX 7ULP).

Enumerator
kSCG_SircEnable 

Enable SIRC clock.

kSCG_SircEnableInStop 

Enable SIRC in stop mode.

kSCG_SircEnableInLowPower 

Enable SIRC in low power mode.

Enumerator
kSCG_FircTrimNonUpdate 

FIRC trim enable but not enable trim value update.

In this mode, the trim value is fixed to the initialized value which is defined by trimCoar and trimFine in configure structure scg_firc_trim_config_t.

kSCG_FircTrimUpdate 

FIRC trim enable and trim value update enable.

In this mode, the trim value is auto update.

Enumerator
kSCG_FircTrimDivBy1 

Divided by 1.

kSCG_FircTrimDivBy128 

Divided by 128.

kSCG_FircTrimDivBy256 

Divided by 256.

kSCG_FircTrimDivBy512 

Divided by 512.

kSCG_FircTrimDivBy1024 

Divided by 1024.

kSCG_FircTrimDivBy2048 

Divided by 2048.

Enumerator
kSCG_FircTrimSrcUsb0 

USB0 start of frame (1kHz).

kSCG_FircTrimSrcUsb1 

USB1 start of frame (1kHz).

kSCG_FircTrimSrcSysOsc 

System OSC.

kSCG_FircTrimSrcRtcOsc 

RTC OSC (32.768 kHz).

Enumerator
kSCG_FircRange48M 

Fast IRC is trimmed to 48 MHz.

kSCG_FircRange52M 

Fast IRC is trimmed to 52 MHz.

kSCG_FircRange56M 

Fast IRC is trimmed to 56 MHz.

kSCG_FircRange60M 

Fast IRC is trimmed to 60 MHz.

Enumerator
kSCG_FircEnable 

Enable FIRC clock.

kSCG_FircEnableInStop 

Enable FIRC in stop mode.

Enumerator
kSCG_SysPllSrcSysOsc 

System PLL clock source is system OSC.

kSCG_SysPllSrcFirc 

System PLL clock source is fast IRC.

Enumerator
kSCG_SysPllEnable 

Enable SPLL clock.

kSCG_SysPllEnableInStop 

Enable SPLL in stop mode.

Enumerator
kSCG_SysPllPfd0Clk 

PFD0 output clock selected.

kSCG_SysPllPfd1Clk 

PFD1 output clock selected.

kSCG_SysPllPfd2Clk 

PFD2 output clock selected.

kSCG_SysPllPfd3Clk 

PFD3 output clock selected.

Enumerator
kSCG_rtcOscMonitorDisable 

Monitor disable.

kSCG_rtcOscMonitorInt 

Interrupt when the RTC OSC error is detected.

kSCG_rtcOscMonitorReset 

Reset when the RTC OSC error is detected.

Enumerator
kSCG_AuxPllSrcSysOsc 

Auxiliary PLL clock source is the system OSC.

kSCG_AuxPllSrcFirc 

Auxiliary PLL clock source is the fast IRC.

Enumerator
kSCG_AuxPllEnable 

Enable APLL clock.

kSCG_AuxPllEnableInStop 

Enable APLL in stop mode.

Enumerator
kSCG_AuxPllPfd0Clk 

PFD0 output clock selected.

kSCG_AuxPllPfd1Clk 

PFD1 output clock selected.

kSCG_AuxPllPfd2Clk 

PFD2 output clock selected.

kSCG_AuxPllPfd3Clk 

PFD3 output clock selected.

Function Documentation

static void CLOCK_EnableClock ( clock_ip_name_t  name)
inlinestatic
Parameters
nameWhich clock to enable, see clock_ip_name_t.
static void CLOCK_DisableClock ( clock_ip_name_t  name)
inlinestatic
Parameters
nameWhich clock to disable, see clock_ip_name_t.
static bool CLOCK_IsEnabledByOtherCore ( clock_ip_name_t  name)
inlinestatic
Parameters
nameWhich peripheral to check, see clock_ip_name_t.
Returns
True if clock is already enabled, otherwise false.
static void CLOCK_SetIpSrc ( clock_ip_name_t  name,
clock_ip_src_t  src 
)
inlinestatic

Set the clock source for specific IP, not all modules need to set the clock source, should only use this function for the modules need source setting.

Parameters
nameWhich peripheral to check, see clock_ip_name_t.
srcClock source to set.
static void CLOCK_SetIpSrcDiv ( clock_ip_name_t  name,
clock_ip_src_t  src,
uint8_t  divValue,
uint8_t  fracValue 
)
inlinestatic

Set the clock source and divider for specific IP, not all modules need to set the clock source and divider, should only use this function for the modules need source and divider setting.

Divider output clock = Divider input clock x [(fracValue+1)/(divValue+1)]).

Parameters
nameWhich peripheral to check, see clock_ip_name_t.
srcClock source to set.
divValueThe divider value.
fracValueThe fraction multiply value.
uint32_t CLOCK_GetFreq ( clock_name_t  clockName)

This function checks the current clock configurations and then calculates the clock frequency for a specific clock name defined in clock_name_t.

Parameters
clockNameClock names defined in clock_name_t
Returns
Clock frequency value in hertz
uint32_t CLOCK_GetCoreSysClkFreq ( void  )
Returns
Clock frequency in Hz.
uint32_t CLOCK_GetPlatClkFreq ( void  )
Returns
Clock frequency in Hz.
uint32_t CLOCK_GetExtClkFreq ( void  )
Returns
Clock frequency in Hz.
uint32_t CLOCK_GetBusClkFreq ( void  )
Returns
Clock frequency in Hz.
uint32_t CLOCK_GetSlowClkFreq ( void  )
Returns
Clock frequency in Hz.
uint32_t CLOCK_GetOsc32kClkFreq ( void  )
Returns
Clock frequency in Hz.
uint32_t CLOCK_GetErClkFreq ( void  )
Returns
Clock frequency in Hz.
uint32_t CLOCK_GetLvdsClkFreq ( void  )
Returns
Clock frequency in Hz.
uint32_t CLOCK_GetIpFreq ( clock_ip_name_t  name)

This function gets the IP module clock frequency based on PCC registers. It is only used for the IP modules which could select clock source by PCC[PCS].

Parameters
nameWhich peripheral to get, see clock_ip_name_t.
Returns
Clock frequency value in hertz
uint32_t CLOCK_GetSysClkFreq ( scg_sys_clk_t  type)

This function gets the SCG system clock frequency. These clocks are used for core, platform, external, and bus clock domains.

Parameters
typeWhich type of clock to get, core clock or slow clock.
Returns
Clock frequency.
static void CLOCK_SetVlprModeSysClkConfig ( const scg_sys_clk_config_t config)
inlinestatic

This function sets the system clock configuration for VLPR mode.

Parameters
configPointer to the configuration.
static void CLOCK_SetRunModeSysClkConfig ( const scg_sys_clk_config_t config)
inlinestatic

This function sets the system clock configuration for RUN mode.

Parameters
configPointer to the configuration.
static void CLOCK_SetHsrunModeSysClkConfig ( const scg_sys_clk_config_t config)
inlinestatic

This function sets the system clock configuration for HSRUN mode.

Parameters
configPointer to the configuration.
static void CLOCK_GetCurSysClkConfig ( scg_sys_clk_config_t config)
inlinestatic

This function gets the system configuration in the current power mode.

Parameters
configPointer to the configuration.
static void CLOCK_SetClkOutSel ( clock_clkout_src_t  setting)
inlinestatic

This function sets the clock out selection (CLKOUTSEL).

Parameters
settingThe selection to set.
Returns
The current clock out selection.
status_t CLOCK_InitSysOsc ( const scg_sosc_config_t config)

This function enables the SCG system OSC clock according to the configuration.

Parameters
configPointer to the configuration structure.
Return values
kStatus_SuccessSystem OSC is initialized.
kStatus_SCG_BusySystem OSC has been enabled and is used by the system clock.
kStatus_ReadOnlySystem OSC control register is locked.
Note
This function can't detect whether the system OSC has been enabled and used by an IP.
status_t CLOCK_DeinitSysOsc ( void  )

This function disables the SCG system OSC clock.

Return values
kStatus_SuccessSystem OSC is deinitialized.
kStatus_SCG_BusySystem OSC is used by the system clock.
kStatus_ReadOnlySystem OSC control register is locked.
Note
This function can't detect whether the system OSC is used by an IP.
static void CLOCK_SetSysOscAsyncClkDiv ( scg_async_clk_t  asyncClk,
scg_async_clk_div_t  divider 
)
inlinestatic
Parameters
asyncClkWhich asynchronous clock to configure.
dividerThe divider value to set.
Note
There might be glitch when changing the asynchronous divider, so make sure the asynchronous clock is not used while changing divider.
uint32_t CLOCK_GetSysOscFreq ( void  )
Returns
Clock frequency; If the clock is invalid, returns 0.
uint32_t CLOCK_GetSysOscAsyncFreq ( scg_async_clk_t  type)
Parameters
typeThe asynchronous clock type.
Returns
Clock frequency; If the clock is invalid, returns 0.
static bool CLOCK_IsSysOscErr ( void  )
inlinestatic
Returns
True if the error occurs, false if not.
static void CLOCK_SetSysOscMonitorMode ( scg_sosc_monitor_mode_t  mode)
inlinestatic

This function sets the system OSC monitor mode. The mode can be disabled, it can generate an interrupt when the error is disabled, or reset when the error is detected.

Parameters
modeMonitor mode to set.
static bool CLOCK_IsSysOscValid ( void  )
inlinestatic
Returns
True if clock is valid, false if not.
status_t CLOCK_InitSirc ( const scg_sirc_config_t config)

This function enables the SCG slow IRC clock according to the configuration.

Parameters
configPointer to the configuration structure.
Return values
kStatus_SuccessSIRC is initialized.
kStatus_SCG_BusySIRC has been enabled and is used by system clock.
kStatus_ReadOnlySIRC control register is locked.
Note
This function can't detect whether the system OSC has been enabled and used by an IP.
status_t CLOCK_DeinitSirc ( void  )

This function disables the SCG slow IRC.

Return values
kStatus_SuccessSIRC is deinitialized.
kStatus_SCG_BusySIRC is used by system clock.
kStatus_ReadOnlySIRC control register is locked.
Note
This function can't detect whether the SIRC is used by an IP.
static void CLOCK_SetSircAsyncClkDiv ( scg_async_clk_t  asyncClk,
scg_async_clk_div_t  divider 
)
inlinestatic
Parameters
asyncClkWhich asynchronous clock to configure.
dividerThe divider value to set.
Note
There might be glitch when changing the asynchronous divider, so make sure the asynchronous clock is not used while changing divider.
static void CLOCK_EnableLpoPowerOption ( bool  enable)
inlinestatic

This function enables/disables the SCG slow IRC 1khz LPO clock in LLS/VLLSx modes.

Parameters
enableSwitcher of LPO Power Option which controls whether the 1 kHz LPO clock is enabled in LLS/VLLSx modes. "true" means to enable, "false" means not enabled.
uint32_t CLOCK_GetSircFreq ( void  )
Returns
Clock frequency; If the clock is invalid, returns 0.
uint32_t CLOCK_GetSircAsyncFreq ( scg_async_clk_t  type)
Parameters
typeThe asynchronous clock type.
Returns
Clock frequency; If the clock is invalid, returns 0.
static bool CLOCK_IsSircValid ( void  )
inlinestatic
Returns
True if clock is valid, false if not.
status_t CLOCK_InitFirc ( const scg_firc_config_t config)

This function enables the SCG fast IRC clock according to the configuration.

Parameters
configPointer to the configuration structure.
Return values
kStatus_SuccessFIRC is initialized.
kStatus_SCG_BusyFIRC has been enabled and is used by the system clock.
kStatus_ReadOnlyFIRC control register is locked.
Note
This function can't detect whether the FIRC has been enabled and used by an IP.
status_t CLOCK_DeinitFirc ( void  )

This function disables the SCG fast IRC.

Return values
kStatus_SuccessFIRC is deinitialized.
kStatus_SCG_BusyFIRC is used by the system clock.
kStatus_ReadOnlyFIRC control register is locked.
Note
This function can't detect whether the FIRC is used by an IP.
static void CLOCK_SetFircAsyncClkDiv ( scg_async_clk_t  asyncClk,
scg_async_clk_div_t  divider 
)
inlinestatic
Parameters
asyncClkWhich asynchronous clock to configure.
dividerThe divider value to set.
Note
There might be glitch when changing the asynchronous divider, so make sure the asynchronous clock is not used while changing divider.
uint32_t CLOCK_GetFircFreq ( void  )
Returns
Clock frequency; If the clock is invalid, returns 0.
uint32_t CLOCK_GetFircAsyncFreq ( scg_async_clk_t  type)
Parameters
typeThe asynchronous clock type.
Returns
Clock frequency; If the clock is invalid, returns 0.
static bool CLOCK_IsFircErr ( void  )
inlinestatic
Returns
True if the error occurs, false if not.
static bool CLOCK_IsFircValid ( void  )
inlinestatic
Returns
True if clock is valid, false if not.
uint32_t CLOCK_GetRtcOscFreq ( void  )
Returns
Clock frequency; If the clock is invalid, returns 0.
static bool CLOCK_IsRtcOscErr ( void  )
inlinestatic
Returns
True if error occurs, false if not.
static void CLOCK_SetRtcOscMonitorMode ( scg_rosc_monitor_mode_t  mode)
inlinestatic

This function sets the RTC OSC monitor mode. The mode can be disabled. It can generate an interrupt when the error is disabled, or reset when the error is detected.

Parameters
modeMonitor mode to set.
static bool CLOCK_IsRtcOscValid ( void  )
inlinestatic
Returns
True if the clock is valid, false if not.

Variable Documentation

volatile uint32_t g_xtal0Freq

The XTAL0/EXTAL0 (OSC0/SYSOSC) clock frequency in Hz. When the clock is set up, use the function CLOCK_SetXtal0Freq to set the value in the clock driver. For example, if XTAL0 is 8 MHz:

* CLOCK_SetXtal0Freq(80000000);
*

This is important for the multicore platforms where only one core needs to set up the OSC0/SYSOSC using CLOCK_InitSysOsc. All other cores need to call the CLOCK_SetXtal0Freq to get a valid clock frequency.

volatile uint32_t g_xtal32Freq

The XTAL32/EXTAL32 clock frequency in Hz. When the clock is set up, use the function CLOCK_SetXtal32Freq to set the value in the clock driver.

This is important for the multicore platforms where only one core needs to set up the clock. All other cores need to call the CLOCK_SetXtal32Freq to get a valid clock frequency.

volatile uint32_t g_lvdsFreq

The LVDS pad clock frequency in Hz. When the clock is set up, use the function CLOCK_SetLvdsFreq to set the value in the clock driver.