Clock Exported Functions
- group CLOCK_Exported_Functions
Functions
-
uint32_t pm_clock_src_freq_get(CLK_SRC_TYPE clock_src_type)
Get clock source frequency.
- 参数:
clock_src_type -- [in] Clock source type.
- 返回:
Clock source frequency.
-
int32_t pm_cpu_freq_set(uint32_t required_mhz, uint32_t *actual_mhz)
Set the CPU clock frequency.
- 参数:
required_mhz -- [in] Required frequency, unit: MHz.
actual_mhz -- [out] Actual frequency after requirement, unit: MHz.
- 返回值:
0 -- Success.
Others -- Fail to set the CPU clock frequency. This may happen when the require_mhz is not supported.
- 返回:
Status of operation.
-
int32_t pm_cpu_freq_get(uint32_t *current_mhz)
Retrieve the current CPU clock frequency.
- 参数:
current_mhz -- [out] The current CPU clock frequency in MHz.
- 返回值:
0 -- Success.
- 返回:
Operation result, and will always return 0.
-
int32_t pm_cpu_slow_freq_set(uint32_t required_mhz)
Set the CPU slow clock. After the system enters WFI, the CPU will automatically slow down to this frequency to reduce power consumption.
When clock source is CLK_40M, CPU slow clock frequency can be set to 40MHz divided by 1 to 1/64.
When clock source is CKO_PLL1_CPU, CPU slow clock frequency can be set to CKO_PLL1_CPU divided by 1 to 1/64.
When clock source is CKO_PLL2, CPU slow clock frequency can be set to CKO_PLL2 divided by 1 to 1/64.
- 参数:
required_mhz -- [in] Required CPU slow clock frequency.
- 返回值:
0 -- Success.
Others -- Fail to set the CPU slow clock frequency. This may happen when the require_mhz is not supported.
- 返回:
Status of operation.
-
bool fmc_flash_nor_clock_switch(FLASH_NOR_IDX_TYPE idx, uint32_t required_mhz, uint32_t *actual_mhz)
Set the Flash Nor clock frequency.
- 参数:
idx -- [in] Corresponding SPIC ID for Flash Nor, refer to FLASH_NOR_IDX_TYPE .
required_mhz -- [in] Required frequency, unit: MHz.
actual_mhz -- [out] Actual frequency after requirement, unit: MHz.
- 返回值:
True -- Success.
False -- Fail to set the Flash Nor clock frequency. This may happen when the require_mhz is not supported.
- 返回:
Status of Operation.
-
bool fmc_psram_clock_switch(PSRAM_IDX_TYPE idx, uint32_t required_mhz, uint32_t *actual_mhz)
Set the PSRAM clock frequency.
- 参数:
idx -- [in] Corresponding SPIC ID for PSRAM, refer to PSRAM_IDX_TYPE .
required_mhz -- [in] Required frequency, unit: MHz.
actual_mhz -- [out] Actual frequency after requirement, unit: MHz.
- 返回值:
True -- Success.
False -- Fail to set the PSRAM clock frequency. This may happen when the require_mhz is not supported.
- 返回:
Status of Operation.
-
int32_t pm_display_freq_set(PLL_CLK_SRC_TYPE clk_src_type, uint32_t pll_output_mhz, uint32_t required_mhz)
Set the frequency of the display's corresponding PLL clock source.
- 参数:
clk_src_type -- [in] PLL clock source selection: Choose the PLL clock source that needs to be initialized.
pll_output_mhz -- [in] PLL clock source frequency: The current frequency of the PLL2 clock source is fixed at 160MHz. Only when the PLL clock source is selected as PLL1, the frequency of CKO_PLL1_PERI can be modified (100MHz, 125MHz, 250MHz), unit: MHz.
required_mhz -- [in] Actual required frequency for display. Unit: MHz. For reference only.
- 返回值:
0 -- Success.
Others -- Fail to set the frequency of the display's corresponding PLL clock source. This may happen when the require_mhz is not supported.
- 返回:
Status of Operation.
-
int32_t pm_display_freq_unset(PLL_CLK_SRC_TYPE clk_src_type)
Request to turn off the PLL clock source corresponding to the display. Only when all modules using the same PLL clock source are turned off, will the PLL clock source be turned off.
- 参数:
clk_src_type -- [in] PLL clock source for display.
- 返回值:
0 -- Success.
- 返回:
Status of Operation, and will always return 0.
-
int32_t pm_sdhc_freq_set(PLL_CLK_SRC_TYPE clk_src_type, uint32_t pll_output_mhz, uint32_t required_mhz)
Set the frequency of the PLL clock source corresponding to SDHC (SDIO Host Controller).
- 参数:
clk_src_type -- [in] PLL clock source selection: Choose the PLL clock source that needs to be initialized.
pll_output_mhz -- [in] PLL clock source frequency: The current frequency of the PLL2 clock source is fixed at 160MHz. Only when the PLL clock source is selected as PLL1, the frequency of CKO_PLL1_PERI can be modified (100MHz, 125MHz, 250MHz), unit: MHz.
required_mhz -- [in] Actual required frequency for SDHC. Unit: MHz. For reference only.
- 返回值:
0 -- Success.
Others -- Fail to set the frequency of the PLL clock source corresponding to SDHC. This may happen when the require_mhz is not supported.
- 返回:
Status of Operation.
-
int32_t pm_sdhc_freq_unset(PLL_CLK_SRC_TYPE clk_src_type)
Request to turn off the PLL clock source corresponding to SDHC. Only when all modules using the same PLL clock source are turned off, will the PLL clock source be turned off.
- 参数:
clk_src_type -- [in] PLL clock source for SDHC.
- 返回值:
0 -- Success.
- 返回:
Status of Operation, and will always return 0.
-
int32_t pm_pke_freq_set(PLL_CLK_SRC_TYPE clk_src_type, uint32_t pll_output_mhz, uint32_t required_mhz)
Set the frequency of the PLL clock source corresponding to PKE (Public Key Engine).
- 参数:
clk_src_type -- [in] PLL clock source selection: Choose the PLL clock source that needs to be initialized.
pll_output_mhz -- [in] PLL clock source frequency: The current frequency of the PLL2 clock source is fixed at 160MHz. Only when the PLL clock source is selected as PLL1, the frequency of CKO_PLL1_PERI can be modified (100MHz, 125MHz, 250MHz), unit: MHz.
required_mhz -- [in] Actual required frequency for PKE. Unit: MHz. For reference only.
- 返回值:
0 -- Success.
Others -- Fail to set the frequency of the PLL clock source corresponding to PKE. This may happen when the require_mhz is not supported.
- 返回:
Status of Operation.
-
int32_t pm_pke_freq_unset(PLL_CLK_SRC_TYPE clk_src_type)
Request to turn off the PLL clock source corresponding to PKE. Only when all modules using the same PLL clock source are turned off, will the PLL clock source be turned off.
- 参数:
clk_src_type -- [in] PLL clock source for PKE.
- 返回值:
0 -- Success.
- 返回:
Status of Operation, and will always return 0.
-
int32_t pm_ethernet_freq_set(PLL_CLK_SRC_TYPE clk_src_type, uint32_t pll_output_mhz, uint32_t required_mhz)
Set the frequency of the PLL clock source corresponding to Ethernet.
- 参数:
clk_src_type -- [in] PLL clock source selection: Choose the PLL clock source that needs to be initialized.
pll_output_mhz -- [in] PLL clock source frequency: The Ethernet clock source can only select CKO_PLL1_ETH (125MHz, 250MHz) or CKO_PLL1_ETH50M (50MHz), unit: MHz.
required_mhz -- [in] Actual required frequency for Ethernet. Unit: MHz. For reference only.
- 返回值:
0 -- Success.
Others -- Fail to set the frequency of the PLL clock source corresponding to Ethernet. This may happen when the require_mhz is not supported.
- 返回:
Status of Operation.
-
int32_t pm_ethernet_freq_unset(PLL_CLK_SRC_TYPE clk_src_type)
Request to turn off the PLL clock source corresponding to Ethernet. Only when all modules using the same PLL clock source are turned off, will the PLL clock source be turned off.
- 参数:
clk_src_type -- [in] PLL clock source for Ethernet.
- 返回值:
0 -- Success.
- 返回:
Status of Operation, and will always return 0.
-
int32_t pm_usb_freq_set(PLL_CLK_SRC_TYPE clk_src_type, uint32_t pll_output_mhz, uint32_t required_mhz)
Set the frequency of the PLL clock source corresponding to USB.
- 参数:
clk_src_type -- [in] PLL clock source selection: Choose the PLL clock source that needs to be initialized.
pll_output_mhz -- [in] PLL clock source frequency: The current frequency of the PLL2 clock source is fixed at 160MHz. Only when the PLL clock source is selected as PLL1, the frequency of CKO_PLL1_PERI can be modified (100MHz, 125MHz, 250MHz), unit: MHz.
required_mhz -- [in] Actual required frequency for USB. Unit: MHz. For reference only.
- 返回值:
0 -- Success.
Others -- Fail to set the frequency of the PLL clock source corresponding to USB. This may happen when the require_mhz is not supported.
- 返回:
Status of Operation.
-
int32_t pm_usb_freq_unset(PLL_CLK_SRC_TYPE clk_src_type)
Request to turn off the PLL clock source corresponding to USB. Only when all modules using the same PLL clock source are turned off, will the PLL clock source be turned off.
- 参数:
clk_src_type -- [in] PLL clock source for USB.
- 返回值:
0 -- Success.
- 返回:
Status of Operation, and will always return 0.
-
int32_t pm_timer_freq_set(PLL_CLK_SRC_TYPE clk_src_type, uint32_t pll_output_mhz, uint32_t required_mhz)
Set the frequency of the PLL clock source corresponding to Timer.
- 参数:
clk_src_type -- [in] PLL clock source selection: Choose the PLL clock source that needs to be initialized.
pll_output_mhz -- [in] PLL clock source frequency: The current frequency of the PLL2 clock source is fixed at 160MHz. Only when the PLL clock source is selected as PLL1, the frequency of CKO_PLL1_PERI can be modified (100MHz, 125MHz, 250MHz), unit: MHz.
required_mhz -- [in] Actual required frequency for Timer. Unit: MHz. For reference only.
- 返回值:
0 -- Success.
Others -- Fail to set the frequency of the PLL clock source corresponding to Timer. This may happen when the require_mhz is not supported.
- 返回:
Status of Operation.
-
int32_t pm_timer_freq_unset(PLL_CLK_SRC_TYPE clk_src_type)
Request to turn off the PLL clock source corresponding to Timer. Only when all modules using the same PLL clock source are turned off, will the PLL clock source be turned off.
- 参数:
clk_src_type -- [in] PLL clock source for Timer.
- 返回值:
0 -- Success.
- 返回:
Status of Operation, and will always return 0.
-
int32_t pm_enhanced_timer_freq_set(PLL_CLK_SRC_TYPE clk_src_type, uint32_t pll_output_mhz, uint32_t required_mhz)
Set the frequency of the PLL clock source corresponding to Enhanced Timer.
- 参数:
clk_src_type -- [in] PLL clock source selection: Choose the PLL clock source that needs to be initialized.
pll_output_mhz -- [in] PLL clock source frequency: The current frequency of the PLL2 clock source is fixed at 160MHz. Only when the PLL clock source is selected as PLL1, the frequency of CKO_PLL1_PERI can be modified (100MHz, 125MHz, 250MHz), unit: MHz.
required_mhz -- [in] Actual required frequency for Enhanced Timer. Unit: MHz. For reference only.
- 返回值:
0 -- Success.
Others -- Fail to set the frequency of the PLL clock source corresponding to Enhanced Timer. This may happen when the require_mhz is not supported.
- 返回:
Status of Operation.
-
int32_t pm_enhanced_timer_freq_unset(PLL_CLK_SRC_TYPE clk_src_type)
Request to turn off the PLL clock source corresponding to Enhanced Timer. Only when all modules using the same PLL clock source are turned off, will the PLL clock source be turned off.
- 参数:
clk_src_type -- [in] PLL clock source for Enhanced Timer.
- 返回值:
0 -- Success.
- 返回:
Status of Operation, and will always return 0.
-
int32_t pm_ir_freq_set(PLL_CLK_SRC_TYPE clk_src_type, uint32_t pll_output_mhz, uint32_t required_mhz)
Set the frequency of the PLL clock source corresponding to IR (Infrared Radiation).
- 参数:
clk_src_type -- [in] PLL clock source selection: Choose the PLL clock source that needs to be initialized.
pll_output_mhz -- [in] PLL clock source frequency: The current frequency of the PLL2 clock source is fixed at 160MHz. Only when the PLL clock source is selected as PLL1, the frequency of CKO_PLL1_PERI can be modified (100MHz, 125MHz, 250MHz), unit: MHz.
required_mhz -- [in] Actual required frequency for IR. Unit: MHz. For reference only.
- 返回值:
0 -- Success.
Others -- Fail to set the frequency of the PLL clock source corresponding to IR. This may happen when the require_mhz is not supported.
- 返回:
Status of Operation.
-
int32_t pm_ir_freq_unset(PLL_CLK_SRC_TYPE clk_src_type)
Request to turn off the PLL clock source corresponding to IR. Only when all modules using the same PLL clock source are turned off, will the PLL clock source be turned off.
- 参数:
clk_src_type -- [in] PLL clock source for IR.
- 返回值:
0 -- Success.
- 返回:
Status of Operation, and will always return 0.
-
int32_t pm_spi0_master_freq_set(PLL_CLK_SRC_TYPE clk_src_type, uint32_t pll_output_mhz, uint32_t required_mhz)
Set the frequency of the PLL clock source corresponding to SPI0 master.
- 参数:
clk_src_type -- [in] PLL clock source selection: Choose the PLL clock source that needs to be initialized.
pll_output_mhz -- [in] PLL clock source frequency: The current frequency of the PLL2 clock source is fixed at 160MHz. Only when the PLL clock source is selected as PLL1, the frequency of CKO_PLL1_PERI can be modified (100MHz, 125MHz, 250MHz), unit: MHz.
required_mhz -- [in] Actual required frequency for SPI0 master. Unit: MHz. For reference only.
- 返回值:
0 -- Success.
Others -- Fail to set the frequency of the PLL clock source corresponding to SPI0 master. This may happen when the require_mhz is not supported.
- 返回:
Status of Operation.
-
int32_t pm_spi0_master_freq_unset(PLL_CLK_SRC_TYPE clk_src_type)
Request to turn off the PLL clock source corresponding to SPI0 master. Only when all modules using the same PLL clock source are turned off, will the PLL clock source be turned off.
- 参数:
clk_src_type -- [in] PLL clock source for SPI0 master.
- 返回值:
0 -- Success.
- 返回:
Status of Operation, and will always return 0.
-
int32_t pm_spi0_slave_freq_set(PLL_CLK_SRC_TYPE clk_src_type, uint32_t pll_output_mhz, uint32_t required_mhz)
Set the frequency of the PLL clock source corresponding to SPI0 slave.
- 参数:
clk_src_type -- [in] PLL clock source selection: Choose the PLL clock source that needs to be initialized.
pll_output_mhz -- [in] PLL clock source frequency: The current frequency of the PLL2 clock source is fixed at 160MHz. Only when the PLL clock source is selected as PLL1, the frequency of CKO_PLL1_PERI can be modified (100MHz, 125MHz, 250MHz), unit: MHz.
required_mhz -- [in] Actual required frequency for SPI0 slave. Unit: MHz. For reference only.
- 返回值:
0 -- Success.
Others -- Fail to set the frequency of the PLL clock source corresponding to SPI0 slave. This may happen when the require_mhz is not supported.
- 返回:
Status of Operation.
-
int32_t pm_spi0_slave_freq_unset(PLL_CLK_SRC_TYPE clk_src_type)
Request to turn off the PLL clock source corresponding to SPI0 slave. Only when all modules using the same PLL clock source are turned off, will the PLL clock source be turned off.
- 参数:
clk_src_type -- [in] PLL clock source for SPI0 slave.
- 返回值:
0 -- Success.
- 返回:
Status of Operation, and will always return 0.
-
uint32_t pm_clock_src_freq_get(CLK_SRC_TYPE clock_src_type)