11 2019 档案
摘要:在Linux 驱动程序中,可以使用等待队列来实现阻塞进程的唤醒。等待队列的头部定义如下,是一个双向列表。 struct list_head { struct list_head *next, *prev; }; struct __wait_queue_head { spinlock_t lock;
阅读全文
摘要:首先是内核初始化函数。代码如下。主要是三个步骤。1 生成设备号。 2 注册设备号。3 创建设备。 #include <linux/module.h> #include <linux/fs.h> #include <linux/init.h> #include <linux/cdev.h> #incl
阅读全文