µOS++ IIIe Reference 7.0.0
The third edition of µOS++, a POSIX inspired open source framework, written in C++
Loading...
Searching...
No Matches
os-c-wrapper.cpp File Reference

Go to the source code of this file.

Functions

os_iterator_t os_children_threads_iter_begin (os_thread_t *thread)
 Get the beginning of the list of children threads.
 
os_iterator_t os_children_threads_iter_end (os_thread_t *thread)
 Get the end of the list of children threads.
 
os_thread_tos_children_threads_iter_get (os_iterator_t iterator)
 Get the thread from the current iterator position.
 
os_iterator_t os_children_threads_iter_next (os_iterator_t iterator)
 Advance the iterator to the next position.
 
os_clock_tos_clock_get_hrclock (void)
 Get hrclock (the high resolution clock).
 
const char * os_clock_get_name (os_clock_t *clock)
 Get the clock name.
 
os_clock_offset_t os_clock_get_offset (os_clock_t *clock)
 Get adjustment offset.
 
os_clock_tos_clock_get_rtclock (void)
 Get rtclock (the real-time clock).
 
os_clock_tos_clock_get_sysclock (void)
 Get sysclock (the system clock).
 
os_clock_timestamp_t os_clock_now (os_clock_t *clock)
 Tell the current time, possibly adjusted for epoch.
 
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_for (os_clock_t *clock, os_clock_duration_t duration)
 Sleep for a relative duration.
 
os_result_t os_clock_sleep_until (os_clock_t *clock, os_clock_timestamp_t timestamp)
 Sleep until an absolute timestamp.
 
os_clock_timestamp_t os_clock_steady_now (os_clock_t *clock)
 Tell the current time since startup.
 
os_result_t os_clock_wait_for (os_clock_t *clock, os_clock_duration_t timeout)
 Timed wait for an event.
 
void os_condvar_attr_init (os_condvar_attr_t *attr)
 Initialise the condition variable attributes.
 
os_result_t os_condvar_broadcast (os_condvar_t *condvar)
 Notify all threads 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_delete (os_condvar_t *condvar)
 Destruct the condition variable object instance and deallocate it.
 
void os_condvar_destruct (os_condvar_t *condvar)
 Destruct the statically allocated condition variable object instance.
 
const char * os_condvar_get_name (os_condvar_t *condvar)
 Get the condition variable name.
 
os_condvar_tos_condvar_new (const char *name, const os_condvar_attr_t *attr)
 Allocate a condition variable object instance and construct it.
 
os_result_t os_condvar_signal (os_condvar_t *condvar)
 Notify one thread waiting for a condition variable.
 
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.
 
os_result_t os_condvar_wait (os_condvar_t *condvar, os_mutex_t *mutex)
 Wait for a condition variable to be notified.
 
bool os_evflags_are_waiting (os_evflags_t *evflags)
 Check if there are threads waiting.
 
void os_evflags_attr_init (os_evflags_attr_t *attr)
 Initialise the event flags attributes.
 
os_result_t os_evflags_clear (os_evflags_t *evflags, os_flags_mask_t mask, os_flags_mask_t *oflags)
 Clear event flags.
 
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.
 
void os_evflags_delete (os_evflags_t *evflags)
 Destruct the event flags object instance and deallocate it.
 
void os_evflags_destruct (os_evflags_t *evflags)
 Destruct the statically allocated event flags object instance.
 
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.
 
const char * os_evflags_get_name (os_evflags_t *evflags)
 Get the event flags name.
 
os_evflags_tos_evflags_new (const char *name, const os_evflags_attr_t *attr)
 Allocate an event flags object instance and construct it.
 
os_result_t os_evflags_raise (os_evflags_t *evflags, os_flags_mask_t mask, os_flags_mask_t *oflags)
 Raise event flags.
 
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.
 
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_wait (os_evflags_t *evflags, os_flags_mask_t mask, os_flags_mask_t *oflags, os_flags_mode_t mode)
 Wait for event flags.
 
os_irq_state_t os_irq_critical_enter (void)
 Enter an interrupts critical section.
 
void os_irq_critical_exit (os_irq_state_t state)
 Exit the interrupts critical section.
 
os_thread_stack_tos_irq_get_stack (void)
 Get the interrupts stack.
 
bool os_irq_in_handler_mode (void)
 Check if the CPU is in handler mode.
 
os_irq_state_t os_irq_uncritical_enter (void)
 Enter an interrupts uncritical section.
 
void os_irq_uncritical_exit (os_irq_state_t state)
 Exit the interrupts uncritical section.
 
void * os_memory_allocate (os_memory_t *memory, size_t bytes, size_t alignment)
 Allocate a block of memory.
 
bool os_memory_coalesce (os_memory_t *memory)
 Coalesce free blocks.
 
void os_memory_deallocate (os_memory_t *memory, void *addr, size_t bytes, size_t alignment)
 Deallocate the previously allocated block of memory.
 
size_t os_memory_get_allocated_bytes (os_memory_t *memory)
 Get the total size of allocated chunks.
 
size_t os_memory_get_allocated_chunks (os_memory_t *memory)
 Get the number of allocated chunks.
 
os_memory_tos_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.
 
size_t os_memory_get_free_chunks (os_memory_t *memory)
 Get the number of free chunks.
 
size_t os_memory_get_total_bytes (os_memory_t *memory)
 Get the total size of managed memory.
 
void os_memory_reset (os_memory_t *memory)
 Reset the memory manager to the initial state.
 
void * os_mempool_alloc (os_mempool_t *mempool)
 Allocate a memory block.
 
void os_mempool_attr_init (os_mempool_attr_t *attr)
 Initialise the memory pool attributes.
 
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_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.
 
os_result_t os_mempool_free (os_mempool_t *mempool, void *block)
 Free the memory block.
 
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.
 
size_t os_mempool_get_count (os_mempool_t *mempool)
 Get blocks count.
 
const char * os_mempool_get_name (os_mempool_t *mempool)
 Get the memory pool name.
 
void * os_mempool_get_pool (os_mempool_t *mempool)
 Get the pool storage address.
 
bool os_mempool_is_empty (os_mempool_t *mempool)
 Check if the memory pool is empty.
 
bool os_mempool_is_full (os_mempool_t *mempool)
 Check if the memory pool is full.
 
os_mempool_tos_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.
 
void * os_mempool_timed_alloc (os_mempool_t *mempool, os_clock_duration_t timeout)
 Allocate a memory block with timeout.
 
void * os_mempool_try_alloc (os_mempool_t *mempool)
 Try to allocate a memory block.
 
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.
 
void os_mqueue_delete (os_mqueue_t *mqueue)
 Destruct the message queue object instance and deallocate it.
 
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.
 
size_t os_mqueue_get_length (os_mqueue_t *mqueue)
 Get queue length.
 
size_t os_mqueue_get_msg_size (os_mqueue_t *mqueue)
 Get message size.
 
const char * os_mqueue_get_name (os_mqueue_t *mqueue)
 Get the message queue name.
 
bool os_mqueue_is_empty (os_mqueue_t *mqueue)
 Check if the queue is empty.
 
bool os_mqueue_is_full (os_mqueue_t *mqueue)
 Check if the queue is full.
 
os_mqueue_tos_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.
 
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_reset (os_mqueue_t *mqueue)
 Reset the message queue.
 
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.
 
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.
 
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_try_receive (os_mqueue_t *mqueue, void *msg, size_t nbytes, os_mqueue_prio_t *mprio)
 Try to receive a message from the queue.
 
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.
 
const os_mutex_attr_tos_mutex_attr_get_recursive (void)
 Get a recursive mutex attributes object instance.
 
void os_mutex_attr_init (os_mutex_attr_t *attr)
 Initialise the mutex attributes.
 
void os_mutex_attr_recursive_init (os_mutex_attr_t *attr)
 Initialise the recursive mutex attributes.
 
