embkernel
 All Classes Functions Variables Typedefs Groups Pages
Classes | Functions | Variables
RTOS: Real-time preemptive operating system.

Classes

class  Rtos
 Core class. More...
 
class  RtosBuffer
 Synchronized buffer. More...
 
class  RtosHeap
 Dynamic memory. More...
 
class  RtosList
 Doubly-linked list. More...
 
class  RtosListIterable
 RtosList iterable. More...
 
class  RtosMsgBox< T, N >
 Message box template. More...
 
class  RtosPortable
 Portable functions. More...
 
class  RtosRunnable
 Task runnable interface. More...
 
class  RtosSemaphore
 Semaphore object. More...
 
class  RtosSyncObject
 Synchronization object super class. More...
 
class  RtosTask
 Task implementation. More...
 
class  RtosTimer
 Simple timer. More...
 

Functions

static void Rtos::start ()
 
static void Rtos::sleep (TICK tick)
 
static void Rtos::sleepUntil (TICK tick)
 
static bool Rtos::isElapsed (TICK tick)
 
static void Rtos::addTask (RtosTask *task)
 
static void Rtos::removeTask (RtosTask *task)
 
static void Rtos::putOnSleepingList (RtosTask *task, TICK tick)
 
static void Rtos::putOnSuspendedList (RtosTask *task)
 
static void Rtos::onTick ()
 
static void * Rtos::schedule (void *stackPointer)
 
static void Rtos::idleRun (RtosTask *task)
 
 RtosBuffer::RtosBuffer (int size)
 
int RtosBuffer::write (const void *buffer, int len, Rtos::TICK tick)
 
int RtosBuffer::writeChunk (const void *buffer, int len, Rtos::TICK tick)
 
int RtosBuffer::writeFromInt (const void *buffer, int len)
 
int RtosBuffer::read (void *buffer, int len, Rtos::TICK tick)
 
int RtosBuffer::readChunk (void *buffer, int len, Rtos::TICK tick)
 
int RtosBuffer::readFromInt (void *buffer, int len)
 
void RtosBuffer::writeBuffer (const void *buffer, int len)
 
void RtosBuffer::readBuffer (void *buffer, int len)
 
static void * RtosHeap::alloc (size_t size)
 
static void RtosHeap::free (void *p)
 
static void * RtosHeap::resize (void *p, size_t size)
 
void * RtosHeap::resizeLeft (void *p, size_t left)
 
static size_t RtosHeap::getTotalMemory ()
 
static size_t RtosHeap::getFreeMemory ()
 
static unsigned int RtosHeap::getBlockCount ()
 
void RtosList::insertAtBeginning (RtosListIterable &iterable)
 
void RtosList::insertAtEnd (RtosListIterable &iterable)
 
void RtosList::insertSorted (RtosListIterable &iterable)
 
void RtosList::insertSorted (RtosListIterable &iterable, uint32_t current)
 
void RtosList::remove (RtosListIterable &iterable)
 
bool RtosList::isInside (RtosListIterable &iterable)
 
RtosListIterableRtosList::getFirst ()
 
bool RtosMsgBox< T, N >::give (T &msg, Rtos::TICK tick)
 
bool RtosMsgBox< T, N >::giveFromInt (T &msg)
 
bool RtosMsgBox< T, N >::take (T &msg, Rtos::TICK tick)
 
bool RtosMsgBox< T, N >::takeFromInt (T &msg)
 
 RtosSemaphore::RtosSemaphore (int maxCount, int initialCount)
 
bool RtosSemaphore::give (Rtos::TICK tick)
 
bool RtosSemaphore::giveFromInt ()
 
bool RtosSemaphore::take (Rtos::TICK tick)
 
bool RtosSemaphore::takeFromInt ()
 
 RtosSyncObject::RtosSyncObject (int maxCount, int initialCount)
 
int RtosSyncObject::internalTake (Rtos::TICK tick, int value)
 
int RtosSyncObject::internalGive (Rtos::TICK tick, int value)
 
bool RtosSyncObject::putOnWaitList (RtosTask *task, Rtos::TICK tick, RtosList *list)
 
 RtosTask::RtosTask (Rtos::PRIORITY priority, const char *name, size_t stackSize, void(*run)(RtosTask *))
 
 RtosTask::RtosTask (Rtos::PRIORITY priority, const char *name, size_t stackSize, RtosRunnable &runnable)
 
void RtosTask::initVariables (Rtos::PRIORITY priority, const char *name, size_t stackSize)
 
static void RtosTask::caller (RtosRunnable *runnable)
 
const char * RtosTask::getName ()
 
size_t RtosTask::getStackSize ()
 
size_t RtosTask::getFreeStackSize ()
 
void RtosTimer::set (Rtos::TICK timeout)
 
bool RtosTimer::isEllapsed ()
 

Variables

static RtosTaskRtos::sCurrentTask
 Pointer to the currently running task.
 
static TICK Rtos::sTick
 Tick counter value.
 
static RtosList Rtos::sListReady [RTOS_CFG_MAX_PRIORITIES]
 Lists containing the task ready to run separated by priority value.
 
static RtosList Rtos::sListSleep
 List containing the task which are sleeping.
 
static RtosList Rtos::sListSuspended
 List containing the suspended task.
 
static size_t Rtos::sMaxPriorities = RTOS_CFG_MAX_PRIORITIES
 Maximal priority value for a task.
 
static size_t Rtos::sCurrentTaskCount = 0
 Total count of task existing.
 
static void * Rtos::sMemToFree = 0
 Pointer to a task stack that can be discarded.
 
static RtosTask Rtos::sIdleTask
 Idle task is the lower priority task.
 

Detailed Description

Function Documentation

void Rtos::addTask ( RtosTask task)
staticprivate

Add a task to the RTOS. The task is started in ready state.

Parameters
tasktask to be added.

Definition at line 103 of file Rtos.cpp.

void * RtosHeap::alloc ( size_t  size)
static
Parameters
size

Definition at line 26 of file RtosHeap.cpp.

void RtosTask::caller ( RtosRunnable runnable)
staticprotected
Parameters
runnable

Definition at line 69 of file RtosTask.cpp.

void RtosHeap::free ( void *  p)
static
Parameters
p

Definition at line 42 of file RtosHeap.cpp.

unsigned int RtosHeap::getBlockCount ( )
static
Returns

Definition at line 92 of file RtosHeap.cpp.

RtosListIterable * RtosList::getFirst ( )
Returns

Definition at line 172 of file RtosList.cpp.

size_t RtosHeap::getFreeMemory ( )
static
Returns

Definition at line 84 of file RtosHeap.cpp.

size_t RtosTask::getFreeStackSize ( )
Returns

Definition at line 121 of file RtosTask.cpp.

const char * RtosTask::getName ( )
Returns

Definition at line 105 of file RtosTask.cpp.

size_t RtosTask::getStackSize ( )
Returns

Definition at line 113 of file RtosTask.cpp.

size_t RtosHeap::getTotalMemory ( )
static
Returns

Definition at line 76 of file RtosHeap.cpp.

bool RtosSemaphore::give ( Rtos::TICK  tick)
Parameters
tick
Returns

Definition at line 33 of file RtosSemaphore.cpp.

template<class T, int N>
bool RtosMsgBox< T, N >::give ( T &  msg,
Rtos::TICK  tick 
)
Parameters
msg
tick
Returns

Definition at line 60 of file RtosMsgBox.hpp.

bool RtosSemaphore::giveFromInt ( )
Returns

Definition at line 46 of file RtosSemaphore.cpp.

template<class T, int N>
bool RtosMsgBox< T, N >::giveFromInt ( T &  msg)
Parameters
msg
Returns

Definition at line 77 of file RtosMsgBox.hpp.

void Rtos::idleRun ( RtosTask task)
staticprivate

Idle task executing function. This function is called from the scheduler is no other task are ready to run.

Parameters
taskpointer to the idle task.

Definition at line 238 of file Rtos.cpp.

void RtosTask::initVariables ( Rtos::PRIORITY  priority,
const char *  name,
size_t  stackSize 
)
private
Parameters
priority
name
stackSize

Definition at line 55 of file RtosTask.cpp.

void RtosList::insertAtBeginning ( RtosListIterable iterable)
Parameters
iterable

Definition at line 24 of file RtosList.cpp.

void RtosList::insertAtEnd ( RtosListIterable iterable)
Parameters
iterable

Definition at line 41 of file RtosList.cpp.

void RtosList::insertSorted ( RtosListIterable iterable)
Parameters
iterable

Definition at line 58 of file RtosList.cpp.

void RtosList::insertSorted ( RtosListIterable iterable,
uint32_t  current 
)
Parameters
iterable
current

Definition at line 88 of file RtosList.cpp.

int RtosSyncObject::internalGive ( Rtos::TICK  tick,
int  value 
)
protected
Parameters
tick
value
Returns

Definition at line 78 of file RtosSyncObject.cpp.

int RtosSyncObject::internalTake ( Rtos::TICK  tick,
int  value 
)
protected
Parameters
tick
value
Returns

Definition at line 34 of file RtosSyncObject.cpp.

bool Rtos::isElapsed ( TICK  tick)
static

Check is the specified ticks value is already elapsed.

Parameters
tickthe tick value to compare with the current tick value.
Returns
true if the specified tick value is elapsed, false otherwise.

Definition at line 87 of file Rtos.cpp.

bool RtosTimer::isEllapsed ( )
Returns

Definition at line 28 of file RtosTimer.cpp.

bool RtosList::isInside ( RtosListIterable iterable)
Parameters
iterable
Returns

Definition at line 158 of file RtosList.cpp.

void Rtos::onTick ( )
staticprivate

This function is called every tick interval. It increments the ticks counter and checks is there's any task on the sleeping list which needs to wake up.

Definition at line 166 of file Rtos.cpp.

void Rtos::putOnSleepingList ( RtosTask task,
TICK  tick 
)
staticprivate

Called to put a task on the sleeping list for the specified tick interval.

Parameters
taskthe task to put in the list.
tickthe sleep interval value in tick units.

Definition at line 136 of file Rtos.cpp.

void Rtos::putOnSuspendedList ( RtosTask task)
staticprivate

Called to put a task on the suspended list.

Parameters
taskthe task to put in the list.

Definition at line 157 of file Rtos.cpp.

bool RtosSyncObject::putOnWaitList ( RtosTask task,
Rtos::TICK  tick,
RtosList list 
)
private
Parameters
task
tick
list
Returns

Definition at line 126 of file RtosSyncObject.cpp.

int RtosBuffer::read ( void *  buffer,
int  len,
Rtos::TICK  tick 
)
Parameters
buffer
len
tick
Returns

Definition at line 102 of file RtosBuffer.cpp.

void RtosBuffer::readBuffer ( void *  buffer,
int  len 
)
private
Parameters
buffer
len

Definition at line 181 of file RtosBuffer.cpp.

int RtosBuffer::readChunk ( void *  buffer,
int  len,
Rtos::TICK  tick 
)
Parameters
buffer
len
tick
Returns

Definition at line 127 of file RtosBuffer.cpp.

int RtosBuffer::readFromInt ( void *  buffer,
int  len 
)
Parameters
buffer
len
Returns

Definition at line 143 of file RtosBuffer.cpp.

void RtosList::remove ( RtosListIterable iterable)
Parameters
iterable

Definition at line 125 of file RtosList.cpp.

void Rtos::removeTask ( RtosTask task)
staticprivate

Removes a task from the RTOS.

Parameters
tasktask to be removed.

Definition at line 114 of file Rtos.cpp.

void * RtosHeap::resize ( void *  p,
size_t  size 
)
static
Parameters
p
size

Definition at line 53 of file RtosHeap.cpp.

void * RtosHeap::resizeLeft ( void *  p,
size_t  left 
)
Parameters
p
left

Definition at line 65 of file RtosHeap.cpp.

RtosBuffer::RtosBuffer ( int  size)
Parameters
size

Definition at line 15 of file RtosBuffer.cpp.

RtosSemaphore::RtosSemaphore ( int  maxCount,
int  initialCount 
)
Parameters
maxCount
initialCount

Definition at line 16 of file RtosSemaphore.cpp.

RtosSyncObject::RtosSyncObject ( int  maxCount,
int  initialCount 
)
protected
Parameters
maxCount
initialCount

Definition at line 16 of file RtosSyncObject.cpp.

RtosTask::RtosTask ( Rtos::PRIORITY  priority,
const char *  name,
size_t  stackSize,
void(*)(RtosTask *)  run 
)
Parameters
priority
name
stackSize
run

Definition at line 21 of file RtosTask.cpp.

RtosTask::RtosTask ( Rtos::PRIORITY  priority,
const char *  name,
size_t  stackSize,
RtosRunnable runnable 
)
Parameters
priority
name
stackSize
runnable

Definition at line 35 of file RtosTask.cpp.

void * Rtos::schedule ( void *  stackPointer)
staticprivate

Schedules the task iterating through the ready list starting from the higher priority tasks.

Parameters
stackPointer

Definition at line 190 of file Rtos.cpp.

void RtosTimer::set ( Rtos::TICK  timeout)
Parameters
timeout

Definition at line 14 of file RtosTimer.cpp.

void Rtos::sleep ( TICK  tick)
static

Call this function to make the currently executing sleep for the specified ticks interval.

Parameters
tickthe sleep interval value in tick units. Use TICK_INFINITE to sleep forever.

Definition at line 51 of file Rtos.cpp.

void Rtos::sleepUntil ( TICK  tick)
static

Call this function to make the currently executing tasks sleep until the specified tick value is reached.

Parameters
tickthe ticks value up to which the task should sleep.

Definition at line 68 of file Rtos.cpp.

void Rtos::start ( )
static

Must be called to start the RTOS. This functions never exits.

Definition at line 34 of file Rtos.cpp.

bool RtosSemaphore::take ( Rtos::TICK  tick)
Parameters
tick
Returns

Definition at line 60 of file RtosSemaphore.cpp.

template<class T, int N>
bool RtosMsgBox< T, N >::take ( T &  msg,
Rtos::TICK  tick 
)
Parameters
msg
tick
Returns

Definition at line 95 of file RtosMsgBox.hpp.

bool RtosSemaphore::takeFromInt ( )
Returns

Definition at line 73 of file RtosSemaphore.cpp.

template<class T, int N>
bool RtosMsgBox< T, N >::takeFromInt ( T &  msg)
Parameters
msg
Returns

Definition at line 112 of file RtosMsgBox.hpp.

int RtosBuffer::write ( const void *  buffer,
int  len,
Rtos::TICK  tick 
)
Parameters
buffer
len
tick
Returns

Definition at line 41 of file RtosBuffer.cpp.

void RtosBuffer::writeBuffer ( const void *  buffer,
int  len 
)
private
Parameters
buffer
len

Definition at line 160 of file RtosBuffer.cpp.

int RtosBuffer::writeChunk ( const void *  buffer,
int  len,
Rtos::TICK  tick 
)
Parameters
buffer
len
tick
Returns

Definition at line 66 of file RtosBuffer.cpp.

int RtosBuffer::writeFromInt ( const void *  buffer,
int  len 
)
Parameters
buffer
len
Returns

Definition at line 82 of file RtosBuffer.cpp.