- 博客(9)
- 资源 (9)
- 收藏
- 关注
原创 Linux内核定时器的使用
内核定时器的结构体定义在include/linux/timer.h:struct timer_list { /* * All fields that change during normal runtime grouped to the * same cacheline */ struct list_head entry; unsigned long expires; st
2016-06-29 10:47:40 597
原创 Workqueue的应用
工作队列允许内核代码请求某个函数在未来的时间被调用,具有很好的灵活性,其运行在特殊的内核线程,该线程没有对应的用户空间可以访问,因此,工作队列函数不能访问用户空间,但是可以休眠。TP的私有数据结构:struct msg21xx_ts_data { struct input_dev *input; struct hrtimer timer; struct work_struct wor
2016-06-28 14:56:20 537
原创 Linux中seq_file的应用
seq_file和seq_operations结构体定义在include/linux/seq_file.h:struct seq_file { char *buf; size_t size; size_t from; size_t count; size_t pad_until; loff_t index; loff_t read_pos; u64 version; stru
2016-06-28 14:09:35 2184 1
原创 Linux的notifier机制在TP中的应用
在linux内核系统中,各个模块、子系统之间是相互独立的。Linux内核可以通过通知链机制来获取由其它模块或子系统产生的它感兴趣的某些事件。notifier_block结构体在include/linux/notifier.h中定义:struct notifier_block { notifier_fn_t notifier_call; struct notifier_block __r
2016-06-27 22:00:35 3662
原创 Linux中miscdevice的分析
当字符设备不符合预先确定的字符设备范畴时,就可以采用Linux的杂项设备,这类设备用得比较多,misc device用主设备号为10来调用misc_register注册。misc device的实现在drivers/char/misc.c文件中,先看它的init函数。static int __init misc_init(void){ int err;#ifdef CONFIG_PRO
2016-06-27 19:41:02 2213 1
原创 Linux中debugfs的解析
debugfs_create_dir和debugfs_create_file定义在fs/debugfs/inode.c,声明在include/linux/debugfs.h。struct dentry *debugfs_create_dir(const char *name, struct dentry *parent){ return __create_file(name, S_IF
2016-06-27 17:56:17 6554
原创 Linux中debugfs的应用实例
struct ft5x06_ts_data { struct i2c_client *client; struct input_dev *input_dev; const struct ft5x06_ts_platform_data *pdata; struct ft5x06_psensor_platform_data *psensor_pdata;
2016-06-27 16:02:56 905
原创 sysfs_create_group使用
include/linux/sysfs.h中对attribute和attribute_group结构体的定义:struct attribute { const char *name; umode_t mode;#ifdef CONFIG_DEBUG_LOCK_ALLOC bool ignore_lock
2016-06-26 16:10:54 10363
原创 device_create_file的使用
DEVICE_ATTR是一个宏,其定义在include/linux/device.h:#define DEVICE_ATTR(_name, _mode, _show, _store) \ struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store)__ATTR宏定义在include/linux/...
2016-06-26 14:21:20 11876 1
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人