2

I'm a beginner and I'm trying to understand the concept behind the device driver stack? I know the device driver stack has three layers named low level driver, bus manager and a high level driver. My question is this, Is there separate codes exist for low level driver and bus manager? If they exist, where can I find the low level drivers for hardware controllers in a Linux file system? Thanks.

asked Jun 24, 2012 at 7:39
0

2 Answers 2

4

The Linux kernel has three device driver layers, that holds for most part of the device driver system of the Kernel. The bus driver, the protocol driver and the device driver. Let's take as example a SPI device you want write a driver for (e.g. some sort of sensor). Normally you will write the driver using the data sheet of the device, to see how it works and which registers holds which information. This is done in the device driver.

The device driver sends the commands to the protocol driver which basically defines how a SPI command looks like (how you have to fill the data structure to read/write a register of the device).

Normally SPI connection between your SOC and the sensor is done through some special hardware inside the SOC to send receive SPI commands. This is the bus driver. So you have something like this in software: device_driver <-> protocol_driver <-> bus_driver

in hardware it looks like this: SOC_SPI_module <-> sensor

The idea is, to encapsulate the SOC SPI module from the device driver, so when you program a device driver you don't have to care about the SOC you are using to access your device.

Hope I was able to help you.

answered Jun 26, 2012 at 8:03
Sign up to request clarification or add additional context in comments.

Comments

-1

In Linux Device Driver is object oriented programming in C generally. In this we are having on broader view "module_init" as the constructor & "module_exit" as the destructor.

According to my view as the "init & exit" process interacts with the device controller hardware so that can be called as "lower layer driver". After it control is passes through "file operations & working processes of driver" as "Bus Manager or Process Manager" to user controlling through "ioctl process" as "High level driver".

If user have to interact to device then "ioctl process" <--> "File operations" <--> "module_init & module_exit & partly file operations.".

answered Nov 9, 2012 at 7:02

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.