Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
fsl_clock.h File Reference
Go to the source code of this file.
Data Structures | |
| struct | _sim_clock_config |
| SIM configuration structure for clock setting. More... | |
| struct | _oscer_config |
| OSC configuration for OSCERCLK. More... | |
| struct | _osc_config |
| OSC Initialization Configuration Structure. More... | |
| struct | _mcg_pll_config |
| MCG PLL configuration. More... | |
| struct | _mcg_config |
| MCG configure structure for mode change. More... | |
Typedefs | |
| typedef enum _clock_name | clock_name_t |
| Clock name used to get clock frequency. | |
| typedef enum _clock_usb_src | clock_usb_src_t |
| USB clock source definition. | |
| typedef enum _clock_ip_name | clock_ip_name_t |
| Clock gate name used for CLOCK_EnableClock/CLOCK_DisableClock. | |
| typedef struct _sim_clock_config | sim_clock_config_t |
| SIM configuration structure for clock setting. | |
| typedef enum _osc_mode | osc_mode_t |
| OSC work mode. | |
| typedef struct _oscer_config | oscer_config_t |
| OSC configuration for OSCERCLK. | |
| typedef struct _osc_config | osc_config_t |
| OSC Initialization Configuration Structure. | |
| typedef enum _mcg_fll_src | mcg_fll_src_t |
| MCG FLL reference clock source select. | |
| typedef enum _mcg_irc_mode | mcg_irc_mode_t |
| MCG internal reference clock select. | |
| typedef enum _mcg_dmx32 | mcg_dmx32_t |
| MCG DCO Maximum Frequency with 32.768 kHz Reference. | |
| typedef enum _mcg_drs | mcg_drs_t |
| MCG DCO range select. | |
| typedef enum _mcg_pll_ref_src | mcg_pll_ref_src_t |
| MCG PLL reference clock select. | |
| typedef enum _mcg_clkout_src | mcg_clkout_src_t |
| MCGOUT clock source. | |
| typedef enum _mcg_atm_select | mcg_atm_select_t |
| MCG Automatic Trim Machine Select. | |
| typedef enum _mcg_oscsel | mcg_oscsel_t |
| MCG OSC Clock Select. | |
| typedef enum _mcg_pll_clk_select | mcg_pll_clk_select_t |
| MCG PLLCS select. | |
| typedef enum _mcg_monitor_mode | mcg_monitor_mode_t |
| MCG clock monitor mode. | |
| typedef enum _mcg_mode | mcg_mode_t |
| MCG mode definitions. | |
| typedef struct _mcg_pll_config | mcg_pll_config_t |
| MCG PLL configuration. | |
| typedef struct _mcg_config | mcg_config_t |
| MCG configure structure for mode change. | |
Enumerations | |
| enum | _clock_name { kCLOCK_CoreSysClk, kCLOCK_PlatClk, kCLOCK_BusClk, kCLOCK_FlexBusClk, kCLOCK_FlashClk, kCLOCK_FastPeriphClk, kCLOCK_PllFllSelClk, kCLOCK_Er32kClk, kCLOCK_Osc0ErClk, kCLOCK_Osc1ErClk, kCLOCK_Osc0ErClkUndiv, kCLOCK_McgFixedFreqClk, kCLOCK_McgInternalRefClk, kCLOCK_McgFllClk, kCLOCK_McgPll0Clk, kCLOCK_McgPll1Clk, kCLOCK_McgExtPllClk, kCLOCK_McgPeriphClk, kCLOCK_McgIrc48MClk, kCLOCK_LpoClk } |
Clock name used to get clock frequency. More... | |
| enum | _clock_usb_src { kCLOCK_UsbSrcPll0 = SIM_SOPT2_USBSRC(1U) | SIM_SOPT2_PLLFLLSEL(1U), kCLOCK_UsbSrcUsbPfd = SIM_SOPT2_USBSRC(1U) | SIM_SOPT2_PLLFLLSEL(2U), kCLOCK_UsbSrcIrc48M = SIM_SOPT2_USBSRC(1U) | SIM_SOPT2_PLLFLLSEL(3U), kCLOCK_UsbSrcExt = SIM_SOPT2_USBSRC(0U) } |
USB clock source definition. More... | |
| enum | _clock_ip_name |
Clock gate name used for CLOCK_EnableClock/CLOCK_DisableClock. More... | |
| enum | _osc_mode { kOSC_ModeExt = 0U, kOSC_ModeOscLowPower = MCG_C2_EREFS_MASK, kOSC_ModeOscLowPower = MCG_C2_EREFS_MASK, kOSC_ModeOscHighGain, MCG_C2_HGO0_MASK } |
OSC work mode. More... | |
| enum | _osc_cap_load { kOSC_Cap2P = OSC_CR_SC2P_MASK, kOSC_Cap4P = OSC_CR_SC4P_MASK, kOSC_Cap8P = OSC_CR_SC8P_MASK, kOSC_Cap16P = OSC_CR_SC16P_MASK } |
Oscillator capacitor load setting. More... | |
| enum | _oscer_enable_mode { kOSC_ErClkEnable = OSC_CR_ERCLKEN_MASK, kOSC_ErClkEnableInStop = OSC_CR_EREFSTEN_MASK } |
OSCERCLK enable mode. More... | |
| enum | _mcg_fll_src { kMCG_FllSrcExternal, kMCG_FllSrcInternal } |
MCG FLL reference clock source select. More... | |
| enum | _mcg_irc_mode { kMCG_IrcSlow, kMCG_IrcFast } |
MCG internal reference clock select. More... | |
| enum | _mcg_dmx32 { kMCG_Dmx32Default, kMCG_Dmx32Fine } |
MCG DCO Maximum Frequency with 32.768 kHz Reference. More... | |
| enum | _mcg_drs { kMCG_DrsLow, kMCG_DrsMid, kMCG_DrsMidHigh, kMCG_DrsHigh } |
MCG DCO range select. More... | |
| enum | _mcg_pll_ref_src { kMCG_PllRefOsc0, kMCG_PllRefOsc1 } |
MCG PLL reference clock select. More... | |
| enum | _mcg_clkout_src { kMCG_ClkOutSrcOut, kMCG_ClkOutSrcInternal, kMCG_ClkOutSrcExternal } |
MCGOUT clock source. More... | |
| enum | _mcg_atm_select { kMCG_AtmSel32k, kMCG_AtmSel4m } |
MCG Automatic Trim Machine Select. More... | |
| enum | _mcg_oscsel { kMCG_OscselOsc, kMCG_OscselRtc, kMCG_OscselIrc } |
MCG OSC Clock Select. More... | |
| enum | _mcg_pll_clk_select { kMCG_PllClkSelPll0 } |
MCG PLLCS select. More... | |
| enum | _mcg_monitor_mode { kMCG_MonitorNone, kMCG_MonitorInt, kMCG_MonitorReset } |
MCG clock monitor mode. More... | |
| enum | _mcg_status { kStatus_MCG_ModeUnreachable = MAKE_STATUS(kStatusGroup_MCG, 0), kStatus_MCG_ModeInvalid = MAKE_STATUS(kStatusGroup_MCG, 1), kStatus_MCG_AtmBusClockInvalid = MAKE_STATUS(kStatusGroup_MCG, 2), kStatus_MCG_AtmDesiredFreqInvalid = MAKE_STATUS(kStatusGroup_MCG, 3), kStatus_MCG_AtmIrcUsed = MAKE_STATUS(kStatusGroup_MCG, 4), kStatus_MCG_AtmHardwareFail = MAKE_STATUS(kStatusGroup_MCG, 5), kStatus_MCG_SourceUsed = MAKE_STATUS(kStatusGroup_MCG, 6) } |
MCG status. More... | |
| enum | _mcg_status_flags_t { kMCG_Osc0LostFlag = (1U << 0U), kMCG_Osc0InitFlag = (1U << 1U), kMCG_RtcOscLostFlag = (1U << 4U), kMCG_Pll0LostFlag = (1U << 5U), kMCG_Pll0LockFlag = (1U << 6U), kMCG_ExtPllLostFlag = (1U << 9U) } |
MCG status flags. More... | |
| enum | _mcg_irclk_enable_mode { kMCG_IrclkEnable = MCG_C1_IRCLKEN_MASK, kMCG_IrclkEnableInStop = MCG_C1_IREFSTEN_MASK } |
MCG internal reference clock (MCGIRCLK) enable mode definition. More... | |
| enum | _mcg_pll_enable_mode { kMCG_PllEnableIndependent = MCG_C5_PLLCLKEN0_MASK, kMCG_PllEnableInStop = MCG_C5_PLLSTEN0_MASK } |
MCG PLL clock enable mode definition. More... | |
| enum | _mcg_mode { kMCG_ModeFEI = 0U, kMCG_ModeFBI, kMCG_ModeBLPI, kMCG_ModeFEE, kMCG_ModeFBE, kMCG_ModeBLPE, kMCG_ModePBE, kMCG_ModePEE, kMCG_ModeError } |
MCG mode definitions. More... | |
Functions | |
| static void | CLOCK_EnableClock (clock_ip_name_t name) |
| Enable the clock for specific IP. | |
| static void | CLOCK_DisableClock (clock_ip_name_t name) |
| Disable the clock for specific IP. | |
| static void | CLOCK_SetEr32kClock (uint32_t src) |
| Set ERCLK32K source. | |
| static void | CLOCK_SetSdhc0Clock (uint32_t src) |
| Set SDHC0 clock source. | |
| static void | CLOCK_SetLpuartClock (uint32_t src) |
| Set LPUART clock source. | |
| static void | CLOCK_SetTpmClock (uint32_t src) |
| Set TPM clock source. | |
| static void | CLOCK_SetTraceClock (uint32_t src, uint32_t divValue, uint32_t fracValue) |
| Set debug trace clock source. | |
| static void | CLOCK_SetPllFllSelClock (uint32_t src, uint32_t divValue, uint32_t fracValue) |
| Set PLLFLLSEL clock source. | |
| static void | CLOCK_SetClkOutClock (uint32_t src) |
| Set CLKOUT source. | |
| static void | CLOCK_SetRtcClkOutClock (uint32_t src) |
| Set RTC_CLKOUT source. | |
| bool | CLOCK_EnableUsbhs0Clock (clock_usb_src_t src, uint32_t freq) |
| Enable USB HS clock. | |
| static void | CLOCK_DisableUsbhs0Clock (void) |
| bool | CLOCK_EnableUsbfs0Clock (clock_usb_src_t src, uint32_t freq) |
| Enable USB FS clock. | |
| static void | CLOCK_DisableUsbfs0Clock (void) |
| static void | CLOCK_SetOutDiv (uint32_t outdiv1, uint32_t outdiv2, uint32_t outdiv3, uint32_t outdiv4) |
| System clock divider. | |
| uint32_t | CLOCK_GetFreq (clock_name_t clockName) |
| Gets the clock frequency for a specific clock name. | |
| uint32_t | CLOCK_GetCoreSysClkFreq (void) |
| Get the core clock or system clock frequency. | |
| uint32_t | CLOCK_GetPlatClkFreq (void) |
| Get the platform clock frequency. | |
| uint32_t | CLOCK_GetBusClkFreq (void) |
| Get the bus clock frequency. | |
| uint32_t | CLOCK_GetFlexBusClkFreq (void) |
| Get the flexbus clock frequency. | |
| uint32_t | CLOCK_GetFlashClkFreq (void) |
| Get the flash clock frequency. | |
| uint32_t | CLOCK_GetPllFllSelClkFreq (void) |
| Get the output clock frequency selected by SIM[PLLFLLSEL]. | |
| uint32_t | CLOCK_GetEr32kClkFreq (void) |
| Get the external reference 32K clock frequency (ERCLK32K). | |
| uint32_t | CLOCK_GetOsc0ErClkFreq (void) |
| Get the OSC0 external reference clock frequency (OSC0ERCLK). | |
| uint32_t | CLOCK_GetOsc0ErClkUndivFreq (void) |
| Get the OSC0 external reference undivided clock frequency (OSC0ERCLK_UNDIV). | |
| void | CLOCK_SetSimConfig (sim_clock_config_t const *config) |
| Set the clock configure in SIM module. | |
| static void | CLOCK_SetSimSafeDivs (void) |
| Set the system clock dividers in SIM to safe value. | |
MCG frequency functions. | |
| uint32_t | CLOCK_GetOutClkFreq (void) |
| Get the MCG output clock(MCGOUTCLK) frequency. | |
| uint32_t | CLOCK_GetFllFreq (void) |
| Get the MCG FLL clock(MCGFLLCLK) frequency. | |
| uint32_t | CLOCK_GetInternalRefClkFreq (void) |
| Get the MCG internal reference clock(MCGIRCLK) frequency. | |
| uint32_t | CLOCK_GetFixedFreqClkFreq (void) |
| Get the MCG fixed frequency clock(MCGFFCLK) frequency. | |
| uint32_t | CLOCK_GetPll0Freq (void) |
| Get the MCG PLL0 clock(MCGPLL0CLK) frequency. | |
| uint32_t | CLOCK_GetExtPllFreq (void) |
| Get the MCG external PLL frequency. | |
| void | CLOCK_SetExtPllFreq (uint32_t freq) |
| Set the MCG external PLL frequency. | |
MCG clock configuration. | |
| static void | CLOCK_SetLowPowerEnable (bool enable) |
| Enable or disable MCG low power. | |
| status_t | CLOCK_SetInternalRefClkConfig (uint8_t enableMode, mcg_irc_mode_t ircs, uint8_t fcrdiv) |
| Configure the Internal Reference clock (MCGIRCLK) | |
| status_t | CLOCK_SetExternalRefClkConfig (mcg_oscsel_t oscsel) |
| Select the MCG external reference clock. | |
| void | CLOCK_EnablePll0 (mcg_pll_config_t const *config) |
| Enables the PLL0 in FLL mode. | |
| static void | CLOCK_DisablePll0 (void) |
| Disables the PLL0 in FLL mode. | |
| uint32_t | CLOCK_CalcPllDiv (uint32_t refFreq, uint32_t desireFreq, uint8_t *prdiv, uint8_t *vdiv) |
| Calculates the PLL divider setting for desired output frequency. | |
MCG clock lock monitor functions. | |
| void | CLOCK_SetOsc0MonitorMode (mcg_monitor_mode_t mode) |
| Set the OSC0 clock monitor mode. | |
| void | CLOCK_SetRtcOscMonitorMode (mcg_monitor_mode_t mode) |
| Set the RTC OSC clock monitor mode. | |
| void | CLOCK_SetPll0MonitorMode (mcg_monitor_mode_t mode) |
| Set the PLL0 clock monitor mode. | |
| void | CLOCK_SetExtPllMonitorMode (mcg_monitor_mode_t mode) |
| Set the external PLL clock monitor mode. | |
| uint32_t | CLOCK_GetStatusFlags (void) |
| Get the MCG status flags. | |
| void | CLOCK_ClearStatusFlags (uint32_t mask) |
| Clears the MCG status flags. | |
OSC configuration | |
| static void | OSC_SetExtRefClkConfig (OSC_Type *base, oscer_config_t const *config) |
| Configures the OSC external reference clock (OSCERCLK). | |
| static void | OSC_SetCapLoad (OSC_Type *base, uint8_t capLoad) |
| Sets the capacitor load configuration for the oscillator. | |
| void | CLOCK_InitOsc0 (osc_config_t const *config) |
| Initialize OSC0. | |
| void | CLOCK_DeinitOsc0 (void) |
| Deinitialize OSC0. | |
External clock frequency | |
| static void | CLOCK_SetXtal0Freq (uint32_t freq) |
| Set the XTAL0 frequency based on board setting. | |
| static void | CLOCK_SetXtal32Freq (uint32_t freq) |
| Set the XTAL32/RTC_CLKIN frequency based on board setting. | |
MCG auto-trim machine. | |
| status_t | CLOCK_TrimInternalRefClk (uint32_t extFreq, uint32_t desireFreq, uint32_t *actualFreq, mcg_atm_select_t atms) |
| Auto trim the internal reference clock. | |
MCG mode functions. | |
| mcg_mode_t | CLOCK_GetMode (void) |
| Gets the current MCG mode. | |
| status_t | CLOCK_SetFeiMode (mcg_dmx32_t dmx32, mcg_drs_t drs, void(*fllStableDelay)(void)) |
| Set MCG to FEI mode. | |
| status_t | CLOCK_SetFeeMode (uint8_t frdiv, mcg_dmx32_t dmx32, mcg_drs_t drs, void(*fllStableDelay)(void)) |
| Set MCG to FEE mode. | |
| status_t | CLOCK_SetFbiMode (mcg_dmx32_t dmx32, mcg_drs_t drs, void(*fllStableDelay)(void)) |
| Set MCG to FBI mode. | |
| status_t | CLOCK_SetFbeMode (uint8_t frdiv, mcg_dmx32_t dmx32, mcg_drs_t drs, void(*fllStableDelay)(void)) |
| Set MCG to FBE mode. | |
| status_t | CLOCK_SetBlpiMode (void) |
| Set MCG to BLPI mode. | |
| status_t | CLOCK_SetBlpeMode (void) |
| Set MCG to BLPE mode. | |
| status_t | CLOCK_SetPbeMode (mcg_pll_clk_select_t pllcs, mcg_pll_config_t const *config) |
| Set MCG to PBE mode. | |
| status_t | CLOCK_SetPeeMode (void) |
| Set MCG to PEE mode. | |
| status_t | CLOCK_ExternalModeToFbeModeQuick (void) |
| Switch MCG to FBE mode quickly from external mode. | |
| status_t | CLOCK_InternalModeToFbiModeQuick (void) |
| Switch MCG to FBI mode quickly from internal modes. | |
| status_t | CLOCK_BootToFeiMode (mcg_dmx32_t dmx32, mcg_drs_t drs, void(*fllStableDelay)(void)) |
| Set MCG to FEI mode during system boot up. | |
| status_t | CLOCK_BootToFeeMode (mcg_oscsel_t oscsel, uint8_t frdiv, mcg_dmx32_t dmx32, mcg_drs_t drs, void(*fllStableDelay)(void)) |
| Set MCG to FEE mode during system bootup. | |
| status_t | CLOCK_BootToBlpiMode (uint8_t fcrdiv, mcg_irc_mode_t ircs, uint8_t ircEnableMode) |
| Set MCG to BLPI mode during system boot up. | |
| status_t | CLOCK_BootToBlpeMode (mcg_oscsel_t oscsel) |
| Set MCG to BLPE mode during sytem boot up. | |
| status_t | CLOCK_BootToPeeMode (mcg_oscsel_t oscsel, mcg_pll_clk_select_t pllcs, mcg_pll_config_t const *config) |
| Set MCG to PEE mode during system boot up. | |
| status_t | CLOCK_SetMcgConfig (mcg_config_t const *config) |
| Set MCG to some target mode. | |
Variables | |
| uint32_t | g_xtal0Freq |
| External XTAL0 (OSC0) clock frequency. | |
| uint32_t | g_xtal32Freq |
| External XTAL32/EXTAL32/RTC_CLKIN clock frequency. | |
Detailed Description
Definition in file fsl_clock.h.
Generated on Tue Jul 12 2022 15:37:29 by
1.7.2