NAME

rt_set_oneshot_mode, rt_set_periodic_mode - set timer mode

SYNOPSIS

#include "rtai_sched.h"

void rt_set_oneshot_mode (void);

void rt_set_periodic_mode (void);

DESCRIPTION

rt_set_oneshot_mode sets the oneshot mode for the timer. It consists in a variable timing based on the cpu clock frequency. This allows task to be timed arbitrarily. It must be called before using any time related function, including conversions.

rt_set_periodic_mode sets the periodic mode for the timer. It consists of a fixed frequency timing of the tasks in multiple of the period set with a call to start_rt_timer. The resolution is that of the 8254 frequency (1193180 hz). Any timing request not an integer multiple of the period is satisfied at the closest period tick. It is the default mode when no call is made to set the oneshot mode.

Oneshot mode can be set initially also with OneShot command line parameter of the rtai_sched module.

NOTE

Stopping the timer by stop_rt_timer sets the timer back into its defult (periodic) mode. Call rt_set_oneshot_mode before each start_rt_timer if it required.

[return to index]


NAME

start_rt_timer, stop_rt_timer - start/stop timer

SYNOPSIS

#include "rtai_sched.h"

RTIME start_rt_timer (int period);

void stop_rt_timer (void);

DESCRIPTION

start_rt_timer starts the timer with a period period. The period is in internal count units and is required only for the periodic mode. In the oneshot the parameter value is ignored.

stop_rt_timer stops the timer. The timer mode is set to periodic.

RETURN VALUE

The period in internal count units.

[return to index]


NAME

count2nano, nano2count - convert internal count units to nanosecs and back

SYNOPSIS

#include "rtai_sched.h"

RTIME count2nano (RTIME timercounts);

RTIME nano2count (RTIME nanosecs);

DESCRIPTION

count2nano converts the time of timercounts internal count units into nanoseconds.

nano2count converts the time of nanosecs nanoseconds into internal counts units.

Remember that the count units are related to the cpu frequency in oneshot mode and to the 8254 frequency (1193180 Hz) in periodic mode.

RETURN VALUE

The given time in nanoseconds/internal count units is returned.

[return to index]


NAME

rt_get_time, rt_get_time_ns, rt_get_cpu_time_ns - get the current time

SYNOPSIS

#include "rtai_sched.h"

RTIME rt_get_time (void);

RTIME rt_get_time_ns (void);

RTIME rt_get_cpu_time_ns (void);

DESCRIPTION

rt_get_time returns the number of real time clock ticks since RT_TIMER bootup (whatever this means). This number is multiple of the 8254 period in periodic mode, while is multiple of cpu clock period in oneshot mode.

rt_get_time_ns is the same as rt_get_time but the returned time is converted to nanoseconds.

rt_get_cpu_time_ns ???

RETURN VALUE

The current time in internal count units/nanoseconds is returned.

[return to index]


NAME

next_period - get the time of next run

SYNOPSIS

#include "rtai_sched.h"

RTIME next_period (void);

DESCRIPTION

next_period returns the time when the caller task will run next.

RETURN VALUE

Next period time in internal count units.

[return to index]


NAME

rt_busy_sleep, rt_sleep, rt_sleep_until - delay/suspend execution for a while

SYNOPSIS

#include "rtai_sched.h"

void rt_busy_sleep (int nanosecs);

void rt_sleep (RTIME delay);

void rt_sleep_until (RTIME time);

DESCRIPTION

rt_busy_sleep delays the execution of the caller task without giving back the control to the scheduler. This function burns away CPU cycles in a busy wait loop It may be used for very short synchronization delays only.
nanosecs is the number of nanoseconds to wait.

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.

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.

[return to index]