博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
hrtimer高精度定时器的简单使用【学习笔记】
阅读量:4469 次
发布时间:2019-06-08

本文共 1060 字,大约阅读时间需要 3 分钟。

1 #include 
2 3 #include
4 #include
5 #include
6 7 8 static struct hrtimer timer; 9 ktime_t kt;10 11 static enum hrtimer_restart hrtimer_hander(struct hrtimer *timer)12 {13 printk("zbzhuang:I am in hrtimer hander\r\n");14 15 hrtimer_forward(timer,timer->base->get_time(),kt);16 17 return HRTIMER_RESTART;18 19 20 }21 22 static int __init test_init(void)23 {24 printk("zbzhuang:---------%s-----------\r\n",__func__);25 26 kt = ktime_set(1,10);27 hrtimer_init(&timer,CLOCK_MONOTONIC,HRTIMER_MODE_REL);28 hrtimer_start(&timer,kt,HRTIMER_MODE_REL);29 timer.function = hrtimer_hander;30 31 return 0;32 }33 34 static void __exit test_exit(void)35 {36 hrtimer_cancel(&timer);37 printk("zbzhuang------------test over---------------\r\n");38 }39 40 41 module_init(test_init);42 module_exit(test_exit);43 MODULE_LICENSE("GPL");44 MODULE_AUTHOR("zbzhuang@qq.com");

 

转载于:https://www.cnblogs.com/zzb-Dream-90Time/p/7084916.html

你可能感兴趣的文章
魅蓝Note有几种颜色 魅蓝Note哪个颜色好看
查看>>
使用PullToRefresh实现下拉刷新和上拉加载
查看>>
透明度百分比与十六进制转换
查看>>
HBase表预分区
查看>>
NSBundle,UIImage,UIButton的使用
查看>>
GridView 中Item项居中显示
查看>>
UML类图五种关系与代码的对应关系
查看>>
如何理解作用域
查看>>
从无到满意offer,你需要知道的那些事
查看>>
P1516 青蛙的约会 洛谷
查看>>
SDOI2011 染色
查看>>
JQuery EasyUI combobox动态添加option
查看>>
面向连接的TCP概述
查看>>
前端快捷方式 [记录]
查看>>
亲测可用,解决端口被占用的指令!!
查看>>
MySQL--视图、触发器、事务、存储过程、内置函数、流程控制、索引
查看>>
Django--数据库查询操作
查看>>
自定义配置文件的使用
查看>>
js-20170609-运算符
查看>>
算法笔记_065:分治法求逆序对(Java)
查看>>