Internal event flags implementation.
More...
#include <os-flags.h>
Definition at line 46 of file os-flags.h.
◆ event_flags()
| os::rtos::internal::event_flags::event_flags |
( |
| ) |
|
|
default |
◆ ~event_flags()
| os::rtos::internal::event_flags::~event_flags |
( |
| ) |
|
|
default |
◆ check_raised()
- Parameters
-
| [in] | mask | The expected flags (OR-ed bit-mask); if flags::any, any flag raised will do it. |
| [out] | oflags | Pointer where to store the current flags; may be nullptr. |
| [in] | mode | Mode bits to select if either all or any flags in the mask are expected, and if the flags should be cleared. |
- Return values
-
| true | The expected flags are raised. |
| false | The expected flags are not raised. |
Definition at line 63 of file os-flags.cpp.
65 {
67 {
68
69 if (flags_mask_ != 0)
70 {
71 if (oflags != nullptr)
72 {
73 *oflags = flags_mask_;
74 }
75
77 {
78
79 flags_mask_ = 0;
80 }
81 return true;
82 }
83 }
87 && ((flags_mask_ &
mask) != 0)))
88 {
89 if (oflags != nullptr)
90 {
91 *oflags = (flags_mask_ &
mask);
92 }
93
95 {
96#pragma GCC diagnostic push
97#if defined(__clang__)
98#pragma clang diagnostic ignored "-Wdeprecated-volatile"
99#elif defined(__GNUC__)
100#pragma GCC diagnostic ignored "-Wvolatile"
101#endif
102
103 flags_mask_ &= ~mask;
104#pragma GCC diagnostic pop
105 }
106 return true;
107 }
108
109 return false;
110 }
flags::mask_t mask(void)
Get the flags mask.
@ all
Return when all flags are set.
@ clear
Ask for flags to be cleared after read.
@ any
Return when at least one flag is set.
@ any
Special mask to represent any flag.
References os::rtos::flags::mode::all, os::rtos::flags::mode::any, os::rtos::flags::any, os::rtos::flags::mode::clear, and mask().
◆ clear()
- Parameters
-
| [in] | mask | The OR-ed flags to clear. |
| [out] | oflags | Optional pointer where to store the previous value of the flags; may be nullptr. |
- Return values
-
| result::ok | The flags were cleared. |
| EINVAL | The mask is zero. |
Definition at line 149 of file os-flags.cpp.
150 {
152
153 {
154
155 interrupts::critical_section ics;
156
157 if (oflags != nullptr)
158 {
159 *oflags = flags_mask_;
160 }
161
162#pragma GCC diagnostic push
163#if defined(__clang__)
164#pragma clang diagnostic ignored "-Wdeprecated-volatile"
165#elif defined(__GNUC__)
166#pragma GCC diagnostic ignored "-Wvolatile"
167#endif
168
169 flags_mask_ &= ~mask;
170#pragma GCC diagnostic pop
171
172
173 }
174
176 }
@ ok
Function completed; no errors or events occurred.
#define os_assert_err(__e, __er)
Assert or return an error.
References mask(), os::rtos::result::ok, and os_assert_err.
◆ get()
- Parameters
-
| [in] | mask | The OR-ed flags to get/clear; can be flags::any. |
| [in] | mode | Mode bits to select if the flags should be cleared (the other bits are ignored). |
- Returns
- The selected bits from the flags mask.
Definition at line 113 of file os-flags.cpp.
114 {
116 {
117
118 interrupts::critical_section ics;
119
121 {
122
123 ret = flags_mask_;
124 }
125 else
126 {
127 ret = flags_mask_ &
mask;
129 {
130#pragma GCC diagnostic push
131#if defined(__clang__)
132#pragma clang diagnostic ignored "-Wdeprecated-volatile"
133#elif defined(__GNUC__)
134#pragma GCC diagnostic ignored "-Wvolatile"
135#endif
136
137 flags_mask_ &= ~mask;
138#pragma GCC diagnostic pop
139 }
140 }
141
142 }
143
144
145 return ret;
146 }
uint32_t mask_t
Type of variables holding flags masks.
References os::rtos::flags::mode::clear, and mask().
◆ mask()
◆ raise()
- Parameters
-
| [in] | mask | The OR-ed flags to raise. |
| [out] | oflags | Optional pointer where to store the new value of the flags; may be nullptr. |
- Return values
-
| result::ok | The flags were raised. |
| EINVAL | The mask is zero. |
| ENOTRECOVERABLE | Raise failed. |
Definition at line 33 of file os-flags.cpp.
34 {
36
37 assert (port::interrupts::is_priority_valid ());
38
39 {
40
41 interrupts::critical_section ics;
42
43 if (oflags != nullptr)
44 {
45 *oflags = flags_mask_;
46 }
47
48#pragma GCC diagnostic push
49#if defined(__clang__)
50#pragma clang diagnostic ignored "-Wdeprecated-volatile"
51#elif defined(__GNUC__)
52#pragma GCC diagnostic ignored "-Wvolatile"
53#endif
55#pragma GCC diagnostic pop
56
57
58 }
60 }
References mask(), os::rtos::result::ok, and os_assert_err.
The documentation for this class was generated from the following files: