忘记密码   免费注册 查看新帖 | 论坛精华区

ChinaUnix.net

  平台 论坛 博客 认证专区 大话IT HPC论坛 徽章 文库 沙龙 自测 下载 频道自动化运维 虚拟化 储存备份 C/C++ PHP MySQL 嵌入式 Linux系统
12下一页
最近访问板块 发新帖
查看: 10914 | 回复: 10

Device Driver -转自wiki [复制链接]

论坛徽章:
6
2015年辞旧岁徽章
日期:2015-03-03 16:54:152015年迎新春徽章
日期:2015-03-04 09:52:242015元宵节徽章
日期:2015-03-06 15:50:39NBA常规赛纪念章
日期:2015-05-04 22:32:032015七夕节徽章
日期:2015-08-21 09:20:10综合交流区版块每日发帖之星
日期:2016-08-04 06:20:00
发表于 2009-02-09 09:32 |显示全部楼层
http://en.wikipedia.org/wiki/Device_driver

Device driver
From Wikipedia, the free encyclopedia
Jump to: navigation, search
        This article or section includes a list of references or external links, but its sources remain unclear because it has insufficient inline citations.
You can improve this article by introducing more precise citations where appropriate. (November 2008)

In computing, a device driver or software driver is a computer program allowing higher-level computer programs to interact with a hardware device.

A driver typically communicates with the device through the computer bus or communications subsystem to which the hardware is connected. When a calling program invokes a routine in the driver, the driver issues commands to the device. Once the device sends data back to the driver, the driver may invoke routines in the original calling program. Drivers are hardware-dependent and operating-system-specific. They usually provide the interrupt handling required for any necessary asynchronous time-dependent hardware interface.
Contents
[hide]

    * 1 Purpose
    * 2 Design
    * 3 Development
    * 4 Kernel-mode vs User-mode
    * 5 Device driver applications
    * 6 Virtual device drivers
    * 7 Open drivers
    * 8 Driver APIs
    * 9 Identifiers
    * 10 See also
    * 11 References
    * 12 External links

[edit] Purpose

A device driver simplifies programming by acting as an abstraction layer between a hardware device and the applications or operating systems that use it. The higher-level application code can be written independently of whatever specific hardware device it will ultimately control, as it can interface with it in a standard way, regardless of the underlying hardware. Every version of a device, such as a printer, requires its own hardware-specific specialized commands. In contrast, most applications utilize devices (such as sending a file to a printer) by means of high-level device-generic commands such as PRINTLN (print a line). The device-driver accepts these generic high-level commands and breaks them into a series of low-level device-specific commands as required by the device being driven. Furthermore, drivers can provide a level of security as they can run in kernel-mode, thereby protecting the operating system from applications running in user-mode.

[edit] Design

Device drivers can be abstracted into logical and physical layers. Logical layers process data for a class of devices such as ethernet ports or disk drives. Physical layers communicate with specific device instances. For example, a serial port needs to handle standard communication protocols such as XON/XOFF that are common for all serial port hardware. This would be managed by a serial port logical layer. However, the logical layer needs to communicate with a particular serial port chip. 16550 UART hardware differs from PL-011. The physical layer addresses these chip-specific variations. Conventionally, OS requests go to the logical layer first. In turn, the logical layer calls upon the physical layer to implement OS requests in terms understandable by the hardware. Inversely, when a hardware device needs to respond to the OS, it uses the physical layer to speak to the logical layer.

In Linux, device drivers can be built either as parts of the kernel or separately as loadable modules. Makedev includes a list of the devices in Linux: ttyS (terminal), lp (parallel port), hd (disk), loop (loopback disk device), sound (these include mixer, sequencer, dsp, and audio)... [1]

The Windows .sys files and Linux .ko modules are loadable device drivers. The advantage of loadable device drivers is that they can be loaded only when necessary and then unloaded, thus saving kernel memory.

[edit] Development

Writing a device driver requires an in-depth understanding of how the hardware and the software of a given platform function. Drivers operate in a highly privileged environment and can cause disaster if they get things wrong.[2] In contrast, most user-level software on modern operating systems can be stopped without greatly affecting the rest of the system. Even drivers executing in user mode can crash a system if the device is erroneously programmed. These factors make it more difficult and dangerous to diagnose problems.

Thus drivers are usually written by software engineers who come from the companies that develop the hardware. This is because they have better information than most outsiders about the design of their hardware. Moreover, it was traditionally considered in the hardware manufacturer's interest to guarantee that their clients can use their hardware in an optimum way. Typically, the logical device driver (LDD) is written by the operating system vendor, while the physical device driver (PDD) is implemented by the device vendor. But in recent years non-vendors have written numerous device drivers, mainly for use with free operating systems. In such cases, it is important that the hardware manufacturer provides information on how the device communicates. Although this information can instead be learned by reverse engineering, this is much more difficult with hardware than it is with software.

