这是最新(主)开发分支的文档。如果您正在查找以前版本的文档,使用左侧的下拉菜单选择所需的版本。

RCC API 参考

RCC 数据结构体

struct wm_drv_clock_ctx_t

RCC API

int wm_drv_clock_enable(wm_device_t *dev, uint32_t module_type)

Set the rcc clock enable.

参数:
  • dev[in] clock device pointer

  • module_type[in] config the indicate module clock enable, please refer to wm_rcc_clock_enable_t

返回:

  • WM_ERR_SUCCESS: succeed

  • others: failed

int wm_drv_clock_disable(wm_device_t *dev, uint32_t module_type)

Set the rcc clock disable.

参数:
  • dev[in] clock device pointer

  • module_type[in] config the indicate module clock disable, please refer to wm_rcc_clock_enable_t

返回:

  • WM_ERR_SUCCESS: succeed

  • others: failed

int wm_drv_clock_reset(wm_device_t *dev, uint32_t module_type)

Set the rcc clock reset.

参数:
  • dev[in] clock device pointer

  • module_type[in] config the indicate module clock reset, please refer to wm_rcc_clk_rst_t

返回:

  • WM_ERR_SUCCESS: succeed

  • others: failed

wm_device_t *wm_drv_clock_init(char *dev_name)

Initialize clock driver.

参数:

dev_name – clock device name

返回:

  • clock device pointer: succeed

  • NULL : failed

int wm_drv_clock_deinit(wm_device_t *dev)

deinit flash driver

参数:

dev – clock driver device

返回:

  • WM_ERR_SUCCESS: succeed

  • others: failed

返回:

  • WM_ERR_SUCCESS: succeed

  • WM_ERR_INVALID_PARAM: invalid argument

  • others: failed

int wm_drv_rcc_config_clock(wm_device_t *dev, wm_rcc_type_t module_type, uint16_t MHz)

Set the rcc clock.

备注

The Periphal/WLAN/CPU clock should be a divider of PLL clock(480MHz), others value is invalid; The SD ADC clock should be a divider of 40MHz; The wlan clock should be 160MHz to work normal; The CPU clock should above 40MHz to make wifi work, and maxmum clock is 240MHz; The QFLASH clock should be 40MHz or 80MHz; The GPSEC clock should be 80MHz or 160MHz; The RSA clock should be 80MHz or 160MHz; No need to config APB clock, used for query;

参数:
  • dev[in] clock device pointer

  • module_type[in] config the indicate module clock, please refer to wm_rcc_type_t

  • MHz[in] the clock setting, unit: MHz

返回:

  • WM_ERR_SUCCESS: succeed

  • others: failed

int wm_drv_rcc_get_config_clock(wm_device_t *dev, wm_rcc_type_t module_type)

Get the rcc clock.

参数:
  • dev[in] clock device pointer

  • module_type[in] config the clock module, please refer to wm_rcc_type_t

返回:

  • module clock: succeed

  • others: failed

int32_t wm_drv_rcc_set_i2s_clock(wm_device_t *dev, bool extal_en, bool mclk_en, uint32_t mclk_div, uint32_t bclk_div)

Set the I2S clock of RCC.

参数:
  • dev[in] clock device pointer

  • extal_en[in] true if enable clock from extal crystal, otherwise use internal PLL

  • mclk_en[in] true if enable mclk function, otherwise disable

  • mclk_div[in] divider value for mclk, range [2, 64]

  • bclk_div[in] divider value for bclk, range [1, 1024]

返回:

  • module clock: succeed

  • others: failed