DIAPM-RTAI

(Dipartimento di Ingegneria Aerospaziale, Politecnico di Milano - Real Time Application Interface)

A Hard Real Time support for LINUX

This document explains how to call the functions available in the RTAI developed at DIAPM.


Functions provided by rtai_sched module

Task functions:

rt_task_init
rt_task_init_cpuid
rt_task_delete
rt_task_make_periodic
rt_task_make_periodic_relative_ns
rt_task_wait_period
rt_task_yield
rt_task_suspend
rt_task_resume
rt_busy_sleep
rt_sleep
rt_sleep_until
rt_get_task_state
rt_whoami
rt_task_signal_handler
rt_set_runnable_on_cpus
rt_set_runnable_on_cpuid
rt_task_use_fpu
rt_linux_use_fpu
rt_preempt_always
rt_preempt_always_cpuid
Timer functions:
rt_set_oneshot_mode   rt_set_periodic_mode
start_rt_timer   stop_rt_timer
count2nano   nano2count
rt_get_time  
rt_get_time_ns  
rt_get_cpu_time_ns  
next_period  
Semaphore functions:
rt_sem_init
rt_sem_delete
rt_sem_signal
rt_sem_wait
rt_sem_wait_if
rt_sem_wait_until
rt_sem_wait_timed
Mailbox functions:
rt_mbx_init  
rt_mbx_delete  
rt_mbx_send   rt_mbx_receive
rt_mbx_send_wp   rt_mbx_receive_wp
rt_mbx_send_if   rt_mbx_receive_if
rt_mbx_send_until   rt_mbx_receive_until
rt_mbx_send_timed   rt_mbx_receive_timed
Message handling functions:
rt_send   rt_receive
rt_send_if   rt_receive_if
rt_send_until   rt_receive_until
rt_send_timed   rt_receive_timed
RPC (Remote Procedure Call) functions:
rt_rpc
rt_rpc_if
rt_rpc_until
rt_rpc_timed
rt_isrpc
rt_return

Functions provided by rtai module

Following there are some function calls, to be used from Rtai tasks, for managing interrupts within Rtai and communication services between Rtai tasks and Linux processes.

RTAI service functions:

rt_global_cli   rt_global_sti
rt_global_save_flags   rt_global_restore_flags
rt_global_save_flags_and_cli  
send_ipi_shorthand
send_ipi_logical
rt_assign_irq_to_cpu   rt_reset_irq_to_sym_mode
rt_request_global_irq   rt_free_global_irq
request_RTirq   free_RTirq
rt_request_linux_irq   rt_free_linux_irq
rt_pend_linux_irq
rt_request_srq   rt_free_srq
rt_pend_linux_srq
rt_request_timer   rt_free_timer
rt_mount_rtai   rt_umount_rtai
rt_ack_irq  
rt_mask_and_ack_irq  
rt_unmask_irq  
rt_startup_irq   rt_shutdown_irq
rt_enable_irq   rt_disable_irq
enable_RTirq   disable_RTirq

Functions provided by rtai_fifos module

RTAI FIFO communication functions (these are a modification of RT-FIFO devices developed by Michael Barabanov for NMT_RTLinux):
Called from RT task   Called from Linux process
rtf_create   rtf_open_sized
  [open]
rtf_destroy   [close]
rtf_reset   rtf_reset
rtf_resize   rtf_resize
rtf_put   [write]
  rtf_write_timed
rtf_get   [read]
  rtf_read_all_at_once
  rtf_read_timed
rtf_create_handler  
  rtf_set_async_sig
In Linux RTL fifos have to be created by mknod /dev/rtf<x> c 63 <x> where <x> is the minor device number, from 0 to 63; thus on the Linux side RTL fifos can be used as standard character devices.

RTAI FIFO semaphore functions:

Called from RT task   Called from Linux process
rtf_sem_init   rtf_sem_init
rtf_sem_post   rtf_sem_post
  rtf_sem_wait
rtf_sem_trywait   rtf_sem_trywait
  rtf_sem_timed_wait
rtf_sem_destroy   rtf_sem_destroy

RTAI FIFO auxiliary functions:

rt_printk
rt_print_to_screen

The distribution contains some examples on how to use the above described services in subdirectories of directory examples.

Document written by: E. Bianchi, L. Dozio, D. Martini, P. Mantegazza.
Dipartimento di Ingegneria Aerospaziale
Politecnico di Milano
e-mail: mantegazza@aero.polimi.it

Revised and updated by Gábor Kiss
Computer and Automation Institute of Hungarian Academy of Sciences