混杂设备

混杂设备

#include <linux/miscdevice.h>
  • 概念
    • 将不容易分类的设备,归纳为混杂设备
    • 可以简化编程
    • 可以省略设备号,cdev,设备文件的创建
  • 数据结构
    • struct miscdevice {
      • int minor; //设备号
      • const char *name; //名字
      • const struct file_operations *fops; //操作函数集合
    • };
  • 注册函数
    • extern int misc_register(struct miscdevice * misc);
  • 注销函数
    • extern int misc_deregister(struct miscdevice *misc);

猜你喜欢

转载自blog.csdn.net/weixin_38239856/article/details/80364939
今日推荐