码迷,mamicode.com
首页 > 系统相关 > 详细

Linux驱动之混杂设备(misc)

时间:2018-03-17 15:20:22      阅读:222      评论:0      收藏:0      [点我收藏+]

标签:ons   list   联系   lin   linu   body   使用   卸载   class   

字符设备之混杂设备:

定义混杂设备:

struct misdevice{

int  minor; //为什么这里只有次设备号,因为混杂设备是一种在                          /////////////////////////Linux系统默认主设备号为10 的特殊字符设备。

const char  *name;

const struct  file_operation *fops;

struct list_head list;

struct device  *parent;

struct device *this _device;

}

Linux系统注册混杂设备驱动:
int misc_register(struct misdevice *misc) //和函数: int cdev_add(struct cdev ////////////////////////////////////////////////////////////////////////*,dev_t,unsigned);  相同。

 

卸载混杂设备:

int misc_deregister(struct misdevice *misc)

 

注意:混杂设备的初始化没有使用函数cdev_init(stuct cdev *,const struct file_operation *)来将将设备描述结构和设备操作函数集联系起来。

Linux驱动之混杂设备(misc)

标签:ons   list   联系   lin   linu   body   使用   卸载   class   

原文地址:https://www.cnblogs.com/big-devil/p/8589497.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!