Orocos Real-Time Toolkit
2.9.0
|
OS Abstractions such as Mutexes, Semaphores and Threads. More...
Classes | |
class | AtomicInt |
C++ abstraction of atomic integer operations. More... | |
class | basic_iostreams |
An IO stream based on strings. More... | |
class | basic_istreams |
An basic_istream is a stream which can be read. More... | |
class | basic_ostreams |
An basic_ostreams is a stream which can be written to. More... | |
class | basic_streams |
This is a stream class for use in limited environments. More... | |
struct | CleanupFunction |
Use this to register a global cleanup function to the StartStopManager. More... | |
class | Condition |
An object oriented wrapper around a condition variable. More... | |
struct | InitFunction |
Use this to register a global init function to the StartStopManager. More... | |
class | local_allocator |
A simple local allocator which keeps a small pool which you can grow manually with grow(). More... | |
class | local_allocator< void > |
class | MainThread |
A class which represents the main() thread. More... | |
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. More... | |
class | MutexTryLock |
A MutexTryLock tries to lock an Mutex object on construction and if successful, unlocks it on destruction of the MutexTryLock. More... | |
struct | PosixCookie |
struct | print_helper |
class | printbufs |
class | printstream |
The printstream is a stream for printing characters to the terminal window. More... | |
class | rt_allocator |
A real-time malloc allocator which allocates every block with oro_rt_malloc() and deallocates with oro_rt_free(). More... | |
class | rt_allocator< void > |
struct | rt_list |
Implements a list with real-time insertion/removal of elements. More... | |
struct | RTAI_Thread |
class | Semaphore |
An object oriented wrapper around a counting semaphore. More... | |
class | SharedMutex |
An object oriented wrapper around a shared mutex (multiple readers allowed, but only one writer with exclusive access). More... | |
class | SharedMutexLock |
SharedMutexLock is a scope based Monitor, protecting critical sections with a SharedMutex object through locking and unlocking it. More... | |
class | StartStopManager |
This manager starts and stops all globally registered start/stop functions, without a particular order. More... | |
class | streambufs |
A base class for all stream buffer operations. More... | |
struct | string_helper |
class | stringbufs |
A streambufs implementation based on strings. More... | |
class | stringstreams |
Stringstreams, are not guaranteed to be hard realtime. More... | |
class | Thread |
A Thread object executes user code in its own thread. More... | |
class | ThreadInterface |
A thread which is being run. More... | |
struct | ThreadWrapperData |
class | Timer |
This class allows to define a timer object which can be armed in single shot and periodic mode. More... | |
class | TimeService |
The TimeService is used for system-wide time keeping and conversions. More... | |
struct | XenoCookie |
Functions | |
template<class T , class V , class W > | |
bool | CAS (volatile T *addr, const V &expected, const W &value) |
Compare And Swap. More... | |
bool | CAS (volatile oro_atomic_t *addr, const int expected, const int value) |
Overload of Compare And Swap for oro_atomic_t. More... | |
INTERNAL_QUAL int | rtos_task_create_main (RTOS_TASK *main_task) |
Initialise the main thread. More... | |
INTERNAL_QUAL int | rtos_task_delete_main (RTOS_TASK *main_task) |
Cleanup the main thread. More... | |
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) |
Create a thread. More... | |
INTERNAL_QUAL void | rtos_task_yield (RTOS_TASK *task) |
Yields the current thread. More... | |
INTERNAL_QUAL void | wakeup_handler (cyg_handle_t alarm_handle, cyg_addrword_t data) |
INTERNAL_QUAL void | rtos_task_make_periodic (RTOS_TASK *mytask, NANO_TIME nanosecs) |
This function is to inform the RTOS that a thread is switching between periodic or non-periodic execution. More... | |
INTERNAL_QUAL int | rtos_task_check_priority (int *sched_type, int *priority) |
This function checks (and corrects) a given priority within a given scheduler type. More... | |
unsigned int | rtos_task_get_pid (const RTOS_TASK *task) |
Returns the process ID the OS gave to the task task. More... | |
int | rtos_task_set_scheduler (RTOS_TASK *t, int sched_type) |
Set the scheduler of a given task t to a the type sched_type. More... | |
int | rtos_task_get_scheduler (const RTOS_TASK *t) |
Returns the current scheduler set for task t. More... | |
void | rtos_task_set_period (RTOS_TASK *mytask, NANO_TIME nanosecs) |
Change the period of a periodic RTOS task. More... | |
void | rtos_task_set_wait_period_policy (RTOS_TASK *task, int policy) |
Set the wait policy of a thread. More... | |
int | rtos_task_wait_period (RTOS_TASK *task) |
This function is called by a periodic thread which wants to go to sleep and wake up the next period. More... | |
void | rtos_task_delete (RTOS_TASK *mytask) |
This function must join the thread created with rtos_task_create and then clean up the RTOS_TASK struct. More... | |
int | rtos_task_check_scheduler (int *sched_type) |
This function checks (and corrects) if the given sched_type is valid for this RTOS. More... | |
int | rtos_task_set_priority (RTOS_TASK *task, int priority) |
Set the priority of a thread. More... | |
int | rtos_task_get_priority (const RTOS_TASK *task) |
Return the priority of a thread. More... | |
int | rtos_task_set_cpu_affinity (RTOS_TASK *task, unsigned cpu_affinity) |
Set the cpu affinity of a thread. More... | |
unsigned | rtos_task_get_cpu_affinity (const RTOS_TASK *task) |
Return the cpu affinity of a thread. More... | |
const char * | rtos_task_get_name (const RTOS_TASK *task) |
Returns the name by which a task is known in the RTOS. More... | |
int | rtos_task_is_self (const RTOS_TASK *task) |
Returns 1 when task is the task struct of the thread calling this function, 0 otherwise. More... | |
INTERNAL_QUAL void * | rtos_posix_thread_wrapper (void *cookie) |
INTERNAL_QUAL void * | rtai_thread_wrapper (void *arg) |
template<class T , class A , class A2 > | |
bool | operator== (const local_allocator< T, A > &, const local_allocator< T, A2 > &) |
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 , 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 > | |
bool | operator!= (const rt_allocator< T > &, const rt_allocator< T > &) |
basic_ostreams & | endl (basic_ostreams &) |
Flush and newline. More... | |
void * | thread_function (void *t) |
bool | CheckScheduler (int &sched_type) |
Check if the scheduler is a valid type in the current process and adapt to a valid value. More... | |
bool | CheckPriority (int &sched_type, int &priority) |
Check if the scheduler type and priority match and adapt to a valid value. More... | |
void | ErrorHandler (LPTSTR lpszFunction) |
DWORD WINAPI | ThreadWrapper (void *threadData) |
INTERNAL_QUAL NANO_TIME | rtos_task_get_period (const RTOS_TASK *t) |
INTERNAL_QUAL void | rtos_xeno_thread_wrapper (void *cookie) |
Variables | |
const int | LowestPriority = ORONUM_OS_RTOS_LOWEST_PRIORITY |
An integer denoting the lowest priority of the selected OS. More... | |
const int | HighestPriority = ORONUM_OS_RTOS_HIGHEST_PRIORITY |
An integer denoting the highest priority of the selected OS. More... | |
const int | IncreasePriority = -1 |
An interval to be added 'n' times to LowestPriority to get an 'n' times higher priority. More... | |
printstream | cout |
Console Output. More... | |
AtomicInt | threads (0) |
The number of threads in addition to the main() thread. More... | |
OS Abstractions such as Mutexes, Semaphores and Threads.
OS abstractions.
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.
|
inline |
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.
References oro_cmpxchg.
Referenced by RTT::internal::TsPool< Item >::allocate(), RTT::internal::ListLockFree< connection_t >::append(), RTT::internal::ListLockFree< connection_t >::clear(), RTT::base::DataObjectLockFree< T >::clear(), RTT::internal::TsPool< Item >::deallocate(), RTT::internal::ListLockFree< connection_t >::delete_if(), RTT::internal::AtomicMWMRQueue< T >::dequeue(), RTT::internal::AtomicMWMRQueue< T >::enqueue(), RTT::internal::ListLockFree< connection_t >::erase(), RTT::base::DataObjectLockFree< T >::Get(), RTT::os::SharedMutex::lock(), RTT::os::SharedMutex::lock_shared(), RTT::internal::ListLockFree< connection_t >::reserve(), RTT::os::SharedMutex::unlock(), and RTT::os::SharedMutex::unlock_shared().
|
inline |
Overload of Compare And Swap for oro_atomic_t.
Definition at line 61 of file CAS.hpp.
References oro_atomic_read(), and oro_cmpxchg.
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.
Definition at line 51 of file threads.cpp.
References rtos_task_check_priority().
Referenced by RTT::extras::TimerThread::Instance().
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.
Definition at line 46 of file threads.cpp.
References rtos_task_check_scheduler().
Referenced by RTT::os::Thread::setScheduler().
basic_ostreams & RTT::os::endl | ( | basic_ostreams & | s | ) |
Flush and newline.
Definition at line 110 of file rtstreams.cpp.
Referenced by __os_printException(), __os_printFailure(), RTT::os::basic_ostreams::basic_ostreams(), RTT::corba::CorbaFallBackProtocol::buildChannelInput(), RTT::corba::CorbaFallBackProtocol::buildChannelOutput(), RTT::corba::TaskContextServer::Create(), RTT::corba::CorbaFallBackProtocol::createAny(), RTT::corba::CorbaFallBackProtocol::createChannelElement_i(), RTT::corba::TaskContextServer::CreateServer(), RTT::corba::CorbaFallBackProtocol::createStream(), RTT::scripting::FunctionGraph::debugPrintout(), RTT::marsh::XMLRPCDemarshaller::deserialize(), RTT::corba::TaskContextProxy::DestroyOrb(), RTT::StatementProcessor::D::doPrint(), RTT::scripting::DumpObject(), RTT::scripting::CommandString::execute(), RTT::scripting::CommandIllegal::execute(), RTT::scripting::CmdFunction::get(), RTT::corba::TaskContextServer::initTaskContextServer(), RTT::operator<<(), RTT::StatementProcessor::D::printResult(), rtai_thread_wrapper(), RTT::corba::CorbaFallBackProtocol::updateAny(), RTT::corba::CorbaFallBackProtocol::updateFromAny(), and RTT::scripting::CommandIllegal::warn().
void RTT::os::ErrorHandler | ( | LPTSTR | lpszFunction | ) |
Definition at line 56 of file fosi_internal.cpp.
Referenced by ThreadWrapper().
|
inline |
Definition at line 217 of file oro_allocator.hpp.
|
inline |
Definition at line 229 of file oro_allocator.hpp.
|
inline |
Definition at line 312 of file oro_allocator.hpp.
|
inline |
Definition at line 211 of file oro_allocator.hpp.
|
inline |
Definition at line 223 of file oro_allocator.hpp.
|
inline |
Definition at line 306 of file oro_allocator.hpp.
INTERNAL_QUAL void* RTT::os::rtai_thread_wrapper | ( | void * | arg | ) |
Definition at line 154 of file fosi_internal.cpp.
References RTT::Logger::Critical, RTT::os::RTAI_Thread::data, endl(), RTT::Logger::endl(), RTT::Error, INTERNAL_QUAL, RTT::Logger::log(), RTOS_TASK::name, RTOS_TASK::priority, RTT::os::RTAI_Thread::priority, RTOS_TASK::rtaitask, rtos_task_check_priority(), rtos_task_check_scheduler(), rtos_task_create(), rtos_task_delete(), rtos_task_get_cpu_affinity(), rtos_task_get_name(), rtos_task_get_pid(), rtos_task_get_priority(), rtos_task_get_scheduler(), rtos_task_is_self(), rtos_task_make_periodic(), rtos_task_set_cpu_affinity(), rtos_task_set_period(), rtos_task_set_priority(), rtos_task_set_scheduler(), rtos_task_set_wait_period_policy(), rtos_task_wait_period(), rtos_task_yield(), SCHED_LXRT_HARD, SCHED_LXRT_SOFT, RTT::os::RTAI_Thread::task, RTOS_TASK::thread, RTT::os::RTAI_Thread::tnum, usleep(), RTT::Warning, and RTT::os::RTAI_Thread::wrapper.
INTERNAL_QUAL void* RTT::os::rtos_posix_thread_wrapper | ( | void * | cookie | ) |
Definition at line 91 of file fosi_internal.cpp.
References RTOS_TASK::attr, RTT::os::PosixCookie::data, RTT::Debug, RTT::Error, INTERNAL_QUAL, RTOS_TASK::name, ORO_WAIT_ABS, RTOS_TASK::pid, RTOS_TASK::priority, rtos_nanosleep(), rtos_task_check_priority(), rtos_task_create(), rtos_task_set_cpu_affinity(), rtos_task_yield(), RTOS_TASK::thread, ticks2timespec(), RTOS_TASK::wait_policy, RTT::Warning, and RTT::os::PosixCookie::wrapper.
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.
sched_type | An integer denoting a scheduler type, which will be updated if it's not a valid value. |
priority | An integer denoting the priority, which will be updated if it's not a valid value (within that scheduler). |
Definition at line 248 of file fosi_internal.cpp.
References rtos_task_check_scheduler().
Referenced by CheckPriority(), rtai_thread_wrapper(), rtos_posix_thread_wrapper(), rtos_task_check_scheduler(), rtos_task_get_period(), rtos_task_set_priority(), rtos_task_set_scheduler(), and rtos_xeno_thread_wrapper().
INTERNAL_QUAL int RTT::os::rtos_task_check_scheduler | ( | int * | sched_type | ) |
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
sched_type | An integer denoting a scheduler type, which will be updated if it's not a valid value. |
Definition at line 321 of file fosi_internal.cpp.
References RTT::Error, INTERNAL_QUAL, LowestPriority, rtos_task_check_priority(), and RTT::Warning.
Referenced by CheckScheduler(), rtai_thread_wrapper(), rtos_task_check_priority(), rtos_task_get_period(), rtos_task_make_periodic(), rtos_task_set_scheduler(), rtos_xeno_thread_wrapper(), and ThreadWrapper().
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.
task | An uninitialised, by the user allocated struct which will be used to store the task data in. |
priority | The priority of the thread, to be interpreted by the underlying RTOS. |
cpu_affinity | The cpu affinity of the thread ( |
name | The name for the thread, or null if none is given. |
sched_type | The scheduler type, one of ORO_SCHED_OTHER, ORO_SCHED_RT or a value defined by your RTOS. |
stack_size | The stack size of this thread, or zero when the default stack size may be used. |
start_routine | The entry function that the thread will execute. |
obj | The argument to pass to that thread. |
Definition at line 58 of file fosi_internal.cpp.
References RTOS_TASK::alarm_hdl, RTOS_TASK::counter_hdl, RTOS_TASK::handle, RTOS_TASK::hrt, RTOS_TASK::name, OROSEM_OS_ECOS_STACK_SIZE, RTOS_TASK::period, RTOS_TASK::periodMark, RTOS_TASK::stack, and RTOS_TASK::thread.
Referenced by rtai_thread_wrapper(), rtos_posix_thread_wrapper(), rtos_xeno_thread_wrapper(), RTT::os::Thread::Thread(), and ThreadWrapper().
INTERNAL_QUAL int RTT::os::rtos_task_create_main | ( | RTOS_TASK * | main_task | ) |
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 fosi_internal.cpp.
References RTOS_TASK::name.
Referenced by ThreadWrapper(), and warn_upon_switch().
INTERNAL_QUAL void RTT::os::rtos_task_delete | ( | RTOS_TASK * | mytask | ) |
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.
mytask | The thread to join and cleanup. |
Definition at line 314 of file fosi_internal.cpp.
References RTOS_TASK::attr, RTOS_TASK::name, and RTOS_TASK::thread.
Referenced by rtai_thread_wrapper(), rtos_task_get_period(), rtos_task_make_periodic(), rtos_xeno_thread_wrapper(), and RTT::os::Thread::terminate().
INTERNAL_QUAL int RTT::os::rtos_task_delete_main | ( | RTOS_TASK * | main_task | ) |
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 fosi_internal.cpp.
References RTOS_TASK::name.
Referenced by ThreadWrapper(), warn_upon_switch(), and RTT::os::MainThread::~MainThread().
INTERNAL_QUAL unsigned RTT::os::rtos_task_get_cpu_affinity | ( | const RTOS_TASK * | task | ) |
Return the cpu affinity of a thread.
task | The thread to get the cpu affinity |
Definition at line 455 of file fosi_internal.cpp.
References RTOS_TASK::thread.
Referenced by RTT::os::MainThread::getCpuAffinity(), RTT::os::Thread::getCpuAffinity(), rtai_thread_wrapper(), rtos_task_get_period(), rtos_task_make_periodic(), and rtos_xeno_thread_wrapper().
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.
task | The task to query. |
Definition at line 470 of file fosi_internal.cpp.
References RTOS_TASK::name.
Referenced by RTT::os::Thread::getName(), RTT::Activity::loop(), rtai_thread_wrapper(), rtos_task_get_period(), rtos_task_make_periodic(), rtos_xeno_thread_wrapper(), RTT::os::Thread::setScheduler(), and thread_function().
INTERNAL_QUAL NANO_TIME RTT::os::rtos_task_get_period | ( | const RTOS_TASK * | t | ) |
Definition at line 230 of file fosi_internal.cpp.
References RTOS_TASK::handle, INTERNAL_QUAL, RTOS_TASK::name, ORO_WAIT_ABS, RTOS_TASK::period, RTOS_TASK::periodMark, rtos_get_time_ns(), rtos_nanosleep(), rtos_task_check_priority(), rtos_task_check_scheduler(), rtos_task_delete(), rtos_task_get_cpu_affinity(), rtos_task_get_name(), rtos_task_get_priority(), rtos_task_set_cpu_affinity(), rtos_task_set_priority(), rtos_task_set_wait_period_policy(), rtos_task_wait_period(), ticks2timespec(), RTOS_TASK::wait_policy, and RTT::Warning.
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.
task | The task handle of the thread to query |
Definition at line 220 of file fosi_internal.cpp.
References RTOS_TASK::pid.
Referenced by RTT::os::MainThread::getPid(), RTT::os::Thread::getPid(), rtai_thread_wrapper(), rtos_task_make_periodic(), rtos_xeno_thread_wrapper(), and ThreadWrapper().
INTERNAL_QUAL int RTT::os::rtos_task_get_priority | ( | const RTOS_TASK * | task | ) |
Return the priority of a thread.
task | The thread to get the priority of |
Definition at line 426 of file fosi_internal.cpp.
References RTOS_TASK::priority, and RTOS_TASK::thread.
Referenced by RTT::os::MainThread::getPriority(), RTT::os::Thread::getPriority(), rtai_thread_wrapper(), rtos_task_get_period(), rtos_task_make_periodic(), and rtos_xeno_thread_wrapper().
INTERNAL_QUAL int RTT::os::rtos_task_get_scheduler | ( | const RTOS_TASK * | t | ) |
Returns the current scheduler set for task t.
t | The RTOS task to query. |
Definition at line 251 of file fosi_internal.cpp.
References INTERNAL_QUAL, nano2ticks(), RTOS_TASK::period, RTOS_TASK::periodMark, rtos_get_time_ns(), rtos_task_make_periodic(), RTOS_TASK::thread, and ticks2timespec().
Referenced by RTT::os::MainThread::getScheduler(), RTT::os::Thread::getScheduler(), rtai_thread_wrapper(), rtos_task_make_periodic(), rtos_xeno_thread_wrapper(), and ThreadWrapper().
INTERNAL_QUAL int RTT::os::rtos_task_is_self | ( | const RTOS_TASK * | task | ) |
Returns 1 when task is the task struct of the thread calling this function, 0 otherwise.
task | the task struct to compare against. |
-1 | if task is not a valid task struct or this thread is not known to the rtos layer. |
Definition at line 227 of file fosi_internal.cpp.
References RTOS_TASK::thread.
Referenced by RTT::os::ThreadInterface::isSelf(), rtai_thread_wrapper(), rtos_xeno_thread_wrapper(), and ThreadWrapper().
INTERNAL_QUAL void RTT::os::rtos_task_make_periodic | ( | RTOS_TASK * | mytask, |
NANO_TIME | nanosecs | ||
) |
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.
mytask | The RTOS task to change. |
nanosecs | Set 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 106 of file fosi_internal.cpp.
References RTOS_TASK::alarm_hdl, RTOS_TASK::alarm_obj, RTOS_TASK::counter_hdl, RTT::Error, RTOS_TASK::handle, INTERNAL_QUAL, RTOS_TASK::name, nano2ticks(), RTOS_TASK::period, rtos_get_time_ticks(), rtos_task_check_scheduler(), rtos_task_delete(), rtos_task_get_cpu_affinity(), rtos_task_get_name(), rtos_task_get_pid(), rtos_task_get_priority(), rtos_task_get_scheduler(), rtos_task_set_cpu_affinity(), rtos_task_set_period(), rtos_task_set_priority(), rtos_task_set_scheduler(), rtos_task_set_wait_period_policy(), rtos_task_wait_period(), SCHED_ECOS_FIFO, RTOS_TASK::stack, RTOS_TASK::sys_clk_hdl, wakeup_handler(), and RTOS_TASK::wakeup_sem.
Referenced by rtai_thread_wrapper(), rtos_task_get_scheduler(), rtos_task_set_period(), rtos_xeno_thread_wrapper(), RTT::os::Thread::setPeriod(), RTT::os::Thread::start(), RTT::os::Thread::stop(), RTT::Activity::stop(), and ThreadWrapper().
INTERNAL_QUAL int RTT::os::rtos_task_set_cpu_affinity | ( | RTOS_TASK * | task, |
unsigned | cpu_affinity | ||
) |
Set the cpu affinity of a thread.
task | The thread to change the cpu affinity of |
cpu_affinity | is 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. |
Definition at line 439 of file fosi_internal.cpp.
References RTOS_TASK::thread.
Referenced by rtai_thread_wrapper(), rtos_posix_thread_wrapper(), rtos_task_get_period(), rtos_task_make_periodic(), rtos_xeno_thread_wrapper(), and RTT::os::Thread::setCpuAffinity().
INTERNAL_QUAL void RTT::os::rtos_task_set_period | ( | RTOS_TASK * | mytask, |
NANO_TIME | nanosecs | ||
) |
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.
mytask | The RTOS task to change the period. |
nanosecs | the 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 268 of file fosi_internal.cpp.
References rtos_task_make_periodic().
Referenced by RTT::os::Thread::getScheduler(), rtai_thread_wrapper(), rtos_task_make_periodic(), rtos_xeno_thread_wrapper(), thread_function(), and ThreadWrapper().
INTERNAL_QUAL int RTT::os::rtos_task_set_priority | ( | RTOS_TASK * | task, |
int | priority | ||
) |
Set the priority of a thread.
task | The thread to change the priority of |
priority | The priority as interpreted by the underlying RTOS. |
Definition at line 410 of file fosi_internal.cpp.
References RTOS_TASK::priority, rtos_task_check_priority(), and RTOS_TASK::thread.
Referenced by rtai_thread_wrapper(), rtos_task_get_period(), rtos_task_make_periodic(), rtos_xeno_thread_wrapper(), RTT::os::MainThread::setPriority(), and RTT::os::Thread::setPriority().
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.
t | The RTOS task to change. |
sched_type | A scheduler typed known by your RTOS. |
0 | when the scheduler of t was changed successfully |
-1 | if scheduler for t could not be changed or sched_type is invalid |
-2 | if 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 234 of file fosi_internal.cpp.
References RTOS_TASK::priority, rtos_task_check_priority(), rtos_task_check_scheduler(), and RTOS_TASK::thread.
Referenced by RTT::os::Thread::getScheduler(), rtai_thread_wrapper(), rtos_task_make_periodic(), rtos_xeno_thread_wrapper(), RTT::os::MainThread::setScheduler(), RTT::os::Thread::setScheduler(), thread_function(), and ThreadWrapper().
INTERNAL_QUAL void RTT::os::rtos_task_set_wait_period_policy | ( | RTOS_TASK * | task, |
int | policy | ||
) |
Set the wait policy of a thread.
task | The RTOS task to change. |
policy | The wait policy. |
Definition at line 273 of file fosi_internal.cpp.
References RTOS_TASK::wait_policy.
Referenced by rtai_thread_wrapper(), rtos_task_get_period(), rtos_task_make_periodic(), rtos_xeno_thread_wrapper(), RTT::os::MainThread::setWaitPeriodPolicy(), and RTT::os::Thread::setWaitPeriodPolicy().
INTERNAL_QUAL int RTT::os::rtos_task_wait_period | ( | RTOS_TASK * | task | ) |
This function is called by a periodic thread which wants to go to sleep and wake up the next period.
task | This must be RTOS_TASK struct of the calling thread. |
Definition at line 278 of file fosi_internal.cpp.
References nano2ticks(), ORO_WAIT_ABS, RTOS_TASK::period, RTOS_TASK::periodMark, rtos_get_time_ns(), ticks2timespec(), and RTOS_TASK::wait_policy.
Referenced by rtai_thread_wrapper(), rtos_task_get_period(), rtos_task_make_periodic(), rtos_xeno_thread_wrapper(), and thread_function().
INTERNAL_QUAL void RTT::os::rtos_task_yield | ( | RTOS_TASK * | task | ) |
Yields the current thread.
This function may be left empty.
task | The task handle of the current thread. |
Definition at line 96 of file fosi_internal.cpp.
Referenced by rtai_thread_wrapper(), rtos_posix_thread_wrapper(), rtos_xeno_thread_wrapper(), ThreadWrapper(), RTT::os::MainThread::yield(), and RTT::os::Thread::yield().
INTERNAL_QUAL void RTT::os::rtos_xeno_thread_wrapper | ( | void * | cookie | ) |
Definition at line 186 of file fosi_internal.cpp.
References RTT::os::XenoCookie::data, RTT::Debug, RTT::Error, INTERNAL_QUAL, RTOS_TASK::name, rtos_task_check_priority(), rtos_task_check_scheduler(), rtos_task_create(), rtos_task_delete(), rtos_task_get_cpu_affinity(), rtos_task_get_name(), rtos_task_get_pid(), rtos_task_get_priority(), rtos_task_get_scheduler(), rtos_task_is_self(), rtos_task_make_periodic(), rtos_task_set_cpu_affinity(), rtos_task_set_period(), rtos_task_set_priority(), rtos_task_set_scheduler(), rtos_task_set_wait_period_policy(), rtos_task_wait_period(), rtos_task_yield(), RTOS_TASK::sched_type, SCHED_XENOMAI_HARD, SCHED_XENOMAI_SOFT, RTT::Warning, RTT::os::XenoCookie::wrapper, RTOS_TASK::xenoptr, and RTOS_TASK::xenotask.
void* RTT::os::thread_function | ( | void * | t | ) |
This is one time initialisation
The real task starts here.
Definition at line 75 of file Thread.cpp.
References RTT::os::Thread::active, RTT::os::Thread::breaker, CATCH, CATCH_ALL, RTT::Critical, RTT::os::Thread::emergencyStop(), RTT::os::Thread::getName(), RTT::os::Thread::getTask(), RTT::os::Thread::inloop, RTT::os::Thread::loop(), RTT::os::Thread::maxOverRun, RTT::os::Thread::msched_type, RTT::os::Thread::period, RTT::os::Thread::prepareForExit, rtos_sem_signal(), rtos_sem_wait(), rtos_task_get_name(), rtos_task_set_period(), rtos_task_set_scheduler(), rtos_task_wait_period(), RTT::os::Thread::running, SCOPE_OFF, SCOPE_ON, RTT::os::Thread::sem, RTT::os::Thread::step(), RTT::os::ThreadInterface::threadNumber(), and TRY.
DWORD WINAPI RTT::os::ThreadWrapper | ( | void * | threadData | ) |
Definition at line 97 of file fosi_internal.cpp.
References ErrorHandler(), RTOS_TASK::handle, INTERNAL_QUAL, RTOS_TASK::name, ORO_WAIT_ABS, RTOS_TASK::period, RTOS_TASK::periodMark, RTT::os::ThreadWrapperData::realData, RTT::os::ThreadWrapperData::realThread, rtos_get_time_ns(), rtos_task_check_scheduler(), rtos_task_create(), rtos_task_create_main(), rtos_task_delete_main(), rtos_task_get_pid(), rtos_task_get_scheduler(), rtos_task_is_self(), rtos_task_make_periodic(), rtos_task_set_period(), rtos_task_set_scheduler(), rtos_task_yield(), RTOS_TASK::sched_type, RTOS_TASK::threadId, and RTOS_TASK::wait_policy.
INTERNAL_QUAL void RTT::os::wakeup_handler | ( | cyg_handle_t | alarm_handle, |
cyg_addrword_t | data | ||
) |
Definition at line 100 of file fosi_internal.cpp.
Referenced by rtos_task_make_periodic().
printstream RTT::os::cout |
Console Output.
Definition at line 45 of file rtstreams.cpp.
Referenced by RTT::scripting::CommandString::execute(), RTT::scripting::CommandIllegal::execute(), RTT::scripting::CmdFunction::get(), RTT::os::printstream::printstream(), and RTT::scripting::CommandIllegal::warn().
const int RTT::os::HighestPriority = ORONUM_OS_RTOS_HIGHEST_PRIORITY |
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.
const int RTT::os::LowestPriority = ORONUM_OS_RTOS_LOWEST_PRIORITY |
An integer denoting the lowest priority of the selected OS.
Definition at line 44 of file ecosthreads.cpp.
Referenced by RTT::internal::GlobalEngine::Instance(), and rtos_task_check_scheduler().
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.
Referenced by RTT::os::ThreadInterface::ThreadInterface().