首页 > 其他 > 详细

驱动笔记 - 混杂设备常用函数

时间:2014-11-19 23:51:54      阅读:353      评论:0      收藏:0      [点我收藏+]

#include <linux/miscdevice.h>
混杂设备:主设备号为10的字符设备
struct miscdevice
{
int minor; //次设备号
const char *name;
const struct file_operations *fops;
struct list_head list;
struct device *parent;
struct device *this_device;
}

混杂设备注册
int misc_register (struct miscdevice * misc);
int misc_deregister (struct miscdevice * misc);

 

例:

struct miscdevice misc = {
.minor = 12, //若需动态分配填255,不为0为静态分配
.name = DEVICE_NAME,
.fops = &dev_fops,
}

驱动笔记 - 混杂设备常用函数

原文:http://www.cnblogs.com/tolimit/p/4109387.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!