33#pragma clang diagnostic ignored "-Wc++98-compat"
144#pragma GCC diagnostic push
145#pragma GCC diagnostic ignored "-Wunused-parameter"
175#if defined(OS_TRACE_RTOS_EVFLAGS)
176 trace::printf (
"%s() @%p %s\n", __func__,
this, this->name ());
182#if !defined(OS_USE_RTOS_PORT_EVENT_FLAGS)
183 clock_ = attr.clock !=
nullptr ? attr.clock : &
sysclock;
186#if defined(OS_USE_RTOS_PORT_EVENT_FLAGS)
188 port::event_flags::create (
this);
196#pragma GCC diagnostic pop
213#if defined(OS_TRACE_RTOS_EVFLAGS)
217#if defined(OS_USE_RTOS_PORT_EVENT_FLAGS)
219 port::event_flags::destroy (
this);
224 assert(list_.empty ());
254#if defined(OS_TRACE_RTOS_EVFLAGS)
255 trace::printf (
"%s(0x%X,%u) @%p %s <0x%X\n", __func__, mask, mode,
this,
256 name (), event_flags_.mask ());
264#if defined(OS_USE_RTOS_PORT_EVENT_FLAGS)
266 return port::event_flags::wait (
this, mask, oflags, mode);
274 if (event_flags_.check_raised (mask, oflags, mode))
276#if defined(OS_TRACE_RTOS_EVFLAGS)
277 trace::printf (
"%s(0x%X,%u) @%p %s >0x%X\n", __func__, mask, mode,
278 this,
name (), event_flags_.mask ());
299 if (event_flags_.check_raised (mask, oflags, mode))
301#if defined(OS_TRACE_RTOS_EVFLAGS)
303 mode,
this,
name (), event_flags_.mask ());
309 scheduler::internal_link_node (list_, node);
322 scheduler::internal_unlink_node (node);
328#if defined(OS_TRACE_RTOS_EVFLAGS)
329 trace::printf (
"%s(0x%X,%u) EINTR @%p %s\n", __func__, mask, mode,
337 return ENOTRECOVERABLE;
357#if defined(OS_TRACE_RTOS_EVFLAGS)
358 trace::printf (
"%s(0x%X,%u) @%p %s <0x%X\n", __func__, mask, mode,
this,
359 name (), event_flags_.mask ());
362#if defined(OS_USE_RTOS_PORT_EVENT_FLAGS)
364 return port::event_flags::try_wait (
this, mask, oflags, mode);
369 assert(port::interrupts::is_priority_valid ());
375 if (event_flags_.check_raised (mask, oflags, mode))
377#if defined(OS_TRACE_RTOS_EVFLAGS)
378 trace::printf (
"%s(0x%X,%u) @%p %s >0x%X\n", __func__, mask, mode,
379 this,
name (), event_flags_.mask ());
385#if defined(OS_TRACE_RTOS_EVFLAGS)
386 trace::printf (
"%s(0x%X,%u) EWOULDBLOCK @%p %s \n", __func__,
387 mask, mode,
this,
name ());
439#if defined(OS_TRACE_RTOS_EVFLAGS)
440 trace::printf (
"%s(0x%X,%u,%u) @%p %s <0x%X\n", __func__, mask, timeout,
441 mode,
this,
name (), event_flags_.mask ());
449#if defined(OS_USE_RTOS_PORT_EVENT_FLAGS)
451 return port::event_flags::timed_wait (
this, mask, timeout, oflags, mode);
461 if (event_flags_.check_raised (mask, oflags, mode))
463#if defined(OS_TRACE_RTOS_EVFLAGS)
464 trace::printf (
"%s(0x%X,%u,%u) @%p %s >0x%X\n", __func__, mask,
465 timeout, mode,
this,
name (),
466 event_flags_.mask ());
486 { timeout_timestamp, crt_thread };
494 if (event_flags_.check_raised (mask, oflags, mode))
496#if defined(OS_TRACE_RTOS_EVFLAGS)
498 mask, timeout, mode,
this,
name (),
499 event_flags_.mask ());
506 scheduler::internal_link_node (list_, node, clock_list,
517 scheduler::internal_unlink_node (node, timeout_node);
521#if defined(OS_TRACE_RTOS_EVFLAGS)
522 trace::printf (
"%s(0x%X,%u,%u) EINTR @%p %s 0x%X \n", __func__,
523 mask, timeout, mode,
this,
name ());
528 if (clock_->steady_now () >= timeout_timestamp)
530#if defined(OS_TRACE_RTOS_EVFLAGS)
532 __func__, mask, timeout, mode,
this,
name ());
539 return ENOTRECOVERABLE;
555#if defined(OS_TRACE_RTOS_EVFLAGS)
557 event_flags_.mask ());
560#if defined(OS_USE_RTOS_PORT_EVENT_FLAGS)
564 return port::event_flags::raise (
this, mask, oflags);
568 result_t res = event_flags_.raise (mask, oflags);
575#if defined(OS_TRACE_RTOS_EVFLAGS)
577 event_flags_.mask ());
590#if defined(OS_TRACE_RTOS_EVFLAGS)
592 event_flags_.mask ());
595#if defined(OS_USE_RTOS_PORT_EVENT_FLAGS)
599 return port::event_flags::clear (
this, mask, oflags);
603 result_t res = event_flags_.clear (mask, oflags);
605#if defined(OS_TRACE_RTOS_EVFLAGS)
607 event_flags_.mask ());
629#if defined(OS_TRACE_RTOS_EVFLAGS)
633#if defined(OS_USE_RTOS_PORT_EVENT_FLAGS)
635 return port::event_flags::get (
this, mask, mode);
641#if defined(OS_TRACE_RTOS_EVFLAGS)
643 event_flags_.mask (),
this,
name ());
657#if defined(OS_TRACE_RTOS_EVFLAGS)
661#if defined(OS_USE_RTOS_PORT_EVENT_FLAGS)
663 return port::event_flags::waiting (
this);
668 assert(port::interrupts::is_priority_valid ());
674 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.
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.