void os_mutex_construct (os_mutex_t *mutex, const char *name, const os_mutex_attr_t *attr)
 Construct a statically allocated mutex object instance.
 
void os_mutex_delete (os_mutex_t *mutex)
 Destruct the mutex object instance and deallocate it.
 
void os_mutex_destruct (os_mutex_t *mutex)
 Destruct the statically allocated mutex object instance.
 
const char * os_mutex_get_name (os_mutex_t *mutex)
 Get the mutex name.
 
os_thread_tos_mutex_get_owner (os_mutex_t *mutex)
 Get the thread that owns the mutex.
 
os_thread_prio_t os_mutex_get_prio_ceiling (os_mutex_t *mutex)
 Get the priority ceiling of a mutex.
 
os_mutex_protocol_t os_mutex_get_protocol (os_mutex_t *mutex)
 Get the mutex protocol.
 
os_mutex_robustness_t os_mutex_get_robustness (os_mutex_t *mutex)
 Get the mutex robustness.
 
os_mutex_type_t os_mutex_get_type (os_mutex_t *mutex)
 Get the mutex type.
 
os_result_t os_mutex_lock (os_mutex_t *mutex)
 Lock/acquire the mutex.
 
os_result_t os_mutex_mark_consistent (os_mutex_t *mutex)
 Mark mutex as consistent.
 
os_mutex_tos_mutex_new (const char *name, const os_mutex_attr_t *attr)
 Allocate a mutex object instance and construct it.
 
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.
 
os_mutex_tos_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_reset (os_mutex_t *mutex)
 Reset the mutex.
 
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.
 
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_result_t os_mutex_unlock (os_mutex_t *mutex)
 Unlock/release the mutex.
 
os_result_t os_sched_initialize (void)
 Initialise the RTOS scheduler.
 
bool os_sched_is_locked (void)
 Check if the scheduler is locked.
 
bool os_sched_is_preemptive (void)
 Check if the scheduler is in preemptive mode.
 
bool os_sched_is_started (void)
 Check if the scheduler was started.
 
os_sched_state_t os_sched_lock (void)
 Lock the scheduler.
 
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.
 
void os_sched_start (void)
 Start the RTOS scheduler.
 
os_statistics_counter_t os_sched_stat_get_context_switches (void)
 Get the total number of context switches.
 
os_statistics_duration_t os_sched_stat_get_cpu_cycles (void)
 Get the total duration of all threads.
 
os_sched_state_t os_sched_unlock (void)
 Unlock the scheduler.
 
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.
 
const os_semaphore_attr_tos_semaphore_attr_get_binary (void)
 Get a binary semaphore attributes object instance.
 
void os_semaphore_attr_init (os_semaphore_attr_t *attr)
 Initialise the counting semaphore attributes.
 
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_tos_semaphore_binary_new (const char *name, const os_semaphore_count_t initial_value)
 Allocate a binary semaphore object instance and construct it.
 
void os_semaphore_construct (os_semaphore_t *semaphore, const char *name, const os_semaphore_attr_t *attr)
 Construct a statically allocated semaphore object instance.
 
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.
 
os_semaphore_tos_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.
 
void os_semaphore_delete (os_semaphore_t *semaphore)
 Destruct the semaphore object instance.
 
void os_semaphore_destruct (os_semaphore_t *semaphore)
 Destruct the statically allocated semaphore object instance.
 
os_semaphore_count_t os_semaphore_get_initial_value (os_semaphore_t *semaphore)
 Get the semaphore initial count value.
 
os_semaphore_count_t os_semaphore_get_max_value (os_semaphore_t *semaphore)
 Get the semaphore maximum count value.
 
const char * os_semaphore_get_name (os_semaphore_t *semaphore)
 Get the semaphore name.
 
os_semaphore_count_t os_semaphore_get_value (os_semaphore_t *semaphore)
 Get the semaphore count value.
 
os_semaphore_tos_semaphore_new (const char *name, const os_semaphore_attr_t *attr)
 Allocated a semaphore object instance and construct it.
 
