Classes | Functions | Variables
RTT::os Namespace Reference

OS Abstractions such as Mutexes, Semaphores and Threads. More...

Classes

class  AtomicInt
class  basic_iostreams
class  basic_istreams
class  basic_ostreams
class  basic_streams
struct  CleanupFunction
class  Condition
 An object oriented wrapper around a condition variable. More...
struct  InitFunction
class  local_allocator
class  local_allocator< void >
class  MainThread
class  Mutex
 An object oriented wrapper around a non recursive mutex. More...
class  MutexInterface
 An interface to a Mutex. More...
class  MutexLock
 MutexLock is a scope based Monitor, protecting critical sections with a Mutex object through locking and unlocking it. More...
class  MutexRecursive
 An object oriented wrapper around a recursive mutex. More...
class  MutexTimedLock
 A MutexTimedLock locks a Mutex object on construction and if successful, unlocks it on destruction of the MutexTimedLock. If the lock can not be acquired within the user provided time limit, the attempt is aborted. Use isSuccessful() to check whether the attempt succeeded. More...
class  MutexTryLock
 A MutexTryLock tries to lock an Mutex object on construction and if successful, unlocks it on destruction of the MutexTryLock. Use isSuccessful() to check whether the attempt succeeded. More...
struct  PosixCookie
struct  print_helper
class  printbufs
class  printstream
class  rt_allocator
class  rt_allocator< void >
struct  rt_list
struct  RTAI_Thread
class  Semaphore
class  StartStopManager
 This manager starts and stops all globally registered start/stop functions, without a particular order. More...
class  streambufs
struct  string_helper
class  stringbufs
class  stringstreams
class  Thread
class  ThreadInterface
struct  ThreadWrapperData
class  Timer
class  TimeService
struct  XenoCookie

Functions

template<class T , class V , class W >
bool CAS (volatile T *addr, const V &expected, const W &value)
bool CheckPriority (int &sched_type, int &priority)
bool CheckScheduler (int &sched_type)
basic_ostreamsendl (basic_ostreams &s)
void ErrorHandler (LPTSTR lpszFunction)
template<class T , class A , class A2 >
bool operator!= (const local_allocator< T, A > &, const local_allocator< T, A2 > &)
template<class T , class A >
bool operator!= (const local_allocator< T, A > &, const local_allocator< T, A > &)
template<class T >
bool operator!= (const rt_allocator< T > &, const rt_allocator< T > &)
template<class T , class A , class A2 >
bool operator== (const local_allocator< T, A > &, const local_allocator< T, A2 > &)
template<class T , class A >
bool operator== (const local_allocator< T, A > &, const local_allocator< T, A > &)
template<class T >
bool operator== (const rt_allocator< T > &, const rt_allocator< T > &)
INTERNAL_QUAL void * rtai_thread_wrapper (void *arg)
INTERNAL_QUAL void * rtos_posix_thread_wrapper (void *cookie)
INTERNAL_QUAL int rtos_task_check_priority (int *scheduler, int *priority)
int rtos_task_check_scheduler (int *sched_type)
INTERNAL_QUAL int rtos_task_create (RTOS_TASK *task, int priority, unsigned cpu_affinity, const char *name, int sched_type, size_t stack_size, void *(*start_routine)(void *), ThreadInterface *obj)
INTERNAL_QUAL int rtos_task_create_main (RTOS_TASK *main_task)
void rtos_task_delete (RTOS_TASK *mytask)
INTERNAL_QUAL int rtos_task_delete_main (RTOS_TASK *main_task)
unsigned rtos_task_get_cpu_affinity (const RTOS_TASK *task)
const char * rtos_task_get_name (const RTOS_TASK *task)
INTERNAL_QUAL NANO_TIME rtos_task_get_period (const RTOS_TASK *t)
unsigned int rtos_task_get_pid (const RTOS_TASK *task)
int rtos_task_get_priority (const RTOS_TASK *task)
int rtos_task_get_scheduler (const RTOS_TASK *t)
int rtos_task_is_self (const RTOS_TASK *task)
INTERNAL_QUAL void rtos_task_make_periodic (RTOS_TASK *mytask, NANO_TIME nanosecs)
int rtos_task_set_cpu_affinity (RTOS_TASK *task, unsigned cpu_affinity)
void rtos_task_set_period (RTOS_TASK *mytask, NANO_TIME nanosecs)
int rtos_task_set_priority (RTOS_TASK *task, int priority)
int rtos_task_set_scheduler (RTOS_TASK *t, int sched_type)
void rtos_task_set_wait_period_policy (RTOS_TASK *task, int policy)
int rtos_task_wait_period (RTOS_TASK *task)
INTERNAL_QUAL void rtos_task_yield (RTOS_TASK *)
INTERNAL_QUAL void rtos_xeno_thread_wrapper (void *cookie)
void * thread_function (void *t)
DWORD WINAPI ThreadWrapper (void *threadData)
INTERNAL_QUAL void wakeup_handler (cyg_handle_t alarm_handle, cyg_addrword_t data)

Variables

printstream cout
const int HighestPriority = ORONUM_OS_RTOS_HIGHEST_PRIORITY
const int IncreasePriority = -1
const int LowestPriority = ORONUM_OS_RTOS_LOWEST_PRIORITY
AtomicInt threads (0)

Detailed Description

OS Abstractions such as Mutexes, Semaphores and Threads.

It is meant to group all packages which provide OS abstraction classes and functions in a realtime system. Examples are Threads, Mutexes and standard libraries.

OS abstractions.


Function Documentation

template<class T , class V , class W >
bool RTT::os::CAS ( volatile T *  addr,
const V &  expected,
const W &  value 
)

Compare And Swap. Also known as Compare Exchange (cmpxch). If addr contains expected, replace it with value, and return true. Otherwise, return false.

Definition at line 54 of file CAS.hpp.

bool RTT_API RTT::os::CheckPriority ( int &  sched_type,
int &  priority 
)

Check if the scheduler type and priority match and adapt to a valid value. If sched_type is unknown a default is choosen. If priority is invalid within sched_type, a default is choosen.

Returns:
true if the arguments made sense, false if a correction was applied.

Definition at line 51 of file threads.cpp.

bool RTT_API RTT::os::CheckScheduler ( int &  sched_type)

Check if the scheduler is a valid type in the current process and adapt to a valid value.

Returns:
true if sched_type made sense, false if a correction was applied.

Definition at line 46 of file threads.cpp.

basic_ostreams & RTT::os::endl ( basic_ostreams &  )

Flush and newline.

Definition at line 110 of file rtstreams.cpp.

void RTT::os::ErrorHandler ( LPTSTR  lpszFunction)

Definition at line 56 of file win32/fosi_internal.cpp.

template<class T , class A , class A2 >
bool RTT::os::operator!= ( const local_allocator< T, A > &  ,
const local_allocator< T, A2 > &   
) [inline]

Definition at line 217 of file oro_allocator.hpp.

template<class T , class A >
bool RTT::os::operator!= ( const local_allocator< T, A > &  ,
const local_allocator< T, A > &   
) [inline]

Definition at line 229 of file oro_allocator.hpp.

template<class T >
bool RTT::os::operator!= ( const rt_allocator< T > &  ,
const rt_allocator< T > &   
) [inline]

Definition at line 312 of file oro_allocator.hpp.

template<class T , class A , class A2 >
bool RTT::os::operator== ( const local_allocator< T, A > &  ,
const local_allocator< T, A2 > &   
) [inline]

Definition at line 211 of file oro_allocator.hpp.

template<class T , class A >
bool RTT::os::operator== ( const local_allocator< T, A > &  ,
const local_allocator< T, A > &   
) [inline]

Definition at line 223 of file oro_allocator.hpp.

template<class T >
bool RTT::os::operator== ( const rt_allocator< T > &  ,
const rt_allocator< T > &   
) [inline]

Definition at line 306 of file oro_allocator.hpp.

Definition at line 153 of file lxrt/fosi_internal.cpp.

Definition at line 90 of file gnulinux/fosi_internal.cpp.

INTERNAL_QUAL int RTT::os::rtos_task_check_priority ( int *  sched_type,
int *  priority 
)

This function checks (and corrects) a given priority within a given scheduler type. Incorrect arguments are re-set to a sensible default.

Parameters:
sched_typeAn integer denoting a scheduler type, which will be updated if it's not a valid value.
priorityAn integer denoting the priority, which will be updated if it's not a valid value (within that scheduler).
Returns:
0 when it is valid, -1 when invalid and corrected.

Definition at line 244 of file ecos/fosi_internal.cpp.

This function checks (and corrects) if the given sched_type is valid for this RTOS. If it's not, a sensible default is returned in the argument

Parameters:
sched_typeAn integer denoting a scheduler type, which will be updated if it's not a valid value.
Returns:
0 when it is valid, -1 when invalid and corrected.

Definition at line 313 of file gnulinux/fosi_internal.cpp.

INTERNAL_QUAL int RTT::os::rtos_task_create ( RTOS_TASK task,
int  priority,
unsigned  cpu_affinity,
const char *  name,
int  sched_type,
size_t  stack_size,
void *(*)(void *)  start_routine,
ThreadInterface *  obj 
)

Create a thread. Spawn a new thread with the given arguments. When rtos_task_create returns successfully, the task structure must be initialised fully and be valid.

Parameters:
taskAn uninitialised, by the user allocated struct which will be used to store the task data in.
priorityThe priority of the thread, to be interpreted by the underlying RTOS.
cpu_affinityThe cpu affinity of the thread (
See also:
rtos_task_set_cpu_affinity).
Parameters:
nameThe name for the thread, or null if none is given.
sched_typeThe scheduler type, one of ORO_SCHED_OTHER, ORO_SCHED_RT or a value defined by your RTOS.
stack_sizeThe stack size of this thread, or zero when the default stack size may be used.
start_routineThe entry function that the thread will execute.
objThe argument to pass to that thread.
Returns:
zero on success, -1 if it could not be created.

Definition at line 57 of file ecos/fosi_internal.cpp.

Initialise the main thread. Anything necessary to setup the real-time environment on the current RTOS may be done here. This is the first function that the RTT will call in the FOSI layer, when the MainThread object is constructed. Typically, the main thread is assigned a priority, put in a scheduler and memory is locked into RAM.

Definition at line 43 of file ecos/fosi_internal.cpp.

This function must join the thread created with rtos_task_create and then clean up the RTOS_TASK struct. This function may not be called from the thread itself.

Parameters:
mytaskThe thread to join and cleanup.

Definition at line 307 of file gnulinux/fosi_internal.cpp.

Cleanup the main thread. This undoes the actions taken by rtos_task_create_main(). This is the last function that the RTT will call in the FOSI layer, when the MainThread object is destructed.

Definition at line 50 of file ecos/fosi_internal.cpp.

Return the cpu affinity of a thread.

Parameters:
taskThe thread to get the cpu affinity
Returns:
the cpu affinity (
See also:
rtos_task_set_cpu_affinity)

Definition at line 447 of file gnulinux/fosi_internal.cpp.

INTERNAL_QUAL const char * RTT::os::rtos_task_get_name ( const RTOS_TASK task)

Returns the name by which a task is known in the RTOS.

Parameters:
taskThe task to query.
Returns:
It's name.

Definition at line 462 of file gnulinux/fosi_internal.cpp.

Definition at line 229 of file win32/fosi_internal.cpp.

INTERNAL_QUAL unsigned int RTT::os::rtos_task_get_pid ( const RTOS_TASK task)

Returns the process ID the OS gave to the task task.

Parameters:
taskThe task handle of the thread to query
Returns:
0 typically denotes the PID could not be obtained, but any interpretation is left to the user of the Operating System.

Definition at line 206 of file gnulinux/fosi_internal.cpp.

Return the priority of a thread.

Parameters:
taskThe thread to get the priority of
Returns:
the priority, as recorded by the underlying RTOS.

Definition at line 418 of file gnulinux/fosi_internal.cpp.

Returns the current scheduler set for task t.

Parameters:
tThe RTOS task to query.
Returns:
The scheduler type defined by your RTOS in which t is running.

Definition at line 237 of file gnulinux/fosi_internal.cpp.

Returns 1 when task is the task struct of the thread calling this function, 0 otherwise.

Parameters:
taskthe task struct to compare against.
Return values:
-1if task is not a valid task struct or this thread is not known to the rtos layer.

Definition at line 213 of file gnulinux/fosi_internal.cpp.

This function is to inform the RTOS that a thread is switching between periodic or non-periodic execution. This may temporarily suspend the thread. For on-line periodic changes, use rtos_task_set_period, which is guaranteed to keep the thread running.

Parameters:
mytaskThe RTOS task to change.
nanosecsSet to zero if you wish to switch to non periodic execution, set to a positive value (the period in nano seconds) if you wish to switch to periodic execution.

Definition at line 105 of file ecos/fosi_internal.cpp.

INTERNAL_QUAL int RTT::os::rtos_task_set_cpu_affinity ( RTOS_TASK task,
unsigned  cpu_affinity 
)

Set the cpu affinity of a thread.

Parameters:
taskThe thread to change the cpu affinity of
cpu_affinityis a bit mask with the cpu this thread should be bound. The bit 0 is the cpu 0, the bit 1, the cpu 1 and so on. For example ((1 << 0) | (1 << 1)) will bound to cpu 0 and 1.
Returns:
0 if the cpu affinity could be set.

Definition at line 431 of file gnulinux/fosi_internal.cpp.

Change the period of a periodic RTOS task. You must first use rtos_task_make_periodic() before calling this function. This function may not suspend the thread.

Parameters:
mytaskThe RTOS task to change the period.
nanosecsthe new period. As a special exception, if this is equal to zero, it is to inform the RTOS that we'll block this periodic thread for an unspecified amount of time and that this should not trigger a watchdog, or lead to 'catching up' or signalling overruns.

Definition at line 254 of file gnulinux/fosi_internal.cpp.

INTERNAL_QUAL int RTT::os::rtos_task_set_priority ( RTOS_TASK task,
int  priority 
)

Set the priority of a thread.

Parameters:
taskThe thread to change the priority of
priorityThe priority as interpreted by the underlying RTOS.
Returns:
0 if the priority could be set.

Definition at line 402 of file gnulinux/fosi_internal.cpp.

INTERNAL_QUAL int RTT::os::rtos_task_set_scheduler ( RTOS_TASK t,
int  sched_type 
)

Set the scheduler of a given task t to a the type sched_type. In some RTOS's the scheduler can't be changed or the change can only be done for the calling thread.

Parameters:
tThe RTOS task to change.
sched_typeA scheduler typed known by your RTOS.
Return values:
0when the scheduler of t was changed successfully
-1if scheduler for t could not be changed or sched_type is invalid
-2if sched_type is valid but can only be changed for the current thread which is not t. In this case, the calling code should find a way to let the thread associated with t make the call to rtos_task_set_scheduler().

Definition at line 220 of file gnulinux/fosi_internal.cpp.

Set the wait policy of a thread.

Parameters:
taskThe RTOS task to change.
policyThe wait policy.

Definition at line 259 of file gnulinux/fosi_internal.cpp.

This function is called by a periodic thread which wants to go to sleep and wake up the next period.

Parameters:
taskThis must be RTOS_TASK struct of the calling thread.
Returns:
zero on success (or if the thread is non periodic), non-zero to indicate an overrun.

Definition at line 264 of file gnulinux/fosi_internal.cpp.

Yields the current thread. This function may be left empty.

Parameters:
taskThe task handle of the current thread.

Definition at line 95 of file ecos/fosi_internal.cpp.

Definition at line 185 of file xenomai/fosi_internal.cpp.

void* RTT::os::thread_function ( void *  t)

This is one time initialisation

The real task starts here.

Definition at line 74 of file Thread.cpp.

DWORD WINAPI RTT::os::ThreadWrapper ( void *  threadData)

Definition at line 97 of file win32/fosi_internal.cpp.

INTERNAL_QUAL void RTT::os::wakeup_handler ( cyg_handle_t  alarm_handle,
cyg_addrword_t  data 
)

Definition at line 99 of file ecos/fosi_internal.cpp.


Variable Documentation

Console Output.

Definition at line 45 of file rtstreams.cpp.

An integer denoting the highest priority of the selected OS.

Definition at line 45 of file ecosthreads.cpp.

const int RTT::os::IncreasePriority = -1

An interval to be added 'n' times to LowestPriority to get an 'n' times higher priority.

Definition at line 46 of file ecosthreads.cpp.

An integer denoting the lowest priority of the selected OS.

Definition at line 44 of file ecosthreads.cpp.

The number of threads in addition to the main() thread. The main thread is thread zero (0). threads is increased by one for each PeriodicThread or SingleThread object created and is never decreased.

Definition at line 54 of file threads.hpp.



rtt
Author(s): RTT Developers
autogenerated on Fri Sep 9 2016 04:02:20