CPU主频调整
1. 概述¶
用户可通过sysdesc以及命令对CPU主频做调整。
2. 配置¶
2.1. sysdesc配置¶
需要确认当前使用的product config是使用的何种sysdesc文件,可在rtk/proj/mak/product
中找到当前工程的配置,打开配置搜索CONFIG_SYSDESC_SELECT
确认当前使用的sysdesc文件。例如,当前工程使用pioneer3_ssc020a_64_freertos_smp_isw_usbdev
,其对应的sysdesc文件为CONFIG_SYSDESC_SELECT = "pioneer3-ssc020a-s01b.sys"
,那么就去修改这个文件。
sysdesc配置文件路径:rtk/proj/sc/driver/sysdriver/sysdesc/hal/pioneer3/pub/
配置示例:
如上图,<cpufreq>
表示CPU主频栏目,<operating_points_u32_u32>
表示当前可调整的CPU主频(单位:kHz)以及对应的核电压(mV)。
用户只需关心选项[default_rate_u32]
,这个选项表示系统起来后默认的CPU主频,目前默认为1GHz。
2.2. 命令配置¶
RTOS下支持命令cpufreq
,可动态查看和调整当前CPU主频。
cpufreq info
:可查看当前CPU主频以及支持的主频列表,用户可根据主频列表进行调整。
cpufreq set_freq xxx
:可调整当前CPU主频。
SS-RTOS # SS-RTOS # cpufreq sub commands: info set_freq [mV] debug [0|1] get_temp SS-RTOS # SS-RTOS # cpufreq info cpu freq(measured): 1000032000 Hz cpu freq(default): 1000000000 Hz Operating Points:: cpu freq(Hz) Voltage(mV) [0] 1200000000 1000 [1] 1100000000 1000 [2] 1000000000 1000 [3] 800000000 900 [4] 600000000 900 [5] 400000000 900 THERMO Config: Temperature Volt(mV) [Upper] 60 900 [Lower] 40 1000 SS-RTOS # SS-RTOS # cpufreq set_freq 1200000000 SS-RTOS # cpufreq info cpu freq(measured): 1200000000 Hz cpu freq(default): 1200000000 Hz Operating Points:: cpu freq(Hz) Voltage(mV) [0] 1200000000 1000 [1] 1100000000 1000 [2] 1000000000 1000 [3] 800000000 900 [4] 600000000 900 [5] 400000000 900 THERMO Config: Temperature Volt(mV) [Upper] 60 900 [Lower] 40 1000
用户如果需要在代码中进行控制,仅需引入头文件sys_sys_isw_cli.h
,使用接口run_command
即可实现命令输入的功能,例如run_command("cpufreq set_freq 800000000");
能够将CPU主频调整到800MHz。