MCUXpresso SDK API Reference Manual
Rev. 0
NXP Semiconductors
|
The MCUXpresso SDK provides APIs for MCUXpresso SDK devices' clock operation.
Files | |
file | fsl_clock.h |
Data Structures | |
struct | clock_sys_pll_config_t |
PLL configuration for SYSPLL. More... | |
struct | clock_audio_pll_config_t |
PLL configuration for SYSPLL. More... | |
struct | clock_frg_clk_config_t |
PLL configuration for FRG. More... | |
Macros | |
#define | CMP_CLOCKS |
Clock ip name array for ACMP. More... | |
#define | FLEXCOMM_CLOCKS |
Clock ip name array for FLEXCOMM. More... | |
#define | USART_CLOCKS |
Clock ip name array for LPUART. More... | |
#define | I2C_CLOCKS |
Clock ip name array for I2C. More... | |
#define | I3C_CLOCKS |
Clock ip name array for I3C. More... | |
#define | SPI_CLOCKS |
Clock ip name array for SPI. More... | |
#define | FLEXI2S_CLOCKS |
Clock ip name array for FLEXI2S. More... | |
#define | UTICK_CLOCKS |
Clock ip name array for UTICK. More... | |
#define | DMIC_CLOCKS |
Clock ip name array for DMIC. More... | |
#define | CTIMER_CLOCKS |
Clock ip name array for CT32B. More... | |
#define | GPIO_CLOCKS |
Clock ip name array for GPIO. More... | |
#define | LPADC_CLOCKS |
Clock ip name array for ADC. More... | |
#define | MRT_CLOCKS |
Clock ip name array for MRT. More... | |
#define | SCT_CLOCKS |
Clock ip name array for SCT. More... | |
#define | RTC_CLOCKS |
Clock ip name array for RTC. More... | |
#define | WWDT_CLOCKS |
Clock ip name array for WWDT. More... | |
#define | CRC_CLOCKS |
Clock ip name array for CRC. More... | |
#define | USBD_CLOCKS |
Clock ip name array for USBD. More... | |
#define | DMA_CLOCKS |
Clock ip name array for DMA. More... | |
#define | PINT_CLOCKS |
Clock ip name array for PINT. More... | |
#define | QSPI_CLOCKS |
Clock ip name array for QSPI. | |
#define | MU_CLOCKS |
Clock ip name array for MUA. | |
#define | SEMA42_CLOCKS |
Clock ip name array for SEMA. | |
#define | TRNG_CLOCKS |
Clock ip name array for RNG. | |
#define | USDHC_CLOCKS |
Clock ip name array for uSDHC. | |
#define | OSTIMER_CLOCKS |
Clock ip name array for OSTimer. | |
#define | CLK_GATE_REG_OFFSET_SHIFT 8U |
Clock gate name used for CLOCK_EnableClock/CLOCK_DisableClock. More... | |
#define | SYSPLL0CLKSEL_OFFSET 0x200 |
Clock Mux Switches The encoding is as follows each connection identified is 32bits wide starting from LSB upwards. More... | |
Enumerations | |
enum | clock_ip_name_t |
Clock gate name used for CLOCK_EnableClock/CLOCK_DisableClock. More... | |
enum | clock_name_t { kCLOCK_CoreSysClk, kCLOCK_BusClk, kCLOCK_MclkClk, kCLOCK_ClockOuClk, kCLOCK_AdcClk, kCLOCK_QspiClk, kCLOCK_SctClk, kCLOCK_Wdt0Clk, kCLOCK_Wdt1Clk, kCLOCK_SystickClk, kCLOCK_Sdio0Clk, kCLOCK_I3cClk, kCLOCK_UsbClk, kCLOCK_DmicClk, kCLOCK_DspCpuClk, kCLOCK_AcmpClk, kCLOCK_Flexcomm0, kCLOCK_Flexcomm1, kCLOCK_Flexcomm2, kCLOCK_Flexcomm3, kCLOCK_Flexcomm4, kCLOCK_Flexcomm5, kCLOCK_Flexcomm14, kCLOCK_Flexcomm15 } |
Clock name used to get clock frequency. More... | |
enum | clock_pfd_t { kCLOCK_Pfd0 = 0U, kCLOCK_Pfd1 = 1U, kCLOCK_Pfd2 = 2U, kCLOCK_Pfd3 = 3U } |
Functions | |
void | CLOCK_AttachClk (clock_attach_id_t connection) |
Configure the clock selection muxes. More... | |
void | CLOCK_SetClkDiv (clock_div_name_t div_name, uint32_t divider) |
Setup peripheral clock dividers. More... | |
uint32_t | CLOCK_GetFreq (clock_name_t clockName) |
Return Frequency of selected clock. More... | |
uint32_t | CLOCK_GetFRGClock (uint32_t id) |
Return Input frequency for the Fractional baud rate generator. More... | |
void | CLOCK_SetFRGClock (const clock_frg_clk_config_t *config) |
Set output of the Fractional baud rate generator. More... | |
static uint32_t | CLOCK_GetSFroFreq (void) |
Return Frequency of FRO 16MHz. More... | |
uint32_t | CLOCK_GetSysPllFreq (void) |
Return Frequency of SYSPLL. More... | |
uint32_t | CLOCK_GetSysPfdFreq (clock_pfd_t pfd) |
Get current output frequency of specific System PLL PFD. More... | |
uint32_t | CLOCK_GetAudioPllFreq (void) |
Return Frequency of AUDIO PLL. More... | |
uint32_t | CLOCK_GetAudioPfdFreq (clock_pfd_t pfd) |
Get current output frequency of specific Audio PLL PFD. More... | |
static uint32_t | CLOCK_GetFFroFreq (void) |
Return Frequency of High-Freq output of FRO. More... | |
uint32_t | CLOCK_GetMainClkFreq (void) |
Return Frequency of main clk. More... | |
uint32_t | CLOCK_GetDspMainClkFreq (void) |
Return Frequency of DSP main clk. More... | |
uint32_t | CLOCK_GetAcmpClkFreq (void) |
Return Frequency of ACMP clk. More... | |
uint32_t | CLOCK_GetDmicClkFreq (void) |
Return Frequency of DMIC clk. More... | |
uint32_t | CLOCK_GetUsbClkFreq (void) |
Return Frequency of USB clk. More... | |
uint32_t | CLOCK_GetSdioClkFreq (void) |
Return Frequency of SDIO clk. More... | |
uint32_t | CLOCK_GetI3cClkFreq (void) |
Return Frequency of I3C clk. More... | |
uint32_t | CLOCK_GetSystickClkFreq (void) |
Return Frequency of systick clk. More... | |
uint32_t | CLOCK_GetWdtClkFreq (uint32_t id) |
Return Frequency of WDT clk. More... | |
uint32_t | CLOCK_GetMclkClkFreq (void) |
Return Frequency of mclk. More... | |
uint32_t | CLOCK_GetSctClkFreq (void) |
Return Frequency of sct. More... | |
void | CLOCK_EnableSysOscClk (bool enable, uint32_t delay_us) |
Enable/Disable sys osc clock from external crystal clock. More... | |
static uint32_t | CLOCK_GetXtalInClkFreq (void) |
Return Frequency of sys osc Clock. More... | |
static uint32_t | CLOCK_GetLpOscFreq (void) |
Return Frequency of Lower power osc. More... | |
static uint32_t | CLOCK_GetOsc32KFreq (void) |
Return Frequency of 32kHz osc. More... | |
static void | CLOCK_EnableOsc32K (bool enable) |
Enables and disables 32kHz osc. More... | |
static uint32_t | CLOCK_GetWakeClk32KFreq (void) |
Return Frequency of 32khz wake clk. More... | |
static void | CLOCK_SetXtalFreq (uint32_t freq) |
Set the XTALIN (system OSC) frequency based on board setting. More... | |
static void | CLOCK_SetMclkInFreq (uint32_t freq) |
Set the MCLK in (mclk_in) clock frequency based on pin drive. More... | |
uint32_t | CLOCK_GetMclkInClkFreq (void) |
brief Return Frequency of mclk_in return Frequency of mclk clk Note The pin need associated with MCLK function. | |
uint32_t | CLOCK_GetFlexCommClkFreq (uint32_t id) |
Return Frequency of Flexcomm functional Clock. More... | |
uint32_t | CLOCK_GetCtimerClkFreq (uint32_t id) |
Return Frequency of Ctimer Clock. More... | |
uint32_t | CLOCK_GetClockOutClkFreq (void) |
Return Frequency of ClockOut. More... | |
uint32_t | CLOCK_GetAdcClkFreq (void) |
Return Frequency of Adc Clock. More... | |
uint32_t | CLOCK_GetQspiClkFreq (void) |
Return Frequency of QSPI Clock. More... | |
void | CLOCK_InitSysPll (const clock_sys_pll_config_t *config) |
Initialize the System PLL. More... | |
static void | CLOCK_DeinitSysPll (void) |
brief Deinit the System PLL. More... | |
void | CLOCK_InitSysPfd (clock_pfd_t pfd, uint8_t divider) |
Initialize the System PLL PFD. More... | |
static void | CLOCK_DeinitSysPfd (clock_pfd_t pfd) |
brief Disable the audio PLL PFD. More... | |
void | CLOCK_InitAudioPll (const clock_audio_pll_config_t *config) |
Initialize the audio PLL. More... | |
static void | CLOCK_DeinitAudioPll (void) |
brief Deinit the Audio PLL. More... | |
void | CLOCK_InitAudioPfd (clock_pfd_t pfd, uint8_t divider) |
Initialize the audio PLL PFD. More... | |
static void | CLOCK_DeinitAudioPfd (uint32_t pfd) |
brief Disable the audio PLL PFD. More... | |
void | CLOCK_EnableUsbhsDeviceClock (void) |
Enable USB HS device PLL clock. More... | |
void | CLOCK_EnableUsbhsHostClock (void) |
Enable USB HS host PLL clock. More... | |
void | CLOCK_EnableUsbhsPhyClock (void) |
Enable USB HS PHY PLL clock. More... | |
void | SDK_DelayAtLeastUs (uint32_t delay_us) |
Use DWT to delay at least for some time. More... | |
Variables | |
volatile uint32_t | g_xtalFreq |
External XTAL (SYSOSC) clock frequency. More... | |
volatile uint32_t | g_MclkInFreq |
External XTAL (SYSOSC) clock frequency. More... | |
Driver version | |
#define | FSL_CLOCK_DRIVER_VERSION (MAKE_VERSION(2, 3, 0)) |
CLOCK driver version 2.3.0. More... | |
struct clock_sys_pll_config_t |
Public Types | |
enum | { kCLOCK_SysPllSFroClk = 0, kCLOCK_SysPllXtalIn, kCLOCK_SysPllFFroDiv2 } |
Data Fields | |
uint32_t | numerator |
30 bit numerator of fractional loop divider. More... | |
uint32_t | denominator |
30 bit numerator of fractional loop divider. More... | |
anonymous enum |
uint32_t clock_sys_pll_config_t::numerator |
uint32_t clock_sys_pll_config_t::denominator |
struct clock_audio_pll_config_t |
Public Types | |
enum | { kCLOCK_AudioPllSFroClk = 0, kCLOCK_AudioPllXtalIn, kCLOCK_AudioPllFFroDiv2 } |
Data Fields | |
uint32_t | numerator |
30 bit numerator of fractional loop divider. More... | |
uint32_t | denominator |
30 bit numerator of fractional loop divider. More... | |
uint8_t | mult |
PLL loop divider. More... | |
anonymous enum |
uint32_t clock_audio_pll_config_t::numerator |
uint32_t clock_audio_pll_config_t::denominator |
uint8_t clock_audio_pll_config_t::mult |
struct clock_frg_clk_config_t |
Public Types | |
enum | { kCLOCK_FrgMainClk = 0, kCLOCK_FrgPllDiv, kCLOCK_FrgSFro, kCLOCK_FrgFFro } |
Data Fields | |
uint8_t | num |
FRG clock. | |
uint8_t | divider |
PLL loop divider. More... | |
uint8_t | mult |
PLL loop divider. More... | |
anonymous enum |
uint8_t clock_frg_clk_config_t::divider |
uint8_t clock_frg_clk_config_t::mult |
#define FSL_CLOCK_DRIVER_VERSION (MAKE_VERSION(2, 3, 0)) |
#define CMP_CLOCKS |
#define FLEXCOMM_CLOCKS |
#define USART_CLOCKS |
#define I2C_CLOCKS |
#define I3C_CLOCKS |
#define SPI_CLOCKS |
#define FLEXI2S_CLOCKS |
#define UTICK_CLOCKS |
#define DMIC_CLOCKS |
#define CTIMER_CLOCKS |
#define GPIO_CLOCKS |
#define LPADC_CLOCKS |
#define MRT_CLOCKS |
#define SCT_CLOCKS |
#define RTC_CLOCKS |
#define WWDT_CLOCKS |
#define CRC_CLOCKS |
#define USBD_CLOCKS |
#define DMA_CLOCKS |
#define PINT_CLOCKS |
#define CLK_GATE_REG_OFFSET_SHIFT 8U |
#define SYSPLL0CLKSEL_OFFSET 0x200 |
[12 bits for reg offset, 0 means end of descriptor, 4 bits for choice] [bit 31 define CLKCTL0 or CLKCTL1]*
enum clock_ip_name_t |
enum clock_name_t |
enum clock_pfd_t |
void CLOCK_AttachClk | ( | clock_attach_id_t | connection | ) |
connection | : Clock to be configured. |
void CLOCK_SetClkDiv | ( | clock_div_name_t | div_name, |
uint32_t | divider | ||
) |
div_name | : Clock divider name |
divider | : Value to be divided. |
uint32_t CLOCK_GetFreq | ( | clock_name_t | clockName | ) |
uint32_t CLOCK_GetFRGClock | ( | uint32_t | id | ) |
void CLOCK_SetFRGClock | ( | const clock_frg_clk_config_t * | config | ) |
config | : Configuration to set to FRGn clock. |
|
inlinestatic |
uint32_t CLOCK_GetSysPllFreq | ( | void | ) |
uint32_t CLOCK_GetSysPfdFreq | ( | clock_pfd_t | pfd | ) |
pfd | : pfd name to get frequency. |
uint32_t CLOCK_GetAudioPllFreq | ( | void | ) |
uint32_t CLOCK_GetAudioPfdFreq | ( | clock_pfd_t | pfd | ) |
pfd | : pfd name to get frequency. |
|
inlinestatic |
uint32_t CLOCK_GetMainClkFreq | ( | void | ) |
uint32_t CLOCK_GetDspMainClkFreq | ( | void | ) |
uint32_t CLOCK_GetAcmpClkFreq | ( | void | ) |
uint32_t CLOCK_GetDmicClkFreq | ( | void | ) |
uint32_t CLOCK_GetUsbClkFreq | ( | void | ) |
uint32_t CLOCK_GetSdioClkFreq | ( | void | ) |
sel | : clock source select |
divider | : clock divider |
uint32_t CLOCK_GetI3cClkFreq | ( | void | ) |
uint32_t CLOCK_GetSystickClkFreq | ( | void | ) |
uint32_t CLOCK_GetWdtClkFreq | ( | uint32_t | id | ) |
id | : WDT index to get frequency. |
uint32_t CLOCK_GetMclkClkFreq | ( | void | ) |
uint32_t CLOCK_GetSctClkFreq | ( | void | ) |
void CLOCK_EnableSysOscClk | ( | bool | enable, |
uint32_t | delay_us | ||
) |
enable | : true to enable system osc clock, false to bypass system osc. |
delay_us | : Delay time after OSC power up. |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
enable | : true to enable 32k osc clock, false to disable clock |
|
inlinestatic |
|
inlinestatic |
freq | : The XTAL input clock frequency in Hz. |
|
inlinestatic |
freq | : The MCLK input clock frequency in Hz. |
uint32_t CLOCK_GetFlexCommClkFreq | ( | uint32_t | id | ) |
id | : flexcomm index to get frequency. |
uint32_t CLOCK_GetCtimerClkFreq | ( | uint32_t | id | ) |
id | : ctimer index to get frequency. |
uint32_t CLOCK_GetClockOutClkFreq | ( | void | ) |
uint32_t CLOCK_GetAdcClkFreq | ( | void | ) |
uint32_t CLOCK_GetQspiClkFreq | ( | void | ) |
void CLOCK_InitSysPll | ( | const clock_sys_pll_config_t * | config | ) |
config | : Configuration to set to PLL. |
|
inlinestatic |
param none.
void CLOCK_InitSysPfd | ( | clock_pfd_t | pfd, |
uint8_t | divider | ||
) |
pfd | : Which PFD clock to enable. |
divider | : The PFD divider value. |
|
inlinestatic |
param pfd : Which PFD clock to disable.
void CLOCK_InitAudioPll | ( | const clock_audio_pll_config_t * | config | ) |
config | : Configuration to set to PLL. |
|
inlinestatic |
param none.
void CLOCK_InitAudioPfd | ( | clock_pfd_t | pfd, |
uint8_t | divider | ||
) |
pfd | : Which PFD clock to enable. |
divider | : The PFD divider value. |
|
inlinestatic |
param pfd : Which PFD clock to disable.
void CLOCK_EnableUsbhsDeviceClock | ( | void | ) |
This function enables USB HS device PLL clock.
void CLOCK_EnableUsbhsHostClock | ( | void | ) |
This function enables USB HS host PLL clock.
void CLOCK_EnableUsbhsPhyClock | ( | void | ) |
This function enables USB HS PHY PLL clock.
void SDK_DelayAtLeastUs | ( | uint32_t | delay_us | ) |
Please note that, this API will calculate the microsecond period with the maximum supported CPU frequency, so this API will only delay for at least the given microseconds, if precise delay count was needed, please implement a new timer count to achieve this function.
delay_us | Delay time in unit of microsecond. |
volatile uint32_t g_xtalFreq |
The XTAL (SYSOSC) clock frequency in Hz, when the clock is setup, use the function CLOCK_SetXtalFreq to set the value in to clock driver. For example, if XTAL is 16MHz,
volatile uint32_t g_MclkInFreq |
The MCLK in (mclk_in) PIN clock frequency in Hz, when the clock is setup, use the function CLOCK_SetMclkInFreq to set the value in to clock driver. For example, if mclk_In is 16MHz,