Device driver and what it eats with
What is a driver?
As a respected hub user, he probably knows that a “device driver” is a computer program that manages a strictly defined type of device that is connected to or included with any desktop or laptop computer.
The main task of any driver is to provide a software interface for controlling the device, with which the operating system and other computer programs access the functions of this device, “not knowing” how it is used and works.
Typically, a driver communicates with a device through a bus or communication subsystem to which a direct device is connected. When the program calls the driver procedure (sequence of operations), it sends commands to the device itself. As soon as the device has completed the procedure ("routine"), the data is sent back to the driver and from there to the OS.
Any driver is device-specific and specific to each operating system. Typically, drivers provide an interrupt circuit for handling asynchronous procedures in an interface, depending on its execution time.
Any operating system has a “device map” (which we see in the device manager), each of which requires a specific driver. The only exceptions are the central processor and RAM, which is controlled directly by the OS. For everything else, you need a driver that translates operating system commands into a sequence of interrupts - the notorious “binary code”.
How does the driver work and why is it needed?
The main purpose of the driver is to simplify the programming process of working with the device.
It serves as a "translator" between the hard (iron) interface and applications or operating systems that use them. Developers can write, using drivers, high-level applications and programs without going into details of the low-level functionality of each of the necessary devices individually.
As already mentioned, the driver is specific to each device. He "understands" all the operations that the device can perform, as well as the protocol by which the interaction between the software and the iron part occurs. And, of course, it is controlled by the operating system in which it runs a specific application or a separate function of the OS itself ("printing using a printer").
If you want to format the hard disk, then, simplifiedly, this process looks as follows and has a certain sequence: (1) first, the OS sends a command to the device driver using a command that both the driver and the operating system understand. (2) After that, the driver of a specific device translates the command into a format that only the device understands. (3) The hard drive formats itself, returns the result to the driver, which later translates this command into the "language" of the operating system and gives the result to its user (4).
How to create a device driver
Each device has its own strict order of execution of commands, called the "instruction". Without knowing the instruction for the device, it is impossible to write a driver for it, since low-level machine instructions are binary code (interrupts) that, at the output, send the result obtained during the execution of this instruction to the driver.
When creating a driver for Linux, you need to know not only the type of bus and its address, but also the circuitry of the device itself, as well as the entire set of electrical interrupts during which the device gives the result to the driver.
Writing any driver begins with its "skeleton" - that is, the most basic commands like "on / off" and ending with the parameters specific to this device.
And what the driver is not
Often, the device driver is compared with other programs that act as an “intermediary” between software and / or hardware. In order to dot the "i", specify:
- The driver is not an interpreter, since it is not executed directly in the software layer of an application or operating system.
- The driver is not a compiler, since it does not translate commands from one software layer to another, the same.
Well, as an advertisement - you always know where to download the latest drivers for any device running Windows.
Only registered users can participate in the survey. Please come in.