This is the documentation for the latest (main) development branch. If you are looking for the documentation of previous releases, use the drop-down menu on the left and select the desired version.

RCC API Reference

RCC Structures

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.

Parameters:
  • dev[in] clock device pointer

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

Returns:

  • WM_ERR_SUCCESS: succeed

  • others: failed

int wm_drv_clock_disable(wm_device_t *dev, uint32_t module_type)

Set the rcc clock disable.

Parameters:
  • dev[in] clock device pointer

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

Returns:

  • WM_ERR_SUCCESS: succeed

  • others: failed

int wm_drv_clock_reset(wm_device_t *dev, uint32_t module_type)

Set the rcc clock reset.

Parameters:
  • dev[in] clock device pointer

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

Returns:

  • WM_ERR_SUCCESS: succeed

  • others: failed

wm_device_t *wm_drv_clock_init(char *dev_name)

Initialize clock driver.

Parameters:

dev_name – clock device name

Returns:

  • clock device pointer: succeed

  • NULL : failed

int wm_drv_clock_deinit(wm_device_t *dev)

deinit flash driver

Parameters:

dev – clock driver device

Returns:

  • WM_ERR_SUCCESS: succeed

  • others: failed

Returns:

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

Note

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;

Parameters:
  • 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

Returns:

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

Parameters:
  • dev[in] clock device pointer

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

Returns:

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

Parameters:
  • 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]

Returns:

  • module clock: succeed

  • others: failed