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() ...
随机推荐
- Web之localStorage
localStorage: 1.localStorage拓展了cookie的4K限制 2.localStorage会可以将第一次请求的数据直接存储到本地,这个相当于一个5M大小的针对于前端页面的数据库 ...
- Hive_Hive的安装
嵌入模式不推荐使用. 本地模式多用于开发和测试. 远程模式多用于生产环境.
- 记次浙大月赛 134 - ZOJ Monthly, June 2014
链接 虽做出的很少,也记录下来,留着以后来补..浙大题目质量还是很高的 B 并查集的一些操作,同类和不同类我是根据到根节点距离的奇偶判断的,删点是直接新加一个点,记得福大月赛也做过类似的,并差集的这类 ...
- LessCss学习笔记
一.入门 1.LESSCSS是什么? LESSCSS是一种动态样式语言,属于CSS预处理语言的一种,它使用类似CSS的语法,为CSS的赋予了动态语言的特性,如变量.继承.运算.函数等,更方便CSS的编 ...
- zuul filter
前言 过滤器是Zuul的核心组件,这篇文章我们来详细讨论Zuul的过滤器.下面话不多说,来看看详细的介绍吧. 过滤器类型与请求生命周期 Zuul大部分功能都是通过过滤器来实现的.Zuul中定义了四种标 ...
- 8、二进制中1的个数------------>剑指offer系列
题目 输入一个整数,输出该数二进制表示中1的个数.其中负数用补码表示. 法一:分析 这是一道考察二进制的题目 二进制或运算符(or):符号为|,表示若两个二进制位都为0,则结果为0,否则为1. 二进制 ...
- substring和substr,slice和splice
substring 和 substr 这二货都是针对字符串而言的,且都是返回一个副本,而不是在原字符串上直接操作. 上代码: var str = '0123456789'; console.log( ...
- ES-windos环境搭建(1)
前言 由于elasticsearch为Java开发,所以它还依赖Java JDK环境,并且对版本还有要求,需要1.8(含)以上.我们首先来配置Java JDK环境. JDK简介 JDK是Java语言的 ...
- js如何调用电脑的摄像头
闲来无事,用js写了一个调用摄像头的demo,并用canvas显示保存.这个功能很实用,比如上传用户的头像,即时拍照及时上传. Html: <video width="200px&qu ...
- C/C++ 内存分配方式,堆区,栈区,new/delete/malloc/free
内存分配方式 内存分配方式有三种: [1] 从静态存储区域分配.内存在程序编译的时候就已经分配好,这块内存在程序的整个运行期间都存在.例如全局变量, static 变量. [2] 在栈上创建.在执行函 ...