Nirvana Jay / Mbed 2 deprecated F7DISCO_Demo

Dependencies:   BSP_DISCO_F746NG_patch mbed-rtos mbed

Committer:
NirT
Date:
Mon Nov 02 23:38:08 2015 +0000
Revision:
0:c00e6c923941
Error: Incomplete type is not allowed in "patch/LwIP/src/include/lwip/dhcp.h", Line: 83, Col: 4; ; and more like this.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
NirT 0:c00e6c923941 1 /* ----------------------------------------------------------------------
NirT 0:c00e6c923941 2 * $Date: 5. February 2013
NirT 0:c00e6c923941 3 * $Revision: V1.02
NirT 0:c00e6c923941 4 *
NirT 0:c00e6c923941 5 * Project: CMSIS-RTOS API
NirT 0:c00e6c923941 6 * Title: cmsis_os.h header file
NirT 0:c00e6c923941 7 *
NirT 0:c00e6c923941 8 * Version 0.02
NirT 0:c00e6c923941 9 * Initial Proposal Phase
NirT 0:c00e6c923941 10 * Version 0.03
NirT 0:c00e6c923941 11 * osKernelStart added, optional feature: main started as thread
NirT 0:c00e6c923941 12 * osSemaphores have standard behavior
NirT 0:c00e6c923941 13 * osTimerCreate does not start the timer, added osTimerStart
NirT 0:c00e6c923941 14 * osThreadPass is renamed to osThreadYield
NirT 0:c00e6c923941 15 * Version 1.01
NirT 0:c00e6c923941 16 * Support for C++ interface
NirT 0:c00e6c923941 17 * - const attribute removed from the osXxxxDef_t typedef's
NirT 0:c00e6c923941 18 * - const attribute added to the osXxxxDef macros
NirT 0:c00e6c923941 19 * Added: osTimerDelete, osMutexDelete, osSemaphoreDelete
NirT 0:c00e6c923941 20 * Added: osKernelInitialize
NirT 0:c00e6c923941 21 * Version 1.02
NirT 0:c00e6c923941 22 * Control functions for short timeouts in microsecond resolution:
NirT 0:c00e6c923941 23 * Added: osKernelSysTick, osKernelSysTickFrequency, osKernelSysTickMicroSec
NirT 0:c00e6c923941 24 * Removed: osSignalGet
NirT 0:c00e6c923941 25 *
NirT 0:c00e6c923941 26 *
NirT 0:c00e6c923941 27 *----------------------------------------------------------------------------
NirT 0:c00e6c923941 28 *
NirT 0:c00e6c923941 29 * Portions COPYRIGHT 2015 STMicroelectronics
NirT 0:c00e6c923941 30 * Portions Copyright (c) 2013 ARM LIMITED
NirT 0:c00e6c923941 31 * All rights reserved.
NirT 0:c00e6c923941 32 * Redistribution and use in source and binary forms, with or without
NirT 0:c00e6c923941 33 * modification, are permitted provided that the following conditions are met:
NirT 0:c00e6c923941 34 * - Redistributions of source code must retain the above copyright
NirT 0:c00e6c923941 35 * notice, this list of conditions and the following disclaimer.
NirT 0:c00e6c923941 36 * - Redistributions in binary form must reproduce the above copyright
NirT 0:c00e6c923941 37 * notice, this list of conditions and the following disclaimer in the
NirT 0:c00e6c923941 38 * documentation and/or other materials provided with the distribution.
NirT 0:c00e6c923941 39 * - Neither the name of ARM nor the names of its contributors may be used
NirT 0:c00e6c923941 40 * to endorse or promote products derived from this software without
NirT 0:c00e6c923941 41 * specific prior written permission.
NirT 0:c00e6c923941 42 *
NirT 0:c00e6c923941 43 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
NirT 0:c00e6c923941 44 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
NirT 0:c00e6c923941 45 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
NirT 0:c00e6c923941 46 * ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE
NirT 0:c00e6c923941 47 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
NirT 0:c00e6c923941 48 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
NirT 0:c00e6c923941 49 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
NirT 0:c00e6c923941 50 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
NirT 0:c00e6c923941 51 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
NirT 0:c00e6c923941 52 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
NirT 0:c00e6c923941 53 * POSSIBILITY OF SUCH DAMAGE.
NirT 0:c00e6c923941 54 *---------------------------------------------------------------------------*/
NirT 0:c00e6c923941 55
NirT 0:c00e6c923941 56 /**
NirT 0:c00e6c923941 57 ******************************************************************************
NirT 0:c00e6c923941 58 * @file cmsis_os.h
NirT 0:c00e6c923941 59 * @author MCD Application Team
NirT 0:c00e6c923941 60 * @date 27-March-2015
NirT 0:c00e6c923941 61 * @brief Header of cmsis_os.c
NirT 0:c00e6c923941 62 * A new set of APIs are added in addition to existing ones, these APIs
NirT 0:c00e6c923941 63 * are specific to FreeRTOS.
NirT 0:c00e6c923941 64 ******************************************************************************
NirT 0:c00e6c923941 65 * @attention
NirT 0:c00e6c923941 66 *
NirT 0:c00e6c923941 67 * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
NirT 0:c00e6c923941 68 * You may not use this file except in compliance with the License.
NirT 0:c00e6c923941 69 * You may obtain a copy of the License at:
NirT 0:c00e6c923941 70 *
NirT 0:c00e6c923941 71 * http://www.st.com/software_license_agreement_liberty_v2
NirT 0:c00e6c923941 72 *
NirT 0:c00e6c923941 73 * Unless required by applicable law or agreed to in writing, software
NirT 0:c00e6c923941 74 * distributed under the License is distributed on an "AS IS" BASIS,
NirT 0:c00e6c923941 75 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
NirT 0:c00e6c923941 76 * See the License for the specific language governing permissions and
NirT 0:c00e6c923941 77 * limitations under the License.
NirT 0:c00e6c923941 78 *
NirT 0:c00e6c923941 79 ******************************************************************************
NirT 0:c00e6c923941 80 */
NirT 0:c00e6c923941 81
NirT 0:c00e6c923941 82 #if defined ( __CC_ARM )
NirT 0:c00e6c923941 83 #define __ASM __asm /*!< asm keyword for ARM Compiler */
NirT 0:c00e6c923941 84 #define __INLINE __inline /*!< inline keyword for ARM Compiler */
NirT 0:c00e6c923941 85 #define __STATIC_INLINE static __inline
NirT 0:c00e6c923941 86 #elif defined ( __ICCARM__ )
NirT 0:c00e6c923941 87 #define __ASM __asm /*!< asm keyword for IAR Compiler */
NirT 0:c00e6c923941 88 #define __INLINE inline /*!< inline keyword for IAR Compiler. Only available in High optimization mode! */
NirT 0:c00e6c923941 89 #define __STATIC_INLINE static inline
NirT 0:c00e6c923941 90 #elif defined ( __GNUC__ )
NirT 0:c00e6c923941 91 #define __ASM __asm /*!< asm keyword for GNU Compiler */
NirT 0:c00e6c923941 92 #define __INLINE inline /*!< inline keyword for GNU Compiler */
NirT 0:c00e6c923941 93 #define __STATIC_INLINE static inline
NirT 0:c00e6c923941 94 #endif
NirT 0:c00e6c923941 95
NirT 0:c00e6c923941 96 #include <stdint.h>
NirT 0:c00e6c923941 97 #include <stddef.h>
NirT 0:c00e6c923941 98 #include "core_cmFunc.h"
NirT 0:c00e6c923941 99
NirT 0:c00e6c923941 100 #include "FreeRTOS.h"
NirT 0:c00e6c923941 101 #include "task.h"
NirT 0:c00e6c923941 102 #include "timers.h"
NirT 0:c00e6c923941 103 #include "queue.h"
NirT 0:c00e6c923941 104 #include "semphr.h"
NirT 0:c00e6c923941 105 #include "event_groups.h"
NirT 0:c00e6c923941 106
NirT 0:c00e6c923941 107 /**
NirT 0:c00e6c923941 108 \page cmsis_os_h Header File Template: cmsis_os.h
NirT 0:c00e6c923941 109
NirT 0:c00e6c923941 110 The file \b cmsis_os.h is a template header file for a CMSIS-RTOS compliant Real-Time Operating System (RTOS).
NirT 0:c00e6c923941 111 Each RTOS that is compliant with CMSIS-RTOS shall provide a specific \b cmsis_os.h header file that represents
NirT 0:c00e6c923941 112 its implementation.
NirT 0:c00e6c923941 113
NirT 0:c00e6c923941 114 The file cmsis_os.h contains:
NirT 0:c00e6c923941 115 - CMSIS-RTOS API function definitions
NirT 0:c00e6c923941 116 - struct definitions for parameters and return types
NirT 0:c00e6c923941 117 - status and priority values used by CMSIS-RTOS API functions
NirT 0:c00e6c923941 118 - macros for defining threads and other kernel objects
NirT 0:c00e6c923941 119
NirT 0:c00e6c923941 120
NirT 0:c00e6c923941 121 <b>Name conventions and header file modifications</b>
NirT 0:c00e6c923941 122
NirT 0:c00e6c923941 123 All definitions are prefixed with \b os to give an unique name space for CMSIS-RTOS functions.
NirT 0:c00e6c923941 124 Definitions that are prefixed \b os_ are not used in the application code but local to this header file.
NirT 0:c00e6c923941 125 All definitions and functions that belong to a module are grouped and have a common prefix, i.e. \b osThread.
NirT 0:c00e6c923941 126
NirT 0:c00e6c923941 127 Definitions that are marked with <b>CAN BE CHANGED</b> can be adapted towards the needs of the actual CMSIS-RTOS implementation.
NirT 0:c00e6c923941 128 These definitions can be specific to the underlying RTOS kernel.
NirT 0:c00e6c923941 129
NirT 0:c00e6c923941 130 Definitions that are marked with <b>MUST REMAIN UNCHANGED</b> cannot be altered. Otherwise the CMSIS-RTOS implementation is no longer
NirT 0:c00e6c923941 131 compliant to the standard. Note that some functions are optional and need not to be provided by every CMSIS-RTOS implementation.
NirT 0:c00e6c923941 132
NirT 0:c00e6c923941 133
NirT 0:c00e6c923941 134 <b>Function calls from interrupt service routines</b>
NirT 0:c00e6c923941 135
NirT 0:c00e6c923941 136 The following CMSIS-RTOS functions can be called from threads and interrupt service routines (ISR):
NirT 0:c00e6c923941 137 - \ref osSignalSet
NirT 0:c00e6c923941 138 - \ref osSemaphoreRelease
NirT 0:c00e6c923941 139 - \ref osPoolAlloc, \ref osPoolCAlloc, \ref osPoolFree
NirT 0:c00e6c923941 140 - \ref osMessagePut, \ref osMessageGet
NirT 0:c00e6c923941 141 - \ref osMailAlloc, \ref osMailCAlloc, \ref osMailGet, \ref osMailPut, \ref osMailFree
NirT 0:c00e6c923941 142
NirT 0:c00e6c923941 143 Functions that cannot be called from an ISR are verifying the interrupt status and return in case that they are called
NirT 0:c00e6c923941 144 from an ISR context the status code \b osErrorISR. In some implementations this condition might be caught using the HARD FAULT vector.
NirT 0:c00e6c923941 145
NirT 0:c00e6c923941 146 Some CMSIS-RTOS implementations support CMSIS-RTOS function calls from multiple ISR at the same time.
NirT 0:c00e6c923941 147 If this is impossible, the CMSIS-RTOS rejects calls by nested ISR functions with the status code \b osErrorISRRecursive.
NirT 0:c00e6c923941 148
NirT 0:c00e6c923941 149
NirT 0:c00e6c923941 150 <b>Define and reference object definitions</b>
NirT 0:c00e6c923941 151
NirT 0:c00e6c923941 152 With <b>\#define osObjectsExternal</b> objects are defined as external symbols. This allows to create a consistent header file
NirT 0:c00e6c923941 153 that is used throughout a project as shown below:
NirT 0:c00e6c923941 154
NirT 0:c00e6c923941 155 <i>Header File</i>
NirT 0:c00e6c923941 156 \code
NirT 0:c00e6c923941 157 #include <cmsis_os.h> // CMSIS RTOS header file
NirT 0:c00e6c923941 158
NirT 0:c00e6c923941 159 // Thread definition
NirT 0:c00e6c923941 160 extern void thread_sample (void const *argument); // function prototype
NirT 0:c00e6c923941 161 osThreadDef (thread_sample, osPriorityBelowNormal, 1, 100);
NirT 0:c00e6c923941 162
NirT 0:c00e6c923941 163 // Pool definition
NirT 0:c00e6c923941 164 osPoolDef(MyPool, 10, long);
NirT 0:c00e6c923941 165 \endcode
NirT 0:c00e6c923941 166
NirT 0:c00e6c923941 167
NirT 0:c00e6c923941 168 This header file defines all objects when included in a C/C++ source file. When <b>\#define osObjectsExternal</b> is
NirT 0:c00e6c923941 169 present before the header file, the objects are defined as external symbols. A single consistent header file can therefore be
NirT 0:c00e6c923941 170 used throughout the whole project.
NirT 0:c00e6c923941 171
NirT 0:c00e6c923941 172 <i>Example</i>
NirT 0:c00e6c923941 173 \code
NirT 0:c00e6c923941 174 #include "osObjects.h" // Definition of the CMSIS-RTOS objects
NirT 0:c00e6c923941 175 \endcode
NirT 0:c00e6c923941 176
NirT 0:c00e6c923941 177 \code
NirT 0:c00e6c923941 178 #define osObjectExternal // Objects will be defined as external symbols
NirT 0:c00e6c923941 179 #include "osObjects.h" // Reference to the CMSIS-RTOS objects
NirT 0:c00e6c923941 180 \endcode
NirT 0:c00e6c923941 181
NirT 0:c00e6c923941 182 */
NirT 0:c00e6c923941 183
NirT 0:c00e6c923941 184 #ifndef _CMSIS_OS_H
NirT 0:c00e6c923941 185 #define _CMSIS_OS_H
NirT 0:c00e6c923941 186
NirT 0:c00e6c923941 187 /// \note MUST REMAIN UNCHANGED: \b osCMSIS identifies the CMSIS-RTOS API version.
NirT 0:c00e6c923941 188 #define osCMSIS 0x10002 ///< API version (main [31:16] .sub [15:0])
NirT 0:c00e6c923941 189
NirT 0:c00e6c923941 190 /// \note CAN BE CHANGED: \b osCMSIS_KERNEL identifies the underlying RTOS kernel and version number.
NirT 0:c00e6c923941 191 #define osCMSIS_KERNEL 0x10000 ///< RTOS identification and version (main [31:16] .sub [15:0])
NirT 0:c00e6c923941 192
NirT 0:c00e6c923941 193 /// \note MUST REMAIN UNCHANGED: \b osKernelSystemId shall be consistent in every CMSIS-RTOS.
NirT 0:c00e6c923941 194 #define osKernelSystemId "KERNEL V1.00" ///< RTOS identification string
NirT 0:c00e6c923941 195
NirT 0:c00e6c923941 196 /// \note MUST REMAIN UNCHANGED: \b osFeature_xxx shall be consistent in every CMSIS-RTOS.
NirT 0:c00e6c923941 197 #define osFeature_MainThread 1 ///< main thread 1=main can be thread, 0=not available
NirT 0:c00e6c923941 198 #define osFeature_Pool 1 ///< Memory Pools: 1=available, 0=not available
NirT 0:c00e6c923941 199 #define osFeature_MailQ 1 ///< Mail Queues: 1=available, 0=not available
NirT 0:c00e6c923941 200 #define osFeature_MessageQ 1 ///< Message Queues: 1=available, 0=not available
NirT 0:c00e6c923941 201 #define osFeature_Signals 8 ///< maximum number of Signal Flags available per thread
NirT 0:c00e6c923941 202 #define osFeature_Semaphore 1 ///< osFeature_Semaphore function: 1=available, 0=not available
NirT 0:c00e6c923941 203 #define osFeature_Wait 0 ///< osWait function: 1=available, 0=not available
NirT 0:c00e6c923941 204 #define osFeature_SysTick 1 ///< osKernelSysTick functions: 1=available, 0=not available
NirT 0:c00e6c923941 205
NirT 0:c00e6c923941 206 #ifdef __cplusplus
NirT 0:c00e6c923941 207 extern "C"
NirT 0:c00e6c923941 208 {
NirT 0:c00e6c923941 209 #endif
NirT 0:c00e6c923941 210
NirT 0:c00e6c923941 211
NirT 0:c00e6c923941 212 // ==== Enumeration, structures, defines ====
NirT 0:c00e6c923941 213
NirT 0:c00e6c923941 214 /// Priority used for thread control.
NirT 0:c00e6c923941 215 /// \note MUST REMAIN UNCHANGED: \b osPriority shall be consistent in every CMSIS-RTOS.
NirT 0:c00e6c923941 216 typedef enum {
NirT 0:c00e6c923941 217 osPriorityIdle = -3, ///< priority: idle (lowest)
NirT 0:c00e6c923941 218 osPriorityLow = -2, ///< priority: low
NirT 0:c00e6c923941 219 osPriorityBelowNormal = -1, ///< priority: below normal
NirT 0:c00e6c923941 220 osPriorityNormal = 0, ///< priority: normal (default)
NirT 0:c00e6c923941 221 osPriorityAboveNormal = +1, ///< priority: above normal
NirT 0:c00e6c923941 222 osPriorityHigh = +2, ///< priority: high
NirT 0:c00e6c923941 223 osPriorityRealtime = +3, ///< priority: realtime (highest)
NirT 0:c00e6c923941 224 osPriorityError = 0x84 ///< system cannot determine priority or thread has illegal priority
NirT 0:c00e6c923941 225 } osPriority;
NirT 0:c00e6c923941 226
NirT 0:c00e6c923941 227 /// Timeout value.
NirT 0:c00e6c923941 228 /// \note MUST REMAIN UNCHANGED: \b osWaitForever shall be consistent in every CMSIS-RTOS.
NirT 0:c00e6c923941 229 #define osWaitForever 0xFFFFFFFF ///< wait forever timeout value
NirT 0:c00e6c923941 230
NirT 0:c00e6c923941 231 /// Status code values returned by CMSIS-RTOS functions.
NirT 0:c00e6c923941 232 /// \note MUST REMAIN UNCHANGED: \b osStatus shall be consistent in every CMSIS-RTOS.
NirT 0:c00e6c923941 233 typedef enum {
NirT 0:c00e6c923941 234 osOK = 0, ///< function completed; no error or event occurred.
NirT 0:c00e6c923941 235 osEventSignal = 0x08, ///< function completed; signal event occurred.
NirT 0:c00e6c923941 236 osEventMessage = 0x10, ///< function completed; message event occurred.
NirT 0:c00e6c923941 237 osEventMail = 0x20, ///< function completed; mail event occurred.
NirT 0:c00e6c923941 238 osEventTimeout = 0x40, ///< function completed; timeout occurred.
NirT 0:c00e6c923941 239 osErrorParameter = 0x80, ///< parameter error: a mandatory parameter was missing or specified an incorrect object.
NirT 0:c00e6c923941 240 osErrorResource = 0x81, ///< resource not available: a specified resource was not available.
NirT 0:c00e6c923941 241 osErrorTimeoutResource = 0xC1, ///< resource not available within given time: a specified resource was not available within the timeout period.
NirT 0:c00e6c923941 242 osErrorISR = 0x82, ///< not allowed in ISR context: the function cannot be called from interrupt service routines.
NirT 0:c00e6c923941 243 osErrorISRRecursive = 0x83, ///< function called multiple times from ISR with same object.
NirT 0:c00e6c923941 244 osErrorPriority = 0x84, ///< system cannot determine priority or thread has illegal priority.
NirT 0:c00e6c923941 245 osErrorNoMemory = 0x85, ///< system is out of memory: it was impossible to allocate or reserve memory for the operation.
NirT 0:c00e6c923941 246 osErrorValue = 0x86, ///< value of a parameter is out of range.
NirT 0:c00e6c923941 247 osErrorOS = 0xFF, ///< unspecified RTOS error: run-time error but no other error message fits.
NirT 0:c00e6c923941 248 os_status_reserved = 0x7FFFFFFF ///< prevent from enum down-size compiler optimization.
NirT 0:c00e6c923941 249 } osStatus;
NirT 0:c00e6c923941 250
NirT 0:c00e6c923941 251 #if ( INCLUDE_eTaskGetState == 1 )
NirT 0:c00e6c923941 252 /* Thread state returned by osThreadGetState */
NirT 0:c00e6c923941 253 typedef enum {
NirT 0:c00e6c923941 254 osThreadRunning = 0x0, /* A thread is querying the state of itself, so must be running. */
NirT 0:c00e6c923941 255 osThreadReady = 0x1 , /* The thread being queried is in a read or pending ready list. */
NirT 0:c00e6c923941 256 osThreadBlocked = 0x2, /* The thread being queried is in the Blocked state. */
NirT 0:c00e6c923941 257 osThreadSuspended = 0x3, /* The thread being queried is in the Suspended state, or is in the Blocked state with an infinite time out. */
NirT 0:c00e6c923941 258 osThreadDeleted = 0x4, /* The thread being queried has been deleted, but its TCB has not yet been freed. */
NirT 0:c00e6c923941 259 osThreadError = 0x7FFFFFFF
NirT 0:c00e6c923941 260 } osThreadState;
NirT 0:c00e6c923941 261 #endif /* INCLUDE_eTaskGetState */
NirT 0:c00e6c923941 262
NirT 0:c00e6c923941 263 /// Timer type value for the timer definition.
NirT 0:c00e6c923941 264 /// \note MUST REMAIN UNCHANGED: \b os_timer_type shall be consistent in every CMSIS-RTOS.
NirT 0:c00e6c923941 265 typedef enum {
NirT 0:c00e6c923941 266 osTimerOnce = 0, ///< one-shot timer
NirT 0:c00e6c923941 267 osTimerPeriodic = 1 ///< repeating timer
NirT 0:c00e6c923941 268 } os_timer_type;
NirT 0:c00e6c923941 269
NirT 0:c00e6c923941 270 /// Entry point of a thread.
NirT 0:c00e6c923941 271 /// \note MUST REMAIN UNCHANGED: \b os_pthread shall be consistent in every CMSIS-RTOS.
NirT 0:c00e6c923941 272 typedef void (*os_pthread) (void const *argument);
NirT 0:c00e6c923941 273
NirT 0:c00e6c923941 274 /// Entry point of a timer call back function.
NirT 0:c00e6c923941 275 /// \note MUST REMAIN UNCHANGED: \b os_ptimer shall be consistent in every CMSIS-RTOS.
NirT 0:c00e6c923941 276 typedef void (*os_ptimer) (void const *argument);
NirT 0:c00e6c923941 277
NirT 0:c00e6c923941 278 // >>> the following data type definitions may shall adapted towards a specific RTOS
NirT 0:c00e6c923941 279
NirT 0:c00e6c923941 280 /// Thread ID identifies the thread (pointer to a thread control block).
NirT 0:c00e6c923941 281 /// \note CAN BE CHANGED: \b os_thread_cb is implementation specific in every CMSIS-RTOS.
NirT 0:c00e6c923941 282 typedef TaskHandle_t osThreadId;
NirT 0:c00e6c923941 283
NirT 0:c00e6c923941 284 /// Timer ID identifies the timer (pointer to a timer control block).
NirT 0:c00e6c923941 285 /// \note CAN BE CHANGED: \b os_timer_cb is implementation specific in every CMSIS-RTOS.
NirT 0:c00e6c923941 286 typedef TimerHandle_t osTimerId;
NirT 0:c00e6c923941 287
NirT 0:c00e6c923941 288 /// Mutex ID identifies the mutex (pointer to a mutex control block).
NirT 0:c00e6c923941 289 /// \note CAN BE CHANGED: \b os_mutex_cb is implementation specific in every CMSIS-RTOS.
NirT 0:c00e6c923941 290 typedef SemaphoreHandle_t osMutexId;
NirT 0:c00e6c923941 291
NirT 0:c00e6c923941 292 /// Semaphore ID identifies the semaphore (pointer to a semaphore control block).
NirT 0:c00e6c923941 293 /// \note CAN BE CHANGED: \b os_semaphore_cb is implementation specific in every CMSIS-RTOS.
NirT 0:c00e6c923941 294 typedef SemaphoreHandle_t osSemaphoreId;
NirT 0:c00e6c923941 295
NirT 0:c00e6c923941 296 /// Pool ID identifies the memory pool (pointer to a memory pool control block).
NirT 0:c00e6c923941 297 /// \note CAN BE CHANGED: \b os_pool_cb is implementation specific in every CMSIS-RTOS.
NirT 0:c00e6c923941 298 typedef struct os_pool_cb *osPoolId;
NirT 0:c00e6c923941 299
NirT 0:c00e6c923941 300 /// Message ID identifies the message queue (pointer to a message queue control block).
NirT 0:c00e6c923941 301 /// \note CAN BE CHANGED: \b os_messageQ_cb is implementation specific in every CMSIS-RTOS.
NirT 0:c00e6c923941 302 typedef QueueHandle_t osMessageQId;
NirT 0:c00e6c923941 303
NirT 0:c00e6c923941 304 /// Mail ID identifies the mail queue (pointer to a mail queue control block).
NirT 0:c00e6c923941 305 /// \note CAN BE CHANGED: \b os_mailQ_cb is implementation specific in every CMSIS-RTOS.
NirT 0:c00e6c923941 306 typedef struct os_mailQ_cb *osMailQId;
NirT 0:c00e6c923941 307
NirT 0:c00e6c923941 308
NirT 0:c00e6c923941 309 /// Thread Definition structure contains startup information of a thread.
NirT 0:c00e6c923941 310 /// \note CAN BE CHANGED: \b os_thread_def is implementation specific in every CMSIS-RTOS.
NirT 0:c00e6c923941 311 typedef struct os_thread_def {
NirT 0:c00e6c923941 312 char *name; ///< Thread name
NirT 0:c00e6c923941 313 os_pthread pthread; ///< start address of thread function
NirT 0:c00e6c923941 314 osPriority tpriority; ///< initial thread priority
NirT 0:c00e6c923941 315 uint32_t instances; ///< maximum number of instances of that thread function
NirT 0:c00e6c923941 316 uint32_t stacksize; ///< stack size requirements in bytes; 0 is default stack size
NirT 0:c00e6c923941 317 } osThreadDef_t;
NirT 0:c00e6c923941 318
NirT 0:c00e6c923941 319 /// Timer Definition structure contains timer parameters.
NirT 0:c00e6c923941 320 /// \note CAN BE CHANGED: \b os_timer_def is implementation specific in every CMSIS-RTOS.
NirT 0:c00e6c923941 321 typedef struct os_timer_def {
NirT 0:c00e6c923941 322 os_ptimer ptimer; ///< start address of a timer function
NirT 0:c00e6c923941 323 } osTimerDef_t;
NirT 0:c00e6c923941 324
NirT 0:c00e6c923941 325 /// Mutex Definition structure contains setup information for a mutex.
NirT 0:c00e6c923941 326 /// \note CAN BE CHANGED: \b os_mutex_def is implementation specific in every CMSIS-RTOS.
NirT 0:c00e6c923941 327 typedef struct os_mutex_def {
NirT 0:c00e6c923941 328 uint32_t dummy; ///< dummy value.
NirT 0:c00e6c923941 329 } osMutexDef_t;
NirT 0:c00e6c923941 330
NirT 0:c00e6c923941 331 /// Semaphore Definition structure contains setup information for a semaphore.
NirT 0:c00e6c923941 332 /// \note CAN BE CHANGED: \b os_semaphore_def is implementation specific in every CMSIS-RTOS.
NirT 0:c00e6c923941 333 typedef struct os_semaphore_def {
NirT 0:c00e6c923941 334 uint32_t dummy; ///< dummy value.
NirT 0:c00e6c923941 335 } osSemaphoreDef_t;
NirT 0:c00e6c923941 336
NirT 0:c00e6c923941 337 /// Definition structure for memory block allocation.
NirT 0:c00e6c923941 338 /// \note CAN BE CHANGED: \b os_pool_def is implementation specific in every CMSIS-RTOS.
NirT 0:c00e6c923941 339 typedef struct os_pool_def {
NirT 0:c00e6c923941 340 uint32_t pool_sz; ///< number of items (elements) in the pool
NirT 0:c00e6c923941 341 uint32_t item_sz; ///< size of an item
NirT 0:c00e6c923941 342 void *pool; ///< pointer to memory for pool
NirT 0:c00e6c923941 343 } osPoolDef_t;
NirT 0:c00e6c923941 344
NirT 0:c00e6c923941 345 /// Definition structure for message queue.
NirT 0:c00e6c923941 346 /// \note CAN BE CHANGED: \b os_messageQ_def is implementation specific in every CMSIS-RTOS.
NirT 0:c00e6c923941 347 typedef struct os_messageQ_def {
NirT 0:c00e6c923941 348 uint32_t queue_sz; ///< number of elements in the queue
NirT 0:c00e6c923941 349 uint32_t item_sz; ///< size of an item
NirT 0:c00e6c923941 350 //void *pool; ///< memory array for messages
NirT 0:c00e6c923941 351 } osMessageQDef_t;
NirT 0:c00e6c923941 352
NirT 0:c00e6c923941 353 /// Definition structure for mail queue.
NirT 0:c00e6c923941 354 /// \note CAN BE CHANGED: \b os_mailQ_def is implementation specific in every CMSIS-RTOS.
NirT 0:c00e6c923941 355 typedef struct os_mailQ_def {
NirT 0:c00e6c923941 356 uint32_t queue_sz; ///< number of elements in the queue
NirT 0:c00e6c923941 357 uint32_t item_sz; ///< size of an item
NirT 0:c00e6c923941 358 struct os_mailQ_cb **cb;
NirT 0:c00e6c923941 359 } osMailQDef_t;
NirT 0:c00e6c923941 360
NirT 0:c00e6c923941 361 /// Event structure contains detailed information about an event.
NirT 0:c00e6c923941 362 /// \note MUST REMAIN UNCHANGED: \b os_event shall be consistent in every CMSIS-RTOS.
NirT 0:c00e6c923941 363 /// However the struct may be extended at the end.
NirT 0:c00e6c923941 364 typedef struct {
NirT 0:c00e6c923941 365 osStatus status; ///< status code: event or error information
NirT 0:c00e6c923941 366 union {
NirT 0:c00e6c923941 367 uint32_t v; ///< message as 32-bit value
NirT 0:c00e6c923941 368 void *p; ///< message or mail as void pointer
NirT 0:c00e6c923941 369 int32_t signals; ///< signal flags
NirT 0:c00e6c923941 370 } value; ///< event value
NirT 0:c00e6c923941 371 union {
NirT 0:c00e6c923941 372 osMailQId mail_id; ///< mail id obtained by \ref osMailCreate
NirT 0:c00e6c923941 373 osMessageQId message_id; ///< message id obtained by \ref osMessageCreate
NirT 0:c00e6c923941 374 } def; ///< event definition
NirT 0:c00e6c923941 375 } osEvent;
NirT 0:c00e6c923941 376
NirT 0:c00e6c923941 377
NirT 0:c00e6c923941 378 // ==== Kernel Control Functions ====
NirT 0:c00e6c923941 379
NirT 0:c00e6c923941 380 /// Initialize the RTOS Kernel for creating objects.
NirT 0:c00e6c923941 381 /// \return status code that indicates the execution status of the function.
NirT 0:c00e6c923941 382 /// \note MUST REMAIN UNCHANGED: \b osKernelInitialize shall be consistent in every CMSIS-RTOS.
NirT 0:c00e6c923941 383 osStatus osKernelInitialize (void);
NirT 0:c00e6c923941 384
NirT 0:c00e6c923941 385 /// Start the RTOS Kernel.
NirT 0:c00e6c923941 386 /// \return status code that indicates the execution status of the function.
NirT 0:c00e6c923941 387 /// \note MUST REMAIN UNCHANGED: \b osKernelStart shall be consistent in every CMSIS-RTOS.
NirT 0:c00e6c923941 388 osStatus osKernelStart (void);
NirT 0:c00e6c923941 389
NirT 0:c00e6c923941 390 /// Check if the RTOS kernel is already started.
NirT 0:c00e6c923941 391 /// \note MUST REMAIN UNCHANGED: \b osKernelRunning shall be consistent in every CMSIS-RTOS.
NirT 0:c00e6c923941 392 /// \return 0 RTOS is not started, 1 RTOS is started.
NirT 0:c00e6c923941 393 int32_t osKernelRunning(void);
NirT 0:c00e6c923941 394
NirT 0:c00e6c923941 395 #if (defined (osFeature_SysTick) && (osFeature_SysTick != 0)) // System Timer available
NirT 0:c00e6c923941 396
NirT 0:c00e6c923941 397 /// Get the RTOS kernel system timer counter
NirT 0:c00e6c923941 398 /// \note MUST REMAIN UNCHANGED: \b osKernelSysTick shall be consistent in every CMSIS-RTOS.
NirT 0:c00e6c923941 399 /// \return RTOS kernel system timer as 32-bit value
NirT 0:c00e6c923941 400 uint32_t osKernelSysTick (void);
NirT 0:c00e6c923941 401
NirT 0:c00e6c923941 402 /// The RTOS kernel system timer frequency in Hz
NirT 0:c00e6c923941 403 /// \note Reflects the system timer setting and is typically defined in a configuration file.
NirT 0:c00e6c923941 404 #define osKernelSysTickFrequency (configTICK_RATE_HZ)
NirT 0:c00e6c923941 405
NirT 0:c00e6c923941 406 /// Convert a microseconds value to a RTOS kernel system timer value.
NirT 0:c00e6c923941 407 /// \param microsec time value in microseconds.
NirT 0:c00e6c923941 408 /// \return time value normalized to the \ref osKernelSysTickFrequency
NirT 0:c00e6c923941 409 #define osKernelSysTickMicroSec(microsec) (((uint64_t)microsec * (osKernelSysTickFrequency)) / 1000000)
NirT 0:c00e6c923941 410
NirT 0:c00e6c923941 411 #endif // System Timer available
NirT 0:c00e6c923941 412
NirT 0:c00e6c923941 413 // ==== Thread Management ====
NirT 0:c00e6c923941 414
NirT 0:c00e6c923941 415 /// Create a Thread Definition with function, priority, and stack requirements.
NirT 0:c00e6c923941 416 /// \param name name of the thread function.
NirT 0:c00e6c923941 417 /// \param priority initial priority of the thread function.
NirT 0:c00e6c923941 418 /// \param instances number of possible thread instances.
NirT 0:c00e6c923941 419 /// \param stacksz stack size (in bytes) requirements for the thread function.
NirT 0:c00e6c923941 420 /// \note CAN BE CHANGED: The parameters to \b osThreadDef shall be consistent but the
NirT 0:c00e6c923941 421 /// macro body is implementation specific in every CMSIS-RTOS.
NirT 0:c00e6c923941 422 #if defined (osObjectsExternal) // object is external
NirT 0:c00e6c923941 423 #define osThreadDef(name, thread, priority, instances, stacksz) \
NirT 0:c00e6c923941 424 extern const osThreadDef_t os_thread_def_##name
NirT 0:c00e6c923941 425 #else // define the object
NirT 0:c00e6c923941 426 #define osThreadDef(name, thread, priority, instances, stacksz) \
NirT 0:c00e6c923941 427 const osThreadDef_t os_thread_def_##name = \
NirT 0:c00e6c923941 428 { #name, (thread), (priority), (instances), (stacksz) }
NirT 0:c00e6c923941 429 #endif
NirT 0:c00e6c923941 430
NirT 0:c00e6c923941 431 /// Access a Thread definition.
NirT 0:c00e6c923941 432 /// \param name name of the thread definition object.
NirT 0:c00e6c923941 433 /// \note CAN BE CHANGED: The parameter to \b osThread shall be consistent but the
NirT 0:c00e6c923941 434 /// macro body is implementation specific in every CMSIS-RTOS.
NirT 0:c00e6c923941 435 #define osThread(name) \
NirT 0:c00e6c923941 436 &os_thread_def_##name
NirT 0:c00e6c923941 437
NirT 0:c00e6c923941 438 /// Create a thread and add it to Active Threads and set it to state READY.
NirT 0:c00e6c923941 439 /// \param[in] thread_def thread definition referenced with \ref osThread.
NirT 0:c00e6c923941 440 /// \param[in] argument pointer that is passed to the thread function as start argument.
NirT 0:c00e6c923941 441 /// \return thread ID for reference by other functions or NULL in case of error.
NirT 0:c00e6c923941 442 /// \note MUST REMAIN UNCHANGED: \b osThreadCreate shall be consistent in every CMSIS-RTOS.
NirT 0:c00e6c923941 443 osThreadId osThreadCreate (const osThreadDef_t *thread_def, void *argument);
NirT 0:c00e6c923941 444
NirT 0:c00e6c923941 445 /// Return the thread ID of the current running thread.
NirT 0:c00e6c923941 446 /// \return thread ID for reference by other functions or NULL in case of error.
NirT 0:c00e6c923941 447 /// \note MUST REMAIN UNCHANGED: \b osThreadGetId shall be consistent in every CMSIS-RTOS.
NirT 0:c00e6c923941 448 osThreadId osThreadGetId (void);
NirT 0:c00e6c923941 449
NirT 0:c00e6c923941 450 /// Terminate execution of a thread and remove it from Active Threads.
NirT 0:c00e6c923941 451 /// \param[in] thread_id thread ID obtained by \ref osThreadCreate or \ref osThreadGetId.
NirT 0:c00e6c923941 452 /// \return status code that indicates the execution status of the function.
NirT 0:c00e6c923941 453 /// \note MUST REMAIN UNCHANGED: \b osThreadTerminate shall be consistent in every CMSIS-RTOS.
NirT 0:c00e6c923941 454 osStatus osThreadTerminate (osThreadId thread_id);
NirT 0:c00e6c923941 455
NirT 0:c00e6c923941 456 /// Pass control to next thread that is in state \b READY.
NirT 0:c00e6c923941 457 /// \return status code that indicates the execution status of the function.
NirT 0:c00e6c923941 458 /// \note MUST REMAIN UNCHANGED: \b osThreadYield shall be consistent in every CMSIS-RTOS.
NirT 0:c00e6c923941 459 osStatus osThreadYield (void);
NirT 0:c00e6c923941 460
NirT 0:c00e6c923941 461 /// Change priority of an active thread.
NirT 0:c00e6c923941 462 /// \param[in] thread_id thread ID obtained by \ref osThreadCreate or \ref osThreadGetId.
NirT 0:c00e6c923941 463 /// \param[in] priority new priority value for the thread function.
NirT 0:c00e6c923941 464 /// \return status code that indicates the execution status of the function.
NirT 0:c00e6c923941 465 /// \note MUST REMAIN UNCHANGED: \b osThreadSetPriority shall be consistent in every CMSIS-RTOS.
NirT 0:c00e6c923941 466 osStatus osThreadSetPriority (osThreadId thread_id, osPriority priority);
NirT 0:c00e6c923941 467
NirT 0:c00e6c923941 468 /// Get current priority of an active thread.
NirT 0:c00e6c923941 469 /// \param[in] thread_id thread ID obtained by \ref osThreadCreate or \ref osThreadGetId.
NirT 0:c00e6c923941 470 /// \return current priority value of the thread function.
NirT 0:c00e6c923941 471 /// \note MUST REMAIN UNCHANGED: \b osThreadGetPriority shall be consistent in every CMSIS-RTOS.
NirT 0:c00e6c923941 472 osPriority osThreadGetPriority (osThreadId thread_id);
NirT 0:c00e6c923941 473
NirT 0:c00e6c923941 474
NirT 0:c00e6c923941 475 // ==== Generic Wait Functions ====
NirT 0:c00e6c923941 476
NirT 0:c00e6c923941 477 /// Wait for Timeout (Time Delay).
NirT 0:c00e6c923941 478 /// \param[in] millisec time delay value
NirT 0:c00e6c923941 479 /// \return status code that indicates the execution status of the function.
NirT 0:c00e6c923941 480 osStatus osDelay (uint32_t millisec);
NirT 0:c00e6c923941 481
NirT 0:c00e6c923941 482 #if (defined (osFeature_Wait) && (osFeature_Wait != 0)) // Generic Wait available
NirT 0:c00e6c923941 483
NirT 0:c00e6c923941 484 /// Wait for Signal, Message, Mail, or Timeout.
NirT 0:c00e6c923941 485 /// \param[in] millisec timeout value or 0 in case of no time-out
NirT 0:c00e6c923941 486 /// \return event that contains signal, message, or mail information or error code.
NirT 0:c00e6c923941 487 /// \note MUST REMAIN UNCHANGED: \b osWait shall be consistent in every CMSIS-RTOS.
NirT 0:c00e6c923941 488 osEvent osWait (uint32_t millisec);
NirT 0:c00e6c923941 489
NirT 0:c00e6c923941 490 #endif // Generic Wait available
NirT 0:c00e6c923941 491
NirT 0:c00e6c923941 492
NirT 0:c00e6c923941 493 // ==== Timer Management Functions ====
NirT 0:c00e6c923941 494 /// Define a Timer object.
NirT 0:c00e6c923941 495 /// \param name name of the timer object.
NirT 0:c00e6c923941 496 /// \param function name of the timer call back function.
NirT 0:c00e6c923941 497 /// \note CAN BE CHANGED: The parameter to \b osTimerDef shall be consistent but the
NirT 0:c00e6c923941 498 /// macro body is implementation specific in every CMSIS-RTOS.
NirT 0:c00e6c923941 499 #if defined (osObjectsExternal) // object is external
NirT 0:c00e6c923941 500 #define osTimerDef(name, function) \
NirT 0:c00e6c923941 501 extern const osTimerDef_t os_timer_def_##name
NirT 0:c00e6c923941 502 #else // define the object
NirT 0:c00e6c923941 503 #define osTimerDef(name, function) \
NirT 0:c00e6c923941 504 const osTimerDef_t os_timer_def_##name = \
NirT 0:c00e6c923941 505 { (function) }
NirT 0:c00e6c923941 506 #endif
NirT 0:c00e6c923941 507
NirT 0:c00e6c923941 508 /// Access a Timer definition.
NirT 0:c00e6c923941 509 /// \param name name of the timer object.
NirT 0:c00e6c923941 510 /// \note CAN BE CHANGED: The parameter to \b osTimer shall be consistent but the
NirT 0:c00e6c923941 511 /// macro body is implementation specific in every CMSIS-RTOS.
NirT 0:c00e6c923941 512 #define osTimer(name) \
NirT 0:c00e6c923941 513 &os_timer_def_##name
NirT 0:c00e6c923941 514
NirT 0:c00e6c923941 515 /// Create a timer.
NirT 0:c00e6c923941 516 /// \param[in] timer_def timer object referenced with \ref osTimer.
NirT 0:c00e6c923941 517 /// \param[in] type osTimerOnce for one-shot or osTimerPeriodic for periodic behavior.
NirT 0:c00e6c923941 518 /// \param[in] argument argument to the timer call back function.
NirT 0:c00e6c923941 519 /// \return timer ID for reference by other functions or NULL in case of error.
NirT 0:c00e6c923941 520 /// \note MUST REMAIN UNCHANGED: \b osTimerCreate shall be consistent in every CMSIS-RTOS.
NirT 0:c00e6c923941 521 osTimerId osTimerCreate (const osTimerDef_t *timer_def, os_timer_type type, void *argument);
NirT 0:c00e6c923941 522
NirT 0:c00e6c923941 523 /// Start or restart a timer.
NirT 0:c00e6c923941 524 /// \param[in] timer_id timer ID obtained by \ref osTimerCreate.
NirT 0:c00e6c923941 525 /// \param[in] millisec time delay value of the timer.
NirT 0:c00e6c923941 526 /// \return status code that indicates the execution status of the function.
NirT 0:c00e6c923941 527 /// \note MUST REMAIN UNCHANGED: \b osTimerStart shall be consistent in every CMSIS-RTOS.
NirT 0:c00e6c923941 528 osStatus osTimerStart (osTimerId timer_id, uint32_t millisec);
NirT 0:c00e6c923941 529
NirT 0:c00e6c923941 530 /// Stop the timer.
NirT 0:c00e6c923941 531 /// \param[in] timer_id timer ID obtained by \ref osTimerCreate.
NirT 0:c00e6c923941 532 /// \return status code that indicates the execution status of the function.
NirT 0:c00e6c923941 533 /// \note MUST REMAIN UNCHANGED: \b osTimerStop shall be consistent in every CMSIS-RTOS.
NirT 0:c00e6c923941 534 osStatus osTimerStop (osTimerId timer_id);
NirT 0:c00e6c923941 535
NirT 0:c00e6c923941 536 /// Delete a timer that was created by \ref osTimerCreate.
NirT 0:c00e6c923941 537 /// \param[in] timer_id timer ID obtained by \ref osTimerCreate.
NirT 0:c00e6c923941 538 /// \return status code that indicates the execution status of the function.
NirT 0:c00e6c923941 539 /// \note MUST REMAIN UNCHANGED: \b osTimerDelete shall be consistent in every CMSIS-RTOS.
NirT 0:c00e6c923941 540 osStatus osTimerDelete (osTimerId timer_id);
NirT 0:c00e6c923941 541
NirT 0:c00e6c923941 542
NirT 0:c00e6c923941 543 // ==== Signal Management ====
NirT 0:c00e6c923941 544
NirT 0:c00e6c923941 545 /// Set the specified Signal Flags of an active thread.
NirT 0:c00e6c923941 546 /// \param[in] thread_id thread ID obtained by \ref osThreadCreate or \ref osThreadGetId.
NirT 0:c00e6c923941 547 /// \param[in] signals specifies the signal flags of the thread that should be set.
NirT 0:c00e6c923941 548 /// \return osOK if successful, osErrorOS if failed.
NirT 0:c00e6c923941 549 /// \note MUST REMAIN UNCHANGED: \b osSignalSet shall be consistent in every CMSIS-RTOS.
NirT 0:c00e6c923941 550 int32_t osSignalSet (osThreadId thread_id, int32_t signals);
NirT 0:c00e6c923941 551
NirT 0:c00e6c923941 552 /// Clear the specified Signal Flags of an active thread.
NirT 0:c00e6c923941 553 /// \param[in] thread_id thread ID obtained by \ref osThreadCreate or \ref osThreadGetId.
NirT 0:c00e6c923941 554 /// \param[in] signals specifies the signal flags of the thread that shall be cleared.
NirT 0:c00e6c923941 555 /// \return previous signal flags of the specified thread or 0x80000000 in case of incorrect parameters.
NirT 0:c00e6c923941 556 /// \note MUST REMAIN UNCHANGED: \b osSignalClear shall be consistent in every CMSIS-RTOS.
NirT 0:c00e6c923941 557 int32_t osSignalClear (osThreadId thread_id, int32_t signals);
NirT 0:c00e6c923941 558
NirT 0:c00e6c923941 559 /// Wait for one or more Signal Flags to become signaled for the current \b RUNNING thread.
NirT 0:c00e6c923941 560 /// \param[in] signals wait until all specified signal flags set or 0 for any single signal flag.
NirT 0:c00e6c923941 561 /// \param[in] millisec timeout value or 0 in case of no time-out.
NirT 0:c00e6c923941 562 /// \return event flag information or error code.
NirT 0:c00e6c923941 563 /// \note MUST REMAIN UNCHANGED: \b osSignalWait shall be consistent in every CMSIS-RTOS.
NirT 0:c00e6c923941 564 osEvent osSignalWait (int32_t signals, uint32_t millisec);
NirT 0:c00e6c923941 565
NirT 0:c00e6c923941 566
NirT 0:c00e6c923941 567 // ==== Mutex Management ====
NirT 0:c00e6c923941 568
NirT 0:c00e6c923941 569 /// Define a Mutex.
NirT 0:c00e6c923941 570 /// \param name name of the mutex object.
NirT 0:c00e6c923941 571 /// \note CAN BE CHANGED: The parameter to \b osMutexDef shall be consistent but the
NirT 0:c00e6c923941 572 /// macro body is implementation specific in every CMSIS-RTOS.
NirT 0:c00e6c923941 573 #if defined (osObjectsExternal) // object is external
NirT 0:c00e6c923941 574 #define osMutexDef(name) \
NirT 0:c00e6c923941 575 extern const osMutexDef_t os_mutex_def_##name
NirT 0:c00e6c923941 576 #else // define the object
NirT 0:c00e6c923941 577 #define osMutexDef(name) \
NirT 0:c00e6c923941 578 const osMutexDef_t os_mutex_def_##name = { 0 }
NirT 0:c00e6c923941 579 #endif
NirT 0:c00e6c923941 580
NirT 0:c00e6c923941 581 /// Access a Mutex definition.
NirT 0:c00e6c923941 582 /// \param name name of the mutex object.
NirT 0:c00e6c923941 583 /// \note CAN BE CHANGED: The parameter to \b osMutex shall be consistent but the
NirT 0:c00e6c923941 584 /// macro body is implementation specific in every CMSIS-RTOS.
NirT 0:c00e6c923941 585 #define osMutex(name) \
NirT 0:c00e6c923941 586 &os_mutex_def_##name
NirT 0:c00e6c923941 587
NirT 0:c00e6c923941 588 /// Create and Initialize a Mutex object.
NirT 0:c00e6c923941 589 /// \param[in] mutex_def mutex definition referenced with \ref osMutex.
NirT 0:c00e6c923941 590 /// \return mutex ID for reference by other functions or NULL in case of error.
NirT 0:c00e6c923941 591 /// \note MUST REMAIN UNCHANGED: \b osMutexCreate shall be consistent in every CMSIS-RTOS.
NirT 0:c00e6c923941 592 osMutexId osMutexCreate (const osMutexDef_t *mutex_def);
NirT 0:c00e6c923941 593
NirT 0:c00e6c923941 594 /// Wait until a Mutex becomes available.
NirT 0:c00e6c923941 595 /// \param[in] mutex_id mutex ID obtained by \ref osMutexCreate.
NirT 0:c00e6c923941 596 /// \param[in] millisec timeout value or 0 in case of no time-out.
NirT 0:c00e6c923941 597 /// \return status code that indicates the execution status of the function.
NirT 0:c00e6c923941 598 /// \note MUST REMAIN UNCHANGED: \b osMutexWait shall be consistent in every CMSIS-RTOS.
NirT 0:c00e6c923941 599 osStatus osMutexWait (osMutexId mutex_id, uint32_t millisec);
NirT 0:c00e6c923941 600
NirT 0:c00e6c923941 601 /// Release a Mutex that was obtained by \ref osMutexWait.
NirT 0:c00e6c923941 602 /// \param[in] mutex_id mutex ID obtained by \ref osMutexCreate.
NirT 0:c00e6c923941 603 /// \return status code that indicates the execution status of the function.
NirT 0:c00e6c923941 604 /// \note MUST REMAIN UNCHANGED: \b osMutexRelease shall be consistent in every CMSIS-RTOS.
NirT 0:c00e6c923941 605 osStatus osMutexRelease (osMutexId mutex_id);
NirT 0:c00e6c923941 606
NirT 0:c00e6c923941 607 /// Delete a Mutex that was created by \ref osMutexCreate.
NirT 0:c00e6c923941 608 /// \param[in] mutex_id mutex ID obtained by \ref osMutexCreate.
NirT 0:c00e6c923941 609 /// \return status code that indicates the execution status of the function.
NirT 0:c00e6c923941 610 /// \note MUST REMAIN UNCHANGED: \b osMutexDelete shall be consistent in every CMSIS-RTOS.
NirT 0:c00e6c923941 611 osStatus osMutexDelete (osMutexId mutex_id);
NirT 0:c00e6c923941 612
NirT 0:c00e6c923941 613
NirT 0:c00e6c923941 614 // ==== Semaphore Management Functions ====
NirT 0:c00e6c923941 615
NirT 0:c00e6c923941 616 #if (defined (osFeature_Semaphore) && (osFeature_Semaphore != 0)) // Semaphore available
NirT 0:c00e6c923941 617
NirT 0:c00e6c923941 618 /// Define a Semaphore object.
NirT 0:c00e6c923941 619 /// \param name name of the semaphore object.
NirT 0:c00e6c923941 620 /// \note CAN BE CHANGED: The parameter to \b osSemaphoreDef shall be consistent but the
NirT 0:c00e6c923941 621 /// macro body is implementation specific in every CMSIS-RTOS.
NirT 0:c00e6c923941 622 #if defined (osObjectsExternal) // object is external
NirT 0:c00e6c923941 623 #define osSemaphoreDef(name) \
NirT 0:c00e6c923941 624 extern const osSemaphoreDef_t os_semaphore_def_##name
NirT 0:c00e6c923941 625 #else // define the object
NirT 0:c00e6c923941 626 #define osSemaphoreDef(name) \
NirT 0:c00e6c923941 627 const osSemaphoreDef_t os_semaphore_def_##name = { 0 }
NirT 0:c00e6c923941 628 #endif
NirT 0:c00e6c923941 629
NirT 0:c00e6c923941 630 /// Access a Semaphore definition.
NirT 0:c00e6c923941 631 /// \param name name of the semaphore object.
NirT 0:c00e6c923941 632 /// \note CAN BE CHANGED: The parameter to \b osSemaphore shall be consistent but the
NirT 0:c00e6c923941 633 /// macro body is implementation specific in every CMSIS-RTOS.
NirT 0:c00e6c923941 634 #define osSemaphore(name) \
NirT 0:c00e6c923941 635 &os_semaphore_def_##name
NirT 0:c00e6c923941 636
NirT 0:c00e6c923941 637 /// Create and Initialize a Semaphore object used for managing resources.
NirT 0:c00e6c923941 638 /// \param[in] semaphore_def semaphore definition referenced with \ref osSemaphore.
NirT 0:c00e6c923941 639 /// \param[in] count number of available resources.
NirT 0:c00e6c923941 640 /// \return semaphore ID for reference by other functions or NULL in case of error.
NirT 0:c00e6c923941 641 /// \note MUST REMAIN UNCHANGED: \b osSemaphoreCreate shall be consistent in every CMSIS-RTOS.
NirT 0:c00e6c923941 642 osSemaphoreId osSemaphoreCreate (const osSemaphoreDef_t *semaphore_def, int32_t count);
NirT 0:c00e6c923941 643
NirT 0:c00e6c923941 644 /// Wait until a Semaphore token becomes available.
NirT 0:c00e6c923941 645 /// \param[in] semaphore_id semaphore object referenced with \ref osSemaphoreCreate.
NirT 0:c00e6c923941 646 /// \param[in] millisec timeout value or 0 in case of no time-out.
NirT 0:c00e6c923941 647 /// \return number of available tokens, or -1 in case of incorrect parameters.
NirT 0:c00e6c923941 648 /// \note MUST REMAIN UNCHANGED: \b osSemaphoreWait shall be consistent in every CMSIS-RTOS.
NirT 0:c00e6c923941 649 int32_t osSemaphoreWait (osSemaphoreId semaphore_id, uint32_t millisec);
NirT 0:c00e6c923941 650
NirT 0:c00e6c923941 651 /// Release a Semaphore token.
NirT 0:c00e6c923941 652 /// \param[in] semaphore_id semaphore object referenced with \ref osSemaphoreCreate.
NirT 0:c00e6c923941 653 /// \return status code that indicates the execution status of the function.
NirT 0:c00e6c923941 654 /// \note MUST REMAIN UNCHANGED: \b osSemaphoreRelease shall be consistent in every CMSIS-RTOS.
NirT 0:c00e6c923941 655 osStatus osSemaphoreRelease (osSemaphoreId semaphore_id);
NirT 0:c00e6c923941 656
NirT 0:c00e6c923941 657 /// Delete a Semaphore that was created by \ref osSemaphoreCreate.
NirT 0:c00e6c923941 658 /// \param[in] semaphore_id semaphore object referenced with \ref osSemaphoreCreate.
NirT 0:c00e6c923941 659 /// \return status code that indicates the execution status of the function.
NirT 0:c00e6c923941 660 /// \note MUST REMAIN UNCHANGED: \b osSemaphoreDelete shall be consistent in every CMSIS-RTOS.
NirT 0:c00e6c923941 661 osStatus osSemaphoreDelete (osSemaphoreId semaphore_id);
NirT 0:c00e6c923941 662
NirT 0:c00e6c923941 663 #endif // Semaphore available
NirT 0:c00e6c923941 664
NirT 0:c00e6c923941 665
NirT 0:c00e6c923941 666 // ==== Memory Pool Management Functions ====
NirT 0:c00e6c923941 667
NirT 0:c00e6c923941 668 #if (defined (osFeature_Pool) && (osFeature_Pool != 0)) // Memory Pool Management available
NirT 0:c00e6c923941 669
NirT 0:c00e6c923941 670 /// \brief Define a Memory Pool.
NirT 0:c00e6c923941 671 /// \param name name of the memory pool.
NirT 0:c00e6c923941 672 /// \param no maximum number of blocks (objects) in the memory pool.
NirT 0:c00e6c923941 673 /// \param type data type of a single block (object).
NirT 0:c00e6c923941 674 /// \note CAN BE CHANGED: The parameter to \b osPoolDef shall be consistent but the
NirT 0:c00e6c923941 675 /// macro body is implementation specific in every CMSIS-RTOS.
NirT 0:c00e6c923941 676 #if defined (osObjectsExternal) // object is external
NirT 0:c00e6c923941 677 #define osPoolDef(name, no, type) \
NirT 0:c00e6c923941 678 extern const osPoolDef_t os_pool_def_##name
NirT 0:c00e6c923941 679 #else // define the object
NirT 0:c00e6c923941 680 #define osPoolDef(name, no, type) \
NirT 0:c00e6c923941 681 const osPoolDef_t os_pool_def_##name = \
NirT 0:c00e6c923941 682 { (no), sizeof(type), NULL }
NirT 0:c00e6c923941 683 #endif
NirT 0:c00e6c923941 684
NirT 0:c00e6c923941 685 /// \brief Access a Memory Pool definition.
NirT 0:c00e6c923941 686 /// \param name name of the memory pool
NirT 0:c00e6c923941 687 /// \note CAN BE CHANGED: The parameter to \b osPool shall be consistent but the
NirT 0:c00e6c923941 688 /// macro body is implementation specific in every CMSIS-RTOS.
NirT 0:c00e6c923941 689 #define osPool(name) \
NirT 0:c00e6c923941 690 &os_pool_def_##name
NirT 0:c00e6c923941 691
NirT 0:c00e6c923941 692 /// Create and Initialize a memory pool.
NirT 0:c00e6c923941 693 /// \param[in] pool_def memory pool definition referenced with \ref osPool.
NirT 0:c00e6c923941 694 /// \return memory pool ID for reference by other functions or NULL in case of error.
NirT 0:c00e6c923941 695 /// \note MUST REMAIN UNCHANGED: \b osPoolCreate shall be consistent in every CMSIS-RTOS.
NirT 0:c00e6c923941 696 osPoolId osPoolCreate (const osPoolDef_t *pool_def);
NirT 0:c00e6c923941 697
NirT 0:c00e6c923941 698 /// Allocate a memory block from a memory pool.
NirT 0:c00e6c923941 699 /// \param[in] pool_id memory pool ID obtain referenced with \ref osPoolCreate.
NirT 0:c00e6c923941 700 /// \return address of the allocated memory block or NULL in case of no memory available.
NirT 0:c00e6c923941 701 /// \note MUST REMAIN UNCHANGED: \b osPoolAlloc shall be consistent in every CMSIS-RTOS.
NirT 0:c00e6c923941 702 void *osPoolAlloc (osPoolId pool_id);
NirT 0:c00e6c923941 703
NirT 0:c00e6c923941 704 /// Allocate a memory block from a memory pool and set memory block to zero.
NirT 0:c00e6c923941 705 /// \param[in] pool_id memory pool ID obtain referenced with \ref osPoolCreate.
NirT 0:c00e6c923941 706 /// \return address of the allocated memory block or NULL in case of no memory available.
NirT 0:c00e6c923941 707 /// \note MUST REMAIN UNCHANGED: \b osPoolCAlloc shall be consistent in every CMSIS-RTOS.
NirT 0:c00e6c923941 708 void *osPoolCAlloc (osPoolId pool_id);
NirT 0:c00e6c923941 709
NirT 0:c00e6c923941 710 /// Return an allocated memory block back to a specific memory pool.
NirT 0:c00e6c923941 711 /// \param[in] pool_id memory pool ID obtain referenced with \ref osPoolCreate.
NirT 0:c00e6c923941 712 /// \param[in] block address of the allocated memory block that is returned to the memory pool.
NirT 0:c00e6c923941 713 /// \return status code that indicates the execution status of the function.
NirT 0:c00e6c923941 714 /// \note MUST REMAIN UNCHANGED: \b osPoolFree shall be consistent in every CMSIS-RTOS.
NirT 0:c00e6c923941 715 osStatus osPoolFree (osPoolId pool_id, void *block);
NirT 0:c00e6c923941 716
NirT 0:c00e6c923941 717 #endif // Memory Pool Management available
NirT 0:c00e6c923941 718
NirT 0:c00e6c923941 719
NirT 0:c00e6c923941 720 // ==== Message Queue Management Functions ====
NirT 0:c00e6c923941 721
NirT 0:c00e6c923941 722 #if (defined (osFeature_MessageQ) && (osFeature_MessageQ != 0)) // Message Queues available
NirT 0:c00e6c923941 723
NirT 0:c00e6c923941 724 /// \brief Create a Message Queue Definition.
NirT 0:c00e6c923941 725 /// \param name name of the queue.
NirT 0:c00e6c923941 726 /// \param queue_sz maximum number of messages in the queue.
NirT 0:c00e6c923941 727 /// \param type data type of a single message element (for debugger).
NirT 0:c00e6c923941 728 /// \note CAN BE CHANGED: The parameter to \b osMessageQDef shall be consistent but the
NirT 0:c00e6c923941 729 /// macro body is implementation specific in every CMSIS-RTOS.
NirT 0:c00e6c923941 730 #if defined (osObjectsExternal) // object is external
NirT 0:c00e6c923941 731 #define osMessageQDef(name, queue_sz, type) \
NirT 0:c00e6c923941 732 extern const osMessageQDef_t os_messageQ_def_##name
NirT 0:c00e6c923941 733 #else // define the object
NirT 0:c00e6c923941 734 #define osMessageQDef(name, queue_sz, type) \
NirT 0:c00e6c923941 735 const osMessageQDef_t os_messageQ_def_##name = \
NirT 0:c00e6c923941 736 { (queue_sz), sizeof (type) }
NirT 0:c00e6c923941 737 #endif
NirT 0:c00e6c923941 738
NirT 0:c00e6c923941 739 /// \brief Access a Message Queue Definition.
NirT 0:c00e6c923941 740 /// \param name name of the queue
NirT 0:c00e6c923941 741 /// \note CAN BE CHANGED: The parameter to \b osMessageQ shall be consistent but the
NirT 0:c00e6c923941 742 /// macro body is implementation specific in every CMSIS-RTOS.
NirT 0:c00e6c923941 743 #define osMessageQ(name) \
NirT 0:c00e6c923941 744 &os_messageQ_def_##name
NirT 0:c00e6c923941 745
NirT 0:c00e6c923941 746 /// Create and Initialize a Message Queue.
NirT 0:c00e6c923941 747 /// \param[in] queue_def queue definition referenced with \ref osMessageQ.
NirT 0:c00e6c923941 748 /// \param[in] thread_id thread ID (obtained by \ref osThreadCreate or \ref osThreadGetId) or NULL.
NirT 0:c00e6c923941 749 /// \return message queue ID for reference by other functions or NULL in case of error.
NirT 0:c00e6c923941 750 /// \note MUST REMAIN UNCHANGED: \b osMessageCreate shall be consistent in every CMSIS-RTOS.
NirT 0:c00e6c923941 751 osMessageQId osMessageCreate (const osMessageQDef_t *queue_def, osThreadId thread_id);
NirT 0:c00e6c923941 752
NirT 0:c00e6c923941 753 /// Put a Message to a Queue.
NirT 0:c00e6c923941 754 /// \param[in] queue_id message queue ID obtained with \ref osMessageCreate.
NirT 0:c00e6c923941 755 /// \param[in] info message information.
NirT 0:c00e6c923941 756 /// \param[in] millisec timeout value or 0 in case of no time-out.
NirT 0:c00e6c923941 757 /// \return status code that indicates the execution status of the function.
NirT 0:c00e6c923941 758 /// \note MUST REMAIN UNCHANGED: \b osMessagePut shall be consistent in every CMSIS-RTOS.
NirT 0:c00e6c923941 759 osStatus osMessagePut (osMessageQId queue_id, uint32_t info, uint32_t millisec);
NirT 0:c00e6c923941 760
NirT 0:c00e6c923941 761 /// Get a Message or Wait for a Message from a Queue.
NirT 0:c00e6c923941 762 /// \param[in] queue_id message queue ID obtained with \ref osMessageCreate.
NirT 0:c00e6c923941 763 /// \param[in] millisec timeout value or 0 in case of no time-out.
NirT 0:c00e6c923941 764 /// \return event information that includes status code.
NirT 0:c00e6c923941 765 /// \note MUST REMAIN UNCHANGED: \b osMessageGet shall be consistent in every CMSIS-RTOS.
NirT 0:c00e6c923941 766 osEvent osMessageGet (osMessageQId queue_id, uint32_t millisec);
NirT 0:c00e6c923941 767
NirT 0:c00e6c923941 768 #endif // Message Queues available
NirT 0:c00e6c923941 769
NirT 0:c00e6c923941 770
NirT 0:c00e6c923941 771 // ==== Mail Queue Management Functions ====
NirT 0:c00e6c923941 772
NirT 0:c00e6c923941 773 #if (defined (osFeature_MailQ) && (osFeature_MailQ != 0)) // Mail Queues available
NirT 0:c00e6c923941 774
NirT 0:c00e6c923941 775 /// \brief Create a Mail Queue Definition.
NirT 0:c00e6c923941 776 /// \param name name of the queue
NirT 0:c00e6c923941 777 /// \param queue_sz maximum number of messages in queue
NirT 0:c00e6c923941 778 /// \param type data type of a single message element
NirT 0:c00e6c923941 779 /// \note CAN BE CHANGED: The parameter to \b osMailQDef shall be consistent but the
NirT 0:c00e6c923941 780 /// macro body is implementation specific in every CMSIS-RTOS.
NirT 0:c00e6c923941 781 #if defined (osObjectsExternal) // object is external
NirT 0:c00e6c923941 782 #define osMailQDef(name, queue_sz, type) \
NirT 0:c00e6c923941 783 extern struct os_mailQ_cb *os_mailQ_cb_##name \
NirT 0:c00e6c923941 784 extern osMailQDef_t os_mailQ_def_##name
NirT 0:c00e6c923941 785 #else // define the object
NirT 0:c00e6c923941 786 #define osMailQDef(name, queue_sz, type) \
NirT 0:c00e6c923941 787 struct os_mailQ_cb *os_mailQ_cb_##name; \
NirT 0:c00e6c923941 788 const osMailQDef_t os_mailQ_def_##name = \
NirT 0:c00e6c923941 789 { (queue_sz), sizeof (type), (&os_mailQ_cb_##name) }
NirT 0:c00e6c923941 790 #endif
NirT 0:c00e6c923941 791
NirT 0:c00e6c923941 792 /// \brief Access a Mail Queue Definition.
NirT 0:c00e6c923941 793 /// \param name name of the queue
NirT 0:c00e6c923941 794 /// \note CAN BE CHANGED: The parameter to \b osMailQ shall be consistent but the
NirT 0:c00e6c923941 795 /// macro body is implementation specific in every CMSIS-RTOS.
NirT 0:c00e6c923941 796 #define osMailQ(name) \
NirT 0:c00e6c923941 797 &os_mailQ_def_##name
NirT 0:c00e6c923941 798
NirT 0:c00e6c923941 799 /// Create and Initialize mail queue.
NirT 0:c00e6c923941 800 /// \param[in] queue_def reference to the mail queue definition obtain with \ref osMailQ
NirT 0:c00e6c923941 801 /// \param[in] thread_id thread ID (obtained by \ref osThreadCreate or \ref osThreadGetId) or NULL.
NirT 0:c00e6c923941 802 /// \return mail queue ID for reference by other functions or NULL in case of error.
NirT 0:c00e6c923941 803 /// \note MUST REMAIN UNCHANGED: \b osMailCreate shall be consistent in every CMSIS-RTOS.
NirT 0:c00e6c923941 804 osMailQId osMailCreate (const osMailQDef_t *queue_def, osThreadId thread_id);
NirT 0:c00e6c923941 805
NirT 0:c00e6c923941 806 /// Allocate a memory block from a mail.
NirT 0:c00e6c923941 807 /// \param[in] queue_id mail queue ID obtained with \ref osMailCreate.
NirT 0:c00e6c923941 808 /// \param[in] millisec timeout value or 0 in case of no time-out
NirT 0:c00e6c923941 809 /// \return pointer to memory block that can be filled with mail or NULL in case of error.
NirT 0:c00e6c923941 810 /// \note MUST REMAIN UNCHANGED: \b osMailAlloc shall be consistent in every CMSIS-RTOS.
NirT 0:c00e6c923941 811 void *osMailAlloc (osMailQId queue_id, uint32_t millisec);
NirT 0:c00e6c923941 812
NirT 0:c00e6c923941 813 /// Allocate a memory block from a mail and set memory block to zero.
NirT 0:c00e6c923941 814 /// \param[in] queue_id mail queue ID obtained with \ref osMailCreate.
NirT 0:c00e6c923941 815 /// \param[in] millisec timeout value or 0 in case of no time-out
NirT 0:c00e6c923941 816 /// \return pointer to memory block that can be filled with mail or NULL in case of error.
NirT 0:c00e6c923941 817 /// \note MUST REMAIN UNCHANGED: \b osMailCAlloc shall be consistent in every CMSIS-RTOS.
NirT 0:c00e6c923941 818 void *osMailCAlloc (osMailQId queue_id, uint32_t millisec);
NirT 0:c00e6c923941 819
NirT 0:c00e6c923941 820 /// Put a mail to a queue.
NirT 0:c00e6c923941 821 /// \param[in] queue_id mail queue ID obtained with \ref osMailCreate.
NirT 0:c00e6c923941 822 /// \param[in] mail memory block previously allocated with \ref osMailAlloc or \ref osMailCAlloc.
NirT 0:c00e6c923941 823 /// \return status code that indicates the execution status of the function.
NirT 0:c00e6c923941 824 /// \note MUST REMAIN UNCHANGED: \b osMailPut shall be consistent in every CMSIS-RTOS.
NirT 0:c00e6c923941 825 osStatus osMailPut (osMailQId queue_id, void *mail);
NirT 0:c00e6c923941 826
NirT 0:c00e6c923941 827 /// Get a mail from a queue.
NirT 0:c00e6c923941 828 /// \param[in] queue_id mail queue ID obtained with \ref osMailCreate.
NirT 0:c00e6c923941 829 /// \param[in] millisec timeout value or 0 in case of no time-out
NirT 0:c00e6c923941 830 /// \return event that contains mail information or error code.
NirT 0:c00e6c923941 831 /// \note MUST REMAIN UNCHANGED: \b osMailGet shall be consistent in every CMSIS-RTOS.
NirT 0:c00e6c923941 832 osEvent osMailGet (osMailQId queue_id, uint32_t millisec);
NirT 0:c00e6c923941 833
NirT 0:c00e6c923941 834 /// Free a memory block from a mail.
NirT 0:c00e6c923941 835 /// \param[in] queue_id mail queue ID obtained with \ref osMailCreate.
NirT 0:c00e6c923941 836 /// \param[in] mail pointer to the memory block that was obtained with \ref osMailGet.
NirT 0:c00e6c923941 837 /// \return status code that indicates the execution status of the function.
NirT 0:c00e6c923941 838 /// \note MUST REMAIN UNCHANGED: \b osMailFree shall be consistent in every CMSIS-RTOS.
NirT 0:c00e6c923941 839 osStatus osMailFree (osMailQId queue_id, void *mail);
NirT 0:c00e6c923941 840
NirT 0:c00e6c923941 841 #endif // Mail Queues available
NirT 0:c00e6c923941 842
NirT 0:c00e6c923941 843 /*************************** Additional specific APIs to Free RTOS ************/
NirT 0:c00e6c923941 844 /**
NirT 0:c00e6c923941 845 * @brief Handles the tick increment
NirT 0:c00e6c923941 846 * @param none.
NirT 0:c00e6c923941 847 * @retval none.
NirT 0:c00e6c923941 848 */
NirT 0:c00e6c923941 849 void osSystickHandler(void);
NirT 0:c00e6c923941 850
NirT 0:c00e6c923941 851 #if ( INCLUDE_eTaskGetState == 1 )
NirT 0:c00e6c923941 852 /**
NirT 0:c00e6c923941 853 * @brief Obtain the state of any thread.
NirT 0:c00e6c923941 854 * @param thread_id thread ID obtained by \ref osThreadCreate or \ref osThreadGetId.
NirT 0:c00e6c923941 855 * @retval the stae of the thread, states are encoded by the osThreadState enumerated type.
NirT 0:c00e6c923941 856 */
NirT 0:c00e6c923941 857 osThreadState osThreadGetState(osThreadId thread_id);
NirT 0:c00e6c923941 858 #endif /* INCLUDE_eTaskGetState */
NirT 0:c00e6c923941 859
NirT 0:c00e6c923941 860 #if ( INCLUDE_eTaskGetState == 1 )
NirT 0:c00e6c923941 861 /**
NirT 0:c00e6c923941 862 * @brief Check if a thread is already suspended or not.
NirT 0:c00e6c923941 863 * @param thread_id thread ID obtained by \ref osThreadCreate or \ref osThreadGetId.
NirT 0:c00e6c923941 864 * @retval status code that indicates the execution status of the function.
NirT 0:c00e6c923941 865 */
NirT 0:c00e6c923941 866
NirT 0:c00e6c923941 867 osStatus osThreadIsSuspended(osThreadId thread_id);
NirT 0:c00e6c923941 868
NirT 0:c00e6c923941 869 #endif /* INCLUDE_eTaskGetState */
NirT 0:c00e6c923941 870
NirT 0:c00e6c923941 871 /**
NirT 0:c00e6c923941 872 * @brief Suspend execution of a thread.
NirT 0:c00e6c923941 873 * @param thread_id thread ID obtained by \ref osThreadCreate or \ref osThreadGetId.
NirT 0:c00e6c923941 874 * @retval status code that indicates the execution status of the function.
NirT 0:c00e6c923941 875 */
NirT 0:c00e6c923941 876 osStatus osThreadSuspend (osThreadId thread_id);
NirT 0:c00e6c923941 877
NirT 0:c00e6c923941 878 /**
NirT 0:c00e6c923941 879 * @brief Resume execution of a suspended thread.
NirT 0:c00e6c923941 880 * @param thread_id thread ID obtained by \ref osThreadCreate or \ref osThreadGetId.
NirT 0:c00e6c923941 881 * @retval status code that indicates the execution status of the function.
NirT 0:c00e6c923941 882 */
NirT 0:c00e6c923941 883 osStatus osThreadResume (osThreadId thread_id);
NirT 0:c00e6c923941 884
NirT 0:c00e6c923941 885 /**
NirT 0:c00e6c923941 886 * @brief Suspend execution of a all active threads.
NirT 0:c00e6c923941 887 * @retval status code that indicates the execution status of the function.
NirT 0:c00e6c923941 888 */
NirT 0:c00e6c923941 889 osStatus osThreadSuspendAll (void);
NirT 0:c00e6c923941 890
NirT 0:c00e6c923941 891 /**
NirT 0:c00e6c923941 892 * @brief Resume execution of a all suspended threads.
NirT 0:c00e6c923941 893 * @retval status code that indicates the execution status of the function.
NirT 0:c00e6c923941 894 */
NirT 0:c00e6c923941 895 osStatus osThreadResumeAll (void);
NirT 0:c00e6c923941 896
NirT 0:c00e6c923941 897 /**
NirT 0:c00e6c923941 898 * @brief Delay a task until a specified time
NirT 0:c00e6c923941 899 * @param PreviousWakeTime Pointer to a variable that holds the time at which the
NirT 0:c00e6c923941 900 * task was last unblocked. PreviousWakeTime must be initialised with the current time
NirT 0:c00e6c923941 901 * prior to its first use (PreviousWakeTime = osKernelSysTick() )
NirT 0:c00e6c923941 902 * @param millisec time delay value
NirT 0:c00e6c923941 903 * @retval status code that indicates the execution status of the function.
NirT 0:c00e6c923941 904 */
NirT 0:c00e6c923941 905 osStatus osDelayUntil (uint32_t *PreviousWakeTime, uint32_t millisec);
NirT 0:c00e6c923941 906
NirT 0:c00e6c923941 907 /**
NirT 0:c00e6c923941 908 * @brief Lists all the current threads, along with their current state
NirT 0:c00e6c923941 909 * and stack usage high water mark.
NirT 0:c00e6c923941 910 * @param buffer A buffer into which the above mentioned details
NirT 0:c00e6c923941 911 * will be written
NirT 0:c00e6c923941 912 * @retval status code that indicates the execution status of the function.
NirT 0:c00e6c923941 913 */
NirT 0:c00e6c923941 914 osStatus osThreadList (uint8_t *buffer);
NirT 0:c00e6c923941 915
NirT 0:c00e6c923941 916 /**
NirT 0:c00e6c923941 917 * @brief Receive an item from a queue without removing the item from the queue.
NirT 0:c00e6c923941 918 * @param queue_id message queue ID obtained with \ref osMessageCreate.
NirT 0:c00e6c923941 919 * @param millisec timeout value or 0 in case of no time-out.
NirT 0:c00e6c923941 920 * @retval event information that includes status code.
NirT 0:c00e6c923941 921 */
NirT 0:c00e6c923941 922 osEvent osMessagePeek (osMessageQId queue_id, uint32_t millisec);
NirT 0:c00e6c923941 923
NirT 0:c00e6c923941 924 /**
NirT 0:c00e6c923941 925 * @brief Create and Initialize a Recursive Mutex
NirT 0:c00e6c923941 926 * @param mutex_def mutex definition referenced with \ref osMutex.
NirT 0:c00e6c923941 927 * @retval mutex ID for reference by other functions or NULL in case of error..
NirT 0:c00e6c923941 928 */
NirT 0:c00e6c923941 929 osMutexId osRecursiveMutexCreate (const osMutexDef_t *mutex_def);
NirT 0:c00e6c923941 930
NirT 0:c00e6c923941 931 /**
NirT 0:c00e6c923941 932 * @brief Release a Recursive Mutex
NirT 0:c00e6c923941 933 * @param mutex_id mutex ID obtained by \ref osRecursiveMutexCreate.
NirT 0:c00e6c923941 934 * @retval status code that indicates the execution status of the function.
NirT 0:c00e6c923941 935 */
NirT 0:c00e6c923941 936 osStatus osRecursiveMutexRelease (osMutexId mutex_id);
NirT 0:c00e6c923941 937
NirT 0:c00e6c923941 938 /**
NirT 0:c00e6c923941 939 * @brief Release a Recursive Mutex
NirT 0:c00e6c923941 940 * @param mutex_id mutex ID obtained by \ref osRecursiveMutexCreate.
NirT 0:c00e6c923941 941 * @param millisec timeout value or 0 in case of no time-out.
NirT 0:c00e6c923941 942 * @retval status code that indicates the execution status of the function.
NirT 0:c00e6c923941 943 */
NirT 0:c00e6c923941 944 osStatus osRecursiveMutexWait (osMutexId mutex_id, uint32_t millisec);
NirT 0:c00e6c923941 945
NirT 0:c00e6c923941 946 #ifdef __cplusplus
NirT 0:c00e6c923941 947 }
NirT 0:c00e6c923941 948 #endif
NirT 0:c00e6c923941 949
NirT 0:c00e6c923941 950 #endif // _CMSIS_OS_H