这个页面的 最新开发版本 可能比这个发布的 2.3-beta.1 版本新。

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 clk_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

  • clk_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

int 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

int wm_drv_rcc_register_cb_bus_clock_change(wm_device_t *dev, uint8_t dev_idx, wm_bus_clock_change_cb cb, void *usr_arg)

register callback for cpu and wlan bus be changed

参数:
  • dev[in] clock device pointer

  • dev_idx[in] device index, please refer wm_rcc_dev_t

  • cb[in] cpu or wlan clock be changed will call this function

  • usr_arg[in] the argument for call back

返回:

  • WM_ERR_SUCCESS: succeed

  • others: failed

int wm_drv_rcc_unregister_cb_bus_clock_change(wm_device_t *dev, uint8_t dev_idx)

unregister callback for cpu and wlan bus be changed

参数:
  • dev[in] clock device pointer

  • dev_idx[in] device index, please refer wm_rcc_dev_t

返回:

  • WM_ERR_SUCCESS: succeed

  • others: failed