12#if defined(OS_USE_OS_APP_CONFIG_H)
13#include <cmsis-plus/os-app-config.h>
21#pragma clang diagnostic ignored "-Wc++98-compat"
133#pragma GCC diagnostic push
134#if defined(__clang__)
135#elif defined(__GNUC__)
136#pragma GCC diagnostic ignored "-Wunused-parameter"
164 : object_named_system{ name }
166#if defined(OS_TRACE_RTOS_EVFLAGS)
167 trace::printf (
"%s() @%p %s\n", __func__,
this, this->name ());
173#if !defined(OS_USE_RTOS_PORT_EVENT_FLAGS)
177#if defined(OS_USE_RTOS_PORT_EVENT_FLAGS)
179 port::event_flags::create (
this);
186#pragma GCC diagnostic pop
203#if defined(OS_TRACE_RTOS_EVFLAGS)
207#if defined(OS_USE_RTOS_PORT_EVENT_FLAGS)
209 port::event_flags::destroy (
this);
214 assert (list_.empty ());
244#if defined(OS_TRACE_RTOS_EVFLAGS)
245 trace::printf (
"%s(0x%X,%u) @%p %s <0x%X\n", __func__, mask, mode,
this,
246 name (), event_flags_.mask ());
254#if defined(OS_USE_RTOS_PORT_EVENT_FLAGS)
256 return port::event_flags::wait (
this, mask, oflags, mode);
264 if (event_flags_.check_raised (mask, oflags, mode))
266#if defined(OS_TRACE_RTOS_EVFLAGS)
267 trace::printf (
"%s(0x%X,%u) @%p %s >0x%X\n", __func__, mask, mode,
268 this,
name (), event_flags_.mask ());
288 if (event_flags_.check_raised (mask, oflags, mode))
290#if defined(OS_TRACE_RTOS_EVFLAGS)
292 mode,
this,
name (), event_flags_.mask ());
298 scheduler::internal_link_node (list_, node);
311 scheduler::internal_unlink_node (node);
317#if defined(OS_TRACE_RTOS_EVFLAGS)
319 mode,
this,
name ());
326 return ENOTRECOVERABLE;
346#if defined(OS_TRACE_RTOS_EVFLAGS)
347 trace::printf (
"%s(0x%X,%u) @%p %s <0x%X\n", __func__, mask, mode,
this,
348 name (), event_flags_.mask ());
351#if defined(OS_USE_RTOS_PORT_EVENT_FLAGS)
353 return port::event_flags::try_wait (
this, mask, oflags, mode);
358 assert (port::interrupts::is_priority_valid ());
364 if (event_flags_.check_raised (mask, oflags, mode))
366#if defined(OS_TRACE_RTOS_EVFLAGS)
367 trace::printf (
"%s(0x%X,%u) @%p %s >0x%X\n", __func__, mask, mode,
368 this,
name (), event_flags_.mask ());
374#if defined(OS_TRACE_RTOS_EVFLAGS)
375 trace::printf (
"%s(0x%X,%u) EWOULDBLOCK @%p %s \n", __func__, mask,
376 mode,
this,
name ());
428#if defined(OS_TRACE_RTOS_EVFLAGS)
429 trace::printf (
"%s(0x%X,%u,%u) @%p %s <0x%X\n", __func__, mask, timeout,
430 mode,
this,
name (), event_flags_.mask ());
438#if defined(OS_USE_RTOS_PORT_EVENT_FLAGS)
440 return port::event_flags::timed_wait (
this, mask, timeout, oflags, mode);
450 if (event_flags_.check_raised (mask, oflags, mode))
452#if defined(OS_TRACE_RTOS_EVFLAGS)
453 trace::printf (
"%s(0x%X,%u,%u) @%p %s >0x%X\n", __func__, mask,
454 timeout, mode,
this,
name (), event_flags_.mask ());
481 if (event_flags_.check_raised (mask, oflags, mode))
483#if defined(OS_TRACE_RTOS_EVFLAGS)
484 trace::printf (
"%s(0x%X,%u,%u) @%p %s >0x%X\n", __func__, mask,
485 timeout, mode,
this,
name (),
486 event_flags_.mask ());
493 scheduler::internal_link_node (list_, node, clock_list,
504 scheduler::internal_unlink_node (node, timeout_node);
508#if defined(OS_TRACE_RTOS_EVFLAGS)
509 trace::printf (
"%s(0x%X,%u,%u) EINTR @%p %s 0x%X \n", __func__,
510 mask, timeout, mode,
this,
name ());
515 if (clock_->steady_now () >= timeout_timestamp)
517#if defined(OS_TRACE_RTOS_EVFLAGS)
519 __func__, mask, timeout, mode,
this,
name ());
526 return ENOTRECOVERABLE;
542#if defined(OS_TRACE_RTOS_EVFLAGS)
544 event_flags_.mask ());
547#if defined(OS_USE_RTOS_PORT_EVENT_FLAGS)
551 return port::event_flags::raise (
this, mask, oflags);
555 result_t res = event_flags_.raise (mask, oflags);
562#if defined(OS_TRACE_RTOS_EVFLAGS)
564 event_flags_.mask ());
577#if defined(OS_TRACE_RTOS_EVFLAGS)
579 event_flags_.mask ());
582#if defined(OS_USE_RTOS_PORT_EVENT_FLAGS)
586 return port::event_flags::clear (
this, mask, oflags);
590 result_t res = event_flags_.clear (mask, oflags);
592#if defined(OS_TRACE_RTOS_EVFLAGS)
594 event_flags_.mask ());
616#if defined(OS_TRACE_RTOS_EVFLAGS)
620#if defined(OS_USE_RTOS_PORT_EVENT_FLAGS)
622 return port::event_flags::get (
this, mask, mode);
628#if defined(OS_TRACE_RTOS_EVFLAGS)
630 event_flags_.mask (),
this,
name ());
644#if defined(OS_TRACE_RTOS_EVFLAGS)
648#if defined(OS_USE_RTOS_PORT_EVENT_FLAGS)
650 return port::event_flags::waiting (
this);
655 assert (port::interrupts::is_priority_valid ());
661 return !list_.empty ();
Synchronised event flags.
result_t wait(flags::mask_t mask, flags::mask_t *oflags, flags::mode_t mode=flags::mode::all|flags::mode::clear)
Wait for event flags.
result_t timed_wait(flags::mask_t mask, clock::duration_t timeout, flags::mask_t *oflags=nullptr, flags::mode_t mode=flags::mode::all|flags::mode::clear)
Timed wait for event flags.
~event_flags()
Destruct the event flags object instance.
event_flags(const attributes &attr=initializer)
Construct an event flags object instance.
bool waiting(void)
Check if there are threads waiting.
flags::mask_t get(flags::mask_t mask, flags::mode_t mode=flags::mode::clear)
Get (and possibly clear) event flags.
result_t try_wait(flags::mask_t mask, flags::mask_t *oflags=nullptr, flags::mode_t mode=flags::mode::all|flags::mode::clear)
Try to wait for event flags.
result_t raise(flags::mask_t mask, flags::mask_t *oflags=nullptr)
Raise event flags.
result_t clear(flags::mask_t mask, flags::mask_t *oflags=nullptr)
Clear event flags.
rtos::clock * clock
Attribute with the address of the clock to be used for timeouts.
Ordered list of time stamp nodes.
const char * name(void) const
Get object name.
Double linked list node, with time stamp and thread.
Double linked list node, with thread reference.
Interrupts critical section RAII helper.
POSIX compliant thread, using the default RTOS allocator.
bool interrupted(void)
Check if interrupted.
int printf(const char *format,...)
Write a formatted string to the trace device.
port::clock::duration_t duration_t
Type of variables holding clock durations.
port::clock::timestamp_t timestamp_t
Type of variables holding clock time stamps.
clock_systick sysclock
The system clock object instance.
static const attributes initializer
Default event flags initialiser.
uint32_t mode_t
Type of variables holding flags modes.
uint32_t mask_t
Type of variables holding flags masks.
bool in_handler_mode(void)
Check if the CPU is in handler mode.
@ ok
Function completed; no errors or events occurred.
bool locked(void)
Check if the scheduler is locked.
thread & thread(void)
Get the current running thread.
uint32_t result_t
Type of values returned by RTOS functions.
#define os_assert_throw(__e, __er)
Assert or throw a system error exception.
#define os_assert_err(__e, __er)
Assert or return an error.
Single file µOS++ RTOS definitions.