既然硬件中已经有了固件,为什么还需要设备驱动程序呢?

时间:2022-01-14 22:26:50

For example, for SD card connected to a linux machine, we have a firmware running in SD card and we have a host controller which also runs a firmware(my understanding), then why do we need a full fledged SD device driver when we can simply send commands to SD host controller to do operations ?

例如,对于SD卡连接到linux机器,我们有一个固件运行在SD卡和主机控制器也开设了固件(我的理解),那么为什么我们需要一个完整的SD设备驱动程序时,我们可以简单地发送命令SD主机控制器操作吗?

4 个解决方案

#1


1  

Answer

Firmware is the software that runs on the device. A device driver also called software driver is the software that tells your operating system how to communicate with the device. Not all devices have firmware.Typical examples of devices containing Firmware are embedded systems such as traffic lights, consumer appliances, digital watches, computers, computer peripherals, mobile phones, and digital cameras.The Firmware contained in these devices provides the control program for the device.

固件是在设备上运行的软件。一个设备驱动程序也叫软件驱动程序,它告诉你的操作系统如何与设备通信。并不是所有的设备都有固件。包含固件的设备的典型例子是嵌入式系统,如交通灯、家用电器、数字手表、计算机、计算机外围设备、手机和数码相机。这些设备中包含的固件为设备提供控制程序。

#2


1  

An analogy for the application (employer), device (employee) and device driver (translator). Hope this clarifies!

类似于应用程序(雇主)、设备(雇员)和设备驱动程序(翻译)。希望这澄清!

Imagine a company in which the employer speaks English while the employee speaks his own language with limited English words. Now if the employer wants to instruct jobs and tasks clearly, he may fail to do so except understanding bits and pieces. A time-saving method is to hire a translator.

想象一下,在一个公司里,雇主说英语,而雇员用有限的英语语言说自己的语言。现在,如果雇主想要清楚地指导工作和任务,他可能会做不到,除非他能理解细节。一种省时的方法是雇一名翻译。

Further, firmware makes sense only on devices that have a processor on them. Ex: RFID cards don't have firmware, but RFID readers do.

此外,固件只有在有处理器的设备上才有意义。RFID卡没有固件,但是RFID阅读器有。

#3


1  

...then why do we need a full fledged SD device driver when we can simply send commands to SD host controller to do operations ?

…那么,当我们可以简单地向SD主机控制器发送命令来执行操作时,为什么我们需要一个功能齐全的SD设备驱动程序呢?

for different type of sdcard some implementation would be different. You just can not send different set of commands for each manufactured/vendor's sdcard.

对于不同类型的sdcard,有些实现是不同的。您不能为每个生产/供应商的sdcard发送不同的命令集。

different operating system would have different set of APIs exported to users. So there should be some kind of sub system and device specific abstraction layer. which are handled by such device driver.

不同的操作系统会有不同的api集导出给用户。所以应该有某种子系统和设备特定的抽象层。由该设备驱动程序处理。

#4


0  

Near as I can tell, we use device drivers for historical reasons.

据我所知,出于历史原因,我们使用设备驱动程序。

Early on, devices did not have firmware. To use the device, commands to the device had to be primitive. That is, at a very low level of abstraction, if any abstraction was used at all.

早期,设备没有固件。要使用设备,对设备的命令必须是原始的。也就是说,在非常低的抽象级别上,如果使用任何抽象的话。

But the interfaces between the operating system and the computer's devices is still abstract, albeit at a lower level of abstraction than the application program interfaces (API). So snippets of code were needed to translate the low-level but still abstract commands coming out of the operating system to a more primitive, device-specific level.

但是操作系统和计算机设备之间的接口仍然是抽象的,尽管其抽象程度低于应用程序接口(API)。因此,需要一些代码片段来将来自操作系统的低级但仍然抽象的命令转换为更原始的、特定于设备的级别。

In early computers, those snippets of code needed to translate commands to the device had to run on the processor in the host computer. That was the only platform available. Device drivers are these snippets of code. The drivers had to written for each device, and installed on the host computer.

在早期的计算机中,需要将指令翻译到设备上的代码片段必须在主机上的处理器上运行。这是唯一可用的平台。设备驱动程序是这些代码片段。驱动程序必须为每个设备编写代码,并安装在主机上。

Now any device can easily be built with the capability onboard to process these low-level, but still abstract commands, using firmware or some other method. So device drivers are no longer needed. Indeed, many drivers for mice and keyboards are generic now anyway. But doing away with device drivers would be difficult, given all the hardware in use. So I'm sure they are here to stay.

现在,任何设备都可以很容易地构建,使用固件或其他方法处理这些低级但仍然抽象的命令。因此,不再需要设备驱动程序。事实上,现在很多鼠标和键盘驱动都是通用的。但是,考虑到所有正在使用的硬件,取消设备驱动程序将是困难的。所以我相信他们会一直呆在这里。

I'm not sure if we would benefit much anyway by getting rid of device drivers now. Device drivers are annoying, and I've wasted a lot of time finding, installing, and tearing my hair out about drivers. Plus having to junk perfectly good hardware when no driver could be found for it to run on a new operating system.

我不确定我们现在摆脱设备驱动是否会有什么好处。设备驱动程序很烦人,而且我浪费了很多时间去找、安装,还对驱动程序大发脾气。此外,在没有找到驱动程序的情况下,必须丢弃性能非常好的硬件,以便在新的操作系统上运行。

But any alternative solution would have its own problems.

但任何替代方案都有其自身的问题。

#1


1  

Answer

Firmware is the software that runs on the device. A device driver also called software driver is the software that tells your operating system how to communicate with the device. Not all devices have firmware.Typical examples of devices containing Firmware are embedded systems such as traffic lights, consumer appliances, digital watches, computers, computer peripherals, mobile phones, and digital cameras.The Firmware contained in these devices provides the control program for the device.

固件是在设备上运行的软件。一个设备驱动程序也叫软件驱动程序,它告诉你的操作系统如何与设备通信。并不是所有的设备都有固件。包含固件的设备的典型例子是嵌入式系统,如交通灯、家用电器、数字手表、计算机、计算机外围设备、手机和数码相机。这些设备中包含的固件为设备提供控制程序。

#2


1  

An analogy for the application (employer), device (employee) and device driver (translator). Hope this clarifies!

类似于应用程序(雇主)、设备(雇员)和设备驱动程序(翻译)。希望这澄清!

Imagine a company in which the employer speaks English while the employee speaks his own language with limited English words. Now if the employer wants to instruct jobs and tasks clearly, he may fail to do so except understanding bits and pieces. A time-saving method is to hire a translator.

想象一下,在一个公司里,雇主说英语,而雇员用有限的英语语言说自己的语言。现在,如果雇主想要清楚地指导工作和任务,他可能会做不到,除非他能理解细节。一种省时的方法是雇一名翻译。

Further, firmware makes sense only on devices that have a processor on them. Ex: RFID cards don't have firmware, but RFID readers do.

此外,固件只有在有处理器的设备上才有意义。RFID卡没有固件,但是RFID阅读器有。

#3


1  

...then why do we need a full fledged SD device driver when we can simply send commands to SD host controller to do operations ?

…那么,当我们可以简单地向SD主机控制器发送命令来执行操作时,为什么我们需要一个功能齐全的SD设备驱动程序呢?

for different type of sdcard some implementation would be different. You just can not send different set of commands for each manufactured/vendor's sdcard.

对于不同类型的sdcard,有些实现是不同的。您不能为每个生产/供应商的sdcard发送不同的命令集。

different operating system would have different set of APIs exported to users. So there should be some kind of sub system and device specific abstraction layer. which are handled by such device driver.

不同的操作系统会有不同的api集导出给用户。所以应该有某种子系统和设备特定的抽象层。由该设备驱动程序处理。

#4


0  

Near as I can tell, we use device drivers for historical reasons.

据我所知,出于历史原因,我们使用设备驱动程序。

Early on, devices did not have firmware. To use the device, commands to the device had to be primitive. That is, at a very low level of abstraction, if any abstraction was used at all.

早期,设备没有固件。要使用设备,对设备的命令必须是原始的。也就是说,在非常低的抽象级别上,如果使用任何抽象的话。

But the interfaces between the operating system and the computer's devices is still abstract, albeit at a lower level of abstraction than the application program interfaces (API). So snippets of code were needed to translate the low-level but still abstract commands coming out of the operating system to a more primitive, device-specific level.

但是操作系统和计算机设备之间的接口仍然是抽象的,尽管其抽象程度低于应用程序接口(API)。因此,需要一些代码片段来将来自操作系统的低级但仍然抽象的命令转换为更原始的、特定于设备的级别。

In early computers, those snippets of code needed to translate commands to the device had to run on the processor in the host computer. That was the only platform available. Device drivers are these snippets of code. The drivers had to written for each device, and installed on the host computer.

在早期的计算机中,需要将指令翻译到设备上的代码片段必须在主机上的处理器上运行。这是唯一可用的平台。设备驱动程序是这些代码片段。驱动程序必须为每个设备编写代码,并安装在主机上。

Now any device can easily be built with the capability onboard to process these low-level, but still abstract commands, using firmware or some other method. So device drivers are no longer needed. Indeed, many drivers for mice and keyboards are generic now anyway. But doing away with device drivers would be difficult, given all the hardware in use. So I'm sure they are here to stay.

现在,任何设备都可以很容易地构建,使用固件或其他方法处理这些低级但仍然抽象的命令。因此,不再需要设备驱动程序。事实上,现在很多鼠标和键盘驱动都是通用的。但是,考虑到所有正在使用的硬件,取消设备驱动程序将是困难的。所以我相信他们会一直呆在这里。

I'm not sure if we would benefit much anyway by getting rid of device drivers now. Device drivers are annoying, and I've wasted a lot of time finding, installing, and tearing my hair out about drivers. Plus having to junk perfectly good hardware when no driver could be found for it to run on a new operating system.

我不确定我们现在摆脱设备驱动是否会有什么好处。设备驱动程序很烦人,而且我浪费了很多时间去找、安装,还对驱动程序大发脾气。此外,在没有找到驱动程序的情况下,必须丢弃性能非常好的硬件,以便在新的操作系统上运行。

But any alternative solution would have its own problems.

但任何替代方案都有其自身的问题。