os_result_t os_semaphore_post (os_semaphore_t *semaphore)
 Post (unlock) the semaphore.
 
os_result_t os_semaphore_reset (os_semaphore_t *semaphore)
 Reset the semaphore.
 
os_result_t os_semaphore_timed_wait (os_semaphore_t *semaphore, os_clock_duration_t timeout)
 Timed wait to lock the semaphore.
 
os_result_t os_semaphore_try_wait (os_semaphore_t *semaphore)
 Try to lock the semaphore.
 
os_result_t os_semaphore_wait (os_semaphore_t *semaphore)
 Lock the semaphore, possibly waiting.
 
os_clock_timestamp_t os_sysclock_now (void)
 Tell the current time since startup.
 
os_result_t os_sysclock_sleep_for (os_clock_duration_t duration)
 Sleep for a relative duration.
 
os_result_t os_sysclock_sleep_until (os_clock_timestamp_t timestamp)
 Sleep until an absolute timestamp.
 
os_result_t os_sysclock_wait_for (os_clock_duration_t timeout)
 Timed wait for an event.
 
os_thread_tos_this_thread (void)
 Get the current running thread.
 
void os_this_thread_exit (void *exit_ptr)
 Terminate the current running thread.
 
os_result_t os_this_thread_flags_clear (os_flags_mask_t mask, os_flags_mask_t *oflags)
 Clear thread event flags.
 
os_flags_mask_t os_this_thread_flags_get (os_flags_mask_t mask, os_flags_mode_t mode)
 Get/clear thread event flags.
 
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_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.
 
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_this_thread_suspend (void)
 Suspend the current running thread to wait for an event.
 
void os_thread_attr_init (os_thread_attr_t *attr)
 Initialise the thread attributes.
 
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_thread_delete (os_thread_t *thread)
 Destruct the thread object instance and deallocate it.
 
void os_thread_destruct (os_thread_t *thread)
 Destruct the statically allocated thread object instance.
 
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.
 
const char * os_thread_get_name (os_thread_t *thread)
 Get the thread name.
 
os_thread_prio_t os_thread_get_priority (os_thread_t *thread)
 Get the thread current scheduling priority.
 
os_thread_stack_tos_thread_get_stack (os_thread_t *thread)
 Get the thread context stack.
 
os_thread_state_t os_thread_get_state (os_thread_t *thread)
 Get the thread scheduler state.
 
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_result_t os_thread_join (os_thread_t *thread, void **exit_ptr)
 Wait for thread termination.
 
os_result_t os_thread_kill (os_thread_t *thread)
 Force thread termination.
 
os_thread_tos_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.
 
void os_thread_resume (os_thread_t *thread)
 Resume the thread.
 
os_result_t os_thread_set_priority (os_thread_t *thread, os_thread_prio_t prio)
 Set the thread dynamic scheduling priority.
 
bool os_thread_stack_check_bottom_magic (os_thread_stack_t *stack)
 Check if bottom magic word is still there.
 
bool os_thread_stack_check_top_magic (os_thread_stack_t *stack)
 Check if top magic word is still there.
 
size_t os_thread_stack_get_available (os_thread_stack_t *stack)
 Compute how much available stack remains.
 
os_thread_stack_element_tos_thread_stack_get_bottom (os_thread_stack_t *stack)
 Get the stack lowest reserved address.
 
size_t os_thread_stack_get_default_size (void)
 Get the default stack size.
 
size_t os_thread_stack_get_min_size (void)
 Get the min stack size.
 
size_t os_thread_stack_get_size (os_thread_stack_t *stack)
 Get the stack size.
 
os_thread_stack_element_tos_thread_stack_get_top (os_thread_stack_t *stack)
 Get the top stack address.
 
size_t os_thread_stack_set_default_size (size_t size_bytes)
 Set the default stack size.
 
size_t os_thread_stack_set_min_size (size_t size_bytes)
 Set the min stack size.
 
