MT2523 API Reference  LinkIt SDK v4
DVFS

This section introduces the DVFS driver APIs including terms and acronyms, supported features, details on how to use this driver, DVFS function groups, enums, structures and functions. More...

Overview

This section introduces the DVFS driver APIs including terms and acronyms, supported features, details on how to use this driver, DVFS function groups, enums, structures and functions.

Terms and acronyms

The following provides descriptions of the terms commonly used in the DVFS driver and how to use its various functions.

Terms Details
DVFS Dynamic Voltage and Frequency Scaling.
OPP Operating Performance Point, a tuple of frequency and voltage. For more details, please refer to the section "Power modes" in MediaTek MT2523 datasheet.
hal_dvfs_opp.png

How to use the driver

Functions

hal_dvfs_status_t hal_dvfs_init (void)
 The function initializes the DVFS framework. More...
 
hal_dvfs_status_t hal_dvfs_target_cpu_frequency (uint32_t target_freq, hal_dvfs_freq_relation_t relation)
 This function adjusts the CPU frequency to a suitable target frequency according to the passed-in relation. More...
 
uint32_t hal_dvfs_get_cpu_frequency (void)
 This function gets the current CPU frequency. More...
 
hal_dvfs_status_t hal_dvfs_get_cpu_frequency_list (const uint32_t **list, uint32_t *list_num)
 This function gets all adjustable CPU frequencies listed in the OPP table. More...
 

Modules

 Enum
 

Function Documentation

uint32_t hal_dvfs_get_cpu_frequency ( void  )

This function gets the current CPU frequency.

Returns
The current CPU frequency is in kHz.
hal_dvfs_status_t hal_dvfs_get_cpu_frequency_list ( const uint32_t **  list,
uint32_t *  list_num 
)

This function gets all adjustable CPU frequencies listed in the OPP table.

Parameters
[out]listis a double pointer to the frequency table.
[out]list_numis a pointer to the number of the entries in the frequency table.
Returns
HAL_DVFS_STATUS_OK, if the operation completed successfully.
HAL_DVFS_STATUS_ERROR, if an error occurred during the operation..
hal_dvfs_status_t hal_dvfs_init ( void  )

The function initializes the DVFS framework.

Returns
HAL_DVFS_STATUS_OK, if the initialization completed successfully.
HAL_DVFS_STATUS_ERROR, if an error occurred during the initialization.
hal_dvfs_status_t hal_dvfs_target_cpu_frequency ( uint32_t  target_freq,
hal_dvfs_freq_relation_t  relation 
)

This function adjusts the CPU frequency to a suitable target frequency according to the passed-in relation.

Parameters
[in]target_freqis the target frequency in kHz.
[in]relationis the relationship between the target frequency and the final frequency. HAL_DVFS_FREQ_RELATION_L, the lowest frequency at or above the target level.
HAL_DVFS_FREQ_RELATION_H, the highest frequency below or at the target level.
Example 1.
hal_dvfs_target_cpu_frequency(103000, HAL_DVFS_FREQ_RELATION_L). The final CPU frequency is equal to or greater than 103MHz.
hal_dvfs_example1.png
Example 2.
hal_dvfs_target_cpu_frequency(103000, HAL_DVFS_FREQ_RELATION_H). The final CPU frequency is equal to or less than 103MHz.
hal_dvfs_example2.png
Returns
HAL_DVFS_STATUS_OK, if OK.
HAL_DVFS_STATUS_INVALID_PARAM, if the parameter value is invalid.
HAL_DVFS_STATUS_ERROR, if an error occurred.