zoukankan      html  css  js  c++  java
  • Linux驱动之混杂设备(misc)

    字符设备之混杂设备:

    定义混杂设备:

    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 *)来将将设备描述结构和设备操作函数集联系起来。

    <wiz_tmp_tag id="wiz-table-range-border" contenteditable="false" style="display: none;">

  • 相关阅读:
    洛谷P1865 A%B Problem
    树状数组的操作
    树状数组的基础知识
    卡常优化中最为奇怪的操作
    inline的用法
    快速读入的方法
    P1059 明明的随机数及unique去重的用法
    P3376 网络最大流 【模板】
    Gym
    HDU
  • 原文地址:https://www.cnblogs.com/big-devil/p/8590039.html
Copyright © 2011-2022 走看看