Driver programming


RTLinux 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 RTLinux level, it is not possible to call linux services. Interrupt handlers are installed and uninstalled with rtl_request_irq() and rtl_free_irq() functions.

Soft interrupts are normal Linux kernel interrupts, in the sense that the interrupt handlers are executed by the Linux kernel thread. The latency of this interrupts are the same than that of a normal linux, i.e., no realtime. On the other hand, is is possible to use all the facilities of the linux kernel. The following functions are used to manage this kind of interrupts: rtl_get_soft_irq() and rtl_free_soft_irq().

It is possible to generate interrupts from RTLinux to Linux with the function: rtl_global_pend_irq. Also, by using the POSIX signal mechanism is possible to send signals (which are received like soft interrupts) to the linux thread.

Low level prograaming

Since RTLinux 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.