|
|
|
|
|
by gmueckl
1563 days ago
|
|
A device driver is program code like any other, so there's no way it can be magic. Whether it's simple or complex depends on a couple of things. Some hardware maps registers into memory and you communicate it by reading from/writing to these addresses. This is very common in simpler architectures like microcontrollers. Other times, your hardware is attached to shared system busses like PCI or USB and you need to go through driver layers for them. Of course, there's the occasional bit of quirky hardware that requires that the driver does some odd things, but even that isn't magic if you understand the device hardware. I think the biggest source of complexity for device drivers is the expectations that come with the design of the operating system the driver should run on. If there are e.g. strong expectations that device drivers don't block for certain operations or keep certain locks for extended amounts of time, then the driver may gain a lot of complexity from trying to play nice. Modern optimized desktop and server operating system are somewhat guilty of forcing that kind of complexity onto device drivers. |
|