Power Manager Transport Layer Exported Functions

group PM_Exported_Functions

Functions

void bt_power_mode_set(BtPowerMode mode)
BtPowerMode bt_power_mode_get(void)
int32_t power_check_cb_register(POWERCheckFunc func)

Register Check CB to Power module which will call it before entering Dlps.

Parameters:

func – DLPSEnterCheckFunc.

Returns:

Status of Operation.

int32_t power_stage_cb_register(POWERStageFunc func, POWERStage stage)

Register HW Control CB to Power module which will call it before entering power mode or after exiting from power mode (according to POWERStage).

Parameters:
  • func – POWERStageFunc.

  • stage – tell the Power module the CB should be called when POWER_STAGE_ENTER or POWER_STAGE_EXIT.

Returns:

Status of Operation.

int32_t power_mode_set(POWERMode mode)

POWERMode Set.

Parameters:

mode – POWERMode.

Returns:

void

POWERMode power_mode_get(void)

POWERMode Get.

Parameters:

void

Returns:

The POWERMode.

int32_t power_dlps_mode_select(POWERDlpsMode mode)

POWERDLPSMode Set.

Note

It only takes effect when bt_power_mode_set(POWER_DLPS_MODE).Please call this function before power_mode_set(POWER_DLPS_MODE).

Parameters:

mode – DLPSMODE,default value is DLPS_PFM.

Returns:

void

POWERDlpsMode power_dlps_mode_get(void)

POWERDlpsMode Get.

Parameters:

mode – none.

Returns:

The POWERDlpsMode.

int32_t power_mode_pause(void)

POWERMode Pause.

Parameters:

void

Returns:

void

int32_t power_mode_resume(void)

POWERMode Resume.

Parameters:

void

Returns:

void

PowerModeErrorCode power_get_error_code(void)

POWERErrorCode get.

Parameters:

void

Returns:

POWERErrorCode.

void power_stop_all_non_excluded_timer(void)

Stop timer which are not using after POWERDlpsMode.

Parameters:

void

Returns:

void

bool power_register_excluded_handle(void **handle, PowerModeExcludedHandleType type)

Register task or timer handle in excluded pool.

Parameters:
  • handle – Task or timer handle.

  • type – PM_EXCLUDED_TIMER or PM_EXCLUDED_TASK.

Returns:

The error code of power manager.

void power_get_statistics(uint32_t *wakeup_count, uint32_t *total_wakeup_time, uint32_t *total_sleep_time)

Get statistics of power manager.

Parameters:
  • wakeup_count – Amount of wakeup.

  • total_wakeup_time – The time of total wakeup.

  • total_sleep_time – The time of total sleep.

Returns:

void

int32_t pm_cpu_freq_set(uint32_t required_mhz, uint32_t *actual_mhz)

Config cpu clock freq.

Parameters:
  • require_mhz – Require cpu freqency .

  • real_mhz – The freqency of current cpu.

Returns:

Status of Operation.

int32_t pm_cpu_slow_freq_set(uint32_t required_mhz)

Config cpu clock freq.

Parameters:

require_mhz – Require dsp1 freqency .

Returns:

Status of Operation.

int32_t pm_dsp1_freq_set(uint32_t required_mhz, uint32_t *actual_mhz)

Config dsp1 clock freq.

Parameters:
  • require_mhz – require dsp1 freqency .

  • real_mhz – the freqency of current dsp1.

Returns:

Status of Operation.

uint32_t pm_cpu_freq_get(void)

Get cpu clock freq.

Parameters:

void

Returns:

mhz.

uint32_t pm_cpu_default_freq_get(void)

Get cpu default clock freq.

Added Since 2.12.0.0:

Parameters:

void

Returns:

mhz.

uint32_t pm_cpu_max_freq_get(void)

Get cpu max clock freq.

Added Since 2.12.0.0:

Parameters:

void

Returns:

mhz.

int32_t pm_cpu_freq_init(void)

Init cpu freq handle.

Parameters:

void

Returns:

Status of Operation.

int32_t pm_cpu_freq_req(uint8_t *handle, uint32_t required_mhz, uint32_t *actual_mhz)

CPU freq adjustment for different application scenarios. The actual CPU freq will be set according current scanarios.

Note

pm_cpu_freq_clear and pm_cpu_freq_req must match.

Parameters:
  • handle – The cpu freq session handle.

  • required_mhz – Required cpu freqency .

  • actual_mhz – The freqency of current cpu.

Returns:

Status of Operation.

int32_t pm_cpu_freq_clear(uint8_t *handle, uint32_t *actual_mhz)

Used for recovery cpu freq.

Note

pm_cpu_freq_clear and pm_cpu_freq_req must match.

Parameters:
  • handle – The cpu freq session handle.

  • actual_mhz – The freqency of current cpu.

Returns:

Status of operation.

int32_t pm_cpu_freq_cb_register(PMCPUFREQCbFunc cb)

Used for register cpu freq cb for user.

Parameters:

Cb:the – cb register to cpu manager.

Returns:

Status of Operation.

uint32_t pm_dsp1_freq_get(void)

Get dsp1 clock freq.

Parameters:

void

Returns:

mhz.

int32_t pm_dvfs_set_supreme(void)

Set dvfs to the supreme mode.

Parameters:

void

Returns:

Status of Operation.

int32_t pm_dvfs_set_by_clock(void)

Set dvfs mode refs to current freqency of clock.

Parameters:

void

Returns:

Status of Operation.

int32_t pm_dvfs_register_check_func(PMDVFSCheckFunc func)

Register Check CB to dvfs module which will call it before dvfs mode changed.

Parameters:

func – PMDVFSCheckFunc.

Returns:

Status of Operation.

void pm_cpu_set_auto_slow_enable(bool is_auto_slow)

Whether the cpu enable auto slow.

Experimental Added Since 2.13.0.0:

Parameters:

is_auto_slow – Enable or disable auto slow.

Returns:

void