Repostiory containing DAPLink source code with Reset Pin workaround for HANI_IOT board.

Upstream: https://github.com/ARMmbed/DAPLink

Committer:
Pawel Zarembski
Date:
Tue Apr 07 12:55:42 2020 +0200
Revision:
0:01f31e923fe2
hani: DAPLink with reset workaround

Who changed what in which revision?

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