Professional Documents
Culture Documents
Share
Tweet
+1
This series on Linux device drivers aims to present the usually technical topic in a way that is
more interesting to a wider cross-section of readers.
After a week of hard work, we finally got our driver working, were Pugs first words when
he met his girlfriend, Shweta.
Why? What was your driver up to? Was he sick? And what hard work did you do? asked
Shweta. Confused, Pugs responded, What are you talking about?
Now it was Shwetas turn to look puzzled, as she replied, Why ask me? You tell me
which of your drivers are you talking about?
When understanding dawned on him, Pugs groaned, Ah cmon! Not my car drivers I am
talking about a device driver on my computer.
I know about car and bus drivers, pilots, and even screwdrivers; but what is this device
driver? queried Shweta, puzzled.
That was all it took to launch Pugs into a passionate explanation of device drivers for the
newbie in particular, Linux device drivers, which he had been working on for many years.
Device controllers are typically connected to the CPU through their respectively named buses
(collection of physical lines) for example, the PCI bus, the IDE bus, etc. In todays embedded
world, we encounter more micro-controllers than CPUs; these are the CPU plus various device
controllers built onto a single chip. This effective embedding of device controllers primarily
reduces cost and space, making it suitable for embedded systems. In such cases, the buses are
integrated into the chip itself. Does this change anything for the drivers, or more generically, on
the software front?
The answer is, not much except that the bus drivers corresponding to the embedded
device controllers are now developed under the architecture-specific umbrella.
The device-specific portion of a device driver remains the same across all operating systems,
and is more about understanding and decoding the device data sheets than software
programming. A data sheet for a device is a document with technical details of the device,
including its operation, performance, programming, etc. in short a device user manual.
Later, I shall show some examples of decoding data sheets as well. However, the OSspecific portion is the one that is tightly coupled with the OS mechanisms of user
interfaces, and thus differentiates a Linux device driver from a Windows device driver and
from a MacOS device driver.
Verticals
In Linux, a device driver provides a system call interface to the user; this is the boundary
line between the so-called kernel space and user-space of Linux, as shown in Figure 2.
Figure 3 provides further classification.
Based on the OS-specific interface of a driver, in Linux, a driver is broadly classified into three
verticals:
Packet-oriented or the network vertical
Block-oriented or the storage vertical
Multiple-vertical drivers
One final note on the complete picture (placement of all the drivers in the Linux driver
ecosystem): the horizontals like USB, PCI, etc, span below multiple verticals. Why is that?
Simple you already know that you can have a USB Wi-Fi dongle, a USB pen drive, and a
USB-to-serial converter all are USB, but come under three different verticals!
In Linux, bus drivers or the horizontals, are often split into two parts, or even two drivers: a)
device controller-specific, and b) an abstraction layer over that for the verticals to interface,
commonly called cores. A classic example would be the USB controller drivers ohci, ehci,
etc., and the USB abstraction, usbcore.
Summing up
So, to conclude, a device driver is a piece of software that drives a device, though there are
so many classifications. In case it drives only another piece of software, we call it just a
driver. Examples are file-system drivers, usbcore, etc. Hence, all device drivers are drivers,
but all drivers are not device drivers.
Hey, Pugs, hold on; were getting late for class, and you know what kind of trouble we can
get into. Lets continue from here, later, exclaimed Shweta.
Jumping up, Pugs finished his explanation: Okay. This is the basic theory about device
drivers. If youre interested, later, I can show you the code, and all that we have been doing
for the various kinds of drivers. And they hurried towards their classroom.
Related Posts:
Device Drivers, Part 17: Module Interactions
Some Nifty udev Rules and Examples
Extend Wireless Router Capabilities Using a Netbook or
Whats Up in Linux Graphicstopia Lately
The Semester Project-IV File Systems: Formatting a Pen
Previous Post
Android Application Development: CLI Tools
AROUND THE WEB
Next Post
Cut And Play With Pitivi Video Editor
WHAT'S THIS?
IDE Technologies
Bridgestone
Amerikanki
Accenture Native
Share
2 comments
Login
Sort by Newest
AngryGirlfriend
a month ago
This article is a good introduction for beginners in driver development. But, the first part is obnoxious. I
have seen girls who know about device drivers, modules, etc. much in depth than their guys. So, the
time is right to stop stereotyping people.
Reply
There is no intention to stereotype any kind of people here - only intention is to learn. Even then, if it
has hurt your feeling, I apologize for that.
Reply
Prasanna Venkatesh
2 months ago
Hello sir, I need your help. I couldn't be able to compile the C file which is having basic "Hello_world.c"
kind of program for Kernel Module Programming.
Whenever i tried to compile using cc, gcc even make, I'm getting the error like shown below
" fatal error linux/nodules.h: No such file or directory"
In my /src directory i can find two files
linux-headers-3.13.0-24
linux-headers-3.13.0-24-generic
Inside the include i can see the files init.h, modules.h........
But while compiling the program it is showing the above error
After installing Linux on my Virtual machine I never made any manual updates or installation.
I'm running Ubuntu 14.04 on VMware
My kernel version is 3.13.0.24-generic
Do i need to install something ????
see more
Reply
Reply
You need to use make. But before that you need to fix the kernel source path in the Makefile. Or,
better take the updated files from our updated blog at SysPlay: http://sysplay.in/blog/linux-d...
Reply
Prasanna Venkatesh
2 months ago
2 months ago
What is the exact difference between Firmwares and Device drivers and Writing the Program directly on
device registers????
Reply
Both firmware & device drivers are software which directly writes into the device registers - it is just
that the first one is without any OS and second one is with OS.
Reply
Please can you suggest any best tutor made for RTLinux and basics of Linux and Embedded
Linux
Reply
Reply
Reply
Reply
Reply
paras gupta
6 months ago
can you tell me that what is the use of device controllers and bus drivers? why device drivers are not
directly interact with devices? as in fig 1 and 2. plz reply...
Reply
Paras: this is what we call a layered architecture of Linux Kernel. No, program can access the
devices directly. They need to access the device through layers. This is for the security of the kernel.
Reply
Reply
naresh09418
7 months ago
Reply
Thanks for appreciating that. Get into it and feel not just the goodness but the beauty inside.
Reply
Nishanth
a year ago
Hi,
Thanks for the wonderful tutorial.
But i have a doubt, may be a silly even. Want to know whether the actual Bus IP and the Device
controller(Bus controller) are one and the same. For eg: The microcontroller which i am working with,
has I2C interface IP, SPI interface IP supplied by Synopsys. Does that mean it has the I2C device
controller(Bus driver) and SPI device controller(Bus driver) as well by default ? From your text, it
appears both are different.If so, does not all compliant device require device controllers to have
connection with their interface buses ? Can a I2C compliant A/D converter directly talk with I2C
interface IP itself, without a I2C device controller ?
Reply
Reply
What i mean is SPI,I2C,UART protcols which are actually IP blocks, (normally provided by a third
party) that are being used in SOCs..
Reply
Subscribe
Privacy
Back to top
Mobile
Desktop
Open Source For You