Linux Device Drivers.ppt

  1. 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
  2. 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  3. 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
Linux Device Drivers.ppt

Linux Device Drivers Inroduction What’s a ‘device-driver’? A special kind of computer program Intended to control a peripheral device Needs to execute ‘privileged’ instructions Must be integrated into the OS kernel Interfaces both to kernel and to hardware Program-format specific to a particular OS Linux device-drivers A package mainly of ‘service functions’ The package is conceptually an ‘object’ But in C this means it’s a ‘struct’ Specifically: struct file_operations { …; }; Definition is found in a kernel-header: ‘/usr/src/linux/include/linux/fs.h’ Types of Device-Drivers Character drivers: - the device processes individual bytes (e.g., keyboard, printer, modem) Block drivers: - the device processes groups of bytes (e.g., hard disks, CD-ROM drives) Linux has other driver-types Network drivers Mouse drivers SCSI drivers USB drivers Video drivers ‘Hot-swap’ drivers … and others Linux treats devices as files Programmers accustomed to the file API open(), seek(), read(), write(), close(), ... Requires creating a filename in a directory (special ‘/dev’ directory is for devices) Driver Identification Character/Block drivers: Use ‘major-number’ to identify the driver Use ‘minor-numbers’ to distinguish among several devices the same driver controls Kernel also needs a driver-name Users need a device-node as ‘interface’ Developing a device-driver Clarify your requirements Devise a design to achieve them Test your design-concept (‘prototype’) ‘Debug’ your prototype (as needed) Build your final driver in iteratively Document your work for future use ‘Open Source’ Hardware Some equipment manufactures regard their designs as ‘intellectual property’ They don’t want to ‘give away’ their info They believe ‘secrecy’ is an advantage They fear others might copy their designs BUT: This hinders systems programmers! Non-Disclosure Agreements Sometimes manufacturers will let ‘trusted’ individuals, or commercial ‘partners’, look at th

文档评论(0)

zhaoxq + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档