os_statistics_counter_t os_thread_stat_get_context_switches (os_thread_t *thread)
 Get the number of thread context switches.
 
os_statistics_duration_t os_thread_stat_get_cpu_cycles (os_thread_t *thread)
 Get the thread execution time.
 
const os_timer_attr_tos_timer_attr_get_periodic (void)
 Get a periodic timer attributes object instance.
 
void os_timer_attr_init (os_timer_attr_t *attr)
 Initialise the single shot timer attributes.
 
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.
 
void os_timer_destruct (os_timer_t *timer)
 Destruct the statically allocated timer object instance.
 
const char * os_timer_get_name (os_timer_t *timer)
 Get the timer name.
 
os_timer_tos_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.
 
os_result_t os_timer_stop (os_timer_t *timer)
 Stop the timer.
 
osStatus osDelay (uint32_t millisec)
 Time Delay.
 
osStatus osKernelInitialize (void)
 Initialize the RTOS.
 
int32_t osKernelRunning (void)
 Check if the RTOS scheduler is started.
 
osStatus osKernelStart (void)
 
osMutexId osMutexCreate (const osMutexDef_t *mutex_def)
 Create a mutex.
 
osStatus osMutexDelete (osMutexId mutex_id)
 Delete the mutex.
 
osStatus osMutexRelease (osMutexId mutex_id)
 Release the mutex.
 
osStatus osMutexWait (osMutexId mutex_id, uint32_t millisec)
 Wait for mutex.
 
int32_t osSignalClear (osThreadId thread_id, int32_t signals)
 Clear the specified Signal Flags of an active thread.
 
int32_t osSignalSet (osThreadId thread_id, int32_t signals)
 Set signal flags.
 
osEvent osSignalWait (int32_t signals, uint32_t millisec)
 Wait for one or more Signal Flags to become signaled for the current RUNNING thread.
 
osThreadId osThreadCreate (const osThreadDef_t *thread_def, void *args)
 Create a thread.
 
osThreadId osThreadGetId (void)
 Get the current thread.
 
osPriority osThreadGetPriority (osThreadId thread_id)
 Get thread priority.
 
osStatus osThreadSetPriority (osThreadId thread_id, osPriority priority)
 Change thread priority.
 
osStatus osThreadTerminate (osThreadId thread_id)
 Terminate a thread.
 
osStatus osThreadYield (void)
 Yield control.
 
osTimerId osTimerCreate (const osTimerDef_t *timer_def, os_timer_type type, void *args)
 Create a timer.
 
osStatus osTimerDelete (osTimerId timer_id)
 Delete the timer.
 
osStatus osTimerStart (osTimerId timer_id, uint32_t millisec)
 Start the timer.
 
osStatus osTimerStop (osTimerId timer_id)
 Stop the timer.
 

Function Documentation

◆ osDelay()

osStatus osDelay ( uint32_t  millisec)

Time Delay.

Wait for a specified time period in millisec.

The millisec value specifies the number of timer ticks and is therefore an upper bound. The exact time delay depends on the actual time elapsed since the last timer tick.

For a value of 1, the system waits until the next timer tick occurs. That means that the actual time delay may be up to one timer tick less.

Warning
Cannot be invoked from Interrupt Service Routines.

Definition at line 3490 of file os-c-wrapper.cpp.

◆ osKernelInitialize()

osStatus osKernelInitialize ( void  )

Initialize the RTOS.

Initialise of the RTOS Kernel to allow peripheral setup and creation of other RTOS objects with the functions:

  • osThreadCreate : Create a thread function.
  • osTimerCreate : Define attributes of the timer callback function.
  • osMutexCreate : Define and initialise a mutex.
  • osSemaphoreCreate : Define and initialise a semaphore.
  • osPoolCreate : Define and initialise a fix-size memory pool.
  • osMessageCreate : Define and initialise a message queue.
  • osMailCreate : Define and initialise a mail queue with fix-size memory blocks.

The RTOS scheduler does not start thread switching until the function osKernelStart is called.

