摘要: 一、注册一个平台设备 方法1:platform_device_register 核心数据结构: 1 struct platform_device { 2 const char *name; 3 int id; 4 bool id_auto; 5 struct device dev; 6 u32 nu 阅读全文
posted @ 2019-04-04 20:21 一枚小苦工 阅读(1293) 评论(0) 推荐(0) 编辑
摘要: printk("HZ is %d\n",HZ); timeout = jiffies + 5*HZ/100; printk(KERN_INFO"time_after test\r\n"); while(1) { if(time_after(jiffies,timeout)) { printk("ti 阅读全文
posted @ 2019-03-19 11:12 一枚小苦工 阅读(654) 评论(0) 推荐(0) 编辑
摘要: 一、Linux定时器主要调用接口 1、定时器数据结构 1 struct timer_list { 2 /* 3 * All fields that change during normal runtime grouped to 4 * the same cacheline 5 */ 6 struct 阅读全文
posted @ 2019-03-16 14:41 一枚小苦工 阅读(3465) 评论(0) 推荐(1) 编辑
摘要: char_driver.c 1 #include <linux/module.h> 2 #include <linux/slab.h> //kmalloc 3 #include <linux/cdev.h> //cdev 4 #include <linux/fs.h> //register_chrd 阅读全文
posted @ 2017-11-22 19:54 一枚小苦工 阅读(345) 评论(0) 推荐(0) 编辑