HAL layer vs Device driver
Asked Answered
D

4

10

In Linux, HAL provides hardware abstraction and device driver too provide hardware abstraction. Can you please clarify me the difference between two ?

Doctrine answered 6/5, 2013 at 7:28 Comment(4)
Read wikipedia HAL and udev pages.Saddlecloth
BTW, HAL is last century...Discouragement
I have read wikipedia and other literature but can't differentiate the twoDoctrine
All depends on type of your devices. For example, if it is PCI-device, you can't work without "driver" (kernel module). But if your device is USB, you can work in user-space with libusb. So, for such devices you have a single universal kernel module and many client utilities (one for each hardware). Udev will help you to run needed utility or load needed kernel module.Discouragement
G
14

The device driver communicates with a specific device at a specific buffer and control flag block location. A hardware abstraction layer abstracts away the details of how specific devices work. For example, the driver for a USB mouse is very different from the driver for a PS2 mouse but at the HAL layer they are both mice and can be treated interchangeably.

Gypsie answered 19/6, 2018 at 7:28 Comment(0)
N
6

I would say that HAL provides hardware abstraction using device drivers. From a certain point of view, no device can work without a driver. HAL goes one step ahead, offering a uniform (or, "easier") API for the application.

You can bypass HAL and talk directly to the device driver, but you can not bypass the device driver and talk directly to the hardware (this last sentence is more or less valid in general, depending on OS and environment).

Neurologist answered 19/6, 2018 at 9:18 Comment(1)
Or, HALs offer a more generic API.Inexplicable
H
4

The main difference is what they provide abstraction for. HAL abstracts processors, device drivers abstract different devices. So in a sense HAL is the "device" driver of the processor or the motherboard in PCs.

Herald answered 22/9, 2017 at 11:33 Comment(1)
This is how I architect my embedded firmware solutions, in description and in file organizationCanvas
E
3

Back in the day, every programmer who coded an app also codes drivers for the various hardware that they wanted to support. So, if you have an idea to develop an app which needs to use network capabilities, you also needed to know how to program hardware drivers for the network card.

Then came in the HAL.

So instead of having your software and OS directly reaching out to the hardware, there is now a layer in between called the HAL. The HAL lies underneath the operating system layer or within.

Now nobody is allowed to access the hardware, except that they do it through and by the hardware abstraction layer(HAL). Just the HAL is allowed to access the hardware.

Now it's something which is standard. All Devs have to do is make the game/app work with the HAL.

Now we have the drivers. The drivers tell the HAL how to access the actual hardware. So whoever makes the sound card, they just make a driver that tells the HAL how to access that sound card.

So overall, our software interacts with the HAL, The HAL uses drivers to interact with the hardware. We are telling the HAL how to access that sound card or network card etc. with the use of the drivers.

Eisele answered 2/1, 2021 at 9:57 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.