设为首页 加入收藏

TOP

Linux驱动程序设计全文详解(二)
2014-11-23 22:22:22 来源: 作者: 【 】 浏览:19
Tags:Linux 驱动 程序设计 全文 详解
truct tq_struct plug_tq;


/*
* Boolean that indicates whether this queue is plugged or not.
*/
int plugged:1;


/*
* Boolean that indicates whether current_request is active or
* not.
*/
int head_active:1;


/*
* Boolean that indicates you will use blk_started_sectors
* and blk_finished_sectors in addition to blk_started_io
* and blk_finished_io. It enables the throttling code to
* help keep the sectors in flight to a reasonable value
*/
int can_throttle:1;


unsigned long bounce_pfn;


/*
* Is meant to protect the queue in the future instead of
* io_request_lock
*/
spinlock_t queue_lock;


/*
* Tasks wait here for free read and write requests
*/
wait_queue_head_t wait_for_requests;


struct request *last_request;
};


缓冲区和对缓冲区相应的I/O操作在此任务队列中相关联,等待内核的调度.如果是字符设备就不需要此数据结构.而
块设备的read(),write()函数则在buffer_queue的initize和设备请求队列进行处理请求时候传递给request_fn().
struct request_queue_t{}设备请求队列的变量类型,驱动程序在初始化的时候需要填写request_fn().


其他的数据结构还有 I/O port,Irq,DMA 资源分配,符合POSIX标准的ioctl的cmd的构造和定义,以及描述设备自身的
相关数据结构定义-如设备的控制寄存器的相关数据结构定义,BIOS里的参数定义,设备类型定义等.


首页 上一页 1 2 下一页 尾页 2/2/2
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇linux内核配置选项及删改全过程 下一篇数据库在C++程序下使用教程讲解

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: