RTC auf true
rtos/Thread.h@0:38ceb79fef03, 2018-11-28 (annotated)
- Committer:
- kevman
- Date:
- Wed Nov 28 15:10:15 2018 +0000
- Revision:
- 0:38ceb79fef03
RTC modified
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
kevman | 0:38ceb79fef03 | 1 | /* mbed Microcontroller Library |
kevman | 0:38ceb79fef03 | 2 | * Copyright (c) 2006-2012 ARM Limited |
kevman | 0:38ceb79fef03 | 3 | * |
kevman | 0:38ceb79fef03 | 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
kevman | 0:38ceb79fef03 | 5 | * of this software and associated documentation files (the "Software"), to deal |
kevman | 0:38ceb79fef03 | 6 | * in the Software without restriction, including without limitation the rights |
kevman | 0:38ceb79fef03 | 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
kevman | 0:38ceb79fef03 | 8 | * copies of the Software, and to permit persons to whom the Software is |
kevman | 0:38ceb79fef03 | 9 | * furnished to do so, subject to the following conditions: |
kevman | 0:38ceb79fef03 | 10 | * |
kevman | 0:38ceb79fef03 | 11 | * The above copyright notice and this permission notice shall be included in |
kevman | 0:38ceb79fef03 | 12 | * all copies or substantial portions of the Software. |
kevman | 0:38ceb79fef03 | 13 | * |
kevman | 0:38ceb79fef03 | 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
kevman | 0:38ceb79fef03 | 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
kevman | 0:38ceb79fef03 | 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
kevman | 0:38ceb79fef03 | 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
kevman | 0:38ceb79fef03 | 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
kevman | 0:38ceb79fef03 | 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
kevman | 0:38ceb79fef03 | 20 | * SOFTWARE. |
kevman | 0:38ceb79fef03 | 21 | */ |
kevman | 0:38ceb79fef03 | 22 | #ifndef THREAD_H |
kevman | 0:38ceb79fef03 | 23 | #define THREAD_H |
kevman | 0:38ceb79fef03 | 24 | |
kevman | 0:38ceb79fef03 | 25 | #include <stdint.h> |
kevman | 0:38ceb79fef03 | 26 | #include "cmsis_os2.h" |
kevman | 0:38ceb79fef03 | 27 | #include "mbed_rtos1_types.h" |
kevman | 0:38ceb79fef03 | 28 | #include "mbed_rtos_storage.h" |
kevman | 0:38ceb79fef03 | 29 | #include "platform/Callback.h" |
kevman | 0:38ceb79fef03 | 30 | #include "platform/mbed_toolchain.h" |
kevman | 0:38ceb79fef03 | 31 | #include "platform/NonCopyable.h" |
kevman | 0:38ceb79fef03 | 32 | #include "rtos/Semaphore.h" |
kevman | 0:38ceb79fef03 | 33 | #include "rtos/Mutex.h" |
kevman | 0:38ceb79fef03 | 34 | |
kevman | 0:38ceb79fef03 | 35 | namespace rtos { |
kevman | 0:38ceb79fef03 | 36 | /** \addtogroup rtos */ |
kevman | 0:38ceb79fef03 | 37 | /** @{*/ |
kevman | 0:38ceb79fef03 | 38 | /** |
kevman | 0:38ceb79fef03 | 39 | * \defgroup rtos_Thread Thread class |
kevman | 0:38ceb79fef03 | 40 | * @{ |
kevman | 0:38ceb79fef03 | 41 | */ |
kevman | 0:38ceb79fef03 | 42 | |
kevman | 0:38ceb79fef03 | 43 | /** The Thread class allow defining, creating, and controlling thread functions in the system. |
kevman | 0:38ceb79fef03 | 44 | * |
kevman | 0:38ceb79fef03 | 45 | * Example: |
kevman | 0:38ceb79fef03 | 46 | * @code |
kevman | 0:38ceb79fef03 | 47 | * #include "mbed.h" |
kevman | 0:38ceb79fef03 | 48 | * #include "rtos.h" |
kevman | 0:38ceb79fef03 | 49 | * |
kevman | 0:38ceb79fef03 | 50 | * Thread thread; |
kevman | 0:38ceb79fef03 | 51 | * DigitalOut led1(LED1); |
kevman | 0:38ceb79fef03 | 52 | * volatile bool running = true; |
kevman | 0:38ceb79fef03 | 53 | * |
kevman | 0:38ceb79fef03 | 54 | * // Blink function toggles the led in a long running loop |
kevman | 0:38ceb79fef03 | 55 | * void blink(DigitalOut *led) { |
kevman | 0:38ceb79fef03 | 56 | * while (running) { |
kevman | 0:38ceb79fef03 | 57 | * *led = !*led; |
kevman | 0:38ceb79fef03 | 58 | * wait(1); |
kevman | 0:38ceb79fef03 | 59 | * } |
kevman | 0:38ceb79fef03 | 60 | * } |
kevman | 0:38ceb79fef03 | 61 | * |
kevman | 0:38ceb79fef03 | 62 | * // Spawns a thread to run blink for 5 seconds |
kevman | 0:38ceb79fef03 | 63 | * int main() { |
kevman | 0:38ceb79fef03 | 64 | * thread.start(callback(blink, &led1)); |
kevman | 0:38ceb79fef03 | 65 | * wait(5); |
kevman | 0:38ceb79fef03 | 66 | * running = false; |
kevman | 0:38ceb79fef03 | 67 | * thread.join(); |
kevman | 0:38ceb79fef03 | 68 | * } |
kevman | 0:38ceb79fef03 | 69 | * @endcode |
kevman | 0:38ceb79fef03 | 70 | * |
kevman | 0:38ceb79fef03 | 71 | * @note |
kevman | 0:38ceb79fef03 | 72 | * Memory considerations: The thread control structures will be created on current thread's stack, both for the mbed OS |
kevman | 0:38ceb79fef03 | 73 | * and underlying RTOS objects (static or dynamic RTOS memory pools are not being used). |
kevman | 0:38ceb79fef03 | 74 | * Additionally the stack memory for this thread will be allocated on the heap, if it wasn't supplied to the constructor. |
kevman | 0:38ceb79fef03 | 75 | * |
kevman | 0:38ceb79fef03 | 76 | * @note |
kevman | 0:38ceb79fef03 | 77 | * MBED_TZ_DEFAULT_ACCESS (default:0) flag can be used to change the default access of all user threads in non-secure mode. |
kevman | 0:38ceb79fef03 | 78 | * MBED_TZ_DEFAULT_ACCESS set to 1, means all non-secure user threads have access to call secure functions. |
kevman | 0:38ceb79fef03 | 79 | * MBED_TZ_DEFAULT_ACCESS set to 0, means none of the non-secure user thread have access to call secure functions, |
kevman | 0:38ceb79fef03 | 80 | * to give access to particular thread used overloaded constructor with `tz_module` as argument during thread creation. |
kevman | 0:38ceb79fef03 | 81 | * |
kevman | 0:38ceb79fef03 | 82 | * MBED_TZ_DEFAULT_ACCESS is target specific define, should be set in targets.json file for Cortex-M23/M33 devices. |
kevman | 0:38ceb79fef03 | 83 | */ |
kevman | 0:38ceb79fef03 | 84 | |
kevman | 0:38ceb79fef03 | 85 | class Thread : private mbed::NonCopyable<Thread> { |
kevman | 0:38ceb79fef03 | 86 | public: |
kevman | 0:38ceb79fef03 | 87 | /** Allocate a new thread without starting execution |
kevman | 0:38ceb79fef03 | 88 | @param priority initial priority of the thread function. (default: osPriorityNormal). |
kevman | 0:38ceb79fef03 | 89 | @param stack_size stack size (in bytes) requirements for the thread function. (default: OS_STACK_SIZE). |
kevman | 0:38ceb79fef03 | 90 | @param stack_mem pointer to the stack area to be used by this thread (default: NULL). |
kevman | 0:38ceb79fef03 | 91 | @param name name to be used for this thread. It has to stay allocated for the lifetime of the thread (default: NULL) |
kevman | 0:38ceb79fef03 | 92 | |
kevman | 0:38ceb79fef03 | 93 | @note Default value of tz_module will be MBED_TZ_DEFAULT_ACCESS |
kevman | 0:38ceb79fef03 | 94 | @note You cannot call this function from ISR context. |
kevman | 0:38ceb79fef03 | 95 | */ |
kevman | 0:38ceb79fef03 | 96 | |
kevman | 0:38ceb79fef03 | 97 | Thread(osPriority priority = osPriorityNormal, |
kevman | 0:38ceb79fef03 | 98 | uint32_t stack_size = OS_STACK_SIZE, |
kevman | 0:38ceb79fef03 | 99 | unsigned char *stack_mem = NULL, const char *name = NULL) |
kevman | 0:38ceb79fef03 | 100 | { |
kevman | 0:38ceb79fef03 | 101 | constructor(priority, stack_size, stack_mem, name); |
kevman | 0:38ceb79fef03 | 102 | } |
kevman | 0:38ceb79fef03 | 103 | |
kevman | 0:38ceb79fef03 | 104 | /** Allocate a new thread without starting execution |
kevman | 0:38ceb79fef03 | 105 | @param tz_module trustzone thread identifier (osThreadAttr_t::tz_module) |
kevman | 0:38ceb79fef03 | 106 | Context of RTOS threads in non-secure state must be saved when calling secure functions. |
kevman | 0:38ceb79fef03 | 107 | tz_module ID is used to allocate context memory for threads, and it can be safely set to zero for |
kevman | 0:38ceb79fef03 | 108 | threads not using secure calls at all. See "TrustZone RTOS Context Management" for more details. |
kevman | 0:38ceb79fef03 | 109 | @param priority initial priority of the thread function. (default: osPriorityNormal). |
kevman | 0:38ceb79fef03 | 110 | @param stack_size stack size (in bytes) requirements for the thread function. (default: OS_STACK_SIZE). |
kevman | 0:38ceb79fef03 | 111 | @param stack_mem pointer to the stack area to be used by this thread (default: NULL). |
kevman | 0:38ceb79fef03 | 112 | @param name name to be used for this thread. It has to stay allocated for the lifetime of the thread (default: NULL) |
kevman | 0:38ceb79fef03 | 113 | |
kevman | 0:38ceb79fef03 | 114 | @note You cannot call this function from ISR context. |
kevman | 0:38ceb79fef03 | 115 | */ |
kevman | 0:38ceb79fef03 | 116 | |
kevman | 0:38ceb79fef03 | 117 | Thread(uint32_t tz_module, osPriority priority = osPriorityNormal, |
kevman | 0:38ceb79fef03 | 118 | uint32_t stack_size = OS_STACK_SIZE, |
kevman | 0:38ceb79fef03 | 119 | unsigned char *stack_mem = NULL, const char *name = NULL) |
kevman | 0:38ceb79fef03 | 120 | { |
kevman | 0:38ceb79fef03 | 121 | constructor(tz_module, priority, stack_size, stack_mem, name); |
kevman | 0:38ceb79fef03 | 122 | } |
kevman | 0:38ceb79fef03 | 123 | |
kevman | 0:38ceb79fef03 | 124 | |
kevman | 0:38ceb79fef03 | 125 | /** Create a new thread, and start it executing the specified function. |
kevman | 0:38ceb79fef03 | 126 | @param task function to be executed by this thread. |
kevman | 0:38ceb79fef03 | 127 | @param priority initial priority of the thread function. (default: osPriorityNormal). |
kevman | 0:38ceb79fef03 | 128 | @param stack_size stack size (in bytes) requirements for the thread function. (default: OS_STACK_SIZE). |
kevman | 0:38ceb79fef03 | 129 | @param stack_mem pointer to the stack area to be used by this thread (default: NULL). |
kevman | 0:38ceb79fef03 | 130 | @deprecated |
kevman | 0:38ceb79fef03 | 131 | Thread-spawning constructors hide errors. Replaced by thread.start(task). |
kevman | 0:38ceb79fef03 | 132 | |
kevman | 0:38ceb79fef03 | 133 | @code |
kevman | 0:38ceb79fef03 | 134 | Thread thread(priority, stack_size, stack_mem); |
kevman | 0:38ceb79fef03 | 135 | |
kevman | 0:38ceb79fef03 | 136 | osStatus status = thread.start(task); |
kevman | 0:38ceb79fef03 | 137 | if (status != osOK) { |
kevman | 0:38ceb79fef03 | 138 | error("oh no!"); |
kevman | 0:38ceb79fef03 | 139 | } |
kevman | 0:38ceb79fef03 | 140 | @endcode |
kevman | 0:38ceb79fef03 | 141 | |
kevman | 0:38ceb79fef03 | 142 | @note You cannot call this function from ISR context. |
kevman | 0:38ceb79fef03 | 143 | */ |
kevman | 0:38ceb79fef03 | 144 | MBED_DEPRECATED_SINCE("mbed-os-5.1", |
kevman | 0:38ceb79fef03 | 145 | "Thread-spawning constructors hide errors. " |
kevman | 0:38ceb79fef03 | 146 | "Replaced by thread.start(task).") |
kevman | 0:38ceb79fef03 | 147 | Thread(mbed::Callback<void()> task, |
kevman | 0:38ceb79fef03 | 148 | osPriority priority = osPriorityNormal, |
kevman | 0:38ceb79fef03 | 149 | uint32_t stack_size = OS_STACK_SIZE, |
kevman | 0:38ceb79fef03 | 150 | unsigned char *stack_mem = NULL) |
kevman | 0:38ceb79fef03 | 151 | { |
kevman | 0:38ceb79fef03 | 152 | constructor(task, priority, stack_size, stack_mem); |
kevman | 0:38ceb79fef03 | 153 | } |
kevman | 0:38ceb79fef03 | 154 | |
kevman | 0:38ceb79fef03 | 155 | /** Create a new thread, and start it executing the specified function. |
kevman | 0:38ceb79fef03 | 156 | @param argument pointer that is passed to the thread function as start argument. (default: NULL). |
kevman | 0:38ceb79fef03 | 157 | @param task argument to task. |
kevman | 0:38ceb79fef03 | 158 | @param priority initial priority of the thread function. (default: osPriorityNormal). |
kevman | 0:38ceb79fef03 | 159 | @param stack_size stack size (in bytes) requirements for the thread function. (default: OS_STACK_SIZE). |
kevman | 0:38ceb79fef03 | 160 | @param stack_mem pointer to the stack area to be used by this thread (default: NULL). |
kevman | 0:38ceb79fef03 | 161 | @deprecated |
kevman | 0:38ceb79fef03 | 162 | Thread-spawning constructors hide errors. Replaced by thread.start(callback(task, argument)). |
kevman | 0:38ceb79fef03 | 163 | |
kevman | 0:38ceb79fef03 | 164 | @code |
kevman | 0:38ceb79fef03 | 165 | Thread thread(priority, stack_size, stack_mem); |
kevman | 0:38ceb79fef03 | 166 | |
kevman | 0:38ceb79fef03 | 167 | osStatus status = thread.start(callback(task, argument)); |
kevman | 0:38ceb79fef03 | 168 | if (status != osOK) { |
kevman | 0:38ceb79fef03 | 169 | error("oh no!"); |
kevman | 0:38ceb79fef03 | 170 | } |
kevman | 0:38ceb79fef03 | 171 | @endcode |
kevman | 0:38ceb79fef03 | 172 | |
kevman | 0:38ceb79fef03 | 173 | @note You cannot call this function from ISR context. |
kevman | 0:38ceb79fef03 | 174 | */ |
kevman | 0:38ceb79fef03 | 175 | template <typename T> |
kevman | 0:38ceb79fef03 | 176 | MBED_DEPRECATED_SINCE("mbed-os-5.1", |
kevman | 0:38ceb79fef03 | 177 | "Thread-spawning constructors hide errors. " |
kevman | 0:38ceb79fef03 | 178 | "Replaced by thread.start(callback(task, argument)).") |
kevman | 0:38ceb79fef03 | 179 | Thread(T *argument, void (T::*task)(), |
kevman | 0:38ceb79fef03 | 180 | osPriority priority = osPriorityNormal, |
kevman | 0:38ceb79fef03 | 181 | uint32_t stack_size = OS_STACK_SIZE, |
kevman | 0:38ceb79fef03 | 182 | unsigned char *stack_mem = NULL) |
kevman | 0:38ceb79fef03 | 183 | { |
kevman | 0:38ceb79fef03 | 184 | constructor(mbed::callback(task, argument), |
kevman | 0:38ceb79fef03 | 185 | priority, stack_size, stack_mem); |
kevman | 0:38ceb79fef03 | 186 | } |
kevman | 0:38ceb79fef03 | 187 | |
kevman | 0:38ceb79fef03 | 188 | /** Create a new thread, and start it executing the specified function. |
kevman | 0:38ceb79fef03 | 189 | @param argument pointer that is passed to the thread function as start argument. (default: NULL). |
kevman | 0:38ceb79fef03 | 190 | @param task argument to task. |
kevman | 0:38ceb79fef03 | 191 | @param priority initial priority of the thread function. (default: osPriorityNormal). |
kevman | 0:38ceb79fef03 | 192 | @param stack_size stack size (in bytes) requirements for the thread function. (default: OS_STACK_SIZE). |
kevman | 0:38ceb79fef03 | 193 | @param stack_mem pointer to the stack area to be used by this thread (default: NULL). |
kevman | 0:38ceb79fef03 | 194 | @deprecated |
kevman | 0:38ceb79fef03 | 195 | Thread-spawning constructors hide errors. Replaced by thread.start(callback(task, argument)). |
kevman | 0:38ceb79fef03 | 196 | |
kevman | 0:38ceb79fef03 | 197 | @code |
kevman | 0:38ceb79fef03 | 198 | Thread thread(priority, stack_size, stack_mem); |
kevman | 0:38ceb79fef03 | 199 | |
kevman | 0:38ceb79fef03 | 200 | osStatus status = thread.start(callback(task, argument)); |
kevman | 0:38ceb79fef03 | 201 | if (status != osOK) { |
kevman | 0:38ceb79fef03 | 202 | error("oh no!"); |
kevman | 0:38ceb79fef03 | 203 | } |
kevman | 0:38ceb79fef03 | 204 | @endcode |
kevman | 0:38ceb79fef03 | 205 | |
kevman | 0:38ceb79fef03 | 206 | @note You cannot call this function from ISR context. |
kevman | 0:38ceb79fef03 | 207 | */ |
kevman | 0:38ceb79fef03 | 208 | template <typename T> |
kevman | 0:38ceb79fef03 | 209 | MBED_DEPRECATED_SINCE("mbed-os-5.1", |
kevman | 0:38ceb79fef03 | 210 | "Thread-spawning constructors hide errors. " |
kevman | 0:38ceb79fef03 | 211 | "Replaced by thread.start(callback(task, argument)).") |
kevman | 0:38ceb79fef03 | 212 | Thread(T *argument, void (*task)(T *), |
kevman | 0:38ceb79fef03 | 213 | osPriority priority = osPriorityNormal, |
kevman | 0:38ceb79fef03 | 214 | uint32_t stack_size = OS_STACK_SIZE, |
kevman | 0:38ceb79fef03 | 215 | unsigned char *stack_mem = NULL) |
kevman | 0:38ceb79fef03 | 216 | { |
kevman | 0:38ceb79fef03 | 217 | constructor(mbed::callback(task, argument), |
kevman | 0:38ceb79fef03 | 218 | priority, stack_size, stack_mem); |
kevman | 0:38ceb79fef03 | 219 | } |
kevman | 0:38ceb79fef03 | 220 | |
kevman | 0:38ceb79fef03 | 221 | /** Create a new thread, and start it executing the specified function. |
kevman | 0:38ceb79fef03 | 222 | Provided for backwards compatibility |
kevman | 0:38ceb79fef03 | 223 | @param task function to be executed by this thread. |
kevman | 0:38ceb79fef03 | 224 | @param argument pointer that is passed to the thread function as start argument. (default: NULL). |
kevman | 0:38ceb79fef03 | 225 | @param priority initial priority of the thread function. (default: osPriorityNormal). |
kevman | 0:38ceb79fef03 | 226 | @param stack_size stack size (in bytes) requirements for the thread function. (default: OS_STACK_SIZE). |
kevman | 0:38ceb79fef03 | 227 | @param stack_mem pointer to the stack area to be used by this thread (default: NULL). |
kevman | 0:38ceb79fef03 | 228 | @deprecated |
kevman | 0:38ceb79fef03 | 229 | Thread-spawning constructors hide errors. Replaced by thread.start(callback(task, argument)). |
kevman | 0:38ceb79fef03 | 230 | |
kevman | 0:38ceb79fef03 | 231 | @code |
kevman | 0:38ceb79fef03 | 232 | Thread thread(priority, stack_size, stack_mem); |
kevman | 0:38ceb79fef03 | 233 | |
kevman | 0:38ceb79fef03 | 234 | osStatus status = thread.start(callback(task, argument)); |
kevman | 0:38ceb79fef03 | 235 | if (status != osOK) { |
kevman | 0:38ceb79fef03 | 236 | error("oh no!"); |
kevman | 0:38ceb79fef03 | 237 | } |
kevman | 0:38ceb79fef03 | 238 | @endcode |
kevman | 0:38ceb79fef03 | 239 | |
kevman | 0:38ceb79fef03 | 240 | @note You cannot call this function from ISR context. |
kevman | 0:38ceb79fef03 | 241 | */ |
kevman | 0:38ceb79fef03 | 242 | MBED_DEPRECATED_SINCE("mbed-os-5.1", |
kevman | 0:38ceb79fef03 | 243 | "Thread-spawning constructors hide errors. " |
kevman | 0:38ceb79fef03 | 244 | "Replaced by thread.start(callback(task, argument)).") |
kevman | 0:38ceb79fef03 | 245 | Thread(void (*task)(void const *argument), void *argument = NULL, |
kevman | 0:38ceb79fef03 | 246 | osPriority priority = osPriorityNormal, |
kevman | 0:38ceb79fef03 | 247 | uint32_t stack_size = OS_STACK_SIZE, |
kevman | 0:38ceb79fef03 | 248 | unsigned char *stack_mem = NULL) |
kevman | 0:38ceb79fef03 | 249 | { |
kevman | 0:38ceb79fef03 | 250 | constructor(mbed::callback((void (*)(void *))task, argument), |
kevman | 0:38ceb79fef03 | 251 | priority, stack_size, stack_mem); |
kevman | 0:38ceb79fef03 | 252 | } |
kevman | 0:38ceb79fef03 | 253 | |
kevman | 0:38ceb79fef03 | 254 | /** Starts a thread executing the specified function. |
kevman | 0:38ceb79fef03 | 255 | @param task function to be executed by this thread. |
kevman | 0:38ceb79fef03 | 256 | @return status code that indicates the execution status of the function. |
kevman | 0:38ceb79fef03 | 257 | @note a thread can only be started once |
kevman | 0:38ceb79fef03 | 258 | |
kevman | 0:38ceb79fef03 | 259 | @note You cannot call this function ISR context. |
kevman | 0:38ceb79fef03 | 260 | */ |
kevman | 0:38ceb79fef03 | 261 | osStatus start(mbed::Callback<void()> task); |
kevman | 0:38ceb79fef03 | 262 | |
kevman | 0:38ceb79fef03 | 263 | /** Starts a thread executing the specified function. |
kevman | 0:38ceb79fef03 | 264 | @param obj argument to task |
kevman | 0:38ceb79fef03 | 265 | @param method function to be executed by this thread. |
kevman | 0:38ceb79fef03 | 266 | @return status code that indicates the execution status of the function. |
kevman | 0:38ceb79fef03 | 267 | @deprecated |
kevman | 0:38ceb79fef03 | 268 | The start function does not support cv-qualifiers. Replaced by start(callback(obj, method)). |
kevman | 0:38ceb79fef03 | 269 | |
kevman | 0:38ceb79fef03 | 270 | @note You cannot call this function from ISR context. |
kevman | 0:38ceb79fef03 | 271 | */ |
kevman | 0:38ceb79fef03 | 272 | template <typename T, typename M> |
kevman | 0:38ceb79fef03 | 273 | MBED_DEPRECATED_SINCE("mbed-os-5.1", |
kevman | 0:38ceb79fef03 | 274 | "The start function does not support cv-qualifiers. " |
kevman | 0:38ceb79fef03 | 275 | "Replaced by thread.start(callback(obj, method)).") |
kevman | 0:38ceb79fef03 | 276 | osStatus start(T *obj, M method) |
kevman | 0:38ceb79fef03 | 277 | { |
kevman | 0:38ceb79fef03 | 278 | return start(mbed::callback(obj, method)); |
kevman | 0:38ceb79fef03 | 279 | } |
kevman | 0:38ceb79fef03 | 280 | |
kevman | 0:38ceb79fef03 | 281 | /** Wait for thread to terminate |
kevman | 0:38ceb79fef03 | 282 | @return status code that indicates the execution status of the function. |
kevman | 0:38ceb79fef03 | 283 | |
kevman | 0:38ceb79fef03 | 284 | @note You cannot call this function from ISR context. |
kevman | 0:38ceb79fef03 | 285 | */ |
kevman | 0:38ceb79fef03 | 286 | osStatus join(); |
kevman | 0:38ceb79fef03 | 287 | |
kevman | 0:38ceb79fef03 | 288 | /** Terminate execution of a thread and remove it from Active Threads |
kevman | 0:38ceb79fef03 | 289 | @return status code that indicates the execution status of the function. |
kevman | 0:38ceb79fef03 | 290 | |
kevman | 0:38ceb79fef03 | 291 | @note You cannot call this function from ISR context. |
kevman | 0:38ceb79fef03 | 292 | */ |
kevman | 0:38ceb79fef03 | 293 | osStatus terminate(); |
kevman | 0:38ceb79fef03 | 294 | |
kevman | 0:38ceb79fef03 | 295 | /** Set priority of an active thread |
kevman | 0:38ceb79fef03 | 296 | @param priority new priority value for the thread function. |
kevman | 0:38ceb79fef03 | 297 | @return status code that indicates the execution status of the function. |
kevman | 0:38ceb79fef03 | 298 | |
kevman | 0:38ceb79fef03 | 299 | @note You cannot call this function from ISR context. |
kevman | 0:38ceb79fef03 | 300 | */ |
kevman | 0:38ceb79fef03 | 301 | osStatus set_priority(osPriority priority); |
kevman | 0:38ceb79fef03 | 302 | |
kevman | 0:38ceb79fef03 | 303 | /** Get priority of an active thread |
kevman | 0:38ceb79fef03 | 304 | @return current priority value of the thread function. |
kevman | 0:38ceb79fef03 | 305 | |
kevman | 0:38ceb79fef03 | 306 | @note You cannot call this function from ISR context. |
kevman | 0:38ceb79fef03 | 307 | */ |
kevman | 0:38ceb79fef03 | 308 | osPriority get_priority() const; |
kevman | 0:38ceb79fef03 | 309 | |
kevman | 0:38ceb79fef03 | 310 | /** Set the specified Thread Flags for the thread. |
kevman | 0:38ceb79fef03 | 311 | @param flags specifies the flags of the thread that should be set. |
kevman | 0:38ceb79fef03 | 312 | @return thread flags after setting or osFlagsError in case of incorrect parameters. |
kevman | 0:38ceb79fef03 | 313 | |
kevman | 0:38ceb79fef03 | 314 | @note You may call this function from ISR context. |
kevman | 0:38ceb79fef03 | 315 | */ |
kevman | 0:38ceb79fef03 | 316 | uint32_t flags_set(uint32_t flags); |
kevman | 0:38ceb79fef03 | 317 | |
kevman | 0:38ceb79fef03 | 318 | /** Set the specified Thread Flags for the thread. |
kevman | 0:38ceb79fef03 | 319 | @param signals specifies the signal flags of the thread that should be set. |
kevman | 0:38ceb79fef03 | 320 | @return signal flags after setting or osFlagsError in case of incorrect parameters. |
kevman | 0:38ceb79fef03 | 321 | |
kevman | 0:38ceb79fef03 | 322 | @note You may call this function from ISR context. |
kevman | 0:38ceb79fef03 | 323 | @deprecated Other signal_xxx methods have been deprecated in favour of ThisThread::flags functions. |
kevman | 0:38ceb79fef03 | 324 | To match this naming scheme, derived from CMSIS-RTOS2, Thread::flags_set is now provided. |
kevman | 0:38ceb79fef03 | 325 | */ |
kevman | 0:38ceb79fef03 | 326 | MBED_DEPRECATED_SINCE("mbed-os-5.10", |
kevman | 0:38ceb79fef03 | 327 | "Other signal_xxx methods have been deprecated in favour of ThisThread::flags functions. " |
kevman | 0:38ceb79fef03 | 328 | "To match this naming scheme, derived from CMSIS-RTOS2, Thread::flags_set is now provided.") |
kevman | 0:38ceb79fef03 | 329 | int32_t signal_set(int32_t signals); |
kevman | 0:38ceb79fef03 | 330 | |
kevman | 0:38ceb79fef03 | 331 | /** State of the Thread */ |
kevman | 0:38ceb79fef03 | 332 | enum State { |
kevman | 0:38ceb79fef03 | 333 | Inactive, /**< NOT USED */ |
kevman | 0:38ceb79fef03 | 334 | Ready, /**< Ready to run */ |
kevman | 0:38ceb79fef03 | 335 | Running, /**< Running */ |
kevman | 0:38ceb79fef03 | 336 | WaitingDelay, /**< Waiting for a delay to occur */ |
kevman | 0:38ceb79fef03 | 337 | WaitingJoin, /**< Waiting for thread to join. Only happens when using RTX directly. */ |
kevman | 0:38ceb79fef03 | 338 | WaitingThreadFlag, /**< Waiting for a thread flag to be set */ |
kevman | 0:38ceb79fef03 | 339 | WaitingEventFlag, /**< Waiting for a event flag to be set */ |
kevman | 0:38ceb79fef03 | 340 | WaitingMutex, /**< Waiting for a mutex event to occur */ |
kevman | 0:38ceb79fef03 | 341 | WaitingSemaphore, /**< Waiting for a semaphore event to occur */ |
kevman | 0:38ceb79fef03 | 342 | WaitingMemoryPool, /**< Waiting for a memory pool */ |
kevman | 0:38ceb79fef03 | 343 | WaitingMessageGet, /**< Waiting for message to arrive */ |
kevman | 0:38ceb79fef03 | 344 | WaitingMessagePut, /**< Waiting for message to be send */ |
kevman | 0:38ceb79fef03 | 345 | WaitingInterval, /**< NOT USED */ |
kevman | 0:38ceb79fef03 | 346 | WaitingOr, /**< NOT USED */ |
kevman | 0:38ceb79fef03 | 347 | WaitingAnd, /**< NOT USED */ |
kevman | 0:38ceb79fef03 | 348 | WaitingMailbox, /**< NOT USED (Mail is implemented as MemoryPool and Queue) */ |
kevman | 0:38ceb79fef03 | 349 | |
kevman | 0:38ceb79fef03 | 350 | /* Not in sync with RTX below here */ |
kevman | 0:38ceb79fef03 | 351 | Deleted, /**< The task has been deleted or not started */ |
kevman | 0:38ceb79fef03 | 352 | }; |
kevman | 0:38ceb79fef03 | 353 | |
kevman | 0:38ceb79fef03 | 354 | /** State of this Thread |
kevman | 0:38ceb79fef03 | 355 | @return the State of this Thread |
kevman | 0:38ceb79fef03 | 356 | |
kevman | 0:38ceb79fef03 | 357 | @note You cannot call this function from ISR context. |
kevman | 0:38ceb79fef03 | 358 | */ |
kevman | 0:38ceb79fef03 | 359 | State get_state() const; |
kevman | 0:38ceb79fef03 | 360 | |
kevman | 0:38ceb79fef03 | 361 | /** Get the total stack memory size for this Thread |
kevman | 0:38ceb79fef03 | 362 | @return the total stack memory size in bytes |
kevman | 0:38ceb79fef03 | 363 | |
kevman | 0:38ceb79fef03 | 364 | @note You cannot call this function from ISR context. |
kevman | 0:38ceb79fef03 | 365 | */ |
kevman | 0:38ceb79fef03 | 366 | uint32_t stack_size() const; |
kevman | 0:38ceb79fef03 | 367 | |
kevman | 0:38ceb79fef03 | 368 | /** Get the currently unused stack memory for this Thread |
kevman | 0:38ceb79fef03 | 369 | @return the currently unused stack memory in bytes |
kevman | 0:38ceb79fef03 | 370 | |
kevman | 0:38ceb79fef03 | 371 | @note You cannot call this function from ISR context. |
kevman | 0:38ceb79fef03 | 372 | */ |
kevman | 0:38ceb79fef03 | 373 | uint32_t free_stack() const; |
kevman | 0:38ceb79fef03 | 374 | |
kevman | 0:38ceb79fef03 | 375 | /** Get the currently used stack memory for this Thread |
kevman | 0:38ceb79fef03 | 376 | @return the currently used stack memory in bytes |
kevman | 0:38ceb79fef03 | 377 | |
kevman | 0:38ceb79fef03 | 378 | @note You cannot call this function from ISR context. |
kevman | 0:38ceb79fef03 | 379 | */ |
kevman | 0:38ceb79fef03 | 380 | uint32_t used_stack() const; |
kevman | 0:38ceb79fef03 | 381 | |
kevman | 0:38ceb79fef03 | 382 | /** Get the maximum stack memory usage to date for this Thread |
kevman | 0:38ceb79fef03 | 383 | @return the maximum stack memory usage to date in bytes |
kevman | 0:38ceb79fef03 | 384 | |
kevman | 0:38ceb79fef03 | 385 | @note You cannot call this function from ISR context. |
kevman | 0:38ceb79fef03 | 386 | */ |
kevman | 0:38ceb79fef03 | 387 | uint32_t max_stack() const; |
kevman | 0:38ceb79fef03 | 388 | |
kevman | 0:38ceb79fef03 | 389 | /** Get thread name |
kevman | 0:38ceb79fef03 | 390 | @return thread name or NULL if the name was not set. |
kevman | 0:38ceb79fef03 | 391 | |
kevman | 0:38ceb79fef03 | 392 | @note You may call this function from ISR context. |
kevman | 0:38ceb79fef03 | 393 | */ |
kevman | 0:38ceb79fef03 | 394 | const char *get_name() const; |
kevman | 0:38ceb79fef03 | 395 | |
kevman | 0:38ceb79fef03 | 396 | /** Get thread id |
kevman | 0:38ceb79fef03 | 397 | @return thread ID for reference by other functions. |
kevman | 0:38ceb79fef03 | 398 | |
kevman | 0:38ceb79fef03 | 399 | @note You may call this function from ISR context. |
kevman | 0:38ceb79fef03 | 400 | */ |
kevman | 0:38ceb79fef03 | 401 | osThreadId_t get_id() const; |
kevman | 0:38ceb79fef03 | 402 | |
kevman | 0:38ceb79fef03 | 403 | /** Clears the specified Thread Flags of the currently running thread. |
kevman | 0:38ceb79fef03 | 404 | @param signals specifies the signal flags of the thread that should be cleared. |
kevman | 0:38ceb79fef03 | 405 | @return signal flags before clearing or osFlagsError in case of incorrect parameters. |
kevman | 0:38ceb79fef03 | 406 | |
kevman | 0:38ceb79fef03 | 407 | @note You cannot call this function from ISR context. |
kevman | 0:38ceb79fef03 | 408 | @deprecated Static methods only affecting current thread cause confusion. Replaced by ThisThread::flags_clear. |
kevman | 0:38ceb79fef03 | 409 | */ |
kevman | 0:38ceb79fef03 | 410 | MBED_DEPRECATED_SINCE("mbed-os-5.10", |
kevman | 0:38ceb79fef03 | 411 | "Static methods only affecting current thread cause confusion. " |
kevman | 0:38ceb79fef03 | 412 | "Replaced by ThisThread::flags_clear.") |
kevman | 0:38ceb79fef03 | 413 | static int32_t signal_clr(int32_t signals); |
kevman | 0:38ceb79fef03 | 414 | |
kevman | 0:38ceb79fef03 | 415 | /** Wait for one or more Thread Flags to become signaled for the current RUNNING thread. |
kevman | 0:38ceb79fef03 | 416 | @param signals wait until all specified signal flags are set or 0 for any single signal flag. |
kevman | 0:38ceb79fef03 | 417 | @param millisec timeout value or 0 in case of no time-out. (default: osWaitForever). |
kevman | 0:38ceb79fef03 | 418 | @return event flag information or error code. @note if @a millisec is set to 0 and flag is no set the event carries osOK value. |
kevman | 0:38ceb79fef03 | 419 | |
kevman | 0:38ceb79fef03 | 420 | @note You cannot call this function from ISR context. |
kevman | 0:38ceb79fef03 | 421 | @deprecated Static methods only affecting current thread cause confusion. |
kevman | 0:38ceb79fef03 | 422 | Replaced by ThisThread::flags_wait_all, ThisThread::flags_wait_all_for, ThisThread::flags_wait_any and ThisThread:wait_any_for. |
kevman | 0:38ceb79fef03 | 423 | */ |
kevman | 0:38ceb79fef03 | 424 | MBED_DEPRECATED_SINCE("mbed-os-5.10", |
kevman | 0:38ceb79fef03 | 425 | "Static methods only affecting current thread cause confusion. " |
kevman | 0:38ceb79fef03 | 426 | "Replaced by ThisThread::flags_wait_all, ThisThread::flags_wait_all_for, ThisThread::flags_wait_any and ThisThread:wait_any_for.") |
kevman | 0:38ceb79fef03 | 427 | static osEvent signal_wait(int32_t signals, uint32_t millisec = osWaitForever); |
kevman | 0:38ceb79fef03 | 428 | |
kevman | 0:38ceb79fef03 | 429 | /** Wait for a specified time period in milliseconds |
kevman | 0:38ceb79fef03 | 430 | Being tick-based, the delay will be up to the specified time - eg for |
kevman | 0:38ceb79fef03 | 431 | a value of 1 the system waits until the next millisecond tick occurs, |
kevman | 0:38ceb79fef03 | 432 | leading to a delay of 0-1 milliseconds. |
kevman | 0:38ceb79fef03 | 433 | @param millisec time delay value |
kevman | 0:38ceb79fef03 | 434 | @return status code that indicates the execution status of the function. |
kevman | 0:38ceb79fef03 | 435 | |
kevman | 0:38ceb79fef03 | 436 | @note You cannot call this function from ISR context. |
kevman | 0:38ceb79fef03 | 437 | @deprecated Static methods only affecting current thread cause confusion. Replaced by ThisThread::sleep_for. |
kevman | 0:38ceb79fef03 | 438 | */ |
kevman | 0:38ceb79fef03 | 439 | MBED_DEPRECATED_SINCE("mbed-os-5.10", |
kevman | 0:38ceb79fef03 | 440 | "Static methods only affecting current thread cause confusion. " |
kevman | 0:38ceb79fef03 | 441 | "Replaced by ThisThread::sleep_for.") |
kevman | 0:38ceb79fef03 | 442 | static osStatus wait(uint32_t millisec); |
kevman | 0:38ceb79fef03 | 443 | |
kevman | 0:38ceb79fef03 | 444 | /** Wait until a specified time in millisec |
kevman | 0:38ceb79fef03 | 445 | The specified time is according to Kernel::get_ms_count(). |
kevman | 0:38ceb79fef03 | 446 | @param millisec absolute time in millisec |
kevman | 0:38ceb79fef03 | 447 | @return status code that indicates the execution status of the function. |
kevman | 0:38ceb79fef03 | 448 | @note not callable from interrupt |
kevman | 0:38ceb79fef03 | 449 | @note if millisec is equal to or lower than the current tick count, this |
kevman | 0:38ceb79fef03 | 450 | returns immediately, either with an error or "osOK". |
kevman | 0:38ceb79fef03 | 451 | @note the underlying RTOS may have a limit to the maximum wait time |
kevman | 0:38ceb79fef03 | 452 | due to internal 32-bit computations, but this is guaranteed to work if the |
kevman | 0:38ceb79fef03 | 453 | delay is <= 0x7fffffff milliseconds (~24 days). If the limit is exceeded, |
kevman | 0:38ceb79fef03 | 454 | it may return with an immediate error, or wait for the maximum delay. |
kevman | 0:38ceb79fef03 | 455 | |
kevman | 0:38ceb79fef03 | 456 | @note You cannot call this function from ISR context. |
kevman | 0:38ceb79fef03 | 457 | @deprecated Static methods only affecting current thread cause confusion. Replaced by ThisThread::sleep_until. |
kevman | 0:38ceb79fef03 | 458 | */ |
kevman | 0:38ceb79fef03 | 459 | MBED_DEPRECATED_SINCE("mbed-os-5.10", |
kevman | 0:38ceb79fef03 | 460 | "Static methods only affecting current thread cause confusion. " |
kevman | 0:38ceb79fef03 | 461 | "Replaced by ThisThread::sleep_until.") |
kevman | 0:38ceb79fef03 | 462 | static osStatus wait_until(uint64_t millisec); |
kevman | 0:38ceb79fef03 | 463 | |
kevman | 0:38ceb79fef03 | 464 | /** Pass control to next thread that is in state READY. |
kevman | 0:38ceb79fef03 | 465 | @return status code that indicates the execution status of the function. |
kevman | 0:38ceb79fef03 | 466 | |
kevman | 0:38ceb79fef03 | 467 | @note You cannot call this function from ISR context. |
kevman | 0:38ceb79fef03 | 468 | @deprecated Static methods only affecting current thread cause confusion. Replaced by ThisThread::sleep_until. |
kevman | 0:38ceb79fef03 | 469 | */ |
kevman | 0:38ceb79fef03 | 470 | MBED_DEPRECATED_SINCE("mbed-os-5.10", |
kevman | 0:38ceb79fef03 | 471 | "Static methods only affecting current thread cause confusion. " |
kevman | 0:38ceb79fef03 | 472 | "Replaced by ThisThread::yield.") |
kevman | 0:38ceb79fef03 | 473 | static osStatus yield(); |
kevman | 0:38ceb79fef03 | 474 | |
kevman | 0:38ceb79fef03 | 475 | /** Get the thread id of the current running thread. |
kevman | 0:38ceb79fef03 | 476 | @return thread ID for reference by other functions or NULL in case of error. |
kevman | 0:38ceb79fef03 | 477 | |
kevman | 0:38ceb79fef03 | 478 | @note You may call this function from ISR context. |
kevman | 0:38ceb79fef03 | 479 | @deprecated Static methods only affecting current thread cause confusion. Replaced by ThisThread::get_id. |
kevman | 0:38ceb79fef03 | 480 | Use Thread::get_id for the ID of a specific Thread. |
kevman | 0:38ceb79fef03 | 481 | */ |
kevman | 0:38ceb79fef03 | 482 | MBED_DEPRECATED_SINCE("mbed-os-5.10", |
kevman | 0:38ceb79fef03 | 483 | "Static methods only affecting current thread cause confusion. " |
kevman | 0:38ceb79fef03 | 484 | "Replaced by ThisThread::get_id. Use Thread::get_id for the ID of a specific Thread.") |
kevman | 0:38ceb79fef03 | 485 | static osThreadId gettid(); |
kevman | 0:38ceb79fef03 | 486 | |
kevman | 0:38ceb79fef03 | 487 | /** Attach a function to be called by the RTOS idle task |
kevman | 0:38ceb79fef03 | 488 | @param fptr pointer to the function to be called |
kevman | 0:38ceb79fef03 | 489 | |
kevman | 0:38ceb79fef03 | 490 | @note You may call this function from ISR context. |
kevman | 0:38ceb79fef03 | 491 | @deprecated Static methods affecting system cause confusion. Replaced by Kernel::attach_idle_hook. |
kevman | 0:38ceb79fef03 | 492 | */ |
kevman | 0:38ceb79fef03 | 493 | MBED_DEPRECATED_SINCE("mbed-os-5.10", |
kevman | 0:38ceb79fef03 | 494 | "Static methods affecting system cause confusion. " |
kevman | 0:38ceb79fef03 | 495 | "Replaced by Kernel::attach_idle_hook.") |
kevman | 0:38ceb79fef03 | 496 | static void attach_idle_hook(void (*fptr)(void)); |
kevman | 0:38ceb79fef03 | 497 | |
kevman | 0:38ceb79fef03 | 498 | /** Attach a function to be called when a task is killed |
kevman | 0:38ceb79fef03 | 499 | @param fptr pointer to the function to be called |
kevman | 0:38ceb79fef03 | 500 | |
kevman | 0:38ceb79fef03 | 501 | @note You may call this function from ISR context. |
kevman | 0:38ceb79fef03 | 502 | @deprecated Static methods affecting system cause confusion. Replaced by Kernel::attach_thread_terminate_hook. |
kevman | 0:38ceb79fef03 | 503 | */ |
kevman | 0:38ceb79fef03 | 504 | MBED_DEPRECATED_SINCE("mbed-os-5.10", |
kevman | 0:38ceb79fef03 | 505 | "Static methods affecting system cause confusion. " |
kevman | 0:38ceb79fef03 | 506 | "Replaced by Kernel::attach_thread_terminate_hook.") |
kevman | 0:38ceb79fef03 | 507 | static void attach_terminate_hook(void (*fptr)(osThreadId id)); |
kevman | 0:38ceb79fef03 | 508 | |
kevman | 0:38ceb79fef03 | 509 | /** Thread destructor |
kevman | 0:38ceb79fef03 | 510 | * |
kevman | 0:38ceb79fef03 | 511 | * @note You cannot call this function from ISR context. |
kevman | 0:38ceb79fef03 | 512 | */ |
kevman | 0:38ceb79fef03 | 513 | virtual ~Thread(); |
kevman | 0:38ceb79fef03 | 514 | |
kevman | 0:38ceb79fef03 | 515 | private: |
kevman | 0:38ceb79fef03 | 516 | // Required to share definitions without |
kevman | 0:38ceb79fef03 | 517 | // delegated constructors |
kevman | 0:38ceb79fef03 | 518 | void constructor(osPriority priority = osPriorityNormal, |
kevman | 0:38ceb79fef03 | 519 | uint32_t stack_size = OS_STACK_SIZE, |
kevman | 0:38ceb79fef03 | 520 | unsigned char *stack_mem = NULL, |
kevman | 0:38ceb79fef03 | 521 | const char *name = NULL); |
kevman | 0:38ceb79fef03 | 522 | void constructor(mbed::Callback<void()> task, |
kevman | 0:38ceb79fef03 | 523 | osPriority priority = osPriorityNormal, |
kevman | 0:38ceb79fef03 | 524 | uint32_t stack_size = OS_STACK_SIZE, |
kevman | 0:38ceb79fef03 | 525 | unsigned char *stack_mem = NULL, |
kevman | 0:38ceb79fef03 | 526 | const char *name = NULL); |
kevman | 0:38ceb79fef03 | 527 | void constructor(uint32_t tz_module, |
kevman | 0:38ceb79fef03 | 528 | osPriority priority = osPriorityNormal, |
kevman | 0:38ceb79fef03 | 529 | uint32_t stack_size = OS_STACK_SIZE, |
kevman | 0:38ceb79fef03 | 530 | unsigned char *stack_mem = NULL, |
kevman | 0:38ceb79fef03 | 531 | const char *name = NULL); |
kevman | 0:38ceb79fef03 | 532 | static void _thunk(void *thread_ptr); |
kevman | 0:38ceb79fef03 | 533 | |
kevman | 0:38ceb79fef03 | 534 | mbed::Callback<void()> _task; |
kevman | 0:38ceb79fef03 | 535 | osThreadId_t _tid; |
kevman | 0:38ceb79fef03 | 536 | osThreadAttr_t _attr; |
kevman | 0:38ceb79fef03 | 537 | bool _dynamic_stack; |
kevman | 0:38ceb79fef03 | 538 | Semaphore _join_sem; |
kevman | 0:38ceb79fef03 | 539 | mutable Mutex _mutex; |
kevman | 0:38ceb79fef03 | 540 | mbed_rtos_storage_thread_t _obj_mem; |
kevman | 0:38ceb79fef03 | 541 | bool _finished; |
kevman | 0:38ceb79fef03 | 542 | }; |
kevman | 0:38ceb79fef03 | 543 | /** @}*/ |
kevman | 0:38ceb79fef03 | 544 | /** @}*/ |
kevman | 0:38ceb79fef03 | 545 | } |
kevman | 0:38ceb79fef03 | 546 | #endif |
kevman | 0:38ceb79fef03 | 547 | |
kevman | 0:38ceb79fef03 | 548 |