39#pragma clang diagnostic ignored "-Wc++98-compat"
139#pragma GCC diagnostic push
140#pragma GCC diagnostic ignored "-Wenum-compare"
141#if defined(__clang__)
142#pragma clang diagnostic ignored "-Wanon-enum-enum-conversion"
144#pragma GCC diagnostic ignored "-Wsign-compare"
183#pragma GCC diagnostic pop
190#pragma GCC diagnostic push
191#pragma GCC diagnostic ignored "-Winvalid-offsetof"
238#if defined(OS_INCLUDE_RTOS_STATISTICS_THREAD_CONTEXT_SWITCHES) \
239 || defined(OS_INCLUDE_RTOS_STATISTICS_THREAD_CPU_CYCLES)
245#pragma GCC diagnostic pop
247#pragma GCC diagnostic push
248#pragma GCC diagnostic ignored "-Wold-style-cast"
360#if defined(OS_INCLUDE_RTOS_STATISTICS_THREAD_CONTEXT_SWITCHES)
376#if defined(OS_INCLUDE_RTOS_STATISTICS_THREAD_CPU_CYCLES)
458#if defined(OS_HAS_INTERRUPTS_STACK) || defined(__DOXYGEN__)
498 return this_thread::suspend ();
510 this_thread::exit (exit_ptr);
523 return (
os_result_t) this_thread::flags_wait (mask, oflags, mode);
536 return (
os_result_t) this_thread::flags_try_wait (mask, oflags, mode);
550 return (
os_result_t) this_thread::flags_timed_wait (mask, timeout, oflags,
563 return (
os_result_t) this_thread::flags_clear (mask, oflags);
589 assert (attr !=
nullptr);
606 assert (
thread !=
nullptr);
627 assert (
thread !=
nullptr);
673 assert (
thread !=
nullptr);
686 assert (
thread !=
nullptr);
700 assert (
thread !=
nullptr);
713 assert (
thread !=
nullptr);
726 assert (
thread !=
nullptr);
740 assert (
thread !=
nullptr);
753 assert (
thread !=
nullptr);
766 assert (
thread !=
nullptr);
780 assert (
thread !=
nullptr);
794 assert (
thread !=
nullptr);
798#if defined(OS_INCLUDE_RTOS_CUSTOM_THREAD_USER_STORAGE) || defined(__DOXYGEN__)
810os_thread_user_storage_t*
813 assert(
thread !=
nullptr);
828 assert (
thread !=
nullptr);
891 assert (stack !=
nullptr);
904 assert (stack !=
nullptr);
917 assert (stack !=
nullptr);
930 assert (stack !=
nullptr);
943 assert (stack !=
nullptr);
956 assert (stack !=
nullptr);
962#if defined(OS_INCLUDE_RTOS_STATISTICS_THREAD_CONTEXT_SWITCHES)
973 assert (
thread !=
nullptr);
979#if defined(OS_INCLUDE_RTOS_STATISTICS_THREAD_CPU_CYCLES)
990 assert (
thread !=
nullptr);
1042 thread::threads_list::iterator it
1057 thread::threads_list::iterator it
1061 return reinterpret_cast<os_iterator_t> (it.get_iterator_pointer ());
1075 assert (
clock !=
nullptr);
1088 assert (
clock !=
nullptr);
1101 assert (
clock !=
nullptr);
1114 assert (
clock !=
nullptr);
1128 assert (
clock !=
nullptr);
1142 assert (
clock !=
nullptr);
1156 assert (
clock !=
nullptr);
1170 assert (
clock !=
nullptr);
1171 assert (
clock !=
nullptr);
1274 assert (attr !=
nullptr);
1287 assert (attr !=
nullptr);
1316 assert (
timer !=
nullptr);
1317 if (attr ==
nullptr)
1337 assert (
timer !=
nullptr);
1358 if (attr ==
nullptr)
1383 assert (
timer !=
nullptr);
1396 assert (
timer !=
nullptr);
1409 assert (
timer !=
nullptr);
1422 assert (
timer !=
nullptr);
1437 assert (attr !=
nullptr);
1450 assert (attr !=
nullptr);
1478 assert (
mutex !=
nullptr);
1479 if (attr ==
nullptr)
1498 assert (
mutex !=
nullptr);
1499 if (attr ==
nullptr)
1518 assert (
mutex !=
nullptr);
1538 if (attr ==
nullptr)
1562 if (attr ==
nullptr)
1587 assert (
mutex !=
nullptr);
1600 assert (
mutex !=
nullptr);
1613 assert (
mutex !=
nullptr);
1626 assert (
mutex !=
nullptr);
1639 assert (
mutex !=
nullptr);
1653 assert (
mutex !=
nullptr);
1666 assert (
mutex !=
nullptr);
1680 assert (
mutex !=
nullptr);
1682 prio_ceiling, old_prio_ceiling);
1694 assert (
mutex !=
nullptr);
1707 assert (
mutex !=
nullptr);
1720 assert (
mutex !=
nullptr);
1733 assert (
mutex !=
nullptr);
1746 assert (
mutex !=
nullptr);
1759 assert (
mutex !=
nullptr);
1774 assert (attr !=
nullptr);
1790 assert (condvar !=
nullptr);
1791 if (attr ==
nullptr)
1810 assert (condvar !=
nullptr);
1830 if (attr ==
nullptr)
1854 assert (condvar !=
nullptr);
1867 assert (condvar !=
nullptr);
1880 assert (condvar !=
nullptr);
1893 assert (condvar !=
nullptr);
1906 assert (condvar !=
nullptr);
1921 assert (condvar !=
nullptr);
1937 assert (attr !=
nullptr);
1952 assert (attr !=
nullptr);
1968 assert (attr !=
nullptr);
1970 { max_value, initial_value };
1998 if (attr ==
nullptr)
2020 { name, initial_value };
2038 { name, max_value, initial_value };
2073 if (attr ==
nullptr)
2099 { name, initial_value });
2121 { name, max_value, initial_value });
2274 assert (attr !=
nullptr);
2290 assert (mempool !=
nullptr);
2291 if (attr ==
nullptr)
2295 new (mempool)
memory_pool (name, blocks, block_size_bytes,
2310 assert (mempool !=
nullptr);
2331 if (attr ==
nullptr)
2355 assert (mempool !=
nullptr);
2368 assert (mempool !=
nullptr);
2369 return (
reinterpret_cast<memory_pool&
> (*mempool)).name ();
2381 assert (mempool !=
nullptr);
2382 return (
reinterpret_cast<memory_pool&
> (*mempool)).alloc ();
2394 assert (mempool !=
nullptr);
2395 return (
reinterpret_cast<memory_pool&
> (*mempool)).try_alloc ();
2407 assert (mempool !=
nullptr);
2408 return (
reinterpret_cast<memory_pool&
> (*mempool)).timed_alloc (timeout);
2420 assert (mempool !=
nullptr);
2433 assert (mempool !=
nullptr);
2434 return (
reinterpret_cast<memory_pool&
> (*mempool)).capacity ();
2446 assert (mempool !=
nullptr);
2447 return (
reinterpret_cast<memory_pool&
> (*mempool)).count ();
2459 assert (mempool !=
nullptr);
2460 return (
reinterpret_cast<memory_pool&
> (*mempool)).block_size ();
2472 assert (mempool !=
nullptr);
2473 return (
reinterpret_cast<memory_pool&
> (*mempool)).empty ();
2485 assert (mempool !=
nullptr);
2486 return (
reinterpret_cast<memory_pool&
> (*mempool)).full ();
2498 assert (mempool !=
nullptr);
2511 assert (mempool !=
nullptr);
2512 return (
void*) (
reinterpret_cast<memory_pool&
> (*mempool)).pool ();
2526 assert (attr !=
nullptr);
2542 assert (mqueue !=
nullptr);
2543 if (attr ==
nullptr)
2562 assert (mqueue !=
nullptr);
2583 if (attr ==
nullptr)
2607 assert (mqueue !=
nullptr);
2620 assert (mqueue !=
nullptr);
2621 return (
reinterpret_cast<message_queue&
> (*mqueue)).name ();
2634 assert (mqueue !=
nullptr);
2636 msg, nbytes, mprio);
2649 assert (mqueue !=
nullptr);
2651 msg, nbytes, mprio);
2664 assert (mqueue !=
nullptr);
2666 msg, nbytes, timeout, mprio);
2679 assert (mqueue !=
nullptr);
2681 msg, nbytes, mprio);
2694 assert (mqueue !=
nullptr);
2696 msg, nbytes, mprio);
2709 assert (mqueue !=
nullptr);
2711 msg, nbytes, timeout, mprio);
2723 assert (mqueue !=
nullptr);
2724 return (
reinterpret_cast<message_queue&
> (*mqueue)).length ();
2736 assert (mqueue !=
nullptr);
2737 return (
reinterpret_cast<message_queue&
> (*mqueue)).capacity ();
2749 assert (mqueue !=
nullptr);
2750 return (
reinterpret_cast<message_queue&
> (*mqueue)).msg_size ();
2762 assert (mqueue !=
nullptr);
2763 return (
reinterpret_cast<message_queue&
> (*mqueue)).empty ();
2775 assert (mqueue !=
nullptr);
2776 return (
reinterpret_cast<message_queue&
> (*mqueue)).full ();
2788 assert (mqueue !=
nullptr);
2803 assert (attr !=
nullptr);
2819 assert (evflags !=
nullptr);
2820 if (attr ==
nullptr)
2838 assert (evflags !=
nullptr);
2858 if (attr ==
nullptr)
2882 assert (evflags !=
nullptr);
2895 assert (evflags !=
nullptr);
2896 return (
reinterpret_cast<event_flags&
> (*evflags)).name ();
2909 assert (evflags !=
nullptr);
2925 assert (evflags !=
nullptr);
2927 mask, oflags, mode);
2941 assert (evflags !=
nullptr);
2943 mask, timeout, oflags, mode);
2956 assert (evflags !=
nullptr);
2971 assert (evflags !=
nullptr);
2986 assert (evflags !=
nullptr);
3000 assert (evflags !=
nullptr);
3001 return (
reinterpret_cast<event_flags&
> (*evflags)).waiting ();
3028 assert (memory !=
nullptr);
3044 assert (memory !=
nullptr);
3046 addr, bytes, alignment);
3059 assert (memory !=
nullptr);
3073 assert (memory !=
nullptr);
3087 assert (memory !=
nullptr);
3101 assert (memory !=
nullptr);
3115 assert (memory !=
nullptr);
3129 assert (memory !=
nullptr);
3143 assert (memory !=
nullptr);
3220#if (defined (osFeature_SysTick) && (osFeature_SysTick != 0))
3239 return static_cast<uint32_t
> (
hrclock.
now ());
3269 if (thread_def ==
nullptr)
3285 for (uint32_t i = 0; i < thread_def->
instances; ++i)
3294 * ((thread_def->
stacksize +
sizeof(uint64_t) - 1)
3295 /
sizeof(uint64_t))];
3297#pragma GCC diagnostic push
3298#pragma GCC diagnostic ignored "-Wcast-function-type"
3301#pragma GCC diagnostic pop
3324 return reinterpret_cast<osThreadId> (&this_thread::thread ());
3346 if (thread_id ==
nullptr)
3352 (
reinterpret_cast<rtos::thread&
> (*thread_id)).state ();
3358 if ((
reinterpret_cast<thread*
> (thread_id)) == &this_thread::thread ())
3360 this_thread::exit ();
3408 if (thread_id ==
nullptr)
3414 (
reinterpret_cast<rtos::thread&
> (*thread_id)).state ();
3428 ((
reinterpret_cast<rtos::thread&
> (*thread_id)).priority (prio));
3437 else if (res == EINVAL)
3462 if (thread_id ==
nullptr)
3469 (
reinterpret_cast<rtos::thread&
> (*thread_id)).priority ();
3500 if (res == ETIMEDOUT)
3510#if (defined (osFeature_Wait) && (osFeature_Wait != 0))
3512#pragma GCC diagnostic push
3513#pragma GCC diagnostic ignored "-Waggregate-return"
3533osWait (uint32_t millisec)
3547 if (res == ETIMEDOUT)
3559#pragma GCC diagnostic pop
3582 if (timer_def ==
nullptr)
3611 if (timer_id ==
nullptr)
3640 if (timer_id ==
nullptr)
3650 else if (res == EAGAIN)
3674 if (timer_id ==
nullptr)
3695 if (thread_id ==
nullptr)
3697 return (int32_t) 0x80000000;
3700 if (signals == (int32_t) 0x80000000)
3702 return (int32_t) 0x80000000;
3707 return (int32_t) osig;
3719 if (thread_id ==
nullptr)
3721 return (int32_t) 0x80000000;
3726 return (int32_t) 0x80000000;
3731#if defined(OS_INCLUDE_RTOS_THREAD_PUBLIC_FLAGS_CLEAR)
3734 assert(((
thread* ) (thread_id)) == &this_thread::thread ());
3738 return (int32_t) sig;
3741#pragma GCC diagnostic push
3742#pragma GCC diagnostic ignored "-Waggregate-return"
3777 if ((uint32_t) signals & 0x80000000)
3789 else if (millisec == 0)
3796 res = this_thread::flags_timed_wait (
3806 else if (res == EWOULDBLOCK)
3808 event.status =
osOK;
3810 else if (res == ETIMEDOUT)
3814 else if (res == EPERM)
3818 else if (res == EINVAL)
3830#pragma GCC diagnostic pop
3850 if (mutex_def ==
nullptr)
3859 new ((
void*) mutex_def->
data)
mutex (mutex_def->
name, attr);
3890 if (mutex_id ==
nullptr)
3898 ret = (
reinterpret_cast<rtos::mutex&
> (*mutex_id)).lock ();
3901 else if (millisec == 0)
3903 ret = (
reinterpret_cast<rtos::mutex&
> (*mutex_id)).try_lock ();
3907 ret = (
reinterpret_cast<rtos::mutex&
> (*mutex_id)).timed_lock (
3917 else if (ret == EWOULDBLOCK)
3923 else if (ret == ENOTRECOVERABLE)
3929 else if (ret == ETIMEDOUT)
3959 if (mutex_id ==
nullptr)
3965 res = (
reinterpret_cast<rtos::mutex&
> (*mutex_id)).unlock ();
3971 else if ((res == EPERM) || (res == ENOTRECOVERABLE))
3998 if (mutex_id ==
nullptr)
4011#if (defined (osFeature_Semaphore) && (osFeature_Semaphore != 0))
4030 if (semaphore_def ==
nullptr)
4079 if (semaphore_id ==
nullptr)
4089 else if (millisec == 0)
4091 res = (
reinterpret_cast<rtos::semaphore&
> (*semaphore_id)).try_wait ();
4092 if (res == EWOULDBLOCK)
4099 res = (
reinterpret_cast<rtos::semaphore&
> (*semaphore_id)).timed_wait (
4101 if (res == ETIMEDOUT)
4110 (int32_t) (
reinterpret_cast<rtos::semaphore&
> (*semaphore_id)).value ();
4129 if (semaphore_id ==
nullptr)
4134 if ((
reinterpret_cast<rtos::semaphore&
> (*semaphore_id)).initial_value ()
4146 else if (res == EAGAIN)
4173 if (semaphore_id ==
nullptr)
4187#if (defined (osFeature_Pool) && (osFeature_Pool != 0))
4203 if (pool_def ==
nullptr)
4213 (std::size_t) pool_def->
items,
4214 (std::size_t) pool_def->
item_sz,
4229 if (pool_id ==
nullptr)
4234 return (
reinterpret_cast<memory_pool&
> (*pool_id)).try_alloc ();
4246 if (pool_id ==
nullptr)
4252 ret = (
reinterpret_cast<memory_pool&
> (*pool_id)).try_alloc ();
4256 (
reinterpret_cast<memory_pool&
> (*pool_id)).block_size ());
4271 if (pool_id ==
nullptr)
4276 if (block ==
nullptr)
4288 else if (res == EINVAL)
4303#if (defined (osFeature_MessageQ) && (osFeature_MessageQ != 0))
4313 osThreadId thread_id __attribute__((unused)))
4320 if (queue_def ==
nullptr)
4330 (std::size_t) queue_def->
items,
4331 (std::size_t) queue_def->
item_sz,
4356#pragma GCC diagnostic push
4357#if defined ( __clang__ )
4358#pragma clang diagnostic ignored "-Wint-to-pointer-cast"
4361 if (queue_id ==
nullptr)
4374 (
const char*) &info,
sizeof(uint32_t), 0);
4377 else if (millisec == 0)
4379 res = (
reinterpret_cast<message_queue&
> (*queue_id)).try_send (
4380 (
const char*) &info,
sizeof(uint32_t), 0);
4389 res = (
reinterpret_cast<message_queue&
> (*queue_id)).timed_send (
4390 (
const char*) &info,
sizeof(uint32_t),
4400 else if (res == EWOULDBLOCK)
4405 else if (res == ETIMEDOUT)
4410 else if (res == EINVAL || res == EMSGSIZE)
4420#pragma GCC diagnostic pop
4423#pragma GCC diagnostic push
4424#pragma GCC diagnostic ignored "-Waggregate-return"
4450 if (queue_id ==
nullptr)
4463 res = (
reinterpret_cast<message_queue&
> (*queue_id)).receive (
4464 (
char*) &
event.value.v,
sizeof(uint32_t),
nullptr);
4467 else if (millisec == 0)
4469 res = (
reinterpret_cast<message_queue&
> (*queue_id)).try_receive (
4470 (
char*) &
event.value.v,
sizeof(uint32_t),
nullptr);
4481 res = (
reinterpret_cast<message_queue&
> (*queue_id)).timed_receive (
4482 (
char*) &
event.value.v,
sizeof(uint32_t),
4493 else if (res == ETIMEDOUT)
4498 else if (res == EINVAL || res == EMSGSIZE)
4503 else if (res == EWOULDBLOCK)
4506 event.status =
osOK;
4516#pragma GCC diagnostic pop
4523#if (defined (osFeature_MailQ) && (osFeature_MailQ != 0))
4533 osThreadId thread_id __attribute__((unused)))
4540 if (mail_def ==
nullptr)
4549 mail_def->
name, (std::size_t) mail_def->
items,
4556 mail_def->
name, (std::size_t) mail_def->
items,
4588 if (mail_id ==
nullptr)
4593 void* ret =
nullptr;
4595#pragma GCC diagnostic push
4596#pragma GCC diagnostic ignored "-Wstrict-aliasing"
4605 else if (millisec == 0)
4618#pragma GCC diagnostic pop
4651#pragma GCC diagnostic push
4652#pragma GCC diagnostic ignored "-Wstrict-aliasing"
4655#pragma GCC diagnostic pop
4670 if (mail_id ==
nullptr)
4674 if (mail ==
nullptr)
4681 if (((
char*) mail < (
char*) (pool->
pool ()))
4689#pragma GCC diagnostic push
4690#pragma GCC diagnostic ignored "-Wstrict-aliasing"
4692 (
const char*) &mail,
sizeof(
void*), 0);
4693#pragma GCC diagnostic pop
4704#pragma GCC diagnostic push
4705#pragma GCC diagnostic ignored "-Waggregate-return"
4706#pragma GCC diagnostic ignored "-Wstrict-aliasing"
4732 if (mail_id ==
nullptr)
4746 (
char*) &
event.value.p,
sizeof(
void*),
nullptr);
4749 else if (millisec == 0)
4752 (
char*) &
event.value.p,
sizeof(
void*),
nullptr);
4763 (
char*) &
event.value.p,
sizeof(
void*),
4773 else if (res == EWOULDBLOCK)
4776 event.status =
osOK;
4778 else if (res == EINVAL || res == EMSGSIZE)
4783 else if (res == ETIMEDOUT)
4796#pragma GCC diagnostic pop
4807 if (mail_id ==
nullptr)
4811 if (mail ==
nullptr)
4823#pragma GCC diagnostic pop
virtual timestamp_t now(void) override
Tell the current time.
static constexpr clock::duration_t ticks_cast(Rep_T microsec)
Convert microseconds to ticks.
result_t wait_for(duration_t timeout)
Timed wait for an event.
virtual result_t sleep_until(timestamp_t timestamp)
Sleep until an absolute timestamp.
virtual timestamp_t now(void)
Tell the current time, possibly adjusted for epoch.
result_t sleep_for(duration_t duration)
Sleep for a relative duration.
Condition variable attributes.
POSIX compliant condition variable.
Synchronised event flags.
Double linked list node, with time stamp and timer.
static void exit(state_t state)
Exit the interrupts critical section.
static state_t enter(void)
Enter an interrupts critical section.
static state_t enter(void)
Enter interrupts uncritical section.
static void exit(state_t state)
Exit interrupts uncritical section.
Memory resource manager (abstract class).
void * mp_pool_address
Address of the user defined storage for the memory pool.
std::size_t mp_pool_size_bytes
Size of the user defined storage for the memory pool.
Synchronised memory pool, using the default RTOS allocator.
std::size_t block_size(void) const
Get block size.
std::size_t capacity(void) const
Get memory pool capacity.
void * pool(void)
Get the pool storage address.
Message queue attributes.
void * mq_queue_address
Address of the user defined storage for the message queue.
std::size_t mq_queue_size_bytes
Size of the user defined storage for the message queue.
POSIX compliant message queue, using the default RTOS allocator.
Recursive mutex attributes.
type_t mx_type
Attribute with the mutex type.
protocol_t mx_protocol
Attribute with the mutex protocol.
POSIX compliant recursive mutex.
Binary semaphore attributes.
Counting semaphore attributes.
count_t sm_max_value
Semaphore max count value.
count_t sm_initial_value
Semaphore initial count value.
POSIX compliant binary semaphore.
POSIX compliant counting semaphore.
POSIX compliant semaphore.
std::size_t th_stack_size_bytes
Size of the user defined storage for the thread stack, in bytes.
priority_t th_priority
Thread initial priority.
void * th_stack_address
Address of the user defined storage for the thread stack.
static std::size_t default_size(void)
Get the default stack size.
static std::size_t min_size(void)
Get the min stack size.
POSIX compliant thread, using the default RTOS allocator.
result_t kill(void)
Force thread termination.
uint8_t state_t
Type of variables holding thread states.
void *(*)(func_args_t args) func_t
Type of thread function.
result_t join(void **exit_ptr=nullptr)
Wait for thread termination.
_func_args_t func_args_t
Type of thread function arguments.
static bool is_constructed(const thread &thread)
Check if the thread is constructed.
Periodic timer attributes.
type_t tm_type
Timer type attribute.
User single-shot or periodic timer.
The core of a double linked list, pointers to next, previous.
osEvent osMailGet(osMailQId mail_id, uint32_t millisec)
Get a mail from a queue.
osPoolId osPoolCreate(const osPoolDef_t *pool_def)
Create a memory pool.
osStatus osMailPut(osMailQId mail_id, void *mail)
Put a mail to a queue.
osStatus osPoolFree(osPoolId pool_id, void *block)
Free a memory block.
osEvent osMessageGet(osMessageQId queue_id, uint32_t millisec)
Get a message or Wait for a Message from a Queue.
#define osFeature_Semaphore
maximum count for osSemaphoreCreate function
void * osMailAlloc(osMailQId mail_id, uint32_t millisec)
Allocate a memory block from a mail.
@ osPriorityError
system cannot determine priority or thread has illegal priority
void * osMailCAlloc(osMailQId mail_id, uint32_t millisec)
Allocate and clear a memory block from a mail.
osEvent osWait(uint32_t millisec)
Wait for Signal, Message, Mail, or Timeout.
osSemaphoreId osSemaphoreCreate(const osSemaphoreDef_t *semaphore_def, int32_t count)
Create a semaphore.
#define osWaitForever
Timeout value.
void * osPoolCAlloc(osPoolId pool_id)
Allocate and clear a memory block.
void * osPoolAlloc(osPoolId pool_id)
Allocate a memory block.
osStatus osMailFree(osMailQId mail_id, void *mail)
Free a memory block from a mail.
osStatus osSemaphoreRelease(osSemaphoreId semaphore_id)
Release the semaphore.
osMailQId osMailCreate(const osMailQDef_t *mail_def, osThreadId thread_id)
Create a mail queue.
osStatus osSemaphoreDelete(osSemaphoreId semaphore_id)
Delete the semaphore.
osStatus osMessagePut(osMessageQId queue_id, uint32_t info, uint32_t millisec)
Put a message to a queue.
int32_t osSemaphoreWait(osSemaphoreId semaphore_id, uint32_t millisec)
Wait until a Semaphore token becomes available.
uint32_t osKernelSysTick(void)
Get the system timer counter.
os_timer_type
Timer type value for the timer definition.
osStatus
Status code values returned by CMSIS-RTOS functions.
@ osEventMail
function completed; mail event occurred.
@ osErrorISR
not allowed in ISR context: the function cannot be called from interrupt service routines.
@ osErrorTimeoutResource
resource not available within given time: a specified resource was not available within the timeout p...
@ osErrorValue
value of a parameter is out of range.
@ osEventSignal
function completed; signal event occurred.
@ osErrorOS
unspecified RTOS error: run-time error but no other error message fits.
@ osEventTimeout
function completed; timeout occurred.
@ osErrorResource
resource not available: a specified resource was not available.
@ osOK
function completed; no error or event occurred.
@ osErrorParameter
parameter error: a mandatory parameter was missing or specified an incorrect object.
@ osEventMessage
function completed; message event occurred.
osMessageQId osMessageCreate(const osMessageQDef_t *queue_def, osThreadId thread_id)
Create a message queue.
pid_t wait(int *stat_loc)
int kill(pid_t pid, int sig)
ssize_t send(int socket, const void *buffer, size_t length, int flags)
os_clock_timestamp_t os_clock_now(os_clock_t *clock)
Tell the current time, possibly adjusted for epoch.
os_result_t os_sysclock_wait_for(os_clock_duration_t timeout)
Timed wait for an event.
os_result_t os_clock_sleep_for(os_clock_t *clock, os_clock_duration_t duration)
Sleep for a relative duration.
const char * os_clock_get_name(os_clock_t *clock)
Get the clock name.
os_result_t os_clock_wait_for(os_clock_t *clock, os_clock_duration_t timeout)
Timed wait for an event.
os_clock_timestamp_t os_sysclock_now(void)
Tell the current time since startup.
os_clock_offset_t os_clock_get_offset(os_clock_t *clock)
Get adjustment offset.
os_clock_timestamp_t os_clock_steady_now(os_clock_t *clock)
Tell the current time since startup.
os_clock_t * os_clock_get_sysclock(void)
Get sysclock (the system clock).
os_result_t os_sysclock_sleep_until(os_clock_timestamp_t timestamp)
Sleep until an absolute timestamp.
os_clock_t * os_clock_get_rtclock(void)
Get rtclock (the real-time clock).
os_result_t os_sysclock_sleep_for(os_clock_duration_t duration)
Sleep for a relative duration.
os_clock_t * os_clock_get_hrclock(void)
Get hrclock (the high resolution clock).
os_clock_offset_t os_clock_set_offset(os_clock_t *clock, os_clock_offset_t offset)
Set adjustment offset.
os_result_t os_clock_sleep_until(os_clock_t *clock, os_clock_timestamp_t timestamp)
Sleep until an absolute timestamp.
os_result_t os_condvar_timed_wait(os_condvar_t *condvar, os_mutex_t *mutex, os_clock_duration_t timeout)
Timed wait for a condition variable to be notified.
void os_condvar_delete(os_condvar_t *condvar)
Destruct the condition variable object instance and deallocate it.
os_result_t os_condvar_signal(os_condvar_t *condvar)
Notify one thread waiting for a condition variable.
void os_condvar_construct(os_condvar_t *condvar, const char *name, const os_condvar_attr_t *attr)
Construct a statically allocated condition variable object instance.
void os_condvar_destruct(os_condvar_t *condvar)
Destruct the statically allocated condition variable object instance.
os_result_t os_condvar_wait(os_condvar_t *condvar, os_mutex_t *mutex)
Wait for a condition variable to be notified.
os_condvar_t * os_condvar_new(const char *name, const os_condvar_attr_t *attr)
Allocate a condition variable object instance and construct it.
const char * os_condvar_get_name(os_condvar_t *condvar)
Get the condition variable name.
os_result_t os_condvar_broadcast(os_condvar_t *condvar)
Notify all threads waiting for a condition variable.
void os_condvar_attr_init(os_condvar_attr_t *attr)
Initialise the condition variable attributes.
bool os_irq_in_handler_mode(void)
Check if the CPU is in handler mode.
void os_irq_uncritical_exit(os_irq_state_t state)
Exit the interrupts uncritical section.
bool os_sched_is_locked(void)
Check if the scheduler is locked.
os_irq_state_t os_irq_uncritical_enter(void)
Enter an interrupts uncritical section.
void os_sched_start(void)
Start the RTOS scheduler.
bool os_sched_is_started(void)
Check if the scheduler was started.
os_sched_state_t os_sched_set_locked(os_sched_state_t state)
Lock/unlock the scheduler.
bool os_sched_set_preemptive(bool state)
Set the scheduler preemptive mode.
os_result_t os_sched_initialize(void)
Initialise the RTOS scheduler.
os_statistics_duration_t os_sched_stat_get_cpu_cycles(void)
Get the total duration of all threads.
uint32_t os_flags_mask_t
Type of variables holding flags masks.
uint64_t os_statistics_counter_t
Type of variables holding context switches counters.
os_thread_stack_t * os_irq_get_stack(void)
Get the interrupts stack.
os_sched_state_t os_sched_unlock(void)
Unlock the scheduler.
os_sched_state_t os_sched_lock(void)
Lock the scheduler.
os_port_irq_state_t os_irq_state_t
Type of variables holding interrupts priority values.
void os_irq_critical_exit(os_irq_state_t state)
Exit the interrupts critical section.
uint32_t os_flags_mode_t
Type of variables holding flags modes.
os_statistics_counter_t os_sched_stat_get_context_switches(void)
Get the total number of context switches.
bool os_sched_is_preemptive(void)
Check if the scheduler is in preemptive mode.
os_port_scheduler_state_t os_sched_state_t
Type of variables holding scheduler state codes.
os_port_clock_offset_t os_clock_offset_t
Type of variables holding clock offsets.
void * os_iterator_t
Generic iterator, implemented as a pointer.
uint64_t os_statistics_duration_t
Type of variables holding durations in CPU cycles.
os_irq_state_t os_irq_critical_enter(void)
Enter an interrupts critical section.
os_port_clock_duration_t os_clock_duration_t
Type of variables holding clock durations.
os_port_clock_timestamp_t os_clock_timestamp_t
Type of variables holding clock time stamps.
uint32_t os_result_t
Type of values returned by RTOS functions.
os_result_t os_evflags_try_wait(os_evflags_t *evflags, os_flags_mask_t mask, os_flags_mask_t *oflags, os_flags_mode_t mode)
Try to wait for event flags.
os_result_t os_evflags_clear(os_evflags_t *evflags, os_flags_mask_t mask, os_flags_mask_t *oflags)
Clear event flags.
os_result_t os_evflags_wait(os_evflags_t *evflags, os_flags_mask_t mask, os_flags_mask_t *oflags, os_flags_mode_t mode)
Wait for event flags.
const char * os_evflags_get_name(os_evflags_t *evflags)
Get the event flags name.
bool os_evflags_are_waiting(os_evflags_t *evflags)
Check if there are threads waiting.
os_result_t os_evflags_raise(os_evflags_t *evflags, os_flags_mask_t mask, os_flags_mask_t *oflags)
Raise event flags.
void os_evflags_attr_init(os_evflags_attr_t *attr)
Initialise the event flags attributes.
os_flags_mask_t os_evflags_get(os_evflags_t *evflags, os_flags_mask_t mask, os_flags_mode_t mode)
Get (and possibly clear) event flags.
void os_evflags_delete(os_evflags_t *evflags)
Destruct the event flags object instance and deallocate it.
os_result_t os_evflags_timed_wait(os_evflags_t *evflags, os_flags_mask_t mask, os_clock_duration_t timeout, os_flags_mask_t *oflags, os_flags_mode_t mode)
Timed wait for event flags.
void os_evflags_destruct(os_evflags_t *evflags)
Destruct the statically allocated event flags object instance.
os_evflags_t * os_evflags_new(const char *name, const os_evflags_attr_t *attr)
Allocate an event flags object instance and construct it.
void os_evflags_construct(os_evflags_t *evflags, const char *name, const os_evflags_attr_t *attr)
Construct a statically allocated event flags object instance.
os_result_t os_mempool_free(os_mempool_t *mempool, void *block)
Free the memory block.
void os_mempool_construct(os_mempool_t *mempool, const char *name, size_t blocks, size_t block_size_bytes, const os_mempool_attr_t *attr)
Construct a statically allocated memory pool object instance.
void * os_mempool_get_pool(os_mempool_t *mempool)
Get the pool storage address.
void * os_mempool_alloc(os_mempool_t *mempool)
Allocate a memory block.
const char * os_mempool_get_name(os_mempool_t *mempool)
Get the memory pool name.
bool os_mempool_is_empty(os_mempool_t *mempool)
Check if the memory pool is empty.
void * os_mempool_timed_alloc(os_mempool_t *mempool, os_clock_duration_t timeout)
Allocate a memory block with timeout.
void os_mempool_attr_init(os_mempool_attr_t *attr)
Initialise the memory pool attributes.
void * os_mempool_try_alloc(os_mempool_t *mempool)
Try to allocate a memory block.
os_mempool_t * os_mempool_new(const char *name, size_t blocks, size_t block_size_bytes, const os_mempool_attr_t *attr)
Allocate a memory pool object instance and construct it.
os_result_t os_mempool_reset(os_mempool_t *mempool)
Reset the memory pool.
size_t os_mempool_get_count(os_mempool_t *mempool)
Get blocks count.
void os_mempool_delete(os_mempool_t *mempool)
Destruct the memory pool object instance and deallocate it.
void os_mempool_destruct(os_mempool_t *mempool)
Destruct the statically allocated memory pool object instance.
size_t os_mempool_get_block_size(os_mempool_t *mempool)
Get block size.
size_t os_mempool_get_capacity(os_mempool_t *mempool)
Get memory pool capacity.
bool os_mempool_is_full(os_mempool_t *mempool)
Check if the memory pool is full.
os_memory_t * os_memory_get_default(void)
Get the application default memory resource (free store).
size_t os_memory_get_free_bytes(os_memory_t *memory)
Get the total size of free chunks.
void os_memory_reset(os_memory_t *memory)
Reset the memory manager to the initial state.
size_t os_memory_get_allocated_bytes(os_memory_t *memory)
Get the total size of allocated chunks.
bool os_memory_coalesce(os_memory_t *memory)
Coalesce free blocks.
void * os_memory_allocate(os_memory_t *memory, size_t bytes, size_t alignment)
Allocate a block of memory.
size_t os_memory_get_total_bytes(os_memory_t *memory)
Get the total size of managed memory.
size_t os_memory_get_free_chunks(os_memory_t *memory)
Get the number of free chunks.
size_t os_memory_get_allocated_chunks(os_memory_t *memory)
Get the number of allocated chunks.
void free(void *ptr)
Free the allocated memory block.
void os_memory_deallocate(os_memory_t *memory, void *addr, size_t bytes, size_t alignment)
Deallocate the previously allocated block of memory.
bool os_mqueue_is_full(os_mqueue_t *mqueue)
Check if the queue is full.
os_result_t os_mqueue_reset(os_mqueue_t *mqueue)
Reset the message queue.
os_result_t os_mqueue_timed_send(os_mqueue_t *mqueue, const void *msg, size_t nbytes, os_clock_duration_t timeout, os_mqueue_prio_t mprio)
Send a message to the queue with timeout.
os_result_t os_mqueue_receive(os_mqueue_t *mqueue, void *msg, size_t nbytes, os_mqueue_prio_t *mprio)
Receive a message from the queue.
os_result_t os_mqueue_try_receive(os_mqueue_t *mqueue, void *msg, size_t nbytes, os_mqueue_prio_t *mprio)
Try to receive a message from the queue.
void os_mqueue_delete(os_mqueue_t *mqueue)
Destruct the message queue object instance and deallocate it.
size_t os_mqueue_get_msg_size(os_mqueue_t *mqueue)
Get message size.
bool os_mqueue_is_empty(os_mqueue_t *mqueue)
Check if the queue is empty.
const char * os_mqueue_get_name(os_mqueue_t *mqueue)
Get the message queue name.
os_result_t os_mqueue_send(os_mqueue_t *mqueue, const void *msg, size_t nbytes, os_mqueue_prio_t mprio)
Send a message to the queue.
void os_mqueue_destruct(os_mqueue_t *mqueue)
Destruct the statically allocated message queue object instance.
size_t os_mqueue_get_capacity(os_mqueue_t *mqueue)
Get queue capacity.
os_mqueue_t * os_mqueue_new(const char *name, size_t msgs, size_t msg_size_bytes, const os_mqueue_attr_t *attr)
Allocate a message queue object instance and construct it.
size_t os_mqueue_get_length(os_mqueue_t *mqueue)
Get queue length.
void os_mqueue_attr_init(os_mqueue_attr_t *attr)
Initialise the message queue attributes.
void os_mqueue_construct(os_mqueue_t *mqueue, const char *name, size_t msgs, size_t msg_size_bytes, const os_mqueue_attr_t *attr)
Construct a statically allocated message queue object instance.
os_result_t os_mqueue_try_send(os_mqueue_t *mqueue, const void *msg, size_t nbytes, os_mqueue_prio_t mprio)
Try to send a message to the queue.
os_result_t os_mqueue_timed_receive(os_mqueue_t *mqueue, void *msg, size_t nbytes, os_clock_duration_t timeout, os_mqueue_prio_t *mprio)
Receive a message from the queue with timeout.
uint8_t os_mqueue_prio_t
Type of variables holding message queue priorities.
const char * os_mutex_get_name(os_mutex_t *mutex)
Get the mutex name.
void os_mutex_recursive_construct(os_mutex_t *mutex, const char *name, const os_mutex_attr_t *attr)
Construct a statically allocated recursive mutex object instance.
void os_mutex_attr_recursive_init(os_mutex_attr_t *attr)
Initialise the recursive mutex attributes.
os_mutex_type_t os_mutex_get_type(os_mutex_t *mutex)
Get the mutex type.
os_thread_prio_t os_mutex_get_prio_ceiling(os_mutex_t *mutex)
Get the priority ceiling of a mutex.
void os_mutex_destruct(os_mutex_t *mutex)
Destruct the statically allocated mutex object instance.
os_result_t os_mutex_set_prio_ceiling(os_mutex_t *mutex, os_thread_prio_t prio_ceiling, os_thread_prio_t *old_prio_ceiling)
Change the priority ceiling of a mutex.
void os_mutex_attr_init(os_mutex_attr_t *attr)
Initialise the mutex attributes.
os_result_t os_mutex_timed_lock(os_mutex_t *mutex, os_clock_duration_t timeout)
Timed attempt to lock/acquire the mutex.
os_result_t os_mutex_try_lock(os_mutex_t *mutex)
Try to lock/acquire the mutex.
os_mutex_protocol_t os_mutex_get_protocol(os_mutex_t *mutex)
Get the mutex protocol.
void os_mutex_delete(os_mutex_t *mutex)
Destruct the mutex object instance and deallocate it.
os_result_t os_mutex_unlock(os_mutex_t *mutex)
Unlock/release the mutex.
os_thread_t * os_mutex_get_owner(os_mutex_t *mutex)
Get the thread that owns the mutex.
os_mutex_t * os_mutex_recursive_new(const char *name, const os_mutex_attr_t *attr)
Allocated a recursive mutex object instance and construct it.
os_result_t os_mutex_mark_consistent(os_mutex_t *mutex)
Mark mutex as consistent.
os_result_t os_mutex_lock(os_mutex_t *mutex)
Lock/acquire the mutex.
os_mutex_robustness_t os_mutex_get_robustness(os_mutex_t *mutex)
Get the mutex robustness.
os_result_t os_mutex_reset(os_mutex_t *mutex)
Reset the mutex.
const os_mutex_attr_t * os_mutex_attr_get_recursive(void)
Get a recursive mutex attributes object instance.
os_mutex_t * os_mutex_new(const char *name, const os_mutex_attr_t *attr)
Allocate a mutex object instance and construct it.
void os_mutex_construct(os_mutex_t *mutex, const char *name, const os_mutex_attr_t *attr)
Construct a statically allocated mutex object instance.
@ os_mutex_protocol_inherit
Inherit priority from highest priority thread.
@ os_mutex_protocol_protect
Execute at the highest priority.
@ os_mutex_protocol_none
Priority and scheduling not affected by mutex ownership.
@ os_mutex_type_recursive
Recursive mutex behaviour.
@ os_mutex_type_errorcheck
Check mutex behaviour.
@ os_mutex_type_default
Default mutex type.
@ os_mutex_type_normal
Normal mutex behaviour.
@ os_mutex_robustness_robust
Enhanced robustness at thread termination.
@ os_mutex_robustness_stalled
Normal robustness.
os_semaphore_t * os_semaphore_counting_new(const char *name, const os_semaphore_count_t max_value, const os_semaphore_count_t initial_value)
Allocate a counting semaphore object instance and construct it.
os_result_t os_semaphore_timed_wait(os_semaphore_t *semaphore, os_clock_duration_t timeout)
Timed wait to lock the semaphore.
os_semaphore_t * os_semaphore_binary_new(const char *name, const os_semaphore_count_t initial_value)
Allocate a binary semaphore object instance and construct it.
os_semaphore_count_t os_semaphore_get_initial_value(os_semaphore_t *semaphore)
Get the semaphore initial count value.
const os_semaphore_attr_t * os_semaphore_attr_get_binary(void)
Get a binary semaphore attributes object instance.
const char * os_semaphore_get_name(os_semaphore_t *semaphore)
Get the semaphore name.
void os_semaphore_attr_binary_init(os_semaphore_attr_t *attr, const os_semaphore_count_t initial_value)
Initialise the binary semaphore attributes.
void os_semaphore_attr_counting_init(os_semaphore_attr_t *attr, const os_semaphore_count_t max_value, const os_semaphore_count_t initial_value)
Initialise the counting semaphore attributes.
os_result_t os_semaphore_post(os_semaphore_t *semaphore)
Post (unlock) the semaphore.
os_result_t os_semaphore_wait(os_semaphore_t *semaphore)
Lock the semaphore, possibly waiting.
os_semaphore_count_t os_semaphore_get_value(os_semaphore_t *semaphore)
Get the semaphore count value.
void os_semaphore_destruct(os_semaphore_t *semaphore)
Destruct the statically allocated semaphore object instance.
void os_semaphore_binary_construct(os_semaphore_t *semaphore, const char *name, const os_semaphore_count_t initial_value)
Construct a statically allocated binary semaphore object instance.
os_semaphore_count_t os_semaphore_get_max_value(os_semaphore_t *semaphore)
Get the semaphore maximum count value.
void os_semaphore_counting_construct(os_semaphore_t *semaphore, const char *name, const os_semaphore_count_t max_value, const os_semaphore_count_t initial_value)
Construct a statically allocated counting semaphore object instance.
void os_semaphore_delete(os_semaphore_t *semaphore)
Destruct the semaphore object instance.
os_result_t os_semaphore_reset(os_semaphore_t *semaphore)
Reset the semaphore.
os_semaphore_t * os_semaphore_new(const char *name, const os_semaphore_attr_t *attr)
Allocated a semaphore object instance and construct it.
void os_semaphore_attr_init(os_semaphore_attr_t *attr)
Initialise the counting semaphore attributes.
void os_semaphore_construct(os_semaphore_t *semaphore, const char *name, const os_semaphore_attr_t *attr)
Construct a statically allocated semaphore object instance.
int16_t os_semaphore_count_t
Type of variables holding semaphore counts.
os_result_t os_semaphore_try_wait(os_semaphore_t *semaphore)
Try to lock the semaphore.
void os_thread_attr_init(os_thread_attr_t *attr)
Initialise the thread attributes.
struct os_thread_context_s os_thread_context_t
Thread context.
os_result_t os_this_thread_flags_timed_wait(os_flags_mask_t mask, os_clock_duration_t timeout, os_flags_mask_t *oflags, os_flags_mode_t mode)
Timed wait for thread event flags.
os_iterator_t os_children_threads_iter_next(os_iterator_t iterator)
Advance the iterator to the next position.
os_thread_user_storage_t * os_thread_get_user_storage(os_thread_t *thread)
Get the thread user storage.
bool os_thread_is_constructed(os_thread_t *thread)
Check if the thread is constructed.
os_flags_mask_t os_this_thread_flags_get(os_flags_mask_t mask, os_flags_mode_t mode)
Get/clear thread event flags.
const char * os_thread_get_name(os_thread_t *thread)
Get the thread name.
os_result_t os_this_thread_flags_wait(os_flags_mask_t mask, os_flags_mask_t *oflags, os_flags_mode_t mode)
Wait for thread event flags.
void *(* os_thread_func_t)(os_thread_func_args_t args)
Type of thread function.
uint8_t os_thread_prio_t
Type of variables holding thread priorities.
os_thread_stack_element_t * os_thread_stack_get_bottom(os_thread_stack_t *stack)
Get the stack lowest reserved address.
struct os_thread_statistics_s os_thread_statistics_t
Thread statistics.
struct os_thread_stack_s os_thread_stack_t
Thread stack.
size_t os_thread_stack_set_default_size(size_t size_bytes)
Set the default stack size.
void os_thread_construct(os_thread_t *thread, const char *name, os_thread_func_t func, const os_thread_func_args_t args, const os_thread_attr_t *attr)
Construct a statically allocated thread object instance.
void os_this_thread_suspend(void)
Suspend the current running thread to wait for an event.
os_statistics_counter_t os_thread_stat_get_context_switches(os_thread_t *thread)
Get the number of thread context switches.
void os_thread_resume(os_thread_t *thread)
Resume the thread.
void os_thread_delete(os_thread_t *thread)
Destruct the thread object instance and deallocate it.
os_result_t os_this_thread_flags_clear(os_flags_mask_t mask, os_flags_mask_t *oflags)
Clear thread event flags.
bool os_thread_stack_check_top_magic(os_thread_stack_t *stack)
Check if top magic word is still there.
os_result_t os_thread_join(os_thread_t *thread, void **exit_ptr)
Wait for thread termination.
os_thread_stack_element_t * os_thread_stack_get_top(os_thread_stack_t *stack)
Get the top stack address.
os_thread_state_t os_thread_get_state(os_thread_t *thread)
Get the thread scheduler state.
os_iterator_t os_children_threads_iter_begin(os_thread_t *thread)
Get the beginning of the list of children threads.
bool os_thread_stack_check_bottom_magic(os_thread_stack_t *stack)
Check if bottom magic word is still there.
os_port_thread_stack_element_t os_thread_stack_element_t
Type of variables holding stack words.
os_thread_prio_t os_thread_get_priority(os_thread_t *thread)
Get the thread current scheduling priority.
void * os_thread_func_args_t
Type of thread function arguments.
os_thread_t * os_this_thread(void)
Get the current running thread.
os_thread_stack_t * os_thread_get_stack(os_thread_t *thread)
Get the thread context stack.
os_result_t os_thread_kill(os_thread_t *thread)
Force thread termination.
os_thread_t * os_thread_new(const char *name, os_thread_func_t func, const os_thread_func_args_t args, const os_thread_attr_t *attr)
Allocate a thread object instance and construct it.
os_thread_t * os_children_threads_iter_get(os_iterator_t iterator)
Get the thread from the current iterator position.
size_t os_thread_stack_get_size(os_thread_stack_t *stack)
Get the stack size.
size_t os_thread_stack_get_min_size(void)
Get the min stack size.
size_t os_thread_stack_get_available(os_thread_stack_t *stack)
Compute how much available stack remains.
os_statistics_duration_t os_thread_stat_get_cpu_cycles(os_thread_t *thread)
Get the thread execution time.
os_result_t os_thread_set_priority(os_thread_t *thread, os_thread_prio_t prio)
Set the thread dynamic scheduling priority.
void os_this_thread_exit(void *exit_ptr)
Terminate the current running thread.
os_result_t os_this_thread_flags_try_wait(os_flags_mask_t mask, os_flags_mask_t *oflags, os_flags_mode_t mode)
Try to wait for thread event flags.
uint8_t os_thread_state_t
Type of variables holding thread states.
size_t os_thread_stack_get_default_size(void)
Get the default stack size.
size_t os_thread_stack_set_min_size(size_t size_bytes)
Set the min stack size.
os_iterator_t os_children_threads_iter_end(os_thread_t *thread)
Get the end of the list of children threads.
os_result_t os_thread_flags_raise(os_thread_t *thread, os_flags_mask_t mask, os_flags_mask_t *oflags)
Raise thread event flags.
void os_thread_destruct(os_thread_t *thread)
Destruct the statically allocated thread object instance.
@ os_thread_state_terminated
No longer usable, but resources not yet released.
@ os_thread_state_suspended
Not present in the READY list, waiting for an event.
@ os_thread_state_undefined
Used to catch uninitialised threads.
@ os_thread_state_ready
Present in the READY list and competing for CPU.
@ os_thread_state_initialising
Used to check reused threads.
@ os_thread_state_destroyed
Terminated and resources (like stack) released.
@ os_thread_state_running
Has the CPU and runs.
@ os_thread_priority_error
@ os_thread_priority_below_normal
@ os_thread_priority_high
@ os_thread_priority_realtime
@ os_thread_priority_idle
@ os_thread_priority_normal
@ os_thread_priority_above_normal
uint8_t os_timer_type_t
Type of variables holding timer types.
void(* os_timer_func_t)(os_timer_func_args_t args)
Type of timer function.
void * os_timer_func_args_t
Type of timer function arguments.
const char * os_timer_get_name(os_timer_t *timer)
Get the timer name.
os_result_t os_timer_stop(os_timer_t *timer)
Stop the timer.
void os_timer_destruct(os_timer_t *timer)
Destruct the statically allocated timer object instance.
uint8_t os_timer_state_t
Type of variables holding timer states.
void os_timer_attr_init(os_timer_attr_t *attr)
Initialise the single shot timer attributes.
os_timer_t * os_timer_new(const char *name, os_timer_func_t function, os_timer_func_args_t args, const os_timer_attr_t *attr)
Allocate a timer object instance and construct it.
os_result_t os_timer_start(os_timer_t *timer, os_clock_duration_t period)
Start or restart the timer.
void os_timer_attr_periodic_init(os_timer_attr_t *attr)
Initialise the periodic timer attributes.
void os_timer_construct(os_timer_t *timer, const char *name, os_timer_func_t function, os_timer_func_args_t args, const os_timer_attr_t *attr)
Construct a statically allocated timer object instance.
void os_timer_delete(os_timer_t *timer)
Destruct the timer object instance and deallocate it.
const os_timer_attr_t * os_timer_attr_get_periodic(void)
Get a periodic timer attributes object instance.
port::clock::duration_t duration_t
Type of variables holding clock durations.
clock_highres hrclock
The high resolution clock object instance.
clock_rtc rtclock
The real time clock object instance.
port::clock::timestamp_t timestamp_t
Type of variables holding clock time stamps.
clock_systick sysclock
The system clock object instance.
port::clock::offset_t offset_t
Type of variables holding clock offsets.
static const attributes initializer
Default condition variable initialiser.
class thread::stack * stack(void)
Get the interrupts stack.
static const attributes initializer
Default event flags initialiser.
uint16_t size_t
Type of memory pool size storage.
static const attributes initializer
Default memory pool initialiser.
memory_resource * get_default_resource(void) noexcept
Get the default RTOS system memory manager.
uint8_t priority_t
Type of message priority storage.
message_queue::size_t index_t
Type of list index storage.
static const attributes initializer
Default message queue initialiser.
uint8_t size_t
Type of a queue size storage.
uint16_t msg_size_t
Type of message size storage.
uint8_t type_t
Type of variables holding mutex behaviours.
uint16_t count_t
Type of variables holding mutex recursion counters.
static const attributes_recursive initializer_recursive
Default recursive mutex initialiser.
uint8_t protocol_t
Type of variables holding mutex protocols.
uint8_t robustness_t
Type of variables holding mutex robustness.
static const attributes initializer_normal
Default normal mutex initialiser.
static const attributes_binary initializer_binary
Default binary semaphore initialiser.
int16_t count_t
Type of semaphore counter storage.
uint8_t priority_t
Type of variables holding thread priorities.
void * func_args_t
Timer call back function arguments.
void(*)(func_args_t args) func_t
Entry point of a timer call back function.
uint8_t type_t
Type of of variables holding timer run types.
uint8_t state_t
Type of of variables holding timer states.
static const attributes_periodic periodic_initializer
Default periodic timer initialiser.
@ all
Return when all flags are set.
@ clear
Ask for flags to be cleared after read.
@ any
Return when at least one flag is set.
uint32_t mode_t
Type of variables holding flags modes.
uint32_t mask_t
Type of variables holding flags masks.
port::interrupts::state_t state_t
Type of variables holding interrupts statu codes.
bool in_handler_mode(void)
Check if the CPU is in handler mode.
@ ok
Function completed; no errors or events occurred.
rtos::statistics::duration_t cpu_cycles(void)
Get the total duration of all threads.
rtos::statistics::counter_t context_switches(void)
Get the total number of context switches.
port::scheduler::state_t state_t
Type of variables holding scheduler state codes.
state_t unlock(void)
Unlock the scheduler.
void start(void)
Start the RTOS scheduler.
bool started(void)
Check if the scheduler was started.
thread::threads_list & children_threads(thread *th)
Get the children threads.
state_t lock(void)
Lock the scheduler.
result_t initialize(void)
Initialise the RTOS scheduler.
bool preemptive(void)
Check if the scheduler is in preemptive mode.
bool locked(void)
Check if the scheduler is locked.
uint64_t duration_t
Type of variables holding durations in CPU cycles.
uint64_t counter_t
Type of variables holding context switches counters.
uint32_t result_t
Type of values returned by RTOS functions.
void yield() noexcept
Yield the CPU to the next ready thread.
os_mqueue_size_t os_mqueue_index_t
uint8_t os_mutex_protocol_t
uint8_t os_mutex_robustness_t
uint16_t os_mempool_size_t
uint16_t os_mqueue_msg_size_t
osStatus osMutexRelease(osMutexId mutex_id)
Release the mutex.
osStatus osDelay(uint32_t millisec)
Time Delay.
osStatus osThreadSetPriority(osThreadId thread_id, osPriority priority)
Change thread priority.
osTimerId osTimerCreate(const osTimerDef_t *timer_def, os_timer_type type, void *args)
Create a timer.
osStatus osTimerStart(osTimerId timer_id, uint32_t millisec)
Start the timer.
osEvent osSignalWait(int32_t signals, uint32_t millisec)
Wait for one or more Signal Flags to become signaled for the current RUNNING thread.
int32_t osKernelRunning(void)
Check if the RTOS scheduler is started.
int32_t osSignalSet(osThreadId thread_id, int32_t signals)
Set signal flags.
osPriority osThreadGetPriority(osThreadId thread_id)
Get thread priority.
osStatus osKernelInitialize(void)
Initialize the RTOS.
osStatus osTimerStop(osTimerId timer_id)
Stop the timer.
osMutexId osMutexCreate(const osMutexDef_t *mutex_def)
Create a mutex.
osStatus osMutexWait(osMutexId mutex_id, uint32_t millisec)
Wait for mutex.
osStatus osTimerDelete(osTimerId timer_id)
Delete the timer.
int32_t osSignalClear(osThreadId thread_id, int32_t signals)
Clear the specified Signal Flags of an active thread.
osThreadId osThreadCreate(const osThreadDef_t *thread_def, void *args)
Create a thread.
osStatus osKernelStart(void)
osThreadId osThreadGetId(void)
Get the current thread.
osStatus osMutexDelete(osMutexId mutex_id)
Delete the mutex.
osStatus osThreadTerminate(osThreadId thread_id)
Terminate a thread.
osStatus osThreadYield(void)
Yield control.
Single file µOS++ RTOS definitions.
Event structure contains detailed information about an event.
osStatus status
status code: event or error information
int32_t signals
signal flags
union osEvent::@0 value
event value
@ none
Priority and scheduling not affected by mutex ownership.
@ inherit
Inherit priority from highest priority thread.
@ protect
Execute at the highest priority.
@ stalled
Normal robustness.
@ robust
Enhanced robustness at thread termination.
@ normal
Normal mutex behaviour.
@ errorcheck
Check mutex behaviour.
@ recursive
Recursive mutex behaviour.
@ running
Has the CPU and runs.
@ destroyed
Terminated and resources (like stack) released.
@ initializing
Used to check reused threads.
@ terminated
No longer usable, but resources not yet released.
@ ready
Present in the READY list and competing for CPU.
@ undefined
Used to catch uninitialised threads.
@ suspended
Not present in the READY list, waiting for an event.
@ periodic
Run periodically.
Condition variable attributes.
Condition variable object storage.
Event flags object storage.
Definition structure for mail queue.
uint32_t items
number of elements in the queue
void * queue
pointer to memory array for queue
uint32_t queue_item_sz
size of a queue item
uint32_t pool_item_sz
size of a pool item
void * pool
pointer to memory array for pool
Memory resource object storage.
Memory pool object storage.
Definition structure for message queue.
void * queue
pointer to memory array for messages
uint32_t items
number of elements in the queue
uint32_t item_sz
size of an item
Message queue attributes.
Message queue object storage.
Mutex definition structure contains setup information for a mutex.
Definition structure for memory block allocation.
uint32_t item_sz
size of an item
void * pool
pointer to memory for pool
uint32_t items
number of items (elements) in the pool
Semaphore definition structure contains setup information for a semaphore.
Semaphore object storage.
Thread definition structure contains startup information of a thread.
os_pthread pthread
start address of thread function
osPriority tpriority
initial thread priority
uint32_t stacksize
stack size requirements in bytes; 0 is default stack size
uint32_t instances
maximum number of instances of that thread function
Timer definition structure contains timer parameters.
os_ptimer ptimer
start address of a timer function