static void pwrctrl_dfs_mgrmsg_task(void) { int cur_profile = 0; unsigned int flowctrl_cpuload = 0; PWRCTRLFUNCPTR pRoutine = NULL; struct cpufreq_msg task_msg = {0,0,0,0}; g_stDfsCpuControl.ulStartTime = bsp_get_slice_value(); /* coverity[INFINITE_LOOP] */ /* coverity[no_escape] */ for (;;) { if (NULL != g_sem_calccpu_flag) { semTake(g_sem_calccpu_flag, DFS_WAIT_FOREVER); /*调用ttf回调函数*/ if ((NULL != FlowCtrlCallBack) && (g_flowctrl_in_interr_times >= 200)) { flowctrl_cpuload = cpufreq_calccpu_cpuload(); pRoutine = FlowCtrlCallBack; (void)(*pRoutine)(flowctrl_cpuload); } } else { taskDelay((int)g_stDfsCpuConfigInfo.ulTimerLen); g_calccpu_load_result = cpufreq_calccpu_result(&g_next_freq); } if (!g_cpufreq_lock_status_flag) { continue; } cur_profile = pwrctrl_dfs_get_profile(); cpufreq_assistant_regulate_ddr(cur_profile); if (DFS_PROFILE_NOCHANGE != g_calccpu_load_result) { if (g_icc_run_flag == 1) { task_msg.msg_type = CPUFREQ_ADJUST_FREQ; task_msg.source = CPUFREQ_CCORE; task_msg.content = g_calccpu_load_result; if (DFS_PROFILE_UP_TARGET == g_calccpu_load_result) { cur_profile = DC_RESV; } else if ((u32)cur_profile == CPUFREQ_MIN_PROFILE_LIMIT) { continue; } task_msg.profile = (unsigned int)cur_profile - 1; balong_cpufreq_icc_send(&task_msg); } else if (g_icc_run_flag == 2) { cpufreq_excute_result_cpu(g_calccpu_load_result, g_next_freq); } } } }
/* * 该接口负责cpu负载检测, * 并根据预设阈值判决是否需要向M3请求调频 */ void cpufreq_update_frequency(void) { u32 cpuload = 0; int cur_profile = 0; struct cpufreq_msg task_msg = {CPUFREQ_ADJUST_FREQ, CPUFREQ_ACORE, 0, BALONG_FREQ_MAX}; cpuload = (u32)cpufreq_calccpu_cpuload(); cur_profile = (int)pwrctrl_dfs_get_profile(); if (cpuload > dbs_tuners_ins.up_threshold) { task_msg.content = DFS_PROFILE_UP_TARGET; } else if (cpuload < dbs_tuners_ins.down_threshold) { task_msg.profile = (cur_profile != BALONG_FREQ_MIN) ? (cur_profile - 1) : (BALONG_FREQ_MIN); task_msg.content = DFS_PROFILE_DOWN; } else { return; } balong_cpufreq_icc_send(&task_msg); }
/* * 该接口负责cpu负载检测, * 并根据预设阈值判决是否需要向M3请求调频 */ void cpufreq_update_frequency(void) { u32 cpuload = 0; int cur_profile = 0; struct cpufreq_msg task_msg = {CPUFREQ_ADJUST_FREQ, CPUFREQ_CCORE, 0, BALONG_FREQ_MAX}; cpuload = cpufreq_calccpu_cpuload(); cur_profile = pwrctrl_dfs_get_profile(); if (cpuload > g_stDfsCpuConfigInfo.astThresHold[0].usProfileUpLimit) { task_msg.content = DFS_PROFILE_UP_TARGET; } else if (cpuload < g_stDfsCpuConfigInfo.astThresHold[0].usProfileDownLimit) { task_msg.profile = (cur_profile != BALONG_FREQ_MIN) ? (cur_profile - 1) : (BALONG_FREQ_MIN); task_msg.content = DFS_PROFILE_DOWN; } else { return; } balong_cpufreq_icc_send(&task_msg); }