Note
In case that the RTOS Kernel starts thread execution with the function main the function osKernelInitialize stops thread switching. This allows you to setup the system to a defined state before thread switching is resumed with osKernelStart.
Warning
Cannot be invoked from Interrupt Service Routines.

Definition at line 3178 of file os-c-wrapper.cpp.

◆ osKernelRunning()

int32_t osKernelRunning ( void  )

Check if the RTOS scheduler is started.

Identifies if the RTOS scheduler is started. For systems with the option to start the main function as a thread this allows you to identify that the RTOS scheduler is already running.

Note
Can be invoked from Interrupt Service Routines.

Definition at line 3215 of file os-c-wrapper.cpp.

◆ osKernelStart()

osStatus osKernelStart ( void  )

Start the RTOS Kernel and begin thread switching.

Note
When the CMSIS-RTOS starts thread execution with the function main this function resumes thread switching. The main thread will continue executing after osKernelStart.
Warning
Cannot be invoked from Interrupt Service Routines.

Definition at line 3200 of file os-c-wrapper.cpp.

◆ osMutexCreate()

osMutexId osMutexCreate ( const osMutexDef_t mutex_def)

Create a mutex.

Create and initialise a mutex object instance.

Warning
Cannot be invoked from Interrupt Service Routines.

Definition at line 3843 of file os-c-wrapper.cpp.

◆ osMutexDelete()

osStatus osMutexDelete ( osMutexId  mutex_id)

Delete the mutex.

Delete a mutex object instance. The function releases internal memory obtained for mutex handling. After this call the mutex_id is no longer valid and cannot be used. The mutex may be created again using the function osMutexCreate.

Warning
Cannot be invoked from Interrupt Service Routines.

Definition at line 3991 of file os-c-wrapper.cpp.

◆ osMutexRelease()

osStatus osMutexRelease ( osMutexId  mutex_id)

Release the mutex.

Release a mutex that was obtained with osMutexWait. Other threads that currently wait for the same mutex will be now put into the state READY.

Warning
Cannot be invoked from Interrupt Service Routines.

Definition at line 3952 of file os-c-wrapper.cpp.

◆ osMutexWait()

osStatus osMutexWait ( osMutexId  mutex_id,
uint32_t  millisec 
)

Wait for mutex.

Wait until a mutex becomes available. If no other thread has obtained the mutex, the function instantly returns and blocks the mutex object.

The argument millisec specifies how long the system waits for a mutex. While the system waits the thread that is calling this function is put into the state WAITING. The millisec timeout can have the following values:

  • when millisec is 0, the function returns instantly.
  • when millisec is set to osWaitForever the function will wait for an infinite time until the mutex becomes available.
  • all other values specify a time in millisecond for a timeout.
Warning
Cannot be invoked from Interrupt Service Routines.

Definition at line 3883 of file os-c-wrapper.cpp.

◆ osSignalClear()

int32_t osSignalClear ( osThreadId  thread_id,
int32_t  signals 
)

Clear the specified Signal Flags of an active thread.

Clear the signal flags of an active thread.

Warning
Cannot be invoked from Interrupt Service Routines.

Definition at line 3717 of file os-c-wrapper.cpp.

◆ osSignalSet()

int32_t osSignalSet ( osThreadId  thread_id,
int32_t  signals 
)

Set signal flags.

Set the signal flags of an active thread.

Note
Can be invoked from Interrupt Service Routines.

Definition at line 3693 of file os-c-wrapper.cpp.

◆ osSignalWait()

osEvent osSignalWait ( int32_t  signals,
uint32_t  millisec 
)

Wait for one or more Signal Flags to become signaled for the current RUNNING thread.

Suspend the execution of the current RUNNING thread until all specified signal flags with the parameter signals are set. When the parameter signals is 0 the current RUNNING thread is suspended until any signal is set. When these signal flags are already set, the function returns instantly. Otherwise the thread is put into the state WAITING. Signal flags that are reported as event are automatically cleared.

