![]() |
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 |
Macros | |
#define | FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL 0 |
Configure whether driver controls clock. More... | |
#define | MU_CLOCKS |
Clock ip name array for MU. More... | |
#define | GPIO_CLOCKS |
Clock ip name array for GPIO. More... | |
#define | FLEXSPI_CLOCKS |
Clock ip name array for FLEXSPI. More... | |
#define | RGPIO_CLOCKS |
Clock ip name array for RGPIO. More... | |
#define | FTM_CLOCKS |
Clock ip name array for FTM. More... | |
#define | GPT_CLOCKS |
Clock ip name array for GPT. More... | |
#define | FLEXCAN_CLOCKS |
Clock ip name array for FLEXCAN. More... | |
#define | LPUART_CLOCKS |
Clock ip name array for LPUART. More... | |
#define | LPADC_CLOCKS |
Clock ip name array for LPADC. More... | |
#define | INTMUX_CLOCKS |
Clock ip name array for INTMUX. More... | |
#define | SAI_CLOCKS |
Clock ip name array for SAI. More... | |
#define | SEMA42_CLOCKS |
Clock ip name array for SAI. More... | |
#define | TPM_CLOCKS |
Clock ip name array for TPM. More... | |
#define | LPIT_CLOCKS |
Clock ip name array for LPIT. More... | |
#define | LPI2C_CLOCKS |
Clock ip name array for LPI2C. More... | |
#define | LPSPI_CLOCKS |
Clock ip name array for LPSPI. More... | |
#define | EDMA_CLOCKS |
Clock ip name array for EDMA. More... | |
#define | ESAI_CLOCKS |
Clock ip name array for LPIT. More... | |
#define | ISI_CLOCKS |
Clock ip name array for ISI. More... | |
#define | MIPI_CSI2RX_CLOCKS |
Clock ip name array for MIPI CSI2 RX. More... | |
#define | MIPI_DSI_HOST_CLOCKS |
Clock ip name array for MIPI DSI host. More... | |
#define | ENET_CLOCKS |
Clock ip name array for ENET. More... | |
#define | DPU_CLOCKS |
Clock ip name array for DPU. More... | |
#define | CI_PI_CLOCKS |
Clock ip name array for CI_PI. More... | |
#define | CAAM_CLOCKS |
Clock ip name array for CAAM. More... | |
#define | LDB_CLOCKS |
Clock ip name array for LVDS display bridge(LDB). More... | |
#define | LPCG_TUPLE(rsrc, base) ((uint32_t)((((base) >> 12U) << 10U) | rsrc)) |
LPCG TUPLE macors to map corresponding ip clock name, SCFW API resource index and LPCG Register base address. More... | |
#define | LPCG_TUPLE_REG_BASE(tuple) ((volatile uint32_t *)((((uint32_t)(tuple) >> 10U) & 0xFFFFFU) << 12U)) |
Get the LPCG REG base address. More... | |
#define | LPCG_TUPLE_RSRC(tuple) ((sc_rsrc_t)((uint32_t)(tuple)&0x3FFU)) |
Get the resource index. More... | |
#define | NV (0U) |
LPCG Cell not available. More... | |
Enumerations | |
enum | clock_ip_src_t { kCLOCK_IpSrcNone = 0U, kCLOCK_IpSrcDummy = 1U } |
Clock source for peripherals that support various clock selections. More... | |
enum | clock_name_t { kCLOCK_CoreSysClk, kCLOCK_CONECTIVITY_AhbClk } |
Clock name used to get clock frequency. More... | |
enum | clock_ip_name_t |
Peripheral clock name difinition used for clock gate, clock source and clock divider setting. More... | |
Functions | |
void | CLOCK_Init (sc_ipc_t ipc) |
Initialize Clock module. More... | |
void | CLOCK_Deinit (void) |
Deinitialize Clock module. | |
bool | CLOCK_EnableClockExt (clock_ip_name_t name, uint32_t gate) |
Enable the clock for specific IP, with gate setting. More... | |
static bool | CLOCK_EnableClock (clock_ip_name_t name) |
Enable the clock for specific IP. More... | |
bool | CLOCK_DisableClock (clock_ip_name_t name) |
Disable the clock for specific IP. More... | |
uint32_t | CLOCK_SetIpFreq (clock_ip_name_t name, uint32_t freq) |
Set the clock frequency for specific IP module. More... | |
uint32_t | CLOCK_GetIpFreq (clock_ip_name_t name) |
Get the clock frequency for a specific IP module. More... | |
uint32_t | CLOCK_GetFreq (clock_name_t name) |
Gets the clock frequency for a specific clock name. More... | |
uint32_t | CLOCK_GetCoreSysClkFreq (void) |
Get the core clock or system clock frequency. More... | |
void | CLOCK_ConfigLPCG (clock_ip_name_t name, uint32_t swGate, uint32_t hwGate) |
Config the LPCG cell for specific IP. More... | |
void | CLOCK_SetLpcgGate (volatile uint32_t *regBase, uint32_t swGate, uint32_t hwGate, uint32_t bitsMask) |
Set LPCG gate for specific LPCG. More... | |
void | SDK_DelayAtLeastUs (uint32_t delay_us) |
Use DWT to delay at least for some time. More... | |
Driver version | |
#define | FSL_CLOCK_DRIVER_VERSION (MAKE_VERSION(2, 2, 0)) |
CLOCK driver version 2.2.0. More... | |
#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.
#define FSL_CLOCK_DRIVER_VERSION (MAKE_VERSION(2, 2, 0)) |
#define MU_CLOCKS |
#define GPIO_CLOCKS |
#define FLEXSPI_CLOCKS |
#define RGPIO_CLOCKS |
#define FTM_CLOCKS |
#define GPT_CLOCKS |
#define FLEXCAN_CLOCKS |
#define LPUART_CLOCKS |
#define LPADC_CLOCKS |
#define INTMUX_CLOCKS |
#define SAI_CLOCKS |
#define SEMA42_CLOCKS |
#define TPM_CLOCKS |
#define LPIT_CLOCKS |
#define LPI2C_CLOCKS |
#define LPSPI_CLOCKS |
#define EDMA_CLOCKS |
#define ESAI_CLOCKS |
#define ISI_CLOCKS |
#define MIPI_CSI2RX_CLOCKS |
#define MIPI_DSI_HOST_CLOCKS |
#define ENET_CLOCKS |
#define DPU_CLOCKS |
#define CI_PI_CLOCKS |
#define CAAM_CLOCKS |
#define LDB_CLOCKS |
#define LPCG_TUPLE | ( | rsrc, | |
base | |||
) | ((uint32_t)((((base) >> 12U) << 10U) | rsrc)) |
The LPCG base should be 4KB aligned, if not it will be truncated.
#define LPCG_TUPLE_REG_BASE | ( | tuple | ) | ((volatile uint32_t *)((((uint32_t)(tuple) >> 10U) & 0xFFFFFU) << 12U)) |
#define LPCG_TUPLE_RSRC | ( | tuple | ) | ((sc_rsrc_t)((uint32_t)(tuple)&0x3FFU)) |
#define NV (0U) |
enum clock_ip_src_t |
enum clock_name_t |
enum clock_ip_name_t |
It is defined as the corresponding register address.
void CLOCK_Init | ( | sc_ipc_t | ipc | ) |
ipc | IPC handle for communication with SCU, see sc_ipc_t. |
bool CLOCK_EnableClockExt | ( | clock_ip_name_t | name, |
uint32_t | gate | ||
) |
name | Which clock to enable, see clock_ip_name_t. |
gate | 0: clock always on, 1: HW auto clock gating. |
|
inlinestatic |
name | Which clock to enable, see clock_ip_name_t. |
bool CLOCK_DisableClock | ( | clock_ip_name_t | name | ) |
name | Which clock to disable, see clock_ip_name_t. |
uint32_t CLOCK_SetIpFreq | ( | clock_ip_name_t | name, |
uint32_t | freq | ||
) |
This function sets the IP module clock frequency.
name | Which peripheral to check, see clock_ip_name_t. |
freq | Target clock frequency value in hertz. |
uint32_t CLOCK_GetIpFreq | ( | clock_ip_name_t | name | ) |
This function gets the IP module clock frequency.
name | Which peripheral to get, see clock_ip_name_t. |
uint32_t CLOCK_GetFreq | ( | clock_name_t | name | ) |
This function checks the current clock configurations and then calculates the clock frequency for a specific clock name defined in clock_name_t.
clockName | Clock names defined in clock_name_t |
uint32_t CLOCK_GetCoreSysClkFreq | ( | void | ) |
void CLOCK_ConfigLPCG | ( | clock_ip_name_t | name, |
uint32_t | swGate, | ||
uint32_t | hwGate | ||
) |
name | Which clock to enable, see clock_ip_name_t. |
swGate | Software clock gating. 0: clock is gated; 1: clock is enabled |
swGate | Hardware auto gating. 0: disable the HW clock gate control; 1: HW clock gating is enabled |
void CLOCK_SetLpcgGate | ( | volatile uint32_t * | regBase, |
uint32_t | swGate, | ||
uint32_t | hwGate, | ||
uint32_t | bitsMask | ||
) |
regBase | LPCG register base address. |
swGate | Software clock gating. 0: clock is gated; 1: clock is enabled |
swGate | Hardware auto gating. 0: disable the HW clock gate control; 1: HW clock gating is enabled |
bitsMask | The available bits in LPCG register. Each bit indicate the corresponding bit is available or not. |
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. |