Device Drivers Flashcards
What is the key purpose of device drivers
To provide uniform access to physical devices for all devices of a given class. I.e. all keyboards can be interfaced the same
As well as read write requests, what is the role of device drivers
Device drivers must:
- Initialize the device
- Manage the power supply of the device
- Protect the device from harmful commands
- Deal with availability - i.e. is the device hot-pluggable
Where do device drivers run
In the kernel space, as they need to access I/O registers and need privileged access to do this
Who, most often, makes device drivers
The device manufacturer
Device drives provide an abstraction of physical devices to simplify programming and allow reuse of code, what can be a drawback of this
This abstraction can get in the way of optimization as physical devices may differ from the abstract model assumed by the OS
What would be the first step to writing a driver
Look at the datasheet of the device and learn what commands are available, reading the sample code at the same time