distortos  v0.7.0
object-oriented C++ RTOS for microcontrollers
distortos Namespace Reference

Top-level namespace of distortos project. More...

Namespaces

 architecture
 Architecture-related code of distortos project.
 
 board
 Board-related code of distortos project.
 
 chip
 Chip-related code of distortos project.
 
 devices
 Device drivers.
 
 internal
 Internals of distortos project - should not be used directly!
 
 statistics
 Functions used to read statistics of distortos.
 
 ThisThread
 Functions that can be used to control current thread.
 

Classes

class  ConditionVariable
 ConditionVariable is an advanced synchronization primitive. More...
 
class  Directory
 
class  DynamicFifoQueue
 DynamicFifoQueue class is a variant of FifoQueue that has dynamic storage for queue's contents. More...
 
class  DynamicMessageQueue
 DynamicMessageQueue class is a variant of MessageQueue that has dynamic storage for queue's contents. More...
 
class  DynamicRawFifoQueue
 DynamicRawFifoQueue class is a variant of RawFifoQueue that has dynamic storage for queue's contents. More...
 
class  DynamicRawMessageQueue
 DynamicRawMessageQueue class is a variant of RawMessageQueue that has dynamic storage for queue's contents. More...
 
class  DynamicSignalsReceiver
 DynamicSignalsReceiver class is a templated interface for SignalsReceiver that has dynamic storage for queued signals and SignalAction associations required for catching signals. More...
 
class  DynamicSoftwareTimer
 DynamicSoftwareTimer class is a type-erased interface for software timer that has dynamic storage for bound function. More...
 
class  DynamicThread
 DynamicThread class is a type-erased interface for thread that has dynamic storage for bound function, stack and internal DynamicSignalsReceiver object. More...
 
struct  DynamicThreadParameters
 DynamicThreadParameters struct is a helper with parameters for DynamicThread's constructor. More...
 
class  FifoQueue
 FifoQueue class is a simple FIFO queue for thread-thread, thread-interrupt or interrupt-interrupt communication. It supports multiple readers and multiple writers. It is implemented as a wrapper for internal::FifoQueueBase. More...
 
class  File
 
class  FileSystem
 
class  InterruptMaskingLock
 
class  Littlefs1Directory
 
class  Littlefs1File
 
class  Littlefs1FileSystem
 
class  MessageQueue
 MessageQueue class is a message queue for thread-thread, thread-interrupt or interrupt-interrupt communication. It supports multiple readers and multiple writers. It is implemented as a wrapper for internal::MessageQueueBase. More...
 
class  Mutex
 Mutex is the basic synchronization primitive. More...
 
class  OnceFlag
 OnceFlag is a helper class for callOnce(). More...
 
class  RawFifoQueue
 RawFifoQueue class is very similar to FifoQueue, but optimized for binary serializable types (like POD types). More...
 
class  RawMessageQueue
 RawMessageQueue class is very similar to MessageQueue, but optimized for binary serializable types (like POD types). More...
 
class  Semaphore
 Semaphore is the basic synchronization primitive. More...
 
class  SignalAction
 SignalAction class contains information needed to handle signal that was caught. More...
 
class  SignalInformation
 SignalInformation class contains information about queued signal. More...
 
class  SignalInformationQueueWrapper
 SignalInformationQueueWrapper class is a container for internal::SignalInformationQueue. More...
 
class  SignalsCatcher
 SignalsCatcher class is a container for internal::SignalsCatcherControlBlock. More...
 
class  SignalSet
 SignalSet class is used as a set of signals. More...
 
class  SignalsReceiver
 SignalsReceiver class is a container for internal::SignalsReceiverControlBlock. More...
 
class  SoftwareTimer
 SoftwareTimer class is an abstract interface for software timers. More...
 
class  SoftwareTimerCommon
 SoftwareTimerCommon class implements common functionality of software timers. More...
 
class  StaticFifoQueue
 StaticFifoQueue class is a variant of FifoQueue that has automatic storage for queue's contents. More...
 