Microsoft has attempted to reduce system instability due to poorly written device drivers by creating a new framework for driver development, called Windows Driver Foundation (WDF). This includes User-Mode Driver Framework (UMDF) that encourages development of certain types of drivers - primarily those that implement a message-based protocol for communicating with their devices - as user mode drivers. If such drivers malfunction, they do not cause system instability. The Kernel-Mode Driver Framework (KMDF) model continues to allow development of kernel-mode device drivers, but attempts to provide standard implementations of functions that are well known to cause problems, including cancellation of I/O operations, power management, and plug and play device support.

Apple has an open-source framework for developing drivers on Mac OS X called the I/O Kit.

[edit] Kernel-mode vs User-mode

Device drivers, particularly on modern Windows platforms, can run in kernel-mode (Ring 0) or in user-mode (Ring 3).[3] The primary benefit of running a driver in user mode is improved stability, since a poorly written user mode device driver cannot crash the system by overwriting kernel memory.[4] On the other hand, user-/kernel-mode transitions usually impose a considerable performance overhead, thereby prohibiting user-mode drivers for low latency and high throughput requirements..

[edit] Device driver applications

Because of the diversity of modern hardware and operating systems, many ways exist in which drivers can be used. Drivers are used for interfacing with:

    * Printers
    * Video adapters
    * Network cards
    * Sound cards
    * Local buses of various sorts - in particular, for bus mastering on modern systems
    * Low-bandwidth I/O buses of various sorts (for pointing devices such as mice, keyboards, USB, etc.)
    * computer storage devices such as hard disk, CD-ROM and floppy disk buses (ATA, SATA, SCSI)
    * Implementing support for different file systems
    * Implementing support for image scanners and digital cameras

Common levels of abstraction for device drivers are

    * For hardware:
          o Interfacing directly
          o Writing to or reading from a Device Control Register
          o Using some higher-level interface (e.g. Video BIOS)
          o Using another lower-level device driver (e.g. file system drivers using disk drivers)
          o Simulating work with hardware, while doing something entirely different
    * For software:
          o Allowing the operating system direct access to hardware resources
          o Implementing only primitives
          o Implementing an interface for non-driver software (e.g. TWAIN)
          o Implementing a language, sometimes quite high-level (e.g. PostScript)

Choosing and installing the correct device drivers for given hardware is often a key component of computer system configuration.

[edit] Virtual device drivers

A particular variant of device drivers are virtual device drivers. They are used to emulate a hardware device, particularly in virtualization environments, for example when a DOS program is run on a Microsoft Windows computer or when a guest operating system is run on, for example, a Xen host. Instead of enabling the guest operating system to dialog with hardware, virtual device drivers take the opposite role and emulate a piece of hardware, so that the guest operating system and its drivers running inside a virtual machine can have the illusion of accessing real hardware. Attempts by the guest operating system to access the hardware are routed to the virtual device driver in the host operating system as e.g. function calls. The virtual device driver can also send simulated processor-level events like interrupts into the virtual machine.

Virtual devices are also used in a non-virtualized environment. For example a virtual network adapter is used with a virtual private network, while a virtual disk device is used with iSCSI.

[edit] Open drivers

    * Printers: CUPS.
    * Scanners: SANE.
    * Video: Vidix, Direct Rendering Infrastructure

Solaris descriptions of commonly used device drivers

    * fas: Fast/wide SCSI controller
    * hme: Fast (10/100 Mb/sec) Ethernet
    * isp: Differential SCSI controllers and the SunSwift card
    * glm: UltraSCSI controllers
    * scsi: Small Computer Serial Interface (SCSI) devices
    * sf: soc+ or socal Fiber Channel Arbitrated Loop (FCAL)
    * soc: SPARC Storage Array (SSA) controllers
    * socal: Serial optical controllers for FCAL (soc+)

[edit] Driver APIs

    Main article: API

    * Advanced Linux Sound Architecture (ALSA) - The standard modern Linux sound driver interface
    * I/O Kit - an open-source framework from Apple for developing Mac OS X device drivers
    * Installable File System (IFS) - a filesystem API for IBM OS/2 and Microsoft Windows NT
    * Network Driver Interface Specification (NDIS) - a standard network card driver API
    * Open Data-Link Interface (ODI) - a network card API similar to NDIS
    * Scanner Access Now Easy (SANE) - a public domain interface to raster image scanner hardware
    * Uniform Driver Interface (UDI) - a cross platform driver interface project
    * Windows Display Driver Model (WDDM) - the graphic display driver architecture for Windows Vista
    * Windows Driver Foundation (WDF)
    * Windows Driver Model (WDM)

Identifiers

    * Device id is the device identifier and Vendor id is the vendor identifier.

        Please help improve this section by expanding it. Further information might be found on the talk page. (June 2008)

