Driver framework

The basic device driver design involves 3 components:

  • Device: a representation of the actual hardware device
  • Driver: a software driver able to control a Device
  • DeviceAPI: a programming interface for a Device, usually implemented by the Driver.

There is a DeviceManager where all devices are registered. It delegates to DeviceToDriverMapper instances to find a suitable driver for a given device. Instances of this mapper interface use e.g. the PCI id of a device (in case of PCIDevice) to find a suitable driver. This is configurable via a configuration file.

For a device to operate there are the following resources available:

  • Hardware interrupts. A driver can register an IRQHandler which is called on its own (normal java-) thread. The native kernel signals a hardware interrupt by incrementing a counter for that interrupts, after which the thread scheduler dispatches such events to the correct threads of the IRQHandler's.
  • DMA channels. A driver can claim a DMA channel.
    This channel can be setup, enabled and disabled.
  • IO port access. An Unsafe class has native methods for this. A device must first claim a range of IO ports before it can gain access to it.
  • Memory access. A device can claim a range of the the memory addressspace. A MemoryResource is given to the device. The device can use the methods of the MemoryResource to actually access the memory.