摘要:
1. 字符设备驱动模块加载与卸载函数模板//设备结构体声明struct xxx_dev_t{ struct cdev cdev; …….}xxx_dev;//设备驱动模块加在函数static int __init xxx_init(void){ ……… cdev_init(&xxx_dev.cdev, &xxx_fops)... 阅读全文
posted @ 2009-11-24 21:16 放飞自我 阅读(421) 评论(0) 推荐(0)
摘要:
1. 字符设备驱动模块加载与卸载函数模板//设备结构体声明struct xxx_dev_t{ struct cdev cdev; …….}xxx_dev;//设备驱动模块加在函数static int __init xxx_init(void){ ……… cdev_init(&xxx_dev.cdev, &xxx_fops)... 阅读全文
posted @ 2009-11-24 21:16 放飞自我 阅读(421) 评论(0) 推荐(0)
摘要:
字符设备驱动 首先我们要清楚几个重要的数据结构。1. file_operations 结构体是一个函数指针的集合,每个打开的文件以他自身的函数集相关联。简单的说就是打开某个文件后,对他进行相关操作函数的集合,都包含在了这个结构体中。struct file_operations {struct module *owner;loff_t(*llseek) (struct file *, loff_t... 阅读全文
posted @ 2009-11-24 20:54 放飞自我 阅读(753) 评论(0) 推荐(0) |
||