int rt_task_init (RT_TASK *task, void (*rt_thread)(int), int data, int stack_size, int priority, int uses_fpu, void(*signal)(void));
int rt_task_init_cpuid (RT_TASK *task, void (*rt_thread)(int), int data, int stack_size, int priority, int uses_fpu, void(*signal)(void), unsigned int cpuid);
The newly created real time task is initially in a suspend state. It is can be made active either with rt_task_make_periodic, rt_task_make_periodic_relative_ns or rt_task_resume.
On multiprocessor systems rt_task_init_cpuid assigns task to a specific CPU cpuid. rt_task_init automatically selects which CPU will the task run on. This assignment may be changed by calling rt_set_runnable_on_cpus or rt_set_runnable_on_cpuid. If cpuid is invalid rt_task_init_cpuid falls back to automatic CPU selection.
int rt_task_delete (RT_TASK *task);
int rt_task_make_periodic (RT_TASK *task, RTIME start_time, RTIME period);
int rt_task_make_periodic_relative_ns (RT_TASK *task, RTIME start_delay, RTIME period);
void rt_task_wait_period (void);
void rt_task_yield (void);
int rt_task_suspend (RT_TASK *task);
int rt_task_resume (RT_TASK *task);
void rt_busy_sleep (int nanosecs);
void rt_sleep (RTIME delay);
void rt_sleep_until (RTIME time);
rt_sleep suspends execution of the caller task for a time of delay internal count units. During this time the CPU is used by other tasks.
rt_sleep_until is similar to rt_sleep but the parameter time is the absolute time till the task have to be suspended. If the given time is already passed this call has no effect.
Note: a higher priority task or interrupt handler can run during wait so the actual time spent in these functions may be longer than the specified.
int rt_get_task_state (RT_TASK *task);
Note: the returned task state is just an approximative information. Timer and other hardware interrupts may cause a change in the state of the queried task before the caller could evaluate the returned value. Caller should disable interrupts if it wants reliable info about an other task.
RT_TASK *rt_whoami (void);
void rt_task_signal_handler (RT_TASK *task, void (*handler)(void));
void rt_set_runnable_on_cpus (RT_TASK *task, unsigned int cpu_mask);
void rt_set_runnable_on_cpuid (RT_TASK *task, unsigned int cpuid);
If no CPU selected by cpu_mask or cpuid is available, both functions choose a possible CPU automagically.
Note: This call has no effect on uniprocessor systems.
int rt_task_use_fpu (RT_TASK* task, int use_fpu_flag);
void rt_linux_use_fpu (int use_fpu_flag);
rt_linux_use_fpu informs the scheduler that floating point arithmetic operations will be used the background task (i.e. the Linux kernel itself and all of its processes!).
If use_fpu_flag has nonzero value, FPU context is also switched when task or the kernel became active. This makes task switching slower.
Initial value of this flag is set by rt_task_init when the real time task is created. By default Linux "task" has this flag cleared. It can be set with LinuxFpu command line parameter of the rtai_sched module.
void rt_preempt_always (int yes_no);
void rt_preempt_always_cpuid (int yes_no, unsigned intcpu_id);
Calling these functions with nonzero value assures that a timed high priority preempting task is always programmed to be fired while another task is current. The default is no immediate preemption in oneshot mode, firing of the next shot programmed only after the current task releases the CPU.
Initial value of this flag can be set with PreemptAlways command line parameter of the rtai_sched module.
Note: currently the booth functions are equal, parameter cpu_id is ignored.