mirror of
https://github.com/DragonOS-Community/DragonOS.git
synced 2025-06-21 00:06:32 +00:00
软中断&定时器重构 (#223)
* 软中断&定时器重构 Co-authored-by: houmkh<houjiaying@DragonOS.org> * 修改timer的clock() * 删除debug信息 --------- Co-authored-by: houmkh <1119644616@qq.com>
This commit is contained in:
@ -67,7 +67,7 @@ void HPET_handler(uint64_t number, uint64_t param, struct pt_regs *regs)
|
||||
switch (param)
|
||||
{
|
||||
case 0: // 定时器0中断
|
||||
timer_jiffies += HPET0_INTERVAL;
|
||||
rs_update_timer_jiffies(HPET0_INTERVAL);
|
||||
|
||||
/*
|
||||
// 将HEPT中断消息转发到ap:1处理器
|
||||
@ -76,18 +76,18 @@ void HPET_handler(uint64_t number, uint64_t param, struct pt_regs *regs)
|
||||
*/
|
||||
|
||||
// 若当前时间比定时任务的时间间隔大,则进入中断下半部
|
||||
if (container_of(list_next(&timer_func_head.list), struct timer_func_list_t, list)->expire_jiffies <= timer_jiffies)
|
||||
raise_softirq(TIMER_SIRQ);
|
||||
if (rs_timer_get_first_expire() <= rs_clock())
|
||||
rs_raise_softirq(TIMER_SIRQ);
|
||||
|
||||
// 当时间到了,或进程发生切换时,刷新帧缓冲区
|
||||
if (timer_jiffies >= video_refresh_expire_jiffies || (video_last_refresh_pid != current_pcb->pid))
|
||||
if (rs_clock() >= video_refresh_expire_jiffies || (video_last_refresh_pid != current_pcb->pid))
|
||||
{
|
||||
raise_softirq(VIDEO_REFRESH_SIRQ);
|
||||
rs_raise_softirq(VIDEO_REFRESH_SIRQ);
|
||||
// 超过130ms仍未刷新完成,则重新发起刷新(防止由于进程异常退出导致的屏幕无法刷新)
|
||||
if (unlikely(timer_jiffies >= (video_refresh_expire_jiffies + (1 << 17))))
|
||||
if (unlikely(rs_clock() >= (video_refresh_expire_jiffies + (1 << 17))))
|
||||
{
|
||||
video_refresh_expire_jiffies = timer_jiffies + (1 << 20);
|
||||
clear_softirq_pending(VIDEO_REFRESH_SIRQ);
|
||||
video_refresh_expire_jiffies = rs_clock() + (1 << 20);
|
||||
rs_clear_softirq_pending(VIDEO_REFRESH_SIRQ);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
Reference in New Issue
Block a user