Driver programming


RTAI defines two types of interrupts: Soft and Hard Interrupts.

Hard Interrupts the one originated directly by the real hardware. There is very little system interference in the service of these interrupts, therefore the interrupt latency is almost only limited by the performance of the underlying hardware. Since these handlers are executed at the RTAI level, it is not possible to call linux services. Interrupt handlers are installed and uninstalled with rt_request_global_irq() and rt_free_global_irq() functions.

It is possible to install interrupt handlers that will be executed as a normal Linux interrupt service routines. This is a powerful mechanism to execute code in Linux space, that can be triggered just sending a software interrupt from RTAI with the function rt_pend_linux_irq.

Low level programming

Since RTAI threads are executed in kernel address space and processor mode, it is possible to use all the reserved processor instructions directly. To direct access io ports in ISA bus: rtl_inb, rtl_inb_p, and the outb counterparts. To access physical memory (devices located at the PCI bus) it is possible to use ioremap()[1] function at thread initialization and then access the device through the returned pointer.



ioremap: Maps the given physical address range into the virtual address space with no caching, suitable for being accessed from a driver.