timer event
/* linux/kernel/time/jiffies.c*/
static cycle_t jiffies_read(struct clocksource *cs)
{
return (cycle_t) jiffies;
} struct clocksource clocksource_jiffies = {
.name = "jiffies",
.rating = , /* lowest valid rating*/
.read = jiffies_read,
.mask = 0xffffffff, /*32bits*/
.mult = NSEC_PER_JIFFY << JIFFIES_SHIFT, /* details above */
.mult_orig = NSEC_PER_JIFFY << JIFFIES_SHIFT,
.shift = JIFFIES_SHIFT,
}; static int __init init_jiffies_clocksource(void)
{
return clocksource_register(&clocksource_jiffies);
} core_initcall(init_jiffies_clocksource); int clocksource_register(struct clocksource *c)
-->ret = clocksource_enqueue(c);
/*静态全局变量存储下一个精度最高的时钟源
static struct clocksource *next_clocksource;*/
-->next_clocksource = select_clocksource(); struct clocksource *clocksource_get_next(void)
/*静态全局变量存储当前使用的时钟源
static struct clocksource *curr_clocksource = &clocksource_jiffies;*/
-->curr_clocksource = next_clocksource; /*什么时间更换时钟源,以下两种方法选择其一*/
/*1.jiffies时间中断处理函数*/
static irqreturn_t s3c2410_timer_interrupt(int irq, void *dev_id)
-->void timer_tick(void)
-->void do_timer(unsigned long ticks)
-->jiffies_64 += ticks;
-->update_times(ticks);
-->void update_wall_time(void)
/* check to see if there is a new clocksource to use */
-->change_clocksource();
/*2.jiffies时间中断处理函数*/
void clockevents_register_device(struct clock_event_device *dev)
/*内核通知链触发*/
-->clockevents_do_notify(CLOCK_EVT_NOTIFY_ADD, dev); /*通知链注册*/
void __init tick_init(void)
/*static struct notifier_block tick_notifier = {
.notifier_call = tick_notify,
};*/
-->clockevents_register_notifier(&tick_notifier);
/*通知链回调*/
static int tick_notify(struct notifier_block *nb, unsigned long reason,void *dev)
-->static int tick_check_new_device(struct clock_event_device *newdev)
-->static void tick_setup_device(struct tick_device *td,struct clock_event_device *newdev, int cpu,const struct cpumask *cpumask)
-->void tick_setup_periodic(struct clock_event_device *dev, int broadcast)
-->void tick_set_periodic_handler(struct clock_event_device *dev, int broadcast)
-->dev->event_handler = tick_handle_periodic;
/*event时间处理函数调用*/
void tick_handle_periodic(struct clock_event_device *dev)
-->static void tick_periodic(int cpu)
-->void do_timer(unsigned long ticks)
-->jiffies_64 += ticks;
-->update_times(ticks);
-->void update_wall_time(void)
/* check to see if there is a new clocksource to use */
-->change_clocksource();
/* linux/kernel/time/jiffies.c*/static cycle_t jiffies_read(struct clocksource *cs){return (cycle_t) jiffies;}
struct clocksource clocksource_jiffies = {.name= "jiffies",.rating= 1, /* lowest valid rating*/.read= jiffies_read,.mask= 0xffffffff, /*32bits*/.mult= NSEC_PER_JIFFY << JIFFIES_SHIFT, /* details above */.mult_orig= NSEC_PER_JIFFY << JIFFIES_SHIFT,.shift= JIFFIES_SHIFT,};
static int __init init_jiffies_clocksource(void){return clocksource_register(&clocksource_jiffies);}
core_initcall(init_jiffies_clocksource);
int clocksource_register(struct clocksource *c)-->ret = clocksource_enqueue(c);/*静态全局变量存储下一个精度最高的时钟源static struct clocksource *next_clocksource;*/-->next_clocksource = select_clocksource();
struct clocksource *clocksource_get_next(void)/*静态全局变量存储当前使用的时钟源static struct clocksource *curr_clocksource = &clocksource_jiffies;*/-->curr_clocksource = next_clocksource;
/*什么时间更换时钟源,以下两种方法选择其一*//*1.jiffies时间中断处理函数*/static irqreturn_t s3c2410_timer_interrupt(int irq, void *dev_id)-->void timer_tick(void)-->void do_timer(unsigned long ticks)-->jiffies_64 += ticks;-->update_times(ticks);-->void update_wall_time(void)/* check to see if there is a new clocksource to use */-->change_clocksource();/*2.jiffies时间中断处理函数*/void clockevents_register_device(struct clock_event_device *dev)/*内核通知链触发*/-->clockevents_do_notify(CLOCK_EVT_NOTIFY_ADD, dev);
/*通知链注册*/void __init tick_init(void)/*static struct notifier_block tick_notifier = {.notifier_call = tick_notify,};*/-->clockevents_register_notifier(&tick_notifier);/*通知链回调*/static int tick_notify(struct notifier_block *nb, unsigned long reason,void *dev)-->static int tick_check_new_device(struct clock_event_device *newdev)-->static void tick_setup_device(struct tick_device *td,struct clock_event_device *newdev, int cpu,const struct cpumask *cpumask)-->void tick_setup_periodic(struct clock_event_device *dev, int broadcast)-->void tick_set_periodic_handler(struct clock_event_device *dev, int broadcast)-->dev->event_handler = tick_handle_periodic;/*event时间处理函数调用*/void tick_handle_periodic(struct clock_event_device *dev)-->static void tick_periodic(int cpu)-->void do_timer(unsigned long ticks)-->jiffies_64 += ticks;-->update_times(ticks);-->void update_wall_time(void)/* check to see if there is a new clocksource to use */-->change_clocksource();
timer event的更多相关文章
- Microsecond and Millisecond C# Timer[转]
文章转至:http://www.codeproject.com/Articles/98346/Microsecond-and-Millisecond-NET-Timer IntroductionAny ...
- Python 3.X 实现定时器 Timer,制作抽象的Timer定时器基类
Python 在不依赖第三方库的前提下,对于定时器的实现并不是很完美,但是这不意味着我们无法实现. 阅读了网上的一些资料,得出一些结论,顺手写了一个基类的定时器(Python3) BaseTimer: ...
- C#中5中timer的比较
C#中有5个timer,它们的主要区别如下: System.Threading.Timer 在线程池启动一个后台任务.我前段时间写过一个关于timer的垃圾回收的需要注意一下,参见谁动了我的time ...
- Swoole源代码学习记录(十五)——Timer模块分析
swoole版本号:1.7.7-stable Github地址:点此查看 1.Timer 1.1.swTimer_interval_node 声明: // swoole.h 1045-1050h ty ...
- Linux时间子系统之(十七):ARM generic timer驱动代码分析
专题文档汇总目录 Notes:ARM平台Clock/Timer架构:System counter.Timer以及两者之间关系:Per cpu timer通过CP15访问,System counter通 ...
- UEFI EVENT 全解
Event和Timer在UEFI当中是怎么实现的以及原理,我们先从Timer开始,然后细细的拨开隐藏在底层的实现. 先说Timer,那什么是Timer呢?其实在中文里面我们把它叫做定时/计数器,但是我 ...
- Linux时间子系统(十七) ARM generic timer驱动代码分析
一.前言 关注ARM平台上timer driver(clocksource chip driver和clockevent chip driver)的驱动工程师应该会注意到timer硬件的演化过程.在单 ...
- System and method for controlling switching between VMM and VM using enabling value of VMM timer indicator and VMM timer value having a specified time
In one embodiment, a method includes transitioning control to a virtual machine (VM) from a virtual ...
- .net几种timer区别
概述:.net框架不同名称控件都包含了各种timer,但每个timer有什么具体区别呢? 一.System.Threading private static void ThreadingTimer() ...
随机推荐
- Codeforces Round #532(Div. 2) A.Roman and Browser
链接:https://codeforces.com/contest/1100/problem/A 题意: 给定n,k. 给定一串由正负1组成的数. 任选b,c = b + i*k(i为任意整数).将c ...
- HDU6440(费马小定理)
其实我读题都懵逼--他给出一个素数p,让你设计一种加和乘的运算使得\[(m+n)^p = m^p+n^p\] 答案是设计成%p意义下的加法和乘法,这样:\[(m+n)^p\ \%\ p = m+n\] ...
- 洛谷 P2623 物品选取
https://www.luogu.org/problemnew/show/P2623 https://www.luogu.org/blog/test-1/solution-p2623 重点就是甲类物 ...
- Python type class metaclass
'type' 是 python built-in metaclass 其他继承自 ‘type’的class都可以是 Metaclass 子类可以继承父类的metaclass 然而 __metaclas ...
- mysql 维护添加远程主机访问
https://www.cnblogs.com/JNUX/p/6936548.html
- ListBox,CheckBoxList,DropDownList,RadioButtonList的常见数据绑定
ListBox,CheckBoxList,DropDownList,RadioButtonList的常见用法 四个都是选择控件,用法大同小异,基本都是指定键值对: 直接加选择项: void way1( ...
- asp.net网页跳转
1.Response.Redirect("http://www.bcbbs.net",false); 目标页面和原页面可以在2个服务器上,可输入网址或相对路径.后面的bool ...
- MySQL57修改root密碼
之前在電腦里安裝了MySQL57之后,一直沒用,卻忘記了root密碼, 在網上找了一些資料修改root密碼,卻一直出錯.直到試到這個: 用管理員權限打開CMD CD C:\Program Files\ ...
- Android 6.0 运行时权限处理完全解析 (摘抄)
转载请标明出处: http://blog.csdn.net/lmj623565791/article/details/50709663: 本文出自:[张鸿洋的博客] 一.概述 随着Android 6. ...
- SQL server 数据库基础语句
上篇介绍的是鼠标操作 遗漏两个知识: 主外键 两个列 数据类型 必须一致 //int类型不能约束nvarchar 类型 varchar类型不能约束nvarchar类型 varchar( ...