linux驱动编程--几个重要函数及概念

@cdev is a structure, it is used to record some information about char-device. for add a @cdev, the following steps is necessary:

1.create a @cdev

        cdev_init()        --init a structure about cdev

        cdev_alloc()     --alloc and init a structure

        ps:it is actually helpfull that read a example and the source of the functions.

 2.get a @(device-num)

        register_chrdev_region() -- 向系统请求一个用户指定的设备号,可能已经被占用

        unregister_chrdev_region()

        alloc_chrdev_region()     -- 请求系统分配一个设备号,不会出现被占用的问题

 3.register this cdev

        cdev_add() 

        cdev_del()

关于设备类和设备文件

        class_create()    -- 产生设备类,在参数中指定设备类名称

        device_create()  -- 产生设备文件,在参数中指定设备文件名称

        class_destroy()  --

        device_destroy() --

其他未解决问题:

        主次设备号:主设备号--区分驱动程序。次设备号--区分调用程序?不同调用程序间会通过驱动互相影响?

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值