Thursday, April 4, 2013

What is a device driver

What is a device driver

 initial understanding:

device driver is a software that the OS use to communicate with the device, ie using its functionality, ex: the driver of a mouse device, the OS needs an interface to communicate with the mouse, when you connect the mouse to the machine, a stream of data is transferred from the mouse to the device, HOW THE OS MANAGES THIS STREAM?!

formal definition:


in computing, a device driver is a computer program that operates or controls a particular type of device that is attached to a computer. A driver typically communicates with the device through the computer bus or communications subsystem to which the hardware connects. 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

Main Function:

A device driver simplifies programming by acting as translator between a hardware device and the applications or operating systems that use it.[1] Programmers can write the higher-level application code independently of whatever specific hardware the end-user is using. 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 physical 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. Conversely, when a hardware device needs to respond to the OS, it uses the physical layer to speak to the logical layer.
http://en.wikipedia.org/wiki/Device_driver

Windows and Linux Device Drivers:
In Linux environments, programmers can build device drivers 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)...[3]
The Microsoft Windows .sys files and Linux .ko modules contain 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.
http://en.wikipedia.org/wiki/Device_driver

Device drivers are dangerous!!

since device drivers mostly run in Kernel Mode, the can cause system unstability and falier,normal user mode programs are safe beacause the OS can kill their process if they made a fault or unprevilage instruction, for this who develop a device driver must be very familliar with the underline hardware, usually hardware vendors implement their device drivers.

Logical Device Drivers (LDD) VS Physical Device Drivers (PDD)

LDD is a layer above the PDD, LDD is implemented typically by the OS vendor, while the PDD by the hardware Vendor.
programms communicate with the LDD to request a certain task from the hardware in a logical way what ever the underlining hardware is, 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 physical 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. Conversely, when a hardware device needs to respond to the OS, it uses the physical layer to speak to the logical layer.



in the above figure, the Operating System Abstract Layer is the Logical Device Driver (LDD), while the drivers in the next level are the Physical Device Drivers(PDD).



what is the Board Support Package (BSP) ??

the board support package is the soft ware that wrape all the device derivers for all devices on your board, The board support package has many drivers and it installs the necessary drivers permanently on your computer and it does the following,
 initializes the whole board, brings it up getting all peripherals initaialised, and most importantly jumps to present boot loader, and of course also provides primitive set of drivers support such as disk drive etc.
it also:
  •     Initialize the processor.
  •     Initialize the bus.
  •     Initialize the interrupt controller.
  •     Initialize the clock.
  •     Initialize the RAM (random access memory) settings.
  •     Configure the segments (if applicable).
  •     Run the boot loader.

note: Windows Embedded Compact 7 includes a set of standard device drivers for each board support package (BSP) that it supports.
http://www.linuxforums.org/forum/kernel/89588-difference-between-board-support-package-device-driver.html
http://whatis.techtarget.com/definition/board-support-package



1 comment:

  1. Thanks for your ideas. You can also find the details on Affity Solutions, at the System Programming. The main object of the Affity Solutions is to provide quality web services and is among the few software development company in Nagpur.

    ReplyDelete