Linux--字符设备驱动结构框图
2016-02-01 21:30
417 查看
其中cdev结构体用于描述一个字符设备,其定义如下:
struct cdev {
struct kobject kobj;
struct module *owner;
const struct file_operations *ops;
struct list_head list;
dev_t dev; //设备号
unsigned int count;
};
cdev_init()函数用于初始化cdev成员,建立cdev和file_operations之间的链接;
register_chrdev_region()和alloc_chrdev_region()函数向系统申请设备号。
__init xxx_init()用于设备驱动模块加载函数,其中一般有cdev_init函数,和注册字符设备号,调用register_chrdev_region()。
__exit xxx_exit()用于设备驱动模块卸载函数。其中调用unregister_chrdev_egion()//释放占用的设备号。cdev_del//注销设备。
相关文章推荐
- 初探linux子系统集之timer子系统(一)
- 初探linux子系统集之timer子系统(一)
- 初探linux子系统集之timer子系统(二)
- 初探linux子系统集之timer子系统(二)
- linux下安装中文检索软件 sphinx/coreseek
- linux命令学习之(cat)
- linux 命令
- Linux虚拟化之XenServer的安装与配置管理
- linux if 命令判断条件总结
- 解决远程登陆Linux误按ctrl+s锁屏
- Linux下 config/configure/Configure、make 、make test/make check、sudo make install 的作用
- Linux基本的快捷键
- Linux线程 -- 互斥锁实践
- Linux服务器内外网端口转发映射
- linux 编译安装GCC4.9.3(完整版)
- linux 远程本地端口映射
- linux防火墙实现端口转发、端口映射及双向通路
- Linux 内核开发资料
- Linux运维资料
- centos5.5下更新Python