The argument millisec specifies how long the system waits for the specified signal flags. While the system waits the tread calling this function is put into the state WAITING. The timeout value can have the following values:

  • when millisec is 0, the function returns instantly.
  • when millisec is set to osWaitForever the function will wait an infinite time until a specified signal is set.
  • all other values specify a time in millisecond for a timeout.
Warning
Cannot be invoked from Interrupt Service Routines.

Definition at line 3767 of file os-c-wrapper.cpp.

◆ osThreadCreate()

osThreadId osThreadCreate ( const osThreadDef_t thread_def,
void *  args 
)

Create a thread.

Find a free slot in the array of thread definitions and initialise the thread.

Start the thread function by adding it to the Active Threads list and set it to state READY. The thread function receives the argument pointer as function argument when the function is started. When the priority of the created thread function is higher than the current RUNNING thread, the created thread function starts instantly and becomes the new RUNNING thread.

Warning
Cannot be invoked from Interrupt Service Routines.

Definition at line 3262 of file os-c-wrapper.cpp.

◆ osThreadGetId()

osThreadId osThreadGetId ( void  )

Get the current thread.

Get the thread ID of the current running thread.

Warning
Cannot be invoked from Interrupt Service Routines.

Definition at line 3317 of file os-c-wrapper.cpp.

◆ osThreadGetPriority()

osPriority osThreadGetPriority ( osThreadId  thread_id)

Get thread priority.

Get the priority of an active thread. In case of a failure the value osPriorityError is returned.

Warning
Cannot be invoked from Interrupt Service Routines.

Definition at line 3455 of file os-c-wrapper.cpp.

◆ osThreadSetPriority()

osStatus osThreadSetPriority ( osThreadId  thread_id,
osPriority  priority 
)

Change thread priority.

Change the priority of a running thread. There is no need for an extra yield after it, if the priorities require, there is an implicit reschedule.

Warning
Cannot be invoked from Interrupt Service Routines.

Definition at line 3401 of file os-c-wrapper.cpp.

◆ osThreadTerminate()

osStatus osThreadTerminate ( osThreadId  thread_id)

Terminate a thread.

Remove the thread function from the active thread list. If the thread is currently RUNNING the execution will stop.

Note
In case that osThreadTerminate terminates the currently running task, the function never returns and other threads that are in the READY state are started.
Warning
Cannot be invoked from Interrupt Service Routines.

Definition at line 3339 of file os-c-wrapper.cpp.

◆ osThreadYield()

osStatus osThreadYield ( void  )

Yield control.

Pass control to the next thread that is in state READY. If there is no other thread in the state READY, the current thread continues execution and no thread switching occurs.

Warning
Cannot be invoked from Interrupt Service Routines.

Definition at line 3380 of file os-c-wrapper.cpp.

◆ osTimerCreate()

osTimerId osTimerCreate ( const osTimerDef_t timer_def,
os_timer_type  type,
void *  args 
)

Create a timer.

Create a one-shot or periodic timer and associate it with a callback function argument. The timer is initially stopped and must be started with osTimerStart().

Warning
Cannot be invoked from Interrupt Service Routines.

Definition at line 3575 of file os-c-wrapper.cpp.

◆ osTimerDelete()

osStatus osTimerDelete ( osTimerId  timer_id)

Delete the timer.

Delete the timer object that was created by osTimerCreate.

Warning
Cannot be invoked from Interrupt Service Routines.

Definition at line 3667 of file os-c-wrapper.cpp.

◆ osTimerStart()

osStatus osTimerStart ( osTimerId  timer_id,
uint32_t  millisec 
)

Start the timer.

Start or restart the timer.

Warning
Cannot be invoked from Interrupt Service Routines.

Definition at line 3604 of file os-c-wrapper.cpp.

◆ osTimerStop()

osStatus osTimerStop ( osTimerId  timer_id)

Stop the timer.

Warning
Cannot be invoked from Interrupt Service Routines.

Definition at line 3633 of file os-c-wrapper.cpp.