1c36484f0Sopenharmony_ci/*
2c36484f0Sopenharmony_ci * Copyright (c) 2013-2023 Arm Limited. All rights reserved.
3c36484f0Sopenharmony_ci *
4c36484f0Sopenharmony_ci * SPDX-License-Identifier: Apache-2.0
5c36484f0Sopenharmony_ci *
6c36484f0Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the License); you may
7c36484f0Sopenharmony_ci * not use this file except in compliance with the License.
8c36484f0Sopenharmony_ci * You may obtain a copy of the License at
9c36484f0Sopenharmony_ci *
10c36484f0Sopenharmony_ci * www.apache.org/licenses/LICENSE-2.0
11c36484f0Sopenharmony_ci *
12c36484f0Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
13c36484f0Sopenharmony_ci * distributed under the License is distributed on an AS IS BASIS, WITHOUT
14c36484f0Sopenharmony_ci * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15c36484f0Sopenharmony_ci * See the License for the specific language governing permissions and
16c36484f0Sopenharmony_ci * limitations under the License.
17c36484f0Sopenharmony_ci *
18c36484f0Sopenharmony_ci * ----------------------------------------------------------------------
19c36484f0Sopenharmony_ci *
20c36484f0Sopenharmony_ci * $Date:        30. June 2023
21c36484f0Sopenharmony_ci * $Revision:    V2.3.0
22c36484f0Sopenharmony_ci *
23c36484f0Sopenharmony_ci * Project:      CMSIS-RTOS2 API
24c36484f0Sopenharmony_ci * Title:        cmsis_os2.h header file
25c36484f0Sopenharmony_ci *
26c36484f0Sopenharmony_ci * Version 2.3.0
27c36484f0Sopenharmony_ci *    Added provisional support for processor affinity in SMP systems:
28c36484f0Sopenharmony_ci      - osThreadAttr_t: affinity_mask
29c36484f0Sopenharmony_ci *    - osThreadSetAffinityMask, osThreadGetAffinityMask
30c36484f0Sopenharmony_ci * Version 2.2.0
31c36484f0Sopenharmony_ci *    Added support for Process Isolation (Functional Safety):
32c36484f0Sopenharmony_ci *    - Kernel Management: osKernelProtect, osKernelDestroyClass
33c36484f0Sopenharmony_ci *    - Thread Management: osThreadGetClass, osThreadGetZone,
34c36484f0Sopenharmony_ci *                         osThreadSuspendClass, osThreadResumeClass
35c36484f0Sopenharmony_ci *                         osThreadTerminateZone,
36c36484f0Sopenharmony_ci *                         osThreadFeedWatchdog,
37c36484f0Sopenharmony_ci *                         osThreadProtectPrivileged
38c36484f0Sopenharmony_ci *    - Thread attributes: osThreadZone, osThreadUnprivileged/osThreadPrivileged
39c36484f0Sopenharmony_ci *    - Object attributes: osSafetyClass
40c36484f0Sopenharmony_ci *    - Handler functions: osWatchdogAlarm_Handler
41c36484f0Sopenharmony_ci *    - Zone Management: osZoneSetup_Callback
42c36484f0Sopenharmony_ci *    - Exception Faults: osFaultResume
43c36484f0Sopenharmony_ci *    Additional functions allowed to be called from Interrupt Service Routines:
44c36484f0Sopenharmony_ci *    - osThreadGetName, osTimerGetName, osEventFlagsGetName, osMutexGetName,
45c36484f0Sopenharmony_ci *      osSemaphoreGetName, osMemoryPoolGetName, osMessageQueueGetName
46c36484f0Sopenharmony_ci * Version 2.1.3
47c36484f0Sopenharmony_ci *    Additional functions allowed to be called from Interrupt Service Routines:
48c36484f0Sopenharmony_ci *    - osThreadGetId
49c36484f0Sopenharmony_ci * Version 2.1.2
50c36484f0Sopenharmony_ci *    Additional functions allowed to be called from Interrupt Service Routines:
51c36484f0Sopenharmony_ci *    - osKernelGetInfo, osKernelGetState
52c36484f0Sopenharmony_ci * Version 2.1.1
53c36484f0Sopenharmony_ci *    Additional functions allowed to be called from Interrupt Service Routines:
54c36484f0Sopenharmony_ci *    - osKernelGetTickCount, osKernelGetTickFreq
55c36484f0Sopenharmony_ci *    Changed Kernel Tick type to uint32_t:
56c36484f0Sopenharmony_ci *    - updated: osKernelGetTickCount, osDelayUntil
57c36484f0Sopenharmony_ci * Version 2.1.0
58c36484f0Sopenharmony_ci *    Support for critical and uncritical sections (nesting safe):
59c36484f0Sopenharmony_ci *    - updated: osKernelLock, osKernelUnlock
60c36484f0Sopenharmony_ci *    - added: osKernelRestoreLock
61c36484f0Sopenharmony_ci *    Updated Thread and Event Flags:
62c36484f0Sopenharmony_ci *    - changed flags parameter and return type from int32_t to uint32_t
63c36484f0Sopenharmony_ci * Version 2.0.0
64c36484f0Sopenharmony_ci *    Initial Release
65c36484f0Sopenharmony_ci *---------------------------------------------------------------------------*/
66c36484f0Sopenharmony_ci
67c36484f0Sopenharmony_ci#ifndef CMSIS_OS2_H_
68c36484f0Sopenharmony_ci#define CMSIS_OS2_H_
69c36484f0Sopenharmony_ci
70c36484f0Sopenharmony_ci#ifndef __NO_RETURN
71c36484f0Sopenharmony_ci#if   defined(__CC_ARM)
72c36484f0Sopenharmony_ci#define __NO_RETURN __declspec(noreturn)
73c36484f0Sopenharmony_ci#elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
74c36484f0Sopenharmony_ci#define __NO_RETURN __attribute__((__noreturn__))
75c36484f0Sopenharmony_ci#elif defined(__GNUC__)
76c36484f0Sopenharmony_ci#define __NO_RETURN __attribute__((__noreturn__))
77c36484f0Sopenharmony_ci#elif defined(__ICCARM__)
78c36484f0Sopenharmony_ci#define __NO_RETURN __noreturn
79c36484f0Sopenharmony_ci#else
80c36484f0Sopenharmony_ci#define __NO_RETURN
81c36484f0Sopenharmony_ci#endif
82c36484f0Sopenharmony_ci#endif
83c36484f0Sopenharmony_ci
84c36484f0Sopenharmony_ci#include <stdint.h>
85c36484f0Sopenharmony_ci#include <stddef.h>
86c36484f0Sopenharmony_ci
87c36484f0Sopenharmony_ci#ifdef  __cplusplus
88c36484f0Sopenharmony_ciextern "C"
89c36484f0Sopenharmony_ci{
90c36484f0Sopenharmony_ci#endif
91c36484f0Sopenharmony_ci
92c36484f0Sopenharmony_ci
93c36484f0Sopenharmony_ci//  ==== Enumerations, structures, defines ====
94c36484f0Sopenharmony_ci
95c36484f0Sopenharmony_ci/// Version information.
96c36484f0Sopenharmony_citypedef struct {
97c36484f0Sopenharmony_ci  uint32_t                       api;   ///< API version (major.minor.rev: mmnnnrrrr dec).
98c36484f0Sopenharmony_ci  uint32_t                    kernel;   ///< Kernel version (major.minor.rev: mmnnnrrrr dec).
99c36484f0Sopenharmony_ci} osVersion_t;
100c36484f0Sopenharmony_ci
101c36484f0Sopenharmony_ci/// Kernel state.
102c36484f0Sopenharmony_citypedef enum {
103c36484f0Sopenharmony_ci  osKernelInactive        =  0,         ///< Inactive.
104c36484f0Sopenharmony_ci  osKernelReady           =  1,         ///< Ready.
105c36484f0Sopenharmony_ci  osKernelRunning         =  2,         ///< Running.
106c36484f0Sopenharmony_ci  osKernelLocked          =  3,         ///< Locked.
107c36484f0Sopenharmony_ci  osKernelSuspended       =  4,         ///< Suspended.
108c36484f0Sopenharmony_ci  osKernelError           = -1,         ///< Error.
109c36484f0Sopenharmony_ci  osKernelReserved        = 0x7FFFFFFF  ///< Prevents enum down-size compiler optimization.
110c36484f0Sopenharmony_ci} osKernelState_t;
111c36484f0Sopenharmony_ci
112c36484f0Sopenharmony_ci/// Thread state.
113c36484f0Sopenharmony_citypedef enum {
114c36484f0Sopenharmony_ci  osThreadInactive        =  0,         ///< Inactive.
115c36484f0Sopenharmony_ci  osThreadReady           =  1,         ///< Ready.
116c36484f0Sopenharmony_ci  osThreadRunning         =  2,         ///< Running.
117c36484f0Sopenharmony_ci  osThreadBlocked         =  3,         ///< Blocked.
118c36484f0Sopenharmony_ci  osThreadTerminated      =  4,         ///< Terminated.
119c36484f0Sopenharmony_ci  osThreadError           = -1,         ///< Error.
120c36484f0Sopenharmony_ci  osThreadReserved        = 0x7FFFFFFF  ///< Prevents enum down-size compiler optimization.
121c36484f0Sopenharmony_ci} osThreadState_t;
122c36484f0Sopenharmony_ci
123c36484f0Sopenharmony_ci/// Priority values.
124c36484f0Sopenharmony_citypedef enum {
125c36484f0Sopenharmony_ci  osPriorityNone          =  0,         ///< No priority (not initialized).
126c36484f0Sopenharmony_ci  osPriorityIdle          =  1,         ///< Reserved for Idle thread.
127c36484f0Sopenharmony_ci  osPriorityLow           =  8,         ///< Priority: low
128c36484f0Sopenharmony_ci  osPriorityLow1          =  8+1,       ///< Priority: low + 1
129c36484f0Sopenharmony_ci  osPriorityLow2          =  8+2,       ///< Priority: low + 2
130c36484f0Sopenharmony_ci  osPriorityLow3          =  8+3,       ///< Priority: low + 3
131c36484f0Sopenharmony_ci  osPriorityLow4          =  8+4,       ///< Priority: low + 4
132c36484f0Sopenharmony_ci  osPriorityLow5          =  8+5,       ///< Priority: low + 5
133c36484f0Sopenharmony_ci  osPriorityLow6          =  8+6,       ///< Priority: low + 6
134c36484f0Sopenharmony_ci  osPriorityLow7          =  8+7,       ///< Priority: low + 7
135c36484f0Sopenharmony_ci  osPriorityBelowNormal   = 16,         ///< Priority: below normal
136c36484f0Sopenharmony_ci  osPriorityBelowNormal1  = 16+1,       ///< Priority: below normal + 1
137c36484f0Sopenharmony_ci  osPriorityBelowNormal2  = 16+2,       ///< Priority: below normal + 2
138c36484f0Sopenharmony_ci  osPriorityBelowNormal3  = 16+3,       ///< Priority: below normal + 3
139c36484f0Sopenharmony_ci  osPriorityBelowNormal4  = 16+4,       ///< Priority: below normal + 4
140c36484f0Sopenharmony_ci  osPriorityBelowNormal5  = 16+5,       ///< Priority: below normal + 5
141c36484f0Sopenharmony_ci  osPriorityBelowNormal6  = 16+6,       ///< Priority: below normal + 6
142c36484f0Sopenharmony_ci  osPriorityBelowNormal7  = 16+7,       ///< Priority: below normal + 7
143c36484f0Sopenharmony_ci  osPriorityNormal        = 24,         ///< Priority: normal
144c36484f0Sopenharmony_ci  osPriorityNormal1       = 24+1,       ///< Priority: normal + 1
145c36484f0Sopenharmony_ci  osPriorityNormal2       = 24+2,       ///< Priority: normal + 2
146c36484f0Sopenharmony_ci  osPriorityNormal3       = 24+3,       ///< Priority: normal + 3
147c36484f0Sopenharmony_ci  osPriorityNormal4       = 24+4,       ///< Priority: normal + 4
148c36484f0Sopenharmony_ci  osPriorityNormal5       = 24+5,       ///< Priority: normal + 5
149c36484f0Sopenharmony_ci  osPriorityNormal6       = 24+6,       ///< Priority: normal + 6
150c36484f0Sopenharmony_ci  osPriorityNormal7       = 24+7,       ///< Priority: normal + 7
151c36484f0Sopenharmony_ci  osPriorityAboveNormal   = 32,         ///< Priority: above normal
152c36484f0Sopenharmony_ci  osPriorityAboveNormal1  = 32+1,       ///< Priority: above normal + 1
153c36484f0Sopenharmony_ci  osPriorityAboveNormal2  = 32+2,       ///< Priority: above normal + 2
154c36484f0Sopenharmony_ci  osPriorityAboveNormal3  = 32+3,       ///< Priority: above normal + 3
155c36484f0Sopenharmony_ci  osPriorityAboveNormal4  = 32+4,       ///< Priority: above normal + 4
156c36484f0Sopenharmony_ci  osPriorityAboveNormal5  = 32+5,       ///< Priority: above normal + 5
157c36484f0Sopenharmony_ci  osPriorityAboveNormal6  = 32+6,       ///< Priority: above normal + 6
158c36484f0Sopenharmony_ci  osPriorityAboveNormal7  = 32+7,       ///< Priority: above normal + 7
159c36484f0Sopenharmony_ci  osPriorityHigh          = 40,         ///< Priority: high
160c36484f0Sopenharmony_ci  osPriorityHigh1         = 40+1,       ///< Priority: high + 1
161c36484f0Sopenharmony_ci  osPriorityHigh2         = 40+2,       ///< Priority: high + 2
162c36484f0Sopenharmony_ci  osPriorityHigh3         = 40+3,       ///< Priority: high + 3
163c36484f0Sopenharmony_ci  osPriorityHigh4         = 40+4,       ///< Priority: high + 4
164c36484f0Sopenharmony_ci  osPriorityHigh5         = 40+5,       ///< Priority: high + 5
165c36484f0Sopenharmony_ci  osPriorityHigh6         = 40+6,       ///< Priority: high + 6
166c36484f0Sopenharmony_ci  osPriorityHigh7         = 40+7,       ///< Priority: high + 7
167c36484f0Sopenharmony_ci  osPriorityRealtime      = 48,         ///< Priority: realtime
168c36484f0Sopenharmony_ci  osPriorityRealtime1     = 48+1,       ///< Priority: realtime + 1
169c36484f0Sopenharmony_ci  osPriorityRealtime2     = 48+2,       ///< Priority: realtime + 2
170c36484f0Sopenharmony_ci  osPriorityRealtime3     = 48+3,       ///< Priority: realtime + 3
171c36484f0Sopenharmony_ci  osPriorityRealtime4     = 48+4,       ///< Priority: realtime + 4
172c36484f0Sopenharmony_ci  osPriorityRealtime5     = 48+5,       ///< Priority: realtime + 5
173c36484f0Sopenharmony_ci  osPriorityRealtime6     = 48+6,       ///< Priority: realtime + 6
174c36484f0Sopenharmony_ci  osPriorityRealtime7     = 48+7,       ///< Priority: realtime + 7
175c36484f0Sopenharmony_ci  osPriorityISR           = 56,         ///< Reserved for ISR deferred thread.
176c36484f0Sopenharmony_ci  osPriorityError         = -1,         ///< System cannot determine priority or illegal priority.
177c36484f0Sopenharmony_ci  osPriorityReserved      = 0x7FFFFFFF  ///< Prevents enum down-size compiler optimization.
178c36484f0Sopenharmony_ci} osPriority_t;
179c36484f0Sopenharmony_ci
180c36484f0Sopenharmony_ci/// Entry point of a thread.
181c36484f0Sopenharmony_citypedef void (*osThreadFunc_t) (void *argument);
182c36484f0Sopenharmony_ci
183c36484f0Sopenharmony_ci/// Timer callback function.
184c36484f0Sopenharmony_citypedef void (*osTimerFunc_t) (void *argument);
185c36484f0Sopenharmony_ci
186c36484f0Sopenharmony_ci/// Timer type.
187c36484f0Sopenharmony_citypedef enum {
188c36484f0Sopenharmony_ci  osTimerOnce             = 0,          ///< One-shot timer.
189c36484f0Sopenharmony_ci  osTimerPeriodic         = 1           ///< Repeating timer.
190c36484f0Sopenharmony_ci} osTimerType_t;
191c36484f0Sopenharmony_ci
192c36484f0Sopenharmony_ci// Timeout value.
193c36484f0Sopenharmony_ci#define osWaitForever           0xFFFFFFFFU ///< Wait forever timeout value.
194c36484f0Sopenharmony_ci
195c36484f0Sopenharmony_ci// Flags options (\ref osThreadFlagsWait and \ref osEventFlagsWait).
196c36484f0Sopenharmony_ci#define osFlagsWaitAny          0x00000000U ///< Wait for any flag (default).
197c36484f0Sopenharmony_ci#define osFlagsWaitAll          0x00000001U ///< Wait for all flags.
198c36484f0Sopenharmony_ci#define osFlagsNoClear          0x00000002U ///< Do not clear flags which have been specified to wait for.
199c36484f0Sopenharmony_ci
200c36484f0Sopenharmony_ci// Flags errors (returned by osThreadFlagsXxxx and osEventFlagsXxxx).
201c36484f0Sopenharmony_ci#define osFlagsError            0x80000000U ///< Error indicator.
202c36484f0Sopenharmony_ci#define osFlagsErrorUnknown     0xFFFFFFFFU ///< osError (-1).
203c36484f0Sopenharmony_ci#define osFlagsErrorTimeout     0xFFFFFFFEU ///< osErrorTimeout (-2).
204c36484f0Sopenharmony_ci#define osFlagsErrorResource    0xFFFFFFFDU ///< osErrorResource (-3).
205c36484f0Sopenharmony_ci#define osFlagsErrorParameter   0xFFFFFFFCU ///< osErrorParameter (-4).
206c36484f0Sopenharmony_ci#define osFlagsErrorISR         0xFFFFFFFAU ///< osErrorISR (-6).
207c36484f0Sopenharmony_ci#define osFlagsErrorSafetyClass 0xFFFFFFF9U ///< osErrorSafetyClass (-7).
208c36484f0Sopenharmony_ci
209c36484f0Sopenharmony_ci// Thread attributes (attr_bits in \ref osThreadAttr_t).
210c36484f0Sopenharmony_ci#define osThreadDetached        0x00000000U ///< Thread created in detached mode (default)
211c36484f0Sopenharmony_ci#define osThreadJoinable        0x00000001U ///< Thread created in joinable mode
212c36484f0Sopenharmony_ci#define osThreadUnprivileged    0x00000002U ///< Thread runs in unprivileged mode
213c36484f0Sopenharmony_ci#define osThreadPrivileged      0x00000004U ///< Thread runs in privileged mode
214c36484f0Sopenharmony_ci
215c36484f0Sopenharmony_ci#define osThreadZone_Pos        8U                            ///< MPU protected zone position
216c36484f0Sopenharmony_ci#define osThreadZone_Msk        (0x3FUL << osThreadZone_Pos)  ///< MPU protected zone mask
217c36484f0Sopenharmony_ci#define osThreadZone_Valid      (0x80UL << osThreadZone_Pos)  ///< MPU protected zone valid flag
218c36484f0Sopenharmony_ci#define osThreadZone(n)         ((((n) << osThreadZone_Pos) & osThreadZone_Msk) | \
219c36484f0Sopenharmony_ci                                 osThreadZone_Valid)          ///< MPU zone value in attribute bit field format
220c36484f0Sopenharmony_ci
221c36484f0Sopenharmony_ci// Thread processor affinity (affinity_mask in \ref osThreadAttr_t).
222c36484f0Sopenharmony_ci#define osThreadProcessor(n)    (1UL << (n))    ///< Thread processor number for SMP systems
223c36484f0Sopenharmony_ci
224c36484f0Sopenharmony_ci// Mutex attributes (attr_bits in \ref osMutexAttr_t).
225c36484f0Sopenharmony_ci#define osMutexRecursive        0x00000001U ///< Recursive mutex.
226c36484f0Sopenharmony_ci#define osMutexPrioInherit      0x00000002U ///< Priority inherit protocol.
227c36484f0Sopenharmony_ci#define osMutexRobust           0x00000008U ///< Robust mutex.
228c36484f0Sopenharmony_ci
229c36484f0Sopenharmony_ci// Object attributes (attr_bits in all objects).
230c36484f0Sopenharmony_ci#define osSafetyClass_Pos       16U                           ///< Safety class position
231c36484f0Sopenharmony_ci#define osSafetyClass_Msk       (0x0FUL << osSafetyClass_Pos) ///< Safety class mask
232c36484f0Sopenharmony_ci#define osSafetyClass_Valid     (0x10UL << osSafetyClass_Pos) ///< Safety class valid flag
233c36484f0Sopenharmony_ci#define osSafetyClass(n)        ((((n) << osSafetyClass_Pos) & osSafetyClass_Msk) | \
234c36484f0Sopenharmony_ci                                 osSafetyClass_Valid)         ///< Safety class
235c36484f0Sopenharmony_ci
236c36484f0Sopenharmony_ci// Safety mode (\ref osThreadSuspendClass, \ref osThreadResumeClass and \ref osKernelDestroyClass).
237c36484f0Sopenharmony_ci#define osSafetyWithSameClass   0x00000001U ///< Objects with same safety class.
238c36484f0Sopenharmony_ci#define osSafetyWithLowerClass  0x00000002U ///< Objects with lower safety class.
239c36484f0Sopenharmony_ci
240c36484f0Sopenharmony_ci// Error indication (returned by \ref osThreadGetClass and \ref osThreadGetZone).
241c36484f0Sopenharmony_ci#define osErrorId               0xFFFFFFFFU ///< osError (-1).
242c36484f0Sopenharmony_ci
243c36484f0Sopenharmony_ci/// Status code values returned by CMSIS-RTOS functions.
244c36484f0Sopenharmony_citypedef enum {
245c36484f0Sopenharmony_ci  osOK                    =  0,         ///< Operation completed successfully.
246c36484f0Sopenharmony_ci  osError                 = -1,         ///< Unspecified RTOS error: run-time error but no other error message fits.
247c36484f0Sopenharmony_ci  osErrorTimeout          = -2,         ///< Operation not completed within the timeout period.
248c36484f0Sopenharmony_ci  osErrorResource         = -3,         ///< Resource not available.
249c36484f0Sopenharmony_ci  osErrorParameter        = -4,         ///< Parameter error.
250c36484f0Sopenharmony_ci  osErrorNoMemory         = -5,         ///< System is out of memory: it was impossible to allocate or reserve memory for the operation.
251c36484f0Sopenharmony_ci  osErrorISR              = -6,         ///< Not allowed in ISR context: the function cannot be called from interrupt service routines.
252c36484f0Sopenharmony_ci  osErrorSafetyClass      = -7,         ///< Operation denied because of safety class violation.
253c36484f0Sopenharmony_ci  osStatusReserved        = 0x7FFFFFFF  ///< Prevents enum down-size compiler optimization.
254c36484f0Sopenharmony_ci} osStatus_t;
255c36484f0Sopenharmony_ci
256c36484f0Sopenharmony_ci
257c36484f0Sopenharmony_ci/// \details Thread ID identifies the thread.
258c36484f0Sopenharmony_citypedef void *osThreadId_t;
259c36484f0Sopenharmony_ci
260c36484f0Sopenharmony_ci/// \details Timer ID identifies the timer.
261c36484f0Sopenharmony_citypedef void *osTimerId_t;
262c36484f0Sopenharmony_ci
263c36484f0Sopenharmony_ci/// \details Event Flags ID identifies the event flags.
264c36484f0Sopenharmony_citypedef void *osEventFlagsId_t;
265c36484f0Sopenharmony_ci
266c36484f0Sopenharmony_ci/// \details Mutex ID identifies the mutex.
267c36484f0Sopenharmony_citypedef void *osMutexId_t;
268c36484f0Sopenharmony_ci
269c36484f0Sopenharmony_ci/// \details Semaphore ID identifies the semaphore.
270c36484f0Sopenharmony_citypedef void *osSemaphoreId_t;
271c36484f0Sopenharmony_ci
272c36484f0Sopenharmony_ci/// \details Memory Pool ID identifies the memory pool.
273c36484f0Sopenharmony_citypedef void *osMemoryPoolId_t;
274c36484f0Sopenharmony_ci
275c36484f0Sopenharmony_ci/// \details Message Queue ID identifies the message queue.
276c36484f0Sopenharmony_citypedef void *osMessageQueueId_t;
277c36484f0Sopenharmony_ci
278c36484f0Sopenharmony_ci
279c36484f0Sopenharmony_ci#ifndef TZ_MODULEID_T
280c36484f0Sopenharmony_ci#define TZ_MODULEID_T
281c36484f0Sopenharmony_ci/// \details Data type that identifies secure software modules called by a process.
282c36484f0Sopenharmony_citypedef uint32_t TZ_ModuleId_t;
283c36484f0Sopenharmony_ci#endif
284c36484f0Sopenharmony_ci
285c36484f0Sopenharmony_ci
286c36484f0Sopenharmony_ci/// Attributes structure for thread.
287c36484f0Sopenharmony_citypedef struct {
288c36484f0Sopenharmony_ci  const char                   *name;   ///< name of the thread
289c36484f0Sopenharmony_ci  uint32_t                 attr_bits;   ///< attribute bits
290c36484f0Sopenharmony_ci  void                      *cb_mem;    ///< memory for control block
291c36484f0Sopenharmony_ci  uint32_t                   cb_size;   ///< size of provided memory for control block
292c36484f0Sopenharmony_ci  void                   *stack_mem;    ///< memory for stack
293c36484f0Sopenharmony_ci  uint32_t                stack_size;   ///< size of stack
294c36484f0Sopenharmony_ci  osPriority_t              priority;   ///< initial thread priority (default: osPriorityNormal)
295c36484f0Sopenharmony_ci  TZ_ModuleId_t            tz_module;   ///< TrustZone module identifier
296c36484f0Sopenharmony_ci  uint32_t             affinity_mask;   ///< processor affinity mask for binding the thread to a CPU in a SMP system (0 when not used)
297c36484f0Sopenharmony_ci} osThreadAttr_t;
298c36484f0Sopenharmony_ci
299c36484f0Sopenharmony_ci/// Attributes structure for timer.
300c36484f0Sopenharmony_citypedef struct {
301c36484f0Sopenharmony_ci  const char                   *name;   ///< name of the timer
302c36484f0Sopenharmony_ci  uint32_t                 attr_bits;   ///< attribute bits
303c36484f0Sopenharmony_ci  void                      *cb_mem;    ///< memory for control block
304c36484f0Sopenharmony_ci  uint32_t                   cb_size;   ///< size of provided memory for control block
305c36484f0Sopenharmony_ci} osTimerAttr_t;
306c36484f0Sopenharmony_ci
307c36484f0Sopenharmony_ci/// Attributes structure for event flags.
308c36484f0Sopenharmony_citypedef struct {
309c36484f0Sopenharmony_ci  const char                   *name;   ///< name of the event flags
310c36484f0Sopenharmony_ci  uint32_t                 attr_bits;   ///< attribute bits
311c36484f0Sopenharmony_ci  void                      *cb_mem;    ///< memory for control block
312c36484f0Sopenharmony_ci  uint32_t                   cb_size;   ///< size of provided memory for control block
313c36484f0Sopenharmony_ci} osEventFlagsAttr_t;
314c36484f0Sopenharmony_ci
315c36484f0Sopenharmony_ci/// Attributes structure for mutex.
316c36484f0Sopenharmony_citypedef struct {
317c36484f0Sopenharmony_ci  const char                   *name;   ///< name of the mutex
318c36484f0Sopenharmony_ci  uint32_t                 attr_bits;   ///< attribute bits
319c36484f0Sopenharmony_ci  void                      *cb_mem;    ///< memory for control block
320c36484f0Sopenharmony_ci  uint32_t                   cb_size;   ///< size of provided memory for control block
321c36484f0Sopenharmony_ci} osMutexAttr_t;
322c36484f0Sopenharmony_ci
323c36484f0Sopenharmony_ci/// Attributes structure for semaphore.
324c36484f0Sopenharmony_citypedef struct {
325c36484f0Sopenharmony_ci  const char                   *name;   ///< name of the semaphore
326c36484f0Sopenharmony_ci  uint32_t                 attr_bits;   ///< attribute bits
327c36484f0Sopenharmony_ci  void                      *cb_mem;    ///< memory for control block
328c36484f0Sopenharmony_ci  uint32_t                   cb_size;   ///< size of provided memory for control block
329c36484f0Sopenharmony_ci} osSemaphoreAttr_t;
330c36484f0Sopenharmony_ci
331c36484f0Sopenharmony_ci/// Attributes structure for memory pool.
332c36484f0Sopenharmony_citypedef struct {
333c36484f0Sopenharmony_ci  const char                   *name;   ///< name of the memory pool
334c36484f0Sopenharmony_ci  uint32_t                 attr_bits;   ///< attribute bits
335c36484f0Sopenharmony_ci  void                      *cb_mem;    ///< memory for control block
336c36484f0Sopenharmony_ci  uint32_t                   cb_size;   ///< size of provided memory for control block
337c36484f0Sopenharmony_ci  void                      *mp_mem;    ///< memory for data storage
338c36484f0Sopenharmony_ci  uint32_t                   mp_size;   ///< size of provided memory for data storage
339c36484f0Sopenharmony_ci} osMemoryPoolAttr_t;
340c36484f0Sopenharmony_ci
341c36484f0Sopenharmony_ci/// Attributes structure for message queue.
342c36484f0Sopenharmony_citypedef struct {
343c36484f0Sopenharmony_ci  const char                   *name;   ///< name of the message queue
344c36484f0Sopenharmony_ci  uint32_t                 attr_bits;   ///< attribute bits
345c36484f0Sopenharmony_ci  void                      *cb_mem;    ///< memory for control block
346c36484f0Sopenharmony_ci  uint32_t                   cb_size;   ///< size of provided memory for control block
347c36484f0Sopenharmony_ci  void                      *mq_mem;    ///< memory for data storage
348c36484f0Sopenharmony_ci  uint32_t                   mq_size;   ///< size of provided memory for data storage
349c36484f0Sopenharmony_ci} osMessageQueueAttr_t;
350c36484f0Sopenharmony_ci
351c36484f0Sopenharmony_ci
352c36484f0Sopenharmony_ci//  ==== Kernel Management Functions ====
353c36484f0Sopenharmony_ci
354c36484f0Sopenharmony_ci/// Initialize the RTOS Kernel.
355c36484f0Sopenharmony_ci/// \return status code that indicates the execution status of the function.
356c36484f0Sopenharmony_ciosStatus_t osKernelInitialize (void);
357c36484f0Sopenharmony_ci
358c36484f0Sopenharmony_ci///  Get RTOS Kernel Information.
359c36484f0Sopenharmony_ci/// \param[out]    version       pointer to buffer for retrieving version information.
360c36484f0Sopenharmony_ci/// \param[out]    id_buf        pointer to buffer for retrieving kernel identification string.
361c36484f0Sopenharmony_ci/// \param[in]     id_size       size of buffer for kernel identification string.
362c36484f0Sopenharmony_ci/// \return status code that indicates the execution status of the function.
363c36484f0Sopenharmony_ciosStatus_t osKernelGetInfo (osVersion_t *version, char *id_buf, uint32_t id_size);
364c36484f0Sopenharmony_ci
365c36484f0Sopenharmony_ci/// Get the current RTOS Kernel state.
366c36484f0Sopenharmony_ci/// \return current RTOS Kernel state.
367c36484f0Sopenharmony_ciosKernelState_t osKernelGetState (void);
368c36484f0Sopenharmony_ci
369c36484f0Sopenharmony_ci/// Start the RTOS Kernel scheduler.
370c36484f0Sopenharmony_ci/// \return status code that indicates the execution status of the function.
371c36484f0Sopenharmony_ciosStatus_t osKernelStart (void);
372c36484f0Sopenharmony_ci
373c36484f0Sopenharmony_ci/// Lock the RTOS Kernel scheduler.
374c36484f0Sopenharmony_ci/// \return previous lock state (1 - locked, 0 - not locked, error code if negative).
375c36484f0Sopenharmony_ciint32_t osKernelLock (void);
376c36484f0Sopenharmony_ci
377c36484f0Sopenharmony_ci/// Unlock the RTOS Kernel scheduler.
378c36484f0Sopenharmony_ci/// \return previous lock state (1 - locked, 0 - not locked, error code if negative).
379c36484f0Sopenharmony_ciint32_t osKernelUnlock (void);
380c36484f0Sopenharmony_ci
381c36484f0Sopenharmony_ci/// Restore the RTOS Kernel scheduler lock state.
382c36484f0Sopenharmony_ci/// \param[in]     lock          lock state obtained by \ref osKernelLock or \ref osKernelUnlock.
383c36484f0Sopenharmony_ci/// \return new lock state (1 - locked, 0 - not locked, error code if negative).
384c36484f0Sopenharmony_ciint32_t osKernelRestoreLock (int32_t lock);
385c36484f0Sopenharmony_ci
386c36484f0Sopenharmony_ci/// Suspend the RTOS Kernel scheduler.
387c36484f0Sopenharmony_ci/// \return time in ticks, for how long the system can sleep or power-down.
388c36484f0Sopenharmony_ciuint32_t osKernelSuspend (void);
389c36484f0Sopenharmony_ci
390c36484f0Sopenharmony_ci/// Resume the RTOS Kernel scheduler.
391c36484f0Sopenharmony_ci/// \param[in]     sleep_ticks   time in ticks for how long the system was in sleep or power-down mode.
392c36484f0Sopenharmony_civoid osKernelResume (uint32_t sleep_ticks);
393c36484f0Sopenharmony_ci
394c36484f0Sopenharmony_ci/// Protect the RTOS Kernel scheduler access.
395c36484f0Sopenharmony_ci/// \param[in]     safety_class  safety class.
396c36484f0Sopenharmony_ci/// \return status code that indicates the execution status of the function.
397c36484f0Sopenharmony_ciosStatus_t osKernelProtect (uint32_t safety_class);
398c36484f0Sopenharmony_ci
399c36484f0Sopenharmony_ci/// Destroy objects for specified safety classes.
400c36484f0Sopenharmony_ci/// \param[in]     safety_class  safety class.
401c36484f0Sopenharmony_ci/// \param[in]     mode          safety mode.
402c36484f0Sopenharmony_ci/// \return status code that indicates the execution status of the function.
403c36484f0Sopenharmony_ciosStatus_t osKernelDestroyClass (uint32_t safety_class, uint32_t mode);
404c36484f0Sopenharmony_ci
405c36484f0Sopenharmony_ci/// Get the RTOS kernel tick count.
406c36484f0Sopenharmony_ci/// \return RTOS kernel current tick count.
407c36484f0Sopenharmony_ciuint32_t osKernelGetTickCount (void);
408c36484f0Sopenharmony_ci
409c36484f0Sopenharmony_ci/// Get the RTOS kernel tick frequency.
410c36484f0Sopenharmony_ci/// \return frequency of the kernel tick in hertz, i.e. kernel ticks per second.
411c36484f0Sopenharmony_ciuint32_t osKernelGetTickFreq (void);
412c36484f0Sopenharmony_ci
413c36484f0Sopenharmony_ci/// Get the RTOS kernel system timer count.
414c36484f0Sopenharmony_ci/// \return RTOS kernel current system timer count as 32-bit value.
415c36484f0Sopenharmony_ciuint32_t osKernelGetSysTimerCount (void);
416c36484f0Sopenharmony_ci
417c36484f0Sopenharmony_ci/// Get the RTOS kernel system timer frequency.
418c36484f0Sopenharmony_ci/// \return frequency of the system timer in hertz, i.e. timer ticks per second.
419c36484f0Sopenharmony_ciuint32_t osKernelGetSysTimerFreq (void);
420c36484f0Sopenharmony_ci
421c36484f0Sopenharmony_ci
422c36484f0Sopenharmony_ci//  ==== Thread Management Functions ====
423c36484f0Sopenharmony_ci
424c36484f0Sopenharmony_ci/// Create a thread and add it to Active Threads.
425c36484f0Sopenharmony_ci/// \param[in]     func          thread function.
426c36484f0Sopenharmony_ci/// \param[in]     argument      pointer that is passed to the thread function as start argument.
427c36484f0Sopenharmony_ci/// \param[in]     attr          thread attributes; NULL: default values.
428c36484f0Sopenharmony_ci/// \return thread ID for reference by other functions or NULL in case of error.
429c36484f0Sopenharmony_ciosThreadId_t osThreadNew (osThreadFunc_t func, void *argument, const osThreadAttr_t *attr);
430c36484f0Sopenharmony_ci
431c36484f0Sopenharmony_ci/// Get name of a thread.
432c36484f0Sopenharmony_ci/// \param[in]     thread_id     thread ID obtained by \ref osThreadNew or \ref osThreadGetId.
433c36484f0Sopenharmony_ci/// \return name as null-terminated string.
434c36484f0Sopenharmony_ciconst char *osThreadGetName (osThreadId_t thread_id);
435c36484f0Sopenharmony_ci
436c36484f0Sopenharmony_ci/// Get safety class of a thread.
437c36484f0Sopenharmony_ci/// \param[in]     thread_id     thread ID obtained by \ref osThreadNew or \ref osThreadGetId.
438c36484f0Sopenharmony_ci/// \return safety class of the specified thread.
439c36484f0Sopenharmony_ciuint32_t osThreadGetClass (osThreadId_t thread_id);
440c36484f0Sopenharmony_ci
441c36484f0Sopenharmony_ci/// Get MPU protected zone of a thread.
442c36484f0Sopenharmony_ci/// \param[in]     thread_id     thread ID obtained by \ref osThreadNew or \ref osThreadGetId.
443c36484f0Sopenharmony_ci/// \return MPU protected zone of the specified thread.
444c36484f0Sopenharmony_ciuint32_t osThreadGetZone (osThreadId_t thread_id);
445c36484f0Sopenharmony_ci
446c36484f0Sopenharmony_ci/// Return the thread ID of the current running thread.
447c36484f0Sopenharmony_ci/// \return thread ID for reference by other functions or NULL in case of error.
448c36484f0Sopenharmony_ciosThreadId_t osThreadGetId (void);
449c36484f0Sopenharmony_ci
450c36484f0Sopenharmony_ci/// Get current thread state of a thread.
451c36484f0Sopenharmony_ci/// \param[in]     thread_id     thread ID obtained by \ref osThreadNew or \ref osThreadGetId.
452c36484f0Sopenharmony_ci/// \return current thread state of the specified thread.
453c36484f0Sopenharmony_ciosThreadState_t osThreadGetState (osThreadId_t thread_id);
454c36484f0Sopenharmony_ci
455c36484f0Sopenharmony_ci/// Get stack size of a thread.
456c36484f0Sopenharmony_ci/// \param[in]     thread_id     thread ID obtained by \ref osThreadNew or \ref osThreadGetId.
457c36484f0Sopenharmony_ci/// \return stack size in bytes.
458c36484f0Sopenharmony_ciuint32_t osThreadGetStackSize (osThreadId_t thread_id);
459c36484f0Sopenharmony_ci
460c36484f0Sopenharmony_ci/// Get available stack space of a thread based on stack watermark recording during execution.
461c36484f0Sopenharmony_ci/// \param[in]     thread_id     thread ID obtained by \ref osThreadNew or \ref osThreadGetId.
462c36484f0Sopenharmony_ci/// \return remaining stack space in bytes.
463c36484f0Sopenharmony_ciuint32_t osThreadGetStackSpace (osThreadId_t thread_id);
464c36484f0Sopenharmony_ci
465c36484f0Sopenharmony_ci/// Change priority of a thread.
466c36484f0Sopenharmony_ci/// \param[in]     thread_id     thread ID obtained by \ref osThreadNew or \ref osThreadGetId.
467c36484f0Sopenharmony_ci/// \param[in]     priority      new priority value for the thread function.
468c36484f0Sopenharmony_ci/// \return status code that indicates the execution status of the function.
469c36484f0Sopenharmony_ciosStatus_t osThreadSetPriority (osThreadId_t thread_id, osPriority_t priority);
470c36484f0Sopenharmony_ci
471c36484f0Sopenharmony_ci/// Get current priority of a thread.
472c36484f0Sopenharmony_ci/// \param[in]     thread_id     thread ID obtained by \ref osThreadNew or \ref osThreadGetId.
473c36484f0Sopenharmony_ci/// \return current priority value of the specified thread.
474c36484f0Sopenharmony_ciosPriority_t osThreadGetPriority (osThreadId_t thread_id);
475c36484f0Sopenharmony_ci
476c36484f0Sopenharmony_ci/// Pass control to next thread that is in state \b READY.
477c36484f0Sopenharmony_ci/// \return status code that indicates the execution status of the function.
478c36484f0Sopenharmony_ciosStatus_t osThreadYield (void);
479c36484f0Sopenharmony_ci
480c36484f0Sopenharmony_ci/// Suspend execution of a thread.
481c36484f0Sopenharmony_ci/// \param[in]     thread_id     thread ID obtained by \ref osThreadNew or \ref osThreadGetId.
482c36484f0Sopenharmony_ci/// \return status code that indicates the execution status of the function.
483c36484f0Sopenharmony_ciosStatus_t osThreadSuspend (osThreadId_t thread_id);
484c36484f0Sopenharmony_ci
485c36484f0Sopenharmony_ci/// Resume execution of a thread.
486c36484f0Sopenharmony_ci/// \param[in]     thread_id     thread ID obtained by \ref osThreadNew or \ref osThreadGetId.
487c36484f0Sopenharmony_ci/// \return status code that indicates the execution status of the function.
488c36484f0Sopenharmony_ciosStatus_t osThreadResume (osThreadId_t thread_id);
489c36484f0Sopenharmony_ci
490c36484f0Sopenharmony_ci/// Detach a thread (thread storage can be reclaimed when thread terminates).
491c36484f0Sopenharmony_ci/// \param[in]     thread_id     thread ID obtained by \ref osThreadNew or \ref osThreadGetId.
492c36484f0Sopenharmony_ci/// \return status code that indicates the execution status of the function.
493c36484f0Sopenharmony_ciosStatus_t osThreadDetach (osThreadId_t thread_id);
494c36484f0Sopenharmony_ci
495c36484f0Sopenharmony_ci/// Wait for specified thread to terminate.
496c36484f0Sopenharmony_ci/// \param[in]     thread_id     thread ID obtained by \ref osThreadNew or \ref osThreadGetId.
497c36484f0Sopenharmony_ci/// \return status code that indicates the execution status of the function.
498c36484f0Sopenharmony_ciosStatus_t osThreadJoin (osThreadId_t thread_id);
499c36484f0Sopenharmony_ci
500c36484f0Sopenharmony_ci/// Terminate execution of current running thread.
501c36484f0Sopenharmony_ci__NO_RETURN void osThreadExit (void);
502c36484f0Sopenharmony_ci
503c36484f0Sopenharmony_ci/// Terminate execution of a thread.
504c36484f0Sopenharmony_ci/// \param[in]     thread_id     thread ID obtained by \ref osThreadNew or \ref osThreadGetId.
505c36484f0Sopenharmony_ci/// \return status code that indicates the execution status of the function.
506c36484f0Sopenharmony_ciosStatus_t osThreadTerminate (osThreadId_t thread_id);
507c36484f0Sopenharmony_ci
508c36484f0Sopenharmony_ci/// Feed watchdog of the current running thread.
509c36484f0Sopenharmony_ci/// \param[in]     ticks         interval in kernel ticks until the thread watchdog expires, or 0 to stop the watchdog
510c36484f0Sopenharmony_ci/// \return status code that indicates the execution status of the function.
511c36484f0Sopenharmony_ciosStatus_t osThreadFeedWatchdog (uint32_t ticks);
512c36484f0Sopenharmony_ci
513c36484f0Sopenharmony_ci/// Protect creation of privileged threads.
514c36484f0Sopenharmony_ci/// \return status code that indicates the execution status of the function.
515c36484f0Sopenharmony_ciosStatus_t osThreadProtectPrivileged (void);
516c36484f0Sopenharmony_ci
517c36484f0Sopenharmony_ci/// Suspend execution of threads for specified safety classes.
518c36484f0Sopenharmony_ci/// \param[in]     safety_class  safety class.
519c36484f0Sopenharmony_ci/// \param[in]     mode          safety mode.
520c36484f0Sopenharmony_ci/// \return status code that indicates the execution status of the function.
521c36484f0Sopenharmony_ciosStatus_t osThreadSuspendClass (uint32_t safety_class, uint32_t mode);
522c36484f0Sopenharmony_ci
523c36484f0Sopenharmony_ci/// Resume execution of threads for specified safety classes.
524c36484f0Sopenharmony_ci/// \param[in]     safety_class  safety class.
525c36484f0Sopenharmony_ci/// \param[in]     mode          safety mode.
526c36484f0Sopenharmony_ci/// \return status code that indicates the execution status of the function.
527c36484f0Sopenharmony_ciosStatus_t osThreadResumeClass (uint32_t safety_class, uint32_t mode);
528c36484f0Sopenharmony_ci
529c36484f0Sopenharmony_ci/// Terminate execution of threads assigned to a specified MPU protected zone.
530c36484f0Sopenharmony_ci/// \param[in]     zone          MPU protected zone.
531c36484f0Sopenharmony_ci/// \return status code that indicates the execution status of the function.
532c36484f0Sopenharmony_ciosStatus_t osThreadTerminateZone (uint32_t zone);
533c36484f0Sopenharmony_ci
534c36484f0Sopenharmony_ci/// Set processor affinity mask of a thread.
535c36484f0Sopenharmony_ci/// \param[in]     thread_id     thread ID obtained by \ref osThreadNew or \ref osThreadGetId.
536c36484f0Sopenharmony_ci/// \param[in]     affinity_mask processor affinity mask for the thread.
537c36484f0Sopenharmony_ci/// \return status code that indicates the execution status of the function.
538c36484f0Sopenharmony_ciosStatus_t osThreadSetAffinityMask (osThreadId_t thread_id, uint32_t affinity_mask);
539c36484f0Sopenharmony_ci
540c36484f0Sopenharmony_ci/// Get current processor affinity mask of a thread.
541c36484f0Sopenharmony_ci/// \param[in]     thread_id     thread ID obtained by \ref osThreadNew or \ref osThreadGetId.
542c36484f0Sopenharmony_ci/// \return current processor affinity mask of the specified thread.
543c36484f0Sopenharmony_ciuint32_t osThreadGetAffinityMask (osThreadId_t thread_id);
544c36484f0Sopenharmony_ci
545c36484f0Sopenharmony_ci/// Get number of active threads.
546c36484f0Sopenharmony_ci/// \return number of active threads.
547c36484f0Sopenharmony_ciuint32_t osThreadGetCount (void);
548c36484f0Sopenharmony_ci
549c36484f0Sopenharmony_ci/// Enumerate active threads.
550c36484f0Sopenharmony_ci/// \param[out]    thread_array  pointer to array for retrieving thread IDs.
551c36484f0Sopenharmony_ci/// \param[in]     array_items   maximum number of items in array for retrieving thread IDs.
552c36484f0Sopenharmony_ci/// \return number of enumerated threads.
553c36484f0Sopenharmony_ciuint32_t osThreadEnumerate (osThreadId_t *thread_array, uint32_t array_items);
554c36484f0Sopenharmony_ci
555c36484f0Sopenharmony_ci
556c36484f0Sopenharmony_ci//  ==== Thread Flags Functions ====
557c36484f0Sopenharmony_ci
558c36484f0Sopenharmony_ci/// Set the specified Thread Flags of a thread.
559c36484f0Sopenharmony_ci/// \param[in]     thread_id     thread ID obtained by \ref osThreadNew or \ref osThreadGetId.
560c36484f0Sopenharmony_ci/// \param[in]     flags         specifies the flags of the thread that shall be set.
561c36484f0Sopenharmony_ci/// \return thread flags after setting or error code if highest bit set.
562c36484f0Sopenharmony_ciuint32_t osThreadFlagsSet (osThreadId_t thread_id, uint32_t flags);
563c36484f0Sopenharmony_ci
564c36484f0Sopenharmony_ci/// Clear the specified Thread Flags of current running thread.
565c36484f0Sopenharmony_ci/// \param[in]     flags         specifies the flags of the thread that shall be cleared.
566c36484f0Sopenharmony_ci/// \return thread flags before clearing or error code if highest bit set.
567c36484f0Sopenharmony_ciuint32_t osThreadFlagsClear (uint32_t flags);
568c36484f0Sopenharmony_ci
569c36484f0Sopenharmony_ci/// Get the current Thread Flags of current running thread.
570c36484f0Sopenharmony_ci/// \return current thread flags.
571c36484f0Sopenharmony_ciuint32_t osThreadFlagsGet (void);
572c36484f0Sopenharmony_ci
573c36484f0Sopenharmony_ci/// Wait for one or more Thread Flags of the current running thread to become signaled.
574c36484f0Sopenharmony_ci/// \param[in]     flags         specifies the flags to wait for.
575c36484f0Sopenharmony_ci/// \param[in]     options       specifies flags options (osFlagsXxxx).
576c36484f0Sopenharmony_ci/// \param[in]     timeout       \ref CMSIS_RTOS_TimeOutValue or 0 in case of no time-out.
577c36484f0Sopenharmony_ci/// \return thread flags before clearing or error code if highest bit set.
578c36484f0Sopenharmony_ciuint32_t osThreadFlagsWait (uint32_t flags, uint32_t options, uint32_t timeout);
579c36484f0Sopenharmony_ci
580c36484f0Sopenharmony_ci
581c36484f0Sopenharmony_ci//  ==== Generic Wait Functions ====
582c36484f0Sopenharmony_ci
583c36484f0Sopenharmony_ci/// Wait for Timeout (Time Delay).
584c36484f0Sopenharmony_ci/// \param[in]     ticks         \ref CMSIS_RTOS_TimeOutValue "time ticks" value
585c36484f0Sopenharmony_ci/// \return status code that indicates the execution status of the function.
586c36484f0Sopenharmony_ciosStatus_t osDelay (uint32_t ticks);
587c36484f0Sopenharmony_ci
588c36484f0Sopenharmony_ci/// Wait until specified time.
589c36484f0Sopenharmony_ci/// \param[in]     ticks         absolute time in ticks
590c36484f0Sopenharmony_ci/// \return status code that indicates the execution status of the function.
591c36484f0Sopenharmony_ciosStatus_t osDelayUntil (uint32_t ticks);
592c36484f0Sopenharmony_ci
593c36484f0Sopenharmony_ci
594c36484f0Sopenharmony_ci//  ==== Timer Management Functions ====
595c36484f0Sopenharmony_ci
596c36484f0Sopenharmony_ci/// Create and Initialize a timer.
597c36484f0Sopenharmony_ci/// \param[in]     func          function pointer to callback function.
598c36484f0Sopenharmony_ci/// \param[in]     type          \ref osTimerOnce for one-shot or \ref osTimerPeriodic for periodic behavior.
599c36484f0Sopenharmony_ci/// \param[in]     argument      argument to the timer callback function.
600c36484f0Sopenharmony_ci/// \param[in]     attr          timer attributes; NULL: default values.
601c36484f0Sopenharmony_ci/// \return timer ID for reference by other functions or NULL in case of error.
602c36484f0Sopenharmony_ciosTimerId_t osTimerNew (osTimerFunc_t func, osTimerType_t type, void *argument, const osTimerAttr_t *attr);
603c36484f0Sopenharmony_ci
604c36484f0Sopenharmony_ci/// Get name of a timer.
605c36484f0Sopenharmony_ci/// \param[in]     timer_id      timer ID obtained by \ref osTimerNew.
606c36484f0Sopenharmony_ci/// \return name as null-terminated string.
607c36484f0Sopenharmony_ciconst char *osTimerGetName (osTimerId_t timer_id);
608c36484f0Sopenharmony_ci
609c36484f0Sopenharmony_ci/// Start or restart a timer.
610c36484f0Sopenharmony_ci/// \param[in]     timer_id      timer ID obtained by \ref osTimerNew.
611c36484f0Sopenharmony_ci/// \param[in]     ticks         \ref CMSIS_RTOS_TimeOutValue "time ticks" value of the timer.
612c36484f0Sopenharmony_ci/// \return status code that indicates the execution status of the function.
613c36484f0Sopenharmony_ciosStatus_t osTimerStart (osTimerId_t timer_id, uint32_t ticks);
614c36484f0Sopenharmony_ci
615c36484f0Sopenharmony_ci/// Stop a timer.
616c36484f0Sopenharmony_ci/// \param[in]     timer_id      timer ID obtained by \ref osTimerNew.
617c36484f0Sopenharmony_ci/// \return status code that indicates the execution status of the function.
618c36484f0Sopenharmony_ciosStatus_t osTimerStop (osTimerId_t timer_id);
619c36484f0Sopenharmony_ci
620c36484f0Sopenharmony_ci/// Check if a timer is running.
621c36484f0Sopenharmony_ci/// \param[in]     timer_id      timer ID obtained by \ref osTimerNew.
622c36484f0Sopenharmony_ci/// \return 0 not running, 1 running.
623c36484f0Sopenharmony_ciuint32_t osTimerIsRunning (osTimerId_t timer_id);
624c36484f0Sopenharmony_ci
625c36484f0Sopenharmony_ci/// Delete a timer.
626c36484f0Sopenharmony_ci/// \param[in]     timer_id      timer ID obtained by \ref osTimerNew.
627c36484f0Sopenharmony_ci/// \return status code that indicates the execution status of the function.
628c36484f0Sopenharmony_ciosStatus_t osTimerDelete (osTimerId_t timer_id);
629c36484f0Sopenharmony_ci
630c36484f0Sopenharmony_ci
631c36484f0Sopenharmony_ci//  ==== Event Flags Management Functions ====
632c36484f0Sopenharmony_ci
633c36484f0Sopenharmony_ci/// Create and Initialize an Event Flags object.
634c36484f0Sopenharmony_ci/// \param[in]     attr          event flags attributes; NULL: default values.
635c36484f0Sopenharmony_ci/// \return event flags ID for reference by other functions or NULL in case of error.
636c36484f0Sopenharmony_ciosEventFlagsId_t osEventFlagsNew (const osEventFlagsAttr_t *attr);
637c36484f0Sopenharmony_ci
638c36484f0Sopenharmony_ci/// Get name of an Event Flags object.
639c36484f0Sopenharmony_ci/// \param[in]     ef_id         event flags ID obtained by \ref osEventFlagsNew.
640c36484f0Sopenharmony_ci/// \return name as null-terminated string.
641c36484f0Sopenharmony_ciconst char *osEventFlagsGetName (osEventFlagsId_t ef_id);
642c36484f0Sopenharmony_ci
643c36484f0Sopenharmony_ci/// Set the specified Event Flags.
644c36484f0Sopenharmony_ci/// \param[in]     ef_id         event flags ID obtained by \ref osEventFlagsNew.
645c36484f0Sopenharmony_ci/// \param[in]     flags         specifies the flags that shall be set.
646c36484f0Sopenharmony_ci/// \return event flags after setting or error code if highest bit set.
647c36484f0Sopenharmony_ciuint32_t osEventFlagsSet (osEventFlagsId_t ef_id, uint32_t flags);
648c36484f0Sopenharmony_ci
649c36484f0Sopenharmony_ci/// Clear the specified Event Flags.
650c36484f0Sopenharmony_ci/// \param[in]     ef_id         event flags ID obtained by \ref osEventFlagsNew.
651c36484f0Sopenharmony_ci/// \param[in]     flags         specifies the flags that shall be cleared.
652c36484f0Sopenharmony_ci/// \return event flags before clearing or error code if highest bit set.
653c36484f0Sopenharmony_ciuint32_t osEventFlagsClear (osEventFlagsId_t ef_id, uint32_t flags);
654c36484f0Sopenharmony_ci
655c36484f0Sopenharmony_ci/// Get the current Event Flags.
656c36484f0Sopenharmony_ci/// \param[in]     ef_id         event flags ID obtained by \ref osEventFlagsNew.
657c36484f0Sopenharmony_ci/// \return current event flags.
658c36484f0Sopenharmony_ciuint32_t osEventFlagsGet (osEventFlagsId_t ef_id);
659c36484f0Sopenharmony_ci
660c36484f0Sopenharmony_ci/// Wait for one or more Event Flags to become signaled.
661c36484f0Sopenharmony_ci/// \param[in]     ef_id         event flags ID obtained by \ref osEventFlagsNew.
662c36484f0Sopenharmony_ci/// \param[in]     flags         specifies the flags to wait for.
663c36484f0Sopenharmony_ci/// \param[in]     options       specifies flags options (osFlagsXxxx).
664c36484f0Sopenharmony_ci/// \param[in]     timeout       \ref CMSIS_RTOS_TimeOutValue or 0 in case of no time-out.
665c36484f0Sopenharmony_ci/// \return event flags before clearing or error code if highest bit set.
666c36484f0Sopenharmony_ciuint32_t osEventFlagsWait (osEventFlagsId_t ef_id, uint32_t flags, uint32_t options, uint32_t timeout);
667c36484f0Sopenharmony_ci
668c36484f0Sopenharmony_ci/// Delete an Event Flags object.
669c36484f0Sopenharmony_ci/// \param[in]     ef_id         event flags ID obtained by \ref osEventFlagsNew.
670c36484f0Sopenharmony_ci/// \return status code that indicates the execution status of the function.
671c36484f0Sopenharmony_ciosStatus_t osEventFlagsDelete (osEventFlagsId_t ef_id);
672c36484f0Sopenharmony_ci
673c36484f0Sopenharmony_ci
674c36484f0Sopenharmony_ci//  ==== Mutex Management Functions ====
675c36484f0Sopenharmony_ci
676c36484f0Sopenharmony_ci/// Create and Initialize a Mutex object.
677c36484f0Sopenharmony_ci/// \param[in]     attr          mutex attributes; NULL: default values.
678c36484f0Sopenharmony_ci/// \return mutex ID for reference by other functions or NULL in case of error.
679c36484f0Sopenharmony_ciosMutexId_t osMutexNew (const osMutexAttr_t *attr);
680c36484f0Sopenharmony_ci
681c36484f0Sopenharmony_ci/// Get name of a Mutex object.
682c36484f0Sopenharmony_ci/// \param[in]     mutex_id      mutex ID obtained by \ref osMutexNew.
683c36484f0Sopenharmony_ci/// \return name as null-terminated string.
684c36484f0Sopenharmony_ciconst char *osMutexGetName (osMutexId_t mutex_id);
685c36484f0Sopenharmony_ci
686c36484f0Sopenharmony_ci/// Acquire a Mutex or timeout if it is locked.
687c36484f0Sopenharmony_ci/// \param[in]     mutex_id      mutex ID obtained by \ref osMutexNew.
688c36484f0Sopenharmony_ci/// \param[in]     timeout       \ref CMSIS_RTOS_TimeOutValue or 0 in case of no time-out.
689c36484f0Sopenharmony_ci/// \return status code that indicates the execution status of the function.
690c36484f0Sopenharmony_ciosStatus_t osMutexAcquire (osMutexId_t mutex_id, uint32_t timeout);
691c36484f0Sopenharmony_ci
692c36484f0Sopenharmony_ci/// Release a Mutex that was acquired by \ref osMutexAcquire.
693c36484f0Sopenharmony_ci/// \param[in]     mutex_id      mutex ID obtained by \ref osMutexNew.
694c36484f0Sopenharmony_ci/// \return status code that indicates the execution status of the function.
695c36484f0Sopenharmony_ciosStatus_t osMutexRelease (osMutexId_t mutex_id);
696c36484f0Sopenharmony_ci
697c36484f0Sopenharmony_ci/// Get Thread which owns a Mutex object.
698c36484f0Sopenharmony_ci/// \param[in]     mutex_id      mutex ID obtained by \ref osMutexNew.
699c36484f0Sopenharmony_ci/// \return thread ID of owner thread or NULL when mutex was not acquired.
700c36484f0Sopenharmony_ciosThreadId_t osMutexGetOwner (osMutexId_t mutex_id);
701c36484f0Sopenharmony_ci
702c36484f0Sopenharmony_ci/// Delete a Mutex object.
703c36484f0Sopenharmony_ci/// \param[in]     mutex_id      mutex ID obtained by \ref osMutexNew.
704c36484f0Sopenharmony_ci/// \return status code that indicates the execution status of the function.
705c36484f0Sopenharmony_ciosStatus_t osMutexDelete (osMutexId_t mutex_id);
706c36484f0Sopenharmony_ci
707c36484f0Sopenharmony_ci
708c36484f0Sopenharmony_ci//  ==== Semaphore Management Functions ====
709c36484f0Sopenharmony_ci
710c36484f0Sopenharmony_ci/// Create and Initialize a Semaphore object.
711c36484f0Sopenharmony_ci/// \param[in]     max_count     maximum number of available tokens.
712c36484f0Sopenharmony_ci/// \param[in]     initial_count initial number of available tokens.
713c36484f0Sopenharmony_ci/// \param[in]     attr          semaphore attributes; NULL: default values.
714c36484f0Sopenharmony_ci/// \return semaphore ID for reference by other functions or NULL in case of error.
715c36484f0Sopenharmony_ciosSemaphoreId_t osSemaphoreNew (uint32_t max_count, uint32_t initial_count, const osSemaphoreAttr_t *attr);
716c36484f0Sopenharmony_ci
717c36484f0Sopenharmony_ci/// Get name of a Semaphore object.
718c36484f0Sopenharmony_ci/// \param[in]     semaphore_id  semaphore ID obtained by \ref osSemaphoreNew.
719c36484f0Sopenharmony_ci/// \return name as null-terminated string.
720c36484f0Sopenharmony_ciconst char *osSemaphoreGetName (osSemaphoreId_t semaphore_id);
721c36484f0Sopenharmony_ci
722c36484f0Sopenharmony_ci/// Acquire a Semaphore token or timeout if no tokens are available.
723c36484f0Sopenharmony_ci/// \param[in]     semaphore_id  semaphore ID obtained by \ref osSemaphoreNew.
724c36484f0Sopenharmony_ci/// \param[in]     timeout       \ref CMSIS_RTOS_TimeOutValue or 0 in case of no time-out.
725c36484f0Sopenharmony_ci/// \return status code that indicates the execution status of the function.
726c36484f0Sopenharmony_ciosStatus_t osSemaphoreAcquire (osSemaphoreId_t semaphore_id, uint32_t timeout);
727c36484f0Sopenharmony_ci
728c36484f0Sopenharmony_ci/// Release a Semaphore token up to the initial maximum count.
729c36484f0Sopenharmony_ci/// \param[in]     semaphore_id  semaphore ID obtained by \ref osSemaphoreNew.
730c36484f0Sopenharmony_ci/// \return status code that indicates the execution status of the function.
731c36484f0Sopenharmony_ciosStatus_t osSemaphoreRelease (osSemaphoreId_t semaphore_id);
732c36484f0Sopenharmony_ci
733c36484f0Sopenharmony_ci/// Get current Semaphore token count.
734c36484f0Sopenharmony_ci/// \param[in]     semaphore_id  semaphore ID obtained by \ref osSemaphoreNew.
735c36484f0Sopenharmony_ci/// \return number of tokens available.
736c36484f0Sopenharmony_ciuint32_t osSemaphoreGetCount (osSemaphoreId_t semaphore_id);
737c36484f0Sopenharmony_ci
738c36484f0Sopenharmony_ci/// Delete a Semaphore object.
739c36484f0Sopenharmony_ci/// \param[in]     semaphore_id  semaphore ID obtained by \ref osSemaphoreNew.
740c36484f0Sopenharmony_ci/// \return status code that indicates the execution status of the function.
741c36484f0Sopenharmony_ciosStatus_t osSemaphoreDelete (osSemaphoreId_t semaphore_id);
742c36484f0Sopenharmony_ci
743c36484f0Sopenharmony_ci
744c36484f0Sopenharmony_ci//  ==== Memory Pool Management Functions ====
745c36484f0Sopenharmony_ci
746c36484f0Sopenharmony_ci/// Create and Initialize a Memory Pool object.
747c36484f0Sopenharmony_ci/// \param[in]     block_count   maximum number of memory blocks in memory pool.
748c36484f0Sopenharmony_ci/// \param[in]     block_size    memory block size in bytes.
749c36484f0Sopenharmony_ci/// \param[in]     attr          memory pool attributes; NULL: default values.
750c36484f0Sopenharmony_ci/// \return memory pool ID for reference by other functions or NULL in case of error.
751c36484f0Sopenharmony_ciosMemoryPoolId_t osMemoryPoolNew (uint32_t block_count, uint32_t block_size, const osMemoryPoolAttr_t *attr);
752c36484f0Sopenharmony_ci
753c36484f0Sopenharmony_ci/// Get name of a Memory Pool object.
754c36484f0Sopenharmony_ci/// \param[in]     mp_id         memory pool ID obtained by \ref osMemoryPoolNew.
755c36484f0Sopenharmony_ci/// \return name as null-terminated string.
756c36484f0Sopenharmony_ciconst char *osMemoryPoolGetName (osMemoryPoolId_t mp_id);
757c36484f0Sopenharmony_ci
758c36484f0Sopenharmony_ci/// Allocate a memory block from a Memory Pool.
759c36484f0Sopenharmony_ci/// \param[in]     mp_id         memory pool ID obtained by \ref osMemoryPoolNew.
760c36484f0Sopenharmony_ci/// \param[in]     timeout       \ref CMSIS_RTOS_TimeOutValue or 0 in case of no time-out.
761c36484f0Sopenharmony_ci/// \return address of the allocated memory block or NULL in case of no memory is available.
762c36484f0Sopenharmony_civoid *osMemoryPoolAlloc (osMemoryPoolId_t mp_id, uint32_t timeout);
763c36484f0Sopenharmony_ci
764c36484f0Sopenharmony_ci/// Return an allocated memory block back to a Memory Pool.
765c36484f0Sopenharmony_ci/// \param[in]     mp_id         memory pool ID obtained by \ref osMemoryPoolNew.
766c36484f0Sopenharmony_ci/// \param[in]     block         address of the allocated memory block to be returned to the memory pool.
767c36484f0Sopenharmony_ci/// \return status code that indicates the execution status of the function.
768c36484f0Sopenharmony_ciosStatus_t osMemoryPoolFree (osMemoryPoolId_t mp_id, void *block);
769c36484f0Sopenharmony_ci
770c36484f0Sopenharmony_ci/// Get maximum number of memory blocks in a Memory Pool.
771c36484f0Sopenharmony_ci/// \param[in]     mp_id         memory pool ID obtained by \ref osMemoryPoolNew.
772c36484f0Sopenharmony_ci/// \return maximum number of memory blocks.
773c36484f0Sopenharmony_ciuint32_t osMemoryPoolGetCapacity (osMemoryPoolId_t mp_id);
774c36484f0Sopenharmony_ci
775c36484f0Sopenharmony_ci/// Get memory block size in a Memory Pool.
776c36484f0Sopenharmony_ci/// \param[in]     mp_id         memory pool ID obtained by \ref osMemoryPoolNew.
777c36484f0Sopenharmony_ci/// \return memory block size in bytes.
778c36484f0Sopenharmony_ciuint32_t osMemoryPoolGetBlockSize (osMemoryPoolId_t mp_id);
779c36484f0Sopenharmony_ci
780c36484f0Sopenharmony_ci/// Get number of memory blocks used in a Memory Pool.
781c36484f0Sopenharmony_ci/// \param[in]     mp_id         memory pool ID obtained by \ref osMemoryPoolNew.
782c36484f0Sopenharmony_ci/// \return number of memory blocks used.
783c36484f0Sopenharmony_ciuint32_t osMemoryPoolGetCount (osMemoryPoolId_t mp_id);
784c36484f0Sopenharmony_ci
785c36484f0Sopenharmony_ci/// Get number of memory blocks available in a Memory Pool.
786c36484f0Sopenharmony_ci/// \param[in]     mp_id         memory pool ID obtained by \ref osMemoryPoolNew.
787c36484f0Sopenharmony_ci/// \return number of memory blocks available.
788c36484f0Sopenharmony_ciuint32_t osMemoryPoolGetSpace (osMemoryPoolId_t mp_id);
789c36484f0Sopenharmony_ci
790c36484f0Sopenharmony_ci/// Delete a Memory Pool object.
791c36484f0Sopenharmony_ci/// \param[in]     mp_id         memory pool ID obtained by \ref osMemoryPoolNew.
792c36484f0Sopenharmony_ci/// \return status code that indicates the execution status of the function.
793c36484f0Sopenharmony_ciosStatus_t osMemoryPoolDelete (osMemoryPoolId_t mp_id);
794c36484f0Sopenharmony_ci
795c36484f0Sopenharmony_ci
796c36484f0Sopenharmony_ci//  ==== Message Queue Management Functions ====
797c36484f0Sopenharmony_ci
798c36484f0Sopenharmony_ci/// Create and Initialize a Message Queue object.
799c36484f0Sopenharmony_ci/// \param[in]     msg_count     maximum number of messages in queue.
800c36484f0Sopenharmony_ci/// \param[in]     msg_size      maximum message size in bytes.
801c36484f0Sopenharmony_ci/// \param[in]     attr          message queue attributes; NULL: default values.
802c36484f0Sopenharmony_ci/// \return message queue ID for reference by other functions or NULL in case of error.
803c36484f0Sopenharmony_ciosMessageQueueId_t osMessageQueueNew (uint32_t msg_count, uint32_t msg_size, const osMessageQueueAttr_t *attr);
804c36484f0Sopenharmony_ci
805c36484f0Sopenharmony_ci/// Get name of a Message Queue object.
806c36484f0Sopenharmony_ci/// \param[in]     mq_id         message queue ID obtained by \ref osMessageQueueNew.
807c36484f0Sopenharmony_ci/// \return name as null-terminated string.
808c36484f0Sopenharmony_ciconst char *osMessageQueueGetName (osMessageQueueId_t mq_id);
809c36484f0Sopenharmony_ci
810c36484f0Sopenharmony_ci/// Put a Message into a Queue or timeout if Queue is full.
811c36484f0Sopenharmony_ci/// \param[in]     mq_id         message queue ID obtained by \ref osMessageQueueNew.
812c36484f0Sopenharmony_ci/// \param[in]     msg_ptr       pointer to buffer with message to put into a queue.
813c36484f0Sopenharmony_ci/// \param[in]     msg_prio      message priority.
814c36484f0Sopenharmony_ci/// \param[in]     timeout       \ref CMSIS_RTOS_TimeOutValue or 0 in case of no time-out.
815c36484f0Sopenharmony_ci/// \return status code that indicates the execution status of the function.
816c36484f0Sopenharmony_ciosStatus_t osMessageQueuePut (osMessageQueueId_t mq_id, const void *msg_ptr, uint8_t msg_prio, uint32_t timeout);
817c36484f0Sopenharmony_ci
818c36484f0Sopenharmony_ci/// Get a Message from a Queue or timeout if Queue is empty.
819c36484f0Sopenharmony_ci/// \param[in]     mq_id         message queue ID obtained by \ref osMessageQueueNew.
820c36484f0Sopenharmony_ci/// \param[out]    msg_ptr       pointer to buffer for message to get from a queue.
821c36484f0Sopenharmony_ci/// \param[out]    msg_prio      pointer to buffer for message priority or NULL.
822c36484f0Sopenharmony_ci/// \param[in]     timeout       \ref CMSIS_RTOS_TimeOutValue or 0 in case of no time-out.
823c36484f0Sopenharmony_ci/// \return status code that indicates the execution status of the function.
824c36484f0Sopenharmony_ciosStatus_t osMessageQueueGet (osMessageQueueId_t mq_id, void *msg_ptr, uint8_t *msg_prio, uint32_t timeout);
825c36484f0Sopenharmony_ci
826c36484f0Sopenharmony_ci/// Get maximum number of messages in a Message Queue.
827c36484f0Sopenharmony_ci/// \param[in]     mq_id         message queue ID obtained by \ref osMessageQueueNew.
828c36484f0Sopenharmony_ci/// \return maximum number of messages.
829c36484f0Sopenharmony_ciuint32_t osMessageQueueGetCapacity (osMessageQueueId_t mq_id);
830c36484f0Sopenharmony_ci
831c36484f0Sopenharmony_ci/// Get maximum message size in a Message Queue.
832c36484f0Sopenharmony_ci/// \param[in]     mq_id         message queue ID obtained by \ref osMessageQueueNew.
833c36484f0Sopenharmony_ci/// \return maximum message size in bytes.
834c36484f0Sopenharmony_ciuint32_t osMessageQueueGetMsgSize (osMessageQueueId_t mq_id);
835c36484f0Sopenharmony_ci
836c36484f0Sopenharmony_ci/// Get number of queued messages in a Message Queue.
837c36484f0Sopenharmony_ci/// \param[in]     mq_id         message queue ID obtained by \ref osMessageQueueNew.
838c36484f0Sopenharmony_ci/// \return number of queued messages.
839c36484f0Sopenharmony_ciuint32_t osMessageQueueGetCount (osMessageQueueId_t mq_id);
840c36484f0Sopenharmony_ci
841c36484f0Sopenharmony_ci/// Get number of available slots for messages in a Message Queue.
842c36484f0Sopenharmony_ci/// \param[in]     mq_id         message queue ID obtained by \ref osMessageQueueNew.
843c36484f0Sopenharmony_ci/// \return number of available slots for messages.
844c36484f0Sopenharmony_ciuint32_t osMessageQueueGetSpace (osMessageQueueId_t mq_id);
845c36484f0Sopenharmony_ci
846c36484f0Sopenharmony_ci/// Reset a Message Queue to initial empty state.
847c36484f0Sopenharmony_ci/// \param[in]     mq_id         message queue ID obtained by \ref osMessageQueueNew.
848c36484f0Sopenharmony_ci/// \return status code that indicates the execution status of the function.
849c36484f0Sopenharmony_ciosStatus_t osMessageQueueReset (osMessageQueueId_t mq_id);
850c36484f0Sopenharmony_ci
851c36484f0Sopenharmony_ci/// Delete a Message Queue object.
852c36484f0Sopenharmony_ci/// \param[in]     mq_id         message queue ID obtained by \ref osMessageQueueNew.
853c36484f0Sopenharmony_ci/// \return status code that indicates the execution status of the function.
854c36484f0Sopenharmony_ciosStatus_t osMessageQueueDelete (osMessageQueueId_t mq_id);
855c36484f0Sopenharmony_ci
856c36484f0Sopenharmony_ci
857c36484f0Sopenharmony_ci//  ==== Handler Functions ====
858c36484f0Sopenharmony_ci
859c36484f0Sopenharmony_ci/// Handler for expired thread watchdogs.
860c36484f0Sopenharmony_ci/// \param[in]     thread_id thread ID obtained by \ref osThreadNew or \ref osThreadGetId.
861c36484f0Sopenharmony_ci/// \return new watchdog reload value or 0 to stop the watchdog.
862c36484f0Sopenharmony_ciuint32_t osWatchdogAlarm_Handler (osThreadId_t thread_id);
863c36484f0Sopenharmony_ci
864c36484f0Sopenharmony_ci
865c36484f0Sopenharmony_ci// ==== Zone Management Function ====
866c36484f0Sopenharmony_ci
867c36484f0Sopenharmony_ci/// Setup MPU protected zone (called when zone changes).
868c36484f0Sopenharmony_ci/// \param[in]     zone          zone number.
869c36484f0Sopenharmony_civoid osZoneSetup_Callback (uint32_t zone);
870c36484f0Sopenharmony_ci
871c36484f0Sopenharmony_ci
872c36484f0Sopenharmony_ci//  ==== Exception Faults ====
873c36484f0Sopenharmony_ci
874c36484f0Sopenharmony_ci/// Resume normal operation when exiting exception faults
875c36484f0Sopenharmony_civoid osFaultResume (void);
876c36484f0Sopenharmony_ci
877c36484f0Sopenharmony_ci
878c36484f0Sopenharmony_ci#ifdef  __cplusplus
879c36484f0Sopenharmony_ci}
880c36484f0Sopenharmony_ci#endif
881c36484f0Sopenharmony_ci
882c36484f0Sopenharmony_ci#endif  // CMSIS_OS2_H_
883