C API core & scheduler definitions. More...
Macros | |
#define | os_flags_all 0xFFFFFFFF |
#define | os_flags_any 0 |
Special mask to represent any flag. | |
Typedefs | |
typedef os_port_clock_duration_t | os_clock_duration_t |
Type of variables holding clock durations. | |
typedef os_port_clock_offset_t | os_clock_offset_t |
Type of variables holding clock offsets. | |
typedef os_port_clock_timestamp_t | os_clock_timestamp_t |
Type of variables holding clock time stamps. | |
typedef uint32_t | os_flags_mask_t |
Type of variables holding flags masks. | |
typedef uint32_t | os_flags_mode_t |
Type of variables holding flags modes. | |
typedef os_port_irq_state_t | os_irq_state_t |
Type of variables holding interrupts priority values. | |
typedef void * | os_iterator_t |
Generic iterator, implemented as a pointer. | |
typedef uint32_t | os_result_t |
Type of values returned by RTOS functions. | |
typedef os_port_scheduler_state_t | os_sched_state_t |
Type of variables holding scheduler state codes. | |
typedef uint64_t | os_statistics_counter_t |
Type of variables holding context switches counters. | |
typedef uint64_t | os_statistics_duration_t |
Type of variables holding durations in CPU cycles. | |
Enumerations | |
enum | { os_flags_mode_all = 1 , os_flags_mode_any = 2 , os_flags_mode_clear = 4 } |
Bits used to specify the flags modes. More... | |
Return Codes | |
enum | { os_ok = 0 } |
Return codes, in addition to POSIX codes. More... | |
Scheduler Functions | |
os_result_t | os_sched_initialize (void) |
Initialise the RTOS scheduler. | |
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_lock (void) |
Lock the scheduler. | |
os_sched_state_t | os_sched_unlock (void) |
Unlock the scheduler. | |
os_sched_state_t | os_sched_set_locked (os_sched_state_t state) |
Lock/unlock the 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_set_preemptive (bool state) |
Set the scheduler preemptive mode. | |
Scheduler Statistics Functions | |
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. | |
Interrupts Functions | |
bool | os_irq_in_handler_mode (void) |
Check if the CPU is in handler mode. | |
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_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. | |
os_thread_stack_t * | os_irq_get_stack (void) |
Get the interrupts stack. | |
C API core & scheduler definitions.
#define os_flags_all 0xFFFFFFFF |
Special mask to represent all flags.
Definition at line 143 of file os-c-decls.h.
#define os_flags_any 0 |
Special mask to represent any flag.
Definition at line 138 of file os-c-decls.h.
typedef os_port_clock_duration_t os_clock_duration_t |
Type of variables holding clock durations.
A numeric type intended to store a clock duration, either in ticks cycles, or seconds.
Definition at line 197 of file os-c-decls.h.
typedef os_port_clock_offset_t os_clock_offset_t |
Type of variables holding clock offsets.
A numeric type intended to store a clock offset (difference to epoch), either in ticks or in seconds.
Definition at line 209 of file os-c-decls.h.
typedef os_port_clock_timestamp_t os_clock_timestamp_t |
Type of variables holding clock time stamps.
A numeric type intended to store a clock timestamp, either in ticks cycles or seconds.
Definition at line 186 of file os-c-decls.h.
typedef uint32_t os_flags_mask_t |
Type of variables holding flags masks.
An unsigned type large enough to store all the flags, usually 32-bits wide.
Both thread event flags and generic event flags use this definition.
Definition at line 121 of file os-c-decls.h.
typedef uint32_t os_flags_mode_t |
Type of variables holding flags modes.
An unsigned type used to hold the mode bits passed to functions returning flags.
Both thread event flags and generic event flags use this definition.
Definition at line 108 of file os-c-decls.h.
typedef os_port_irq_state_t os_irq_state_t |
Type of variables holding interrupts priority values.
Usually an integer large enough to hold the CPU register where the interrupt priorities are stored.
Used to temporarily store the CPU register during critical sections.
Definition at line 171 of file os-c-decls.h.
typedef void* os_iterator_t |
Generic iterator, implemented as a pointer.
To simplify things, the C implementation of iterators includes a single pointer to a C++ object instance. Internally, the functions used to iterate must cast this pointer properly, but this should be transparent for the user.
Definition at line 223 of file os-c-decls.h.
typedef uint32_t os_result_t |
Type of values returned by RTOS functions.
For error processing reasons, most µOS++ RTOS functions return a numeric result, which, according to POSIX, when the call was successful, must be 0
(os_ok
) or an error code defined in <errno.h>
otherwise.
Definition at line 95 of file os-c-decls.h.
typedef os_port_scheduler_state_t os_sched_state_t |
Type of variables holding scheduler state codes.
Usually a boolean telling if the scheduler is locked or not, but for recursive locks it might also be a numeric counter.
Definition at line 157 of file os-c-decls.h.
typedef uint64_t os_statistics_counter_t |
Type of variables holding context switches counters.
Definition at line 232 of file os-c-decls.h.
typedef uint64_t os_statistics_duration_t |
Type of variables holding durations in CPU cycles.
Definition at line 239 of file os-c-decls.h.
anonymous enum |
Return codes, in addition to POSIX codes.
Enumerator | |
---|---|
os_ok | Function completed; no error or event occurred. |
Definition at line 57 of file os-c-api.h.
anonymous enum |
Bits used to specify the flags modes.
Enumerator | |
---|---|
os_flags_mode_all | |
os_flags_mode_any | |
os_flags_mode_clear |
Definition at line 128 of file os-c-decls.h.
os_irq_state_t os_irq_critical_enter | ( | void | ) |
Enter an interrupts critical section.
Definition at line 413 of file os-c-wrapper.cpp.
void os_irq_critical_exit | ( | os_irq_state_t | state | ) |
Exit the interrupts critical section.
state | The value to restore the interrupts priority register. |
Definition at line 425 of file os-c-wrapper.cpp.
os_thread_stack_t * os_irq_get_stack | ( | void | ) |
Get the interrupts stack.
Definition at line 466 of file os-c-wrapper.cpp.
bool os_irq_in_handler_mode | ( | void | ) |
Check if the CPU is in handler mode.
true | Execution is in an exception handler context. |
false | Execution is in a thread context. |
Definition at line 399 of file os-c-wrapper.cpp.
os_irq_state_t os_irq_uncritical_enter | ( | void | ) |
Enter an interrupts uncritical section.
Definition at line 439 of file os-c-wrapper.cpp.
void os_irq_uncritical_exit | ( | os_irq_state_t | state | ) |
Exit the interrupts uncritical section.
state | The value to restore the interrupts priority register. |
Definition at line 451 of file os-c-wrapper.cpp.
os_result_t os_sched_initialize | ( | void | ) |
Initialise the RTOS scheduler.
os_ok | The scheduler was initialised. |
EPERM | Cannot be invoked from an Interrupt Service Routines. |
Definition at line 257 of file os-c-wrapper.cpp.
bool os_sched_is_locked | ( | void | ) |
Check if the scheduler is locked.
true | The scheduler is locked. |
false | The scheduler is switching threads (not locked). |
Definition at line 329 of file os-c-wrapper.cpp.
bool os_sched_is_preemptive | ( | void | ) |
Check if the scheduler is in preemptive mode.
true | The scheduler is in preemptive mode. |
false | The scheduler is not in preemptive mode. |
Definition at line 341 of file os-c-wrapper.cpp.
bool os_sched_is_started | ( | void | ) |
Check if the scheduler was started.
true | The scheduler was started. |
false | The scheduler was not started. |
Definition at line 281 of file os-c-wrapper.cpp.
os_sched_state_t os_sched_lock | ( | void | ) |
Lock the scheduler.
Definition at line 293 of file os-c-wrapper.cpp.
os_sched_state_t os_sched_set_locked | ( | os_sched_state_t | state | ) |
Lock/unlock the scheduler.
[in] | state | The new state of the scheduler lock. |
Definition at line 317 of file os-c-wrapper.cpp.
bool os_sched_set_preemptive | ( | bool | state | ) |
Set the scheduler preemptive mode.
[in] | state | The new state of the scheduler preemptive mode. |
Definition at line 353 of file os-c-wrapper.cpp.
void os_sched_start | ( | void | ) |
Start the RTOS scheduler.
Definition at line 269 of file os-c-wrapper.cpp.
os_statistics_counter_t os_sched_stat_get_context_switches | ( | void | ) |
Get the total number of context switches.
Definition at line 367 of file os-c-wrapper.cpp.
os_statistics_duration_t os_sched_stat_get_cpu_cycles | ( | void | ) |
Get the total duration of all threads.
Definition at line 383 of file os-c-wrapper.cpp.
os_sched_state_t os_sched_unlock | ( | void | ) |
Unlock the scheduler.
Definition at line 305 of file os-c-wrapper.cpp.