Neutrino provides the following interrupt handling API:
Table 11-9. Interrupt Handling API
Function | Description |
---|---|
InterruptAttach() | Attach a local function to an interrupt vector. |
InterruptAttachEvent() | Generate an event on an interrupt, which will ready a thread |
InterruptDetach() | Detach from an interrupt using the ID returned by InterruptAttach() or InterruptAttachEvent(). |
InterruptWait() | Wait for interrupt. |
InterruptEnable() | Enable hardware interrupts. |
InterruptDisable() | Disable hardware interrupts. |
InterruptMask() | Mask a hardware interrupt. |
InterruptUnmask() | Unmask a hardware interrupt. |
InterruptLock() | Guard a critical section of code between an interrupt handler and a thread. It is necessary to make this code SMP safe. |
InterruptUnlock() | Remove an SMP-safe lock on a critical section of code. |
Using this API, a privileged thread (in user level) can call InterruptAttach() or InterruptAttachEvent(), passing a hardware interrupt number and the address of a function in the thread's address space to be called when the interrupt occurs. QNX allows multiple ISRs to be attached to each hardware interrupt number.
To access a PCI devices, QNX provides a well defined API. Some of these functions are: pci_map_irq() for mapping a interrupt pin to an IRQ, pci_find_device() to find the PCI device with a given ID and vendor ID, and so on.
In conclusion, QNX provides a lot of APIs to manage low level hardware features.