1.字符设备驱动开发

1.字符设备驱动 

module_init(xxx_init);
module_exit(xxx_exit);
//注册模块加载函数
//注册模块卸载函数

加载模块使用

insmod xxx.ko或modprobe xxx.ko

卸载模块使用

resmod xxx.ko或modprobe -r xxx.ko

推荐使用modprobe 和 resmod

字符设备注册和注销 

static inline int register_chrdev(unsigned int major, const char *name,
const struct file_operations *fops)
static inline void unregister_chrdev(unsigned int major, const char *name)

设备的具体操作函数

编写了四个函数: chrtest_open、 chrtest_read、 chrtest_write和 chrtest_release

添加LICENSE和作者信息

MODULE_LICENSE()
MODULE_AUTHOR()
//添加模块 LICENSE 信息
//添加模块作者信息

设备号分配


 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值