extern int rt_task_init
(RT_TASK* task, void (* rt_thread)(int),
int data, int stack_size, int
priority,
int uses_fpu, void(* signal)(void));
SYNOPSIS
#include "rtl_sched.h"
DESCRIPTION
Creates a real time task.
task is a pointer to an RT_TASK type structure
whose space must be provided by the application. It must be kept during
the whole lifetime of the real time task and cannot be an automatic variable.
rt_thread is the entry point of the task function.
The parent task can pass a single integer value data to the
new task.
stack_size is the size of the stack to be used
by the new task, and priority is the priority to be given
the task. The highest priority is 0, while the lowest is RT_LOWEST_PRIORITY.
uses_fpu is the flag that indicates if the task
will use the floating point unit, == 0 does not, != 0 does.
signal is a function that is called, within the
task environment and with interrupts disabled, when the task becomes the
current running task after a context switch.
The newly created real time task is initially in a suspend
state. It is can be made active either with a call to rt_task_make_periodic
or to rt_task_resume
RETURN VALUE
On success 0 is returned while a negative value is returned
following a failure.
ERRORS
Returns errors are related to the creation of a task already
in use (-EINVAL) or to lack of memory space in allocating the stack (-ENOMEM)
extern int rt_task_delete
(RT_TASK* task);
SYNOPSIS
#include "rtl_sched.h"
DESCRIPTION
Deletes a real time task previously created by a call to
rt_task_init
task is the pointer to the task structure.
Before killing itself the task unblocks from any semaphore
it is waiting on and frees the tasks queued for sending messages to it.
RETURN VALUE
On success, 0 is returned. On failure, a negative value is
returned .
ERRORS
task does not refer to a valid task (-EINVAL)
extern int rt_get_task_state
(RT_TASK* task);
SYNOPSIS
#include "rtl_sched.h"
DESCRIPTION
Return the state of a real time task previously
created by a call to rt_task_init .
task is a pointer to the task structure.
RETURN VALUE
The task state is greater than zero, a value less than zero
indicates an error.
ERRORS
task does not refer to a valid task (-EINVAL)
extern RT_TASK* rt_whoami
(void);
SYNOPSIS
#include "rtl_sched.h"
DESCRIPTION
Return the pointer to the current task.
RETURN VALUE
The pointer to the current task is returned.
ERRORS
None
extern void rt_task_signal_handler
(RT_TASK* task, void (*handler)(void));
SYNOPSIS
#include "rtl_sched.h"
DESCRIPTION
Assign or change the signal function of a real time task.
task is a pointer to the real time task
handler is the entry point of the signal function.
This handler function can be set also when the task is
newly created with rt_task_init; such a signal
function is called, within the task environment and with interrupts disabled,
when the task becomes the current running task after a context switch.
RETURN VALUE
None.
ERRORS
None.
extern void rt_set_runnable_on_cpus
(RT_TASK* task, unsigned int cpu_mask);
SYNOPSIS
#include "rtl_sched.h"
DESCRIPTION
Sets, according to cpu_mask, the CPUs on which task
task has to run.
cpu_mask is given by an unsigned int corresponding
to a bitmask of the CPUs to be set.
RETURN VALUE
None
ERRORS
None
extern int rt_task_use_fpu
(RT_TASK* task, int use_fpu_flag);
SYNOPSIS
#include "rtl_sched.h"
DESCRIPTION
Informs the scheduler that floating point arithmetic operations
will be used by the real time task task.
use_fpu_flag == 0 the task will
use floating point operations, != 0 will not.
RETURN VALUE
On success, 0 is returned. On failure, a negative value is
returned .
ERRORS
task does not refer to a valid task (-EINVAL)
extern void rt_linux_use_fpu
(int use_fpu_flag);
SYNOPSIS
#include "rtl_sched.h"
DESCRIPTION
Informs the scheduler that Linux processes use of floating
point arithmetic operations.
use_fpu_flag == 0 Linux processes
use floating point operations, != 0 do not.
RETURN VALUE
None
ERRORS
None
extern void rt_preempt_always
(int yes_no);
SYNOPSIS
#include "rtl_sched.h"
DESCRIPTION
In the oneshot mode a timed task is made active/current at
the expiration of the timer shot. The next timer expiration is programmed
by choosing among the timed tasks the one with a priority higher than the
current after the current has released the cpu, always assuring the Linux
timing. While this policy minimizes the programming of the oneshot mode,
enhancing efficiency, it can be unsuitable when a task has to be guarded
against looping by using a high priority watch dog task, as in such a case
the latter as no chance of running. By calling this function with yes_no
!= 0 it is assured 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.
RETURN VALUE
None
ERRORS
None
extern void rt_task_yield
(void);
SYNOPSIS
#include "rtl_sched.h"
DESCRIPTION
Suspends the current task and takes it at the end of the
list of ready tasks, with the same priority.
RETURN VALUE
None
ERRORS
None
extern int rt_task_suspend
(RT_TASK* task);
SYNOPSIS
#include "rtl_sched.h"
DESCRIPTION
Suspends execution of the real-time task task.
This function suspends execution of the task until a
call to rt_task_resume or rt_task_make_periodic
is made.
RETURN VALUE
On success, 0 is returned. On failure, a negative value is
returned .
ERRORS
task does not refer to a valid task (-EINVAL)
extern int rt_task_resume
(RT_TASK* task);
SYNOPSIS
#include "rtl_sched.h"
DESCRIPTION
Resumes execution of the real-time task task previously
suspended by a call to rt_task_suspend
RETURN VALUE
On success, 0 is returned. On failure, a negative value is
returned .
ERRORS
task does not refer to a valid task (-EINVAL)