13#ifndef CMSIS_PLUS_RTOS_OS_SCHED_H_
14#define CMSIS_PLUS_RTOS_OS_SCHED_H_
18#if defined(__cplusplus)
22#if defined(OS_USE_OS_APP_CONFIG_H)
23#include <cmsis-plus/os-app-config.h>
31#pragma GCC diagnostic push
33#pragma clang diagnostic ignored "-Wc++98-compat"
34#pragma clang diagnostic ignored "-Wdocumentation-unknown-command"
53 extern bool is_started_;
55#if !defined(OS_USE_RTOS_PORT_SCHEDULER)
56 extern bool is_preemptive_;
57 extern thread*
volatile current_thread_;
58 extern internal::ready_threads_list ready_threads_list_;
61 extern internal::terminated_threads_list terminated_threads_list_;
158 internal_switch_threads (
void);
338 operator= (
const lockable&) =
delete;
427#if defined(OS_INCLUDE_RTOS_STATISTICS_THREAD_CONTEXT_SWITCHES)
448#if defined(OS_INCLUDE_RTOS_STATISTICS_THREAD_CPU_CYCLES)
729 operator= (
const lockable&) =
delete;
841#if !defined(OS_USE_RTOS_PORT_SCHEDULER)
842 return is_preemptive_;
914#if defined(OS_TRACE_RTOS_SCHEDULER)
929#if defined(OS_TRACE_RTOS_SCHEDULER)
945#if defined(OS_TRACE_RTOS_SCHEDULER)
960#if defined(OS_TRACE_RTOS_SCHEDULER)
971 state_ (port::scheduler::state::init)
1015 namespace statistics
1017#if defined(OS_INCLUDE_RTOS_STATISTICS_THREAD_CONTEXT_SWITCHES)
1036 return context_switches_;
1041#if defined(OS_INCLUDE_RTOS_STATISTICS_THREAD_CPU_CYCLES)
1066#if defined(OS_INCLUDE_RTOS_STATISTICS_THREAD_CONTEXT_SWITCHES) \
1067 || defined(OS_INCLUDE_RTOS_STATISTICS_THREAD_CPU_CYCLES)
1083#if defined(OS_INCLUDE_RTOS_STATISTICS_THREAD_CONTEXT_SWITCHES)
1084 context_switches_ = 0;
1087#if defined(OS_INCLUDE_RTOS_STATISTICS_THREAD_CPU_CYCLES)
1101 namespace interrupts
1107 __attribute__((always_inline))
1117 __attribute__((always_inline))
1127 __attribute__((always_inline))
1137 __attribute__((always_inline))
1147 __attribute__((always_inline))
1159 __attribute__((always_inline))
1169 __attribute__((always_inline))
1179 __attribute__((always_inline))
1189 __attribute__((always_inline))
1202 state_ (port::interrupts::state::init)
1210 __attribute__((always_inline))
1219 __attribute__((always_inline))
1233 __attribute__((always_inline))
1244 __attribute__((always_inline))
1256#pragma GCC diagnostic pop
Interrupts critical section RAII helper.
critical_section()
Enter an interrupts critical section.
static void exit(state_t state)
Exit the interrupts critical section.
~critical_section()
Exit the interrupts critical section.
static state_t enter(void)
Enter an interrupts critical section.
Interrupts standard locker.
void lock(void)
Lock the interrupts.
~lockable()
Destruct the interrupts lock.
bool try_lock(void)
Try to lock the interrupts.
void unlock(void)
Unlock the interrupts.
constexpr lockable()
Construct an interrupts lock.
Interrupts critical section RAII helper.
~uncritical_section()
Exit the interrupts uncritical section.
static state_t enter(void)
Enter interrupts uncritical section.
static void exit(state_t state)
Exit interrupts uncritical section.
uncritical_section()
Enter an interrupts uncritical section.
static rtos::interrupts::state_t enter(void)
static void exit(rtos::interrupts::state_t state)
static void exit(rtos::interrupts::state_t state)
static rtos::interrupts::state_t enter(void)
Scheduler critical section RAII helper.
critical_section()
Enter a critical section.
~critical_section()
Exit a critical section.
Scheduler standard locker.
void unlock(void)
Unlock the scheduler.
constexpr lockable()
Construct a lockable object instance.
void lock(void)
Lock the scheduler.
~lockable()
Destruct the lockable object instance.
bool try_lock(void)
Try to lock the scheduler.
Scheduler uncritical section RAII helper.
uncritical_section()
Enter a critical section.
~uncritical_section()
Exit a critical section.
int printf(const char *format,...)
Write a formatted string to the trace device.
port::clock::timestamp_t timestamp_t
Type of variables holding clock time stamps.
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.
bool in_handler_mode(void)
port::scheduler::state_t unlock(void)
port::scheduler::state_t lock(void)
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.
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.