class  StaticMessageQueue
 StaticMessageQueue class is a variant of MessageQueue that has automatic storage for queue's contents. More...
 
class  StaticRawFifoQueue
 StaticRawFifoQueue class is a variant of RawFifoQueue that has automatic storage for queue's contents. More...
 
class  StaticRawMessageQueue
 StaticRawMessageQueue class is a variant of RawMessageQueue that has automatic storage for queue's contents. More...
 
class  StaticSignalsReceiver
 StaticSignalsReceiver class is a templated interface for SignalsReceiver that has automatic storage for queued signals and SignalAction associations required for catching signals. More...
 
class  StaticSignalsReceiver< 0, 0 >
 StaticSignalsReceiver class is a templated interface for SignalsReceiver that has automatic storage for queued signals and SignalAction associations required for catching signals. More...
 
class  StaticSignalsReceiver< 0, SignalActions >
 StaticSignalsReceiver class is a templated interface for SignalsReceiver that has automatic storage for queued signals and SignalAction associations required for catching signals. More...
 
class  StaticSignalsReceiver< QueuedSignals, 0 >
 StaticSignalsReceiver class is a templated interface for SignalsReceiver that has automatic storage for queued signals and SignalAction associations required for catching signals. More...
 
class  StaticSoftwareTimer
 StaticSoftwareTimer class is a templated interface for software timer. More...
 
class  StaticThread
 StaticThread class is a templated interface for thread that has automatic storage for stack. More...
 
class  StaticThread< StackSize, true, QueuedSignals, SignalActions, Function, Args... >
 StaticThread class is a templated interface for thread that has automatic storage for stack and internal StaticSignalsReceiver object. More...
 
class  Thread
 Thread class is a pure abstract interface for threads. More...
 
class  ThreadIdentifier
 ThreadIdentifier class is an identifier of thread. More...
 
class  TickClock
 TickClock is a std::chrono clock, equivalent of std::chrono::steady_clock. More...
 
class  UndetachableThread
 UndetachableThread class is a ThreadCommon that cannot be detached. More...
 

Enumerations

enum  MutexProtocol : uint8_t { MutexProtocol::none, MutexProtocol::priorityInheritance, MutexProtocol::priorityProtect }
 mutex protocols More...
 
enum  MutexType : uint8_t { MutexType::normal, MutexType::errorChecking, MutexType::recursive }
 type of mutex More...
 
enum  SchedulingPolicy : uint8_t { SchedulingPolicy::fifo, SchedulingPolicy::roundRobin }
 scheduling policy of the thread More...
 
enum  ThreadState : uint8_t {
  ThreadState::created, ThreadState::runnable, ThreadState::terminated, ThreadState::sleeping,
  ThreadState::blockedOnSemaphore, ThreadState::suspended, ThreadState::blockedOnMutex, ThreadState::blockedOnConditionVariable,
  ThreadState::waitingForSignal, ThreadState::detached
}
 state of the thread More...
 

Functions

void PendSV_Handler ()
 PendSV_Handler() for ARMv6-M and ARMv7-M. More...
 
int littlefs1ErrorToErrorCode (int littlefs1Error)
 Converts littlefs-v1 error to error code. More...
 
std::pair< int, FILE * > openFile (FileSystem &fileSystem, const char *path, const char *mode)
 Opens file from given file system. More...
 
template<typename Function , typename... Args>
void callOnce (OnceFlag &onceFlag, Function &&function, Args &&... args)
 Executes the callable object exactly once, even if called from multiple threads. More...
 
template<typename Function , typename... Args>
DynamicSoftwareTimer makeDynamicSoftwareTimer (Function &&function, Args &&... args)
 Helper factory function to make DynamicSoftwareTimer object. More...
 
template<typename Function , typename... Args>
DynamicThread makeDynamicThread (const size_t stackSize, const bool canReceiveSignals, const size_t queuedSignals, const size_t signalActions, const uint8_t priority, const SchedulingPolicy schedulingPolicy, Function &&function, Args &&... args)
 Helper factory function to make DynamicThread object. More...
 
template<typename Function , typename... Args>
DynamicThread makeDynamicThread (const DynamicThreadParameters parameters, Function &&function, Args &&... args)
 Helper factory function to make DynamicThread object. More...
 
template<typename Function , typename... Args>
DynamicThread makeAndStartDynamicThread (const size_t stackSize, const bool canReceiveSignals, const size_t queuedSignals, const size_t signalActions, const uint8_t priority, const SchedulingPolicy schedulingPolicy, Function &&function, Args &&... args)
 Helper factory function to make and start DynamicThread object. More...
 
template<typename Function , typename... Args>
DynamicThread makeAndStartDynamicThread (const DynamicThreadParameters parameters, Function &&function, Args &&... args)
 Helper factory function to make and start DynamicThread object. More...
 
static distortos::ConditionVariablefromCApi (distortos_ConditionVariable &conditionVariable)
 Casts C-API distortos_ConditionVariable to distortos::ConditionVariable. More...
 
static const distortos::ConditionVariablefromCApi (const distortos_ConditionVariable &conditionVariable)
 Casts const C-API distortos_ConditionVariable to const distortos::ConditionVariable. More...
 
static distortos::MutexfromCApi (distortos_Mutex &mutex)
 Casts C-API distortos_Mutex to distortos::Mutex. More...
 
static const distortos::MutexfromCApi (const distortos_Mutex &mutex)
 Casts const C-API distortos_Mutex to const distortos::Mutex. More...
 
static distortos::SemaphorefromCApi (distortos_Semaphore &semaphore)
 Casts C-API distortos_Semaphore to distortos::Semaphore. More...
 
static const distortos::SemaphorefromCApi (const distortos_Semaphore &semaphore)
 Casts const C-API distortos_Semaphore to const distortos::Semaphore. More...
 
template<typename Function , typename... Args>
StaticSoftwareTimer< Function, Args... > makeStaticSoftwareTimer (Function &&function, Args &&... args)
 Helper factory function to make StaticSoftwareTimer object with deduced template arguments. More...
 
template<size_t StackSize, bool CanReceiveSignals = {}, size_t QueuedSignals = {}, size_t SignalActions = {}, typename Function , typename... Args>
StaticThread< StackSize, CanReceiveSignals, QueuedSignals, SignalActions, Function, Args... > makeStaticThread (const uint8_t priority, const SchedulingPolicy schedulingPolicy, Function &&function, Args &&... args)
 Helper factory function to make StaticThread object with partially deduced template arguments. More...
 
template<size_t StackSize, bool CanReceiveSignals = {}, size_t QueuedSignals = {}, size_t SignalActions = {}, typename Function , typename... Args>
StaticThread< StackSize, CanReceiveSignals, QueuedSignals, SignalActions, Function, Args... > makeStaticThread (const uint8_t priority, Function &&function, Args &&... args)
 Helper factory function to make StaticThread object with partially deduced template arguments. More...
 
template<size_t StackSize, bool CanReceiveSignals = {}, size_t QueuedSignals = {}, size_t SignalActions = {}, typename Function , typename... Args>
StaticThread< StackSize, CanReceiveSignals, QueuedSignals, SignalActions, Function, Args... > makeAndStartStaticThread (const uint8_t priority, const SchedulingPolicy schedulingPolicy, Function &&function, Args &&... args)
 Helper factory function to make and start StaticThread object with partially deduced template arguments. More...
 
template<size_t StackSize, bool CanReceiveSignals = {}, size_t QueuedSignals = {}, size_t SignalActions = {}, typename Function , typename... Args>
StaticThread< StackSize, CanReceiveSignals, QueuedSignals, SignalActions, Function, Args... > makeAndStartStaticThread (const uint8_t priority, Function &&function, Args &&... args)
 Helper factory function to make and start StaticThread object with partially deduced template arguments. More...
 

Detailed Description

Top-level namespace of distortos project.

Enumeration Type Documentation

◆ MutexProtocol

enum distortos::MutexProtocol : uint8_t
strong

mutex protocols

Enumerator
none 

no protocol, similar to PTHREAD_PRIO_NONE

priorityInheritance 

priority inheritance protocol, similar to PTHREAD_PRIO_INHERIT

priorityProtect 

priority protection protocol (Immediate Ceiling Priority Protocol), similar to PTHREAD_PRIO_PROTECT

◆ MutexType

enum distortos::MutexType : uint8_t
strong

type of mutex

Enumerator
normal 

normal mutex, similar to PTHREAD_MUTEX_NORMAL

errorChecking 

mutex with additional error checking, similar to PTHREAD_MUTEX_ERRORCHECK

recursive 

recursive mutex, similar to PTHREAD_MUTEX_RECURSIVE

Function Documentation

◆ fromCApi() [1/6]

static distortos::ConditionVariable& distortos::fromCApi ( distortos_ConditionVariable conditionVariable)
inlinestatic

Casts C-API distortos_ConditionVariable to distortos::ConditionVariable.

Parameters
[in]conditionVariableis a reference to distortos_ConditionVariable object
Returns
reference to distortos::ConditionVariable object, casted from conditionVariable
Here is the caller graph for this function:

◆ fromCApi() [2/6]

static const distortos::ConditionVariable& distortos::fromCApi ( const distortos_ConditionVariable conditionVariable)
inlinestatic

Casts const C-API distortos_ConditionVariable to const distortos::ConditionVariable.

Parameters
[in]conditionVariableis a const reference to distortos_ConditionVariable object
Returns
const reference to distortos::ConditionVariable object, casted from conditionVariable

◆ fromCApi() [3/6]

static distortos::Mutex& distortos::fromCApi ( distortos_Mutex mutex)
inlinestatic

Casts C-API distortos_Mutex to distortos::Mutex.

Parameters
[in]mutexis a reference to distortos_Mutex object
Returns
reference to distortos::Mutex object, casted from mutex

◆ fromCApi() [4/6]

static const distortos::Mutex& distortos::fromCApi ( const distortos_Mutex mutex)
inlinestatic

Casts const C-API distortos_Mutex to const distortos::Mutex.

Parameters
[in]mutexis a const reference to distortos_Mutex object
Returns
const reference to distortos::Mutex object, casted from mutex

◆ fromCApi() [5/6]

static distortos::Semaphore& distortos::fromCApi ( distortos_Semaphore semaphore)
inlinestatic

Casts C-API distortos_Semaphore to distortos::Semaphore.

Parameters
[in]semaphoreis a reference to distortos_Semaphore object
Returns
reference to distortos::Semaphore object, casted from semaphore

◆ fromCApi() [6/6]

static const distortos::Semaphore& distortos::fromCApi ( const distortos_Semaphore semaphore)
inlinestatic

Casts const C-API distortos_Semaphore to const distortos::Semaphore.

Parameters
[in]semaphoreis a const reference to distortos_Semaphore object
Returns
const reference to distortos::Semaphore object, casted from semaphore

◆ littlefs1ErrorToErrorCode()

int distortos::littlefs1ErrorToErrorCode ( int  littlefs1Error)

Converts littlefs-v1 error to error code.

Parameters
[in]littlefs1Erroris an error returned by littlefs-v1 functions
Returns
littlefs1Error converted to error code
Here is the caller graph for this function:

◆ openFile()

std::pair< int, FILE * > distortos::openFile ( FileSystem fileSystem,
const char *  path,
const char *  mode 
)

Opens file from given file system.

Similar to fopen()

Precondition
fileSystem is mounted.
path and mode are valid.
Parameters
[in]fileSystemis a reference to file system used to open the file
[in]pathis the path of file that will be opened, must be valid
[in]modeis the mode in which the file will be opened, must be valid, for list of available modes and valid combinations see fopen()
Returns
pair with return code (0 on success, error code otherwise) and FILE* with opened file; error codes:

◆ PendSV_Handler()

void distortos::PendSV_Handler ( )

PendSV_Handler() for ARMv6-M and ARMv7-M.

Performs the context switch.