Skip to content Skip to navigation

Connexions

You are here: Home » Content » Device Drivers

Navigation

Content Actions

  • Download module PDF
  • Add to ...
    Add the module to:
    • My Favorites
    • A lens
    • An external social bookmarking service
    • My Favorites (What is 'My Favorites'?)
      'My Favorites' is a special kind of lens which you can use to bookmark modules and collections directly in Connexions. 'My Favorites' can only be seen by you, and collections saved in 'My Favorites' can remember the last module you were on. You need a Connexions account to use 'My Favorites'.
    • A lens (What is a lens?)

      Definition of a lens

      Lenses

      A lens is a custom view of Connexions content. You can think of it as a fancy kind of list that will let you see Connexions through the eyes of organizations and people you trust.

      What is in a lens?

      Lens makers point to Connexions materials (modules and collections), creating a guide that includes their own comments and descriptive tags about the content.

      Who can create a lens?

      Any individual Connexions member, a community, or a respected organization.

    • External bookmarks
  • E-mail the authors

Recently Viewed

This feature requires Javascript to be enabled.

Device Drivers

Module by: adrian valenzuela, CJ Ganier

Summary: A device driver makes all devices of a similar type to appear to behave identically to the user or operating system.

Device Drivers

In some cases in the electronics industry, there is no single standard for how devices should interact. Even more often, there are many standards that accomplish the same task in different ways. Because each hardware device or component may have different requirements for its input and output parameters or standard implementation, it is necessary to write a program on a microcontroller or computer to specifically handle the needs of another particular piece of hardware like a printer, wireless card, or memory. Drivers work as intermediary programs between the operating system and the particular device. Ideally, from the rest of the system’s point of view, the driver makes all devices of a similar type appear to behave identically. This way the programmers can write programs without having to know which hardware they are writing for. This is why the print button in an application should work the same way no matter which printer you are using.

In the case of embedded devices, the specific behavior of the device is more closely related to the program in general than in higher level programming situations. However, it is still useful for the programmer to create a useful interface to the device. A good interface will allow other programmers to easily access the features of the device while only having to do the minimum amount of programming to access those features. Because part manufacturers wish to make their parts easy to use, the documentation will usually attempt to make it clear to the reader the correct way to access the abilities of the part. Generally, part data sheets will explain what kind of pin interface the part uses and the precise commands that can be issued through the interface. The interface to the driver is the series of well-documented functions and parameters that can be called to access the device functions.

Here are some examples of the kind of service a PC device driver and an embedded device driver might provide.

Example 1

A wireless card driver for a laptop- From the PC user’s point of view, a wireless card for a laptop should allow the laptop to surf the web when a wireless base station is available. The web browser should never even know the difference between the wired and wireless internet. The web browser should only need to tell the operating system that it wants to send information to the internet, and the operating system should be able to pass the relevant information on to the wireless card.

From the point of view of a wireless card, there is a computer that sends it commands and a radio antenna that sends and receives information. In order for the internet to work, the wireless card has to find the base station and communicate information between the computer and the base station. This process may have many complicated steps that require information from the computer. Only some of these steps are directly concerned with making the internet work; most of the steps are probably configuration negotiations between the base station and the computer. The device driver is the software that makes sure that the operating system gives the information to the wireless card and that the wireless card then delivers the internet information to the computer in the exact same way as a wired connection delivers the information.

Both the internet and the operating system already have well-defined protocols, so a wireless card device driver should adhere to these protocols. For example, traffic on the internet is organized by chunks of information called “packets,” so the functions in the driver interface for the operating system will focus on the handling of “packets.” The device driver should handle these packets from the web browser and handle the negotiations with the base station without letting the web browser and the base station know about each other.

Example 2

A memory device in an embedded system is quite different from a wireless card for a laptop. Unlike the wireless card, a memory chip only has to worry about one thing- the memory bus. Usually the memory device will be controlled by a microcontroller through a memory bus. Most commands for memory chips are writes, reads, or erases. From the points of view of both the microcontroller and the memory chip, all commands are concerned with storing and removing data from the memory. Because of this, a memory chip driver does not have to hide as much from the larger program or operating system as the wireless card driver. The functions in the interface would be straightforward ones like read to an address, write to an address, and erase an address. Initialization commands might still be necessary, but they would be much less time consuming than in a wireless card driver.

Comments, questions, feedback, criticisms?

Send feedback