[edit] See also

    * Class driver
    * Firmware
    * Interrupt
    * Loadable kernel module
    * Makedev
    * Open source hardware
    * Printer driver
    * udev

[edit] References

   1. ^ MAKEDEV - Linux Command - Unix Command
   2. ^ "Device Driver Basics". http://www.linux-tutorial.info/m ... ial&pageid=255.
   3. ^ "User-mode vs. Kernel-mode Drivers". Microsoft. 2003-03-01. http://technet2.microsoft.com/wi ... 1033.mspx?mfr=true. Retrieved on 2008-03-04.
   4. ^ "Introduction to the User-Mode Driver Framework (UMDF)". Microsoft. 2006-10-10. http://blogs.msdn.com/iliast/arc ... ver-Framework.aspx. Retrieved on 2008-03-04.

[ 本帖最后由 dreamice 于 2009-2-9 10:13 编辑 ]

评分

参与人数 2可用积分 +21 收起 理由
T-bagwell + 6 精品文章
dreamice + 15 精品文章

查看全部评分

论坛徽章:
3
金牛座
日期:2014-06-14 22:04:062015年辞旧岁徽章
日期:2015-03-03 16:54:152015年迎新春徽章
日期:2015-03-04 09:49:45
发表于 2009-02-09 10:13 |显示全部楼层
感谢yidou兄推荐精品文章啊

论坛徽章:
4
摩羯座
日期:2014-07-22 09:03:552015元宵节徽章
日期:2015-03-06 15:50:392015亚冠之大阪钢巴
日期:2015-06-12 16:01:352015年中国系统架构师大会
日期:2015-06-29 16:11:28
发表于 2009-02-09 10:17 |显示全部楼层
好东西

论坛徽章:
0
发表于 2009-02-21 19:57 |显示全部楼层
可惜英文

论坛徽章:
3
金牛座
日期:2014-06-14 22:04:062015年辞旧岁徽章
日期:2015-03-03 16:54:152015年迎新春徽章
日期:2015-03-04 09:49:45
发表于 2009-02-22 14:52 |显示全部楼层
原帖由 lijingsandy 于 2009-2-21 19:57 发表
可惜英文


很多经典文章都是英文的,不会看英文不行啊

论坛徽章:
3
CU十二周年纪念徽章
日期:2013-10-24 15:41:34摩羯座
日期:2013-12-01 00:21:362015年迎新春徽章
日期:2015-03-04 09:49:45
发表于 2009-02-22 19:08 |显示全部楼层
只好慢慢看了。。。呵呵

论坛徽章:
3
戌狗
日期:2014-09-10 17:07:162015年辞旧岁徽章
日期:2015-03-03 16:54:15wusuopu
日期:2016-06-17 17:43:45
发表于 2009-02-23 00:49 |显示全部楼层
好文章

论坛徽章:
0
发表于 2011-01-15 22:41 |显示全部楼层
可怜的人

论坛徽章:
0
发表于 2012-12-02 23:01 |显示全部楼层
感谢分享,自己还没去wiki上搜索过呢

论坛徽章:
0
发表于 2013-07-01 23:33 |显示全部楼层

hb_08540

And are furnishing you with a pace nearer to having a celebrityendorsed apparel,mulberry outlet. Organisation old mature british isles has discharged its Royally popular program in a proposal to discover people cleaning our own closets to give the chunks we not any longer slip on helping a creditable lead and among the list of donators definitely typically has always been Sienna cooper,mulberry womens shoulder bags. The occasional presenter in addition to the girls daughter Savannah currently own were to be given the good causes several parts utilizing armoires your Keungzai outfit,mulberry wallets.
相关的主题文章:

  
   The beds base and also also the mission have to research the material
  
   Obviously if or when he previously we can be been
  
   Terrifying Thisbe was indeed slaughtered
  
   Mulberry sale that results wall socket straw grey
  
   hb_08057
您需要登录后才可以回帖 登录 | 注册

本版积分规则

SACC2017购票8.8折优惠进行时

2017中国系统架构师大会(SACC2017)将于10月19-21日在北京新云南皇冠假日酒店震撼来袭。今年,大会以“云智未来”为主题,云集国内外顶级专家,围绕云计算、人工智能、大数据、移动互联网、产业应用等热点领域展开技术探讨与交流。本届大会共设置2大主会场,18个技术专场;邀请来自互联网、金融、制造业、电商等多个领域,100余位技术专家及行业领袖来分享他们的经验;并将吸引4000+人次的系统运维、架构师及IT决策人士参会,为他们提供最具价值的交流平台。
----------------------------------------
优惠时间:2017年8月2日前

活动链接>>
  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号 北京市公安局海淀分局网监中心备案编号:11010802020122
广播电视节目制作经营许可证(京) 字第1234号 中国互联网协会会员  联系我们:
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP