38#define CONTAINER_VERSION_MAJOR 1
39#define CONTAINER_VERSION_MINOR 0
40#define CONTAINER_VERSION_BUILD 0
41#define CONTAINER_VERSION_NUMBER 0x10000
42#define CONTAINER_VERSION_STRING "1.0.0"
60#define CONTAINER_OS CONTINER_OS_FREERTOS
74#define CONTAINER_OS_USER 0
81#define CONTAINER_OS_FREERTOS 1
91#define CONTAINER_OS_CMSIS 2
101#define CONTAINER_OS_CMSIS2 3
105# ifdef INC_FREERTOS_H
106# define CONTAINER_OS CONTAINER_OS_FREERTOS
113 #define CONTAINER_OS CONTAINER_OS_CMSIS
116 #define CONTAINER_OS CONTAINER_OS_CMSIS2
122#warning CONTAINER_OS not defined and can not be detected
191template<ContainerThreadSafety s>
254template<ContainerThreadSafety s>
357#if CONTAINER_OS == CONTAINER_OS_FREERTOS
361#ifdef configUSE_RECURSIVE_MUTEXES
373 #if configSUPPORT_STATIC_ALLOCATION
374 m_mutex = xSemaphoreCreateRecursiveMutexStatic(&m_mutex_buffer);
376 m_mutex = xSemaphoreCreateRecursiveMutex();
380 vSemaphoreDelete(m_mutex);
406 SemaphoreHandle_t m_mutex;
407#if configSUPPORT_STATIC_ALLOCATION
408 StaticSemaphore_t m_mutex_buffer;
433 void setRoot(
C* root) { m_root = root; }
440 unsigned readLock()
const {
return m_root->readLock(); }
446 void readUnlock(
unsigned code)
const { m_root->readUnlock(code); }
451 unsigned writeLock()
const {
return m_root->writeLock(); }
456 void writeUnlock(
unsigned code)
const { m_root->writeUnlock(code); }
501 return taskENTER_CRITICAL_FROM_ISR() | (upgrade << 15);
506 taskEXIT_CRITICAL_FROM_ISR(save & 0xFF);
513 if(!xPortIsInsideInterrupt()) vTaskSuspendAll();
520 if(!xPortIsInsideInterrupt()) xTaskResumeAll();
528 return taskENTER_CRITICAL_FROM_ISR() | (upgrade << 15);
533 taskEXIT_CRITICAL_FROM_ISR(save & 0xFF);
538 return taskENTER_CRITICAL_FROM_ISR() | (upgradable << 15);
543 taskEXIT_CRITICAL_FROM_ISR(save & 0xFF);
Base Container Class.
Definition Container.h:192
void operator=(Container const &)=delete
We are not assignable;.
Container(Container const &)=delete
We are not copyable.
Container()
Definition Container.h:195
unsigned writeLock(bool upgrade) const
Obtain a write lock.
unsigned readLock(bool upgradable) const
Obtain a read lock.
~Container()
Definition Container.h:196
void readUnlock(unsigned code) const
Release the read lock that was held.
virtual bool check() const =0
void writeUnlock(unsigned code) const
Release write lock.
Base Container Node Class.
Definition Container.h:255
void operator=(ContainerNode const &)=delete
ContainerNode(C *root=nullptr)
Definition Container.h:258
ContainerNode(ContainerNode const &)=delete
~ContainerNode()
Definition Container.h:259
Container< s > C
The type of the Container that we are part of.
Definition Container.h:256
unsigned readLock(bool upgradable) const
virtual bool check() const =0
void setRoot(C *root)
Set our Container.
Definition Container.h:272
void readUnlock(unsigned code) const
unsigned writeLock(bool upgrade) const
void writeUnlock(unsigned code) const
ContainerThreadSafety
Thread Safety selection for container.
Definition Container.h:167
@ ContainerMutexSafe
Container will include a Mutex to protect updates in Tasks, but not ISRs.
Definition Container.h:171
@ ContainerISRSafe
Container will include Critical Sections to protect updates in ISR and Tasks.
Definition Container.h:174
@ ContainerNoSafety
Thread Safety (if needed) provided by the application.
Definition Container.h:168
@ ContainerTaskSafe
Container will include Critical Sections to protect updates in tasks, but not ISRs.
Definition Container.h:173
@ ContainerTaskOnly
Container will suspend the scheduler as no need to protect from ISR usage.
Definition Container.h:172
@ ContainerReadWrite
Container will include a Read/Write lock to protect updates in tasks.
Definition Container.h:170