NRF com

Dependencies:   mbed nRF24L01P

Committer:
vmihalcut
Date:
Mon May 27 06:06:31 2013 +0000
Revision:
0:fdfe93cb9255
NRF24L01 receiver

Who changed what in which revision?

UserRevisionLine numberNew contents of line
vmihalcut 0:fdfe93cb9255 1 /* ----------------------------------------------------------------------
vmihalcut 0:fdfe93cb9255 2 * Copyright (C) 2012 ARM Limited. All rights reserved.
vmihalcut 0:fdfe93cb9255 3 *
vmihalcut 0:fdfe93cb9255 4 * $Date: 5. June 2012
vmihalcut 0:fdfe93cb9255 5 * $Revision: V1.01
vmihalcut 0:fdfe93cb9255 6 *
vmihalcut 0:fdfe93cb9255 7 * Project: CMSIS-RTOS API
vmihalcut 0:fdfe93cb9255 8 * Title: cmsis_os.h RTX header file
vmihalcut 0:fdfe93cb9255 9 *
vmihalcut 0:fdfe93cb9255 10 * Version 0.02
vmihalcut 0:fdfe93cb9255 11 * Initial Proposal Phase
vmihalcut 0:fdfe93cb9255 12 * Version 0.03
vmihalcut 0:fdfe93cb9255 13 * osKernelStart added, optional feature: main started as thread
vmihalcut 0:fdfe93cb9255 14 * osSemaphores have standard behavior
vmihalcut 0:fdfe93cb9255 15 * osTimerCreate does not start the timer, added osTimerStart
vmihalcut 0:fdfe93cb9255 16 * osThreadPass is renamed to osThreadYield
vmihalcut 0:fdfe93cb9255 17 * Version 1.01
vmihalcut 0:fdfe93cb9255 18 * Support for C++ interface
vmihalcut 0:fdfe93cb9255 19 * - const attribute removed from the osXxxxDef_t typedef's
vmihalcut 0:fdfe93cb9255 20 * - const attribute added to the osXxxxDef macros
vmihalcut 0:fdfe93cb9255 21 * Added: osTimerDelete, osMutexDelete, osSemaphoreDelete
vmihalcut 0:fdfe93cb9255 22 * Added: osKernelInitialize
vmihalcut 0:fdfe93cb9255 23 * -------------------------------------------------------------------- */
vmihalcut 0:fdfe93cb9255 24
vmihalcut 0:fdfe93cb9255 25 /**
vmihalcut 0:fdfe93cb9255 26 \page cmsis_os_h Header File Template: cmsis_os.h
vmihalcut 0:fdfe93cb9255 27
vmihalcut 0:fdfe93cb9255 28 The file \b cmsis_os.h is a template header file for a CMSIS-RTOS compliant Real-Time Operating System (RTOS).
vmihalcut 0:fdfe93cb9255 29 Each RTOS that is compliant with CMSIS-RTOS shall provide a specific \b cmsis_os.h header file that represents
vmihalcut 0:fdfe93cb9255 30 its implementation.
vmihalcut 0:fdfe93cb9255 31
vmihalcut 0:fdfe93cb9255 32 The file cmsis_os.h contains:
vmihalcut 0:fdfe93cb9255 33 - CMSIS-RTOS API function definitions
vmihalcut 0:fdfe93cb9255 34 - struct definitions for parameters and return types
vmihalcut 0:fdfe93cb9255 35 - status and priority values used by CMSIS-RTOS API functions
vmihalcut 0:fdfe93cb9255 36 - macros for defining threads and other kernel objects
vmihalcut 0:fdfe93cb9255 37
vmihalcut 0:fdfe93cb9255 38
vmihalcut 0:fdfe93cb9255 39 <b>Name conventions and header file modifications</b>
vmihalcut 0:fdfe93cb9255 40
vmihalcut 0:fdfe93cb9255 41 All definitions are prefixed with \b os to give an unique name space for CMSIS-RTOS functions.
vmihalcut 0:fdfe93cb9255 42 Definitions that are prefixed \b os_ are not used in the application code but local to this header file.
vmihalcut 0:fdfe93cb9255 43 All definitions and functions that belong to a module are grouped and have a common prefix, i.e. \b osThread.
vmihalcut 0:fdfe93cb9255 44
vmihalcut 0:fdfe93cb9255 45 Definitions that are marked with <b>CAN BE CHANGED</b> can be adapted towards the needs of the actual CMSIS-RTOS implementation.
vmihalcut 0:fdfe93cb9255 46 These definitions can be specific to the underlying RTOS kernel.
vmihalcut 0:fdfe93cb9255 47
vmihalcut 0:fdfe93cb9255 48 Definitions that are marked with <b>MUST REMAIN UNCHANGED</b> cannot be altered. Otherwise the CMSIS-RTOS implementation is no longer
vmihalcut 0:fdfe93cb9255 49 compliant to the standard. Note that some functions are optional and need not to be provided by every CMSIS-RTOS implementation.
vmihalcut 0:fdfe93cb9255 50
vmihalcut 0:fdfe93cb9255 51
vmihalcut 0:fdfe93cb9255 52 <b>Function calls from interrupt service routines</b>
vmihalcut 0:fdfe93cb9255 53
vmihalcut 0:fdfe93cb9255 54 The following CMSIS-RTOS functions can be called from threads and interrupt service routines (ISR):
vmihalcut 0:fdfe93cb9255 55 - \ref osSignalSet
vmihalcut 0:fdfe93cb9255 56 - \ref osSemaphoreRelease
vmihalcut 0:fdfe93cb9255 57 - \ref osPoolAlloc, \ref osPoolCAlloc, \ref osPoolFree
vmihalcut 0:fdfe93cb9255 58 - \ref osMessagePut, \ref osMessageGet
vmihalcut 0:fdfe93cb9255 59 - \ref osMailAlloc, \ref osMailCAlloc, \ref osMailGet, \ref osMailPut, \ref osMailFree
vmihalcut 0:fdfe93cb9255 60
vmihalcut 0:fdfe93cb9255 61 Functions that cannot be called from an ISR are verifying the interrupt status and return in case that they are called
vmihalcut 0:fdfe93cb9255 62 from an ISR context the status code \b osErrorISR. In some implementations this condition might be caught using the HARD FAULT vector.
vmihalcut 0:fdfe93cb9255 63
vmihalcut 0:fdfe93cb9255 64 Some CMSIS-RTOS implementations support CMSIS-RTOS function calls from multiple ISR at the same time.
vmihalcut 0:fdfe93cb9255 65 If this is impossible, the CMSIS-RTOS rejects calls by nested ISR functions with the status code \b osErrorISRRecursive.
vmihalcut 0:fdfe93cb9255 66
vmihalcut 0:fdfe93cb9255 67
vmihalcut 0:fdfe93cb9255 68 <b>Define and reference object definitions</b>
vmihalcut 0:fdfe93cb9255 69
vmihalcut 0:fdfe93cb9255 70 With <b>\#define osObjectsExternal</b> objects are defined as external symbols. This allows to create a consistent header file
vmihalcut 0:fdfe93cb9255 71 that is used throughout a project as shown below:
vmihalcut 0:fdfe93cb9255 72
vmihalcut 0:fdfe93cb9255 73 <i>Header File</i>
vmihalcut 0:fdfe93cb9255 74 \code
vmihalcut 0:fdfe93cb9255 75 #include <cmsis_os.h> // CMSIS RTOS header file
vmihalcut 0:fdfe93cb9255 76
vmihalcut 0:fdfe93cb9255 77 // Thread definition
vmihalcut 0:fdfe93cb9255 78 extern void thread_sample (void const *argument); // function prototype
vmihalcut 0:fdfe93cb9255 79 osThreadDef (thread_sample, osPriorityBelowNormal, 1, 100);
vmihalcut 0:fdfe93cb9255 80
vmihalcut 0:fdfe93cb9255 81 // Pool definition
vmihalcut 0:fdfe93cb9255 82 osPoolDef(MyPool, 10, long);
vmihalcut 0:fdfe93cb9255 83 \endcode
vmihalcut 0:fdfe93cb9255 84
vmihalcut 0:fdfe93cb9255 85
vmihalcut 0:fdfe93cb9255 86 This header file defines all objects when included in a C/C++ source file. When <b>\#define osObjectsExternal</b> is
vmihalcut 0:fdfe93cb9255 87 present before the header file, the objects are defined as external symbols. A single consistent header file can therefore be
vmihalcut 0:fdfe93cb9255 88 used throughout the whole project.
vmihalcut 0:fdfe93cb9255 89
vmihalcut 0:fdfe93cb9255 90 <i>Example</i>
vmihalcut 0:fdfe93cb9255 91 \code
vmihalcut 0:fdfe93cb9255 92 #include "osObjects.h" // Definition of the CMSIS-RTOS objects
vmihalcut 0:fdfe93cb9255 93 \endcode
vmihalcut 0:fdfe93cb9255 94
vmihalcut 0:fdfe93cb9255 95 \code
vmihalcut 0:fdfe93cb9255 96 #define osObjectExternal // Objects will be defined as external symbols
vmihalcut 0:fdfe93cb9255 97 #include "osObjects.h" // Reference to the CMSIS-RTOS objects
vmihalcut 0:fdfe93cb9255 98 \endcode
vmihalcut 0:fdfe93cb9255 99
vmihalcut 0:fdfe93cb9255 100 */
vmihalcut 0:fdfe93cb9255 101
vmihalcut 0:fdfe93cb9255 102 #ifndef _CMSIS_OS_H
vmihalcut 0:fdfe93cb9255 103 #define _CMSIS_OS_H
vmihalcut 0:fdfe93cb9255 104
vmihalcut 0:fdfe93cb9255 105 /// \note MUST REMAIN UNCHANGED: \b osCMSIS identifies the CMSIS-RTOS API version.
vmihalcut 0:fdfe93cb9255 106 #define osCMSIS 0x10001 ///< API version (main [31:16] .sub [15:0])
vmihalcut 0:fdfe93cb9255 107
vmihalcut 0:fdfe93cb9255 108 /// \note CAN BE CHANGED: \b osCMSIS_KERNEL identifies the underlying RTOS kernel and version number.
vmihalcut 0:fdfe93cb9255 109 #define osCMSIS_RTX ((4<<16)|61) ///< RTOS identification and version (main [31:16] .sub [15:0])
vmihalcut 0:fdfe93cb9255 110
vmihalcut 0:fdfe93cb9255 111 /// \note MUST REMAIN UNCHANGED: \b osKernelSystemId shall be consistent in every CMSIS-RTOS.
vmihalcut 0:fdfe93cb9255 112 #define osKernelSystemId "RTX V4.61" ///< RTOS identification string
vmihalcut 0:fdfe93cb9255 113
vmihalcut 0:fdfe93cb9255 114
vmihalcut 0:fdfe93cb9255 115 #define CMSIS_OS_RTX
vmihalcut 0:fdfe93cb9255 116
vmihalcut 0:fdfe93cb9255 117 // The stack space occupied is mainly dependent on the underling C standard library
vmihalcut 0:fdfe93cb9255 118 #if defined(TOOLCHAIN_GCC_ARM) || defined(TOOLCHAIN_CS_ARM) || defined(TOOLCHAIN_CR_ARM)
vmihalcut 0:fdfe93cb9255 119 # define WORDS_STACK_SIZE 512
vmihalcut 0:fdfe93cb9255 120 #elif defined(TOOLCHAIN_ARM)
vmihalcut 0:fdfe93cb9255 121 # define WORDS_STACK_SIZE 512
vmihalcut 0:fdfe93cb9255 122 #elif defined(TOOLCHAIN_uARM)
vmihalcut 0:fdfe93cb9255 123 # define WORDS_STACK_SIZE 128
vmihalcut 0:fdfe93cb9255 124 #endif
vmihalcut 0:fdfe93cb9255 125
vmihalcut 0:fdfe93cb9255 126 #define DEFAULT_STACK_SIZE (WORDS_STACK_SIZE*4)
vmihalcut 0:fdfe93cb9255 127
vmihalcut 0:fdfe93cb9255 128
vmihalcut 0:fdfe93cb9255 129 /// \note MUST REMAIN UNCHANGED: \b osFeature_xxx shall be consistent in every CMSIS-RTOS.
vmihalcut 0:fdfe93cb9255 130 #define osFeature_MainThread 1 ///< main thread 1=main can be thread, 0=not available
vmihalcut 0:fdfe93cb9255 131 #define osFeature_Pool 1 ///< Memory Pools: 1=available, 0=not available
vmihalcut 0:fdfe93cb9255 132 #define osFeature_MailQ 1 ///< Mail Queues: 1=available, 0=not available
vmihalcut 0:fdfe93cb9255 133 #define osFeature_MessageQ 1 ///< Message Queues: 1=available, 0=not available
vmihalcut 0:fdfe93cb9255 134 #define osFeature_Signals 16 ///< maximum number of Signal Flags available per thread
vmihalcut 0:fdfe93cb9255 135 #define osFeature_Semaphore 65535 ///< maximum count for \ref osSemaphoreCreate function
vmihalcut 0:fdfe93cb9255 136 #define osFeature_Wait 0 ///< osWait function: 1=available, 0=not available
vmihalcut 0:fdfe93cb9255 137
vmihalcut 0:fdfe93cb9255 138 #if defined (__CC_ARM)
vmihalcut 0:fdfe93cb9255 139 #define os_InRegs __value_in_regs // Compiler specific: force struct in registers
vmihalcut 0:fdfe93cb9255 140 #else
vmihalcut 0:fdfe93cb9255 141 #define os_InRegs
vmihalcut 0:fdfe93cb9255 142 #endif
vmihalcut 0:fdfe93cb9255 143
vmihalcut 0:fdfe93cb9255 144 #include <stdint.h>
vmihalcut 0:fdfe93cb9255 145 #include <stddef.h>
vmihalcut 0:fdfe93cb9255 146
vmihalcut 0:fdfe93cb9255 147 #ifdef __cplusplus
vmihalcut 0:fdfe93cb9255 148 extern "C"
vmihalcut 0:fdfe93cb9255 149 {
vmihalcut 0:fdfe93cb9255 150 #endif
vmihalcut 0:fdfe93cb9255 151
vmihalcut 0:fdfe93cb9255 152 #include "os_tcb.h"
vmihalcut 0:fdfe93cb9255 153
vmihalcut 0:fdfe93cb9255 154 // ==== Enumeration, structures, defines ====
vmihalcut 0:fdfe93cb9255 155
vmihalcut 0:fdfe93cb9255 156 /// Priority used for thread control.
vmihalcut 0:fdfe93cb9255 157 /// \note MUST REMAIN UNCHANGED: \b osPriority shall be consistent in every CMSIS-RTOS.
vmihalcut 0:fdfe93cb9255 158 typedef enum {
vmihalcut 0:fdfe93cb9255 159 osPriorityIdle = -3, ///< priority: idle (lowest)
vmihalcut 0:fdfe93cb9255 160 osPriorityLow = -2, ///< priority: low
vmihalcut 0:fdfe93cb9255 161 osPriorityBelowNormal = -1, ///< priority: below normal
vmihalcut 0:fdfe93cb9255 162 osPriorityNormal = 0, ///< priority: normal (default)
vmihalcut 0:fdfe93cb9255 163 osPriorityAboveNormal = +1, ///< priority: above normal
vmihalcut 0:fdfe93cb9255 164 osPriorityHigh = +2, ///< priority: high
vmihalcut 0:fdfe93cb9255 165 osPriorityRealtime = +3, ///< priority: realtime (highest)
vmihalcut 0:fdfe93cb9255 166 osPriorityError = 0x84 ///< system cannot determine priority or thread has illegal priority
vmihalcut 0:fdfe93cb9255 167 } osPriority;
vmihalcut 0:fdfe93cb9255 168
vmihalcut 0:fdfe93cb9255 169 /// Timeout value.
vmihalcut 0:fdfe93cb9255 170 /// \note MUST REMAIN UNCHANGED: \b osWaitForever shall be consistent in every CMSIS-RTOS.
vmihalcut 0:fdfe93cb9255 171 #define osWaitForever 0xFFFFFFFF ///< wait forever timeout value
vmihalcut 0:fdfe93cb9255 172
vmihalcut 0:fdfe93cb9255 173 /// Status code values returned by CMSIS-RTOS functions.
vmihalcut 0:fdfe93cb9255 174 /// \note MUST REMAIN UNCHANGED: \b osStatus shall be consistent in every CMSIS-RTOS.
vmihalcut 0:fdfe93cb9255 175 typedef enum {
vmihalcut 0:fdfe93cb9255 176 osOK = 0, ///< function completed; no error or event occurred.
vmihalcut 0:fdfe93cb9255 177 osEventSignal = 0x08, ///< function completed; signal event occurred.
vmihalcut 0:fdfe93cb9255 178 osEventMessage = 0x10, ///< function completed; message event occurred.
vmihalcut 0:fdfe93cb9255 179 osEventMail = 0x20, ///< function completed; mail event occurred.
vmihalcut 0:fdfe93cb9255 180 osEventTimeout = 0x40, ///< function completed; timeout occurred.
vmihalcut 0:fdfe93cb9255 181 osErrorParameter = 0x80, ///< parameter error: a mandatory parameter was missing or specified an incorrect object.
vmihalcut 0:fdfe93cb9255 182 osErrorResource = 0x81, ///< resource not available: a specified resource was not available.
vmihalcut 0:fdfe93cb9255 183 osErrorTimeoutResource = 0xC1, ///< resource not available within given time: a specified resource was not available within the timeout period.
vmihalcut 0:fdfe93cb9255 184 osErrorISR = 0x82, ///< not allowed in ISR context: the function cannot be called from interrupt service routines.
vmihalcut 0:fdfe93cb9255 185 osErrorISRRecursive = 0x83, ///< function called multiple times from ISR with same object.
vmihalcut 0:fdfe93cb9255 186 osErrorPriority = 0x84, ///< system cannot determine priority or thread has illegal priority.
vmihalcut 0:fdfe93cb9255 187 osErrorNoMemory = 0x85, ///< system is out of memory: it was impossible to allocate or reserve memory for the operation.
vmihalcut 0:fdfe93cb9255 188 osErrorValue = 0x86, ///< value of a parameter is out of range.
vmihalcut 0:fdfe93cb9255 189 osErrorOS = 0xFF, ///< unspecified RTOS error: run-time error but no other error message fits.
vmihalcut 0:fdfe93cb9255 190 os_status_reserved = 0x7FFFFFFF ///< prevent from enum down-size compiler optimization.
vmihalcut 0:fdfe93cb9255 191 } osStatus;
vmihalcut 0:fdfe93cb9255 192
vmihalcut 0:fdfe93cb9255 193
vmihalcut 0:fdfe93cb9255 194 /// Timer type value for the timer definition.
vmihalcut 0:fdfe93cb9255 195 /// \note MUST REMAIN UNCHANGED: \b os_timer_type shall be consistent in every CMSIS-RTOS.
vmihalcut 0:fdfe93cb9255 196 typedef enum {
vmihalcut 0:fdfe93cb9255 197 osTimerOnce = 0, ///< one-shot timer
vmihalcut 0:fdfe93cb9255 198 osTimerPeriodic = 1 ///< repeating timer
vmihalcut 0:fdfe93cb9255 199 } os_timer_type;
vmihalcut 0:fdfe93cb9255 200
vmihalcut 0:fdfe93cb9255 201 /// Entry point of a thread.
vmihalcut 0:fdfe93cb9255 202 /// \note MUST REMAIN UNCHANGED: \b os_pthread shall be consistent in every CMSIS-RTOS.
vmihalcut 0:fdfe93cb9255 203 typedef void (*os_pthread) (void const *argument);
vmihalcut 0:fdfe93cb9255 204
vmihalcut 0:fdfe93cb9255 205 /// Entry point of a timer call back function.
vmihalcut 0:fdfe93cb9255 206 /// \note MUST REMAIN UNCHANGED: \b os_ptimer shall be consistent in every CMSIS-RTOS.
vmihalcut 0:fdfe93cb9255 207 typedef void (*os_ptimer) (void const *argument);
vmihalcut 0:fdfe93cb9255 208
vmihalcut 0:fdfe93cb9255 209 // >>> the following data type definitions may shall adapted towards a specific RTOS
vmihalcut 0:fdfe93cb9255 210
vmihalcut 0:fdfe93cb9255 211 /// Thread ID identifies the thread (pointer to a thread control block).
vmihalcut 0:fdfe93cb9255 212 /// \note CAN BE CHANGED: \b os_thread_cb is implementation specific in every CMSIS-RTOS.
vmihalcut 0:fdfe93cb9255 213 typedef struct os_thread_cb *osThreadId;
vmihalcut 0:fdfe93cb9255 214
vmihalcut 0:fdfe93cb9255 215 /// Timer ID identifies the timer (pointer to a timer control block).
vmihalcut 0:fdfe93cb9255 216 /// \note CAN BE CHANGED: \b os_timer_cb is implementation specific in every CMSIS-RTOS.
vmihalcut 0:fdfe93cb9255 217 typedef struct os_timer_cb *osTimerId;
vmihalcut 0:fdfe93cb9255 218
vmihalcut 0:fdfe93cb9255 219 /// Mutex ID identifies the mutex (pointer to a mutex control block).
vmihalcut 0:fdfe93cb9255 220 /// \note CAN BE CHANGED: \b os_mutex_cb is implementation specific in every CMSIS-RTOS.
vmihalcut 0:fdfe93cb9255 221 typedef struct os_mutex_cb *osMutexId;
vmihalcut 0:fdfe93cb9255 222
vmihalcut 0:fdfe93cb9255 223 /// Semaphore ID identifies the semaphore (pointer to a semaphore control block).
vmihalcut 0:fdfe93cb9255 224 /// \note CAN BE CHANGED: \b os_semaphore_cb is implementation specific in every CMSIS-RTOS.
vmihalcut 0:fdfe93cb9255 225 typedef struct os_semaphore_cb *osSemaphoreId;
vmihalcut 0:fdfe93cb9255 226
vmihalcut 0:fdfe93cb9255 227 /// Pool ID identifies the memory pool (pointer to a memory pool control block).
vmihalcut 0:fdfe93cb9255 228 /// \note CAN BE CHANGED: \b os_pool_cb is implementation specific in every CMSIS-RTOS.
vmihalcut 0:fdfe93cb9255 229 typedef struct os_pool_cb *osPoolId;
vmihalcut 0:fdfe93cb9255 230
vmihalcut 0:fdfe93cb9255 231 /// Message ID identifies the message queue (pointer to a message queue control block).
vmihalcut 0:fdfe93cb9255 232 /// \note CAN BE CHANGED: \b os_messageQ_cb is implementation specific in every CMSIS-RTOS.
vmihalcut 0:fdfe93cb9255 233 typedef struct os_messageQ_cb *osMessageQId;
vmihalcut 0:fdfe93cb9255 234
vmihalcut 0:fdfe93cb9255 235 /// Mail ID identifies the mail queue (pointer to a mail queue control block).
vmihalcut 0:fdfe93cb9255 236 /// \note CAN BE CHANGED: \b os_mailQ_cb is implementation specific in every CMSIS-RTOS.
vmihalcut 0:fdfe93cb9255 237 typedef struct os_mailQ_cb *osMailQId;
vmihalcut 0:fdfe93cb9255 238
vmihalcut 0:fdfe93cb9255 239
vmihalcut 0:fdfe93cb9255 240 /// Thread Definition structure contains startup information of a thread.
vmihalcut 0:fdfe93cb9255 241 /// \note CAN BE CHANGED: \b os_thread_def is implementation specific in every CMSIS-RTOS.
vmihalcut 0:fdfe93cb9255 242 typedef struct os_thread_def {
vmihalcut 0:fdfe93cb9255 243 os_pthread pthread; ///< start address of thread function
vmihalcut 0:fdfe93cb9255 244 osPriority tpriority; ///< initial thread priority
vmihalcut 0:fdfe93cb9255 245 uint32_t stacksize; ///< stack size requirements in bytes
vmihalcut 0:fdfe93cb9255 246 unsigned char *stack_pointer; ///< pointer to the stack memory block
vmihalcut 0:fdfe93cb9255 247 struct OS_TCB tcb;
vmihalcut 0:fdfe93cb9255 248 } osThreadDef_t;
vmihalcut 0:fdfe93cb9255 249
vmihalcut 0:fdfe93cb9255 250 /// Timer Definition structure contains timer parameters.
vmihalcut 0:fdfe93cb9255 251 /// \note CAN BE CHANGED: \b os_timer_def is implementation specific in every CMSIS-RTOS.
vmihalcut 0:fdfe93cb9255 252 typedef struct os_timer_def {
vmihalcut 0:fdfe93cb9255 253 os_ptimer ptimer; ///< start address of a timer function
vmihalcut 0:fdfe93cb9255 254 void *timer; ///< pointer to internal data
vmihalcut 0:fdfe93cb9255 255 } osTimerDef_t;
vmihalcut 0:fdfe93cb9255 256
vmihalcut 0:fdfe93cb9255 257 /// Mutex Definition structure contains setup information for a mutex.
vmihalcut 0:fdfe93cb9255 258 /// \note CAN BE CHANGED: \b os_mutex_def is implementation specific in every CMSIS-RTOS.
vmihalcut 0:fdfe93cb9255 259 typedef struct os_mutex_def {
vmihalcut 0:fdfe93cb9255 260 void *mutex; ///< pointer to internal data
vmihalcut 0:fdfe93cb9255 261 } osMutexDef_t;
vmihalcut 0:fdfe93cb9255 262
vmihalcut 0:fdfe93cb9255 263 /// Semaphore Definition structure contains setup information for a semaphore.
vmihalcut 0:fdfe93cb9255 264 /// \note CAN BE CHANGED: \b os_semaphore_def is implementation specific in every CMSIS-RTOS.
vmihalcut 0:fdfe93cb9255 265 typedef struct os_semaphore_def {
vmihalcut 0:fdfe93cb9255 266 void *semaphore; ///< pointer to internal data
vmihalcut 0:fdfe93cb9255 267 } osSemaphoreDef_t;
vmihalcut 0:fdfe93cb9255 268
vmihalcut 0:fdfe93cb9255 269 /// Definition structure for memory block allocation.
vmihalcut 0:fdfe93cb9255 270 /// \note CAN BE CHANGED: \b os_pool_def is implementation specific in every CMSIS-RTOS.
vmihalcut 0:fdfe93cb9255 271 typedef struct os_pool_def {
vmihalcut 0:fdfe93cb9255 272 uint32_t pool_sz; ///< number of items (elements) in the pool
vmihalcut 0:fdfe93cb9255 273 uint32_t item_sz; ///< size of an item
vmihalcut 0:fdfe93cb9255 274 void *pool; ///< pointer to memory for pool
vmihalcut 0:fdfe93cb9255 275 } osPoolDef_t;
vmihalcut 0:fdfe93cb9255 276
vmihalcut 0:fdfe93cb9255 277 /// Definition structure for message queue.
vmihalcut 0:fdfe93cb9255 278 /// \note CAN BE CHANGED: \b os_messageQ_def is implementation specific in every CMSIS-RTOS.
vmihalcut 0:fdfe93cb9255 279 typedef struct os_messageQ_def {
vmihalcut 0:fdfe93cb9255 280 uint32_t queue_sz; ///< number of elements in the queue
vmihalcut 0:fdfe93cb9255 281 void *pool; ///< memory array for messages
vmihalcut 0:fdfe93cb9255 282 } osMessageQDef_t;
vmihalcut 0:fdfe93cb9255 283
vmihalcut 0:fdfe93cb9255 284 /// Definition structure for mail queue.
vmihalcut 0:fdfe93cb9255 285 /// \note CAN BE CHANGED: \b os_mailQ_def is implementation specific in every CMSIS-RTOS.
vmihalcut 0:fdfe93cb9255 286 typedef struct os_mailQ_def {
vmihalcut 0:fdfe93cb9255 287 uint32_t queue_sz; ///< number of elements in the queue
vmihalcut 0:fdfe93cb9255 288 uint32_t item_sz; ///< size of an item
vmihalcut 0:fdfe93cb9255 289 void *pool; ///< memory array for mail
vmihalcut 0:fdfe93cb9255 290 } osMailQDef_t;
vmihalcut 0:fdfe93cb9255 291
vmihalcut 0:fdfe93cb9255 292 /// Event structure contains detailed information about an event.
vmihalcut 0:fdfe93cb9255 293 /// \note MUST REMAIN UNCHANGED: \b os_event shall be consistent in every CMSIS-RTOS.
vmihalcut 0:fdfe93cb9255 294 /// However the struct may be extended at the end.
vmihalcut 0:fdfe93cb9255 295 typedef struct {
vmihalcut 0:fdfe93cb9255 296 osStatus status; ///< status code: event or error information
vmihalcut 0:fdfe93cb9255 297 union {
vmihalcut 0:fdfe93cb9255 298 uint32_t v; ///< message as 32-bit value
vmihalcut 0:fdfe93cb9255 299 void *p; ///< message or mail as void pointer
vmihalcut 0:fdfe93cb9255 300 int32_t signals; ///< signal flags
vmihalcut 0:fdfe93cb9255 301 } value; ///< event value
vmihalcut 0:fdfe93cb9255 302 union {
vmihalcut 0:fdfe93cb9255 303 osMailQId mail_id; ///< mail id obtained by \ref osMailCreate
vmihalcut 0:fdfe93cb9255 304 osMessageQId message_id; ///< message id obtained by \ref osMessageCreate
vmihalcut 0:fdfe93cb9255 305 } def; ///< event definition
vmihalcut 0:fdfe93cb9255 306 } osEvent;
vmihalcut 0:fdfe93cb9255 307
vmihalcut 0:fdfe93cb9255 308
vmihalcut 0:fdfe93cb9255 309 // ==== Kernel Control Functions ====
vmihalcut 0:fdfe93cb9255 310
vmihalcut 0:fdfe93cb9255 311 /// Initialize the RTOS Kernel for creating objects.
vmihalcut 0:fdfe93cb9255 312 /// \return status code that indicates the execution status of the function.
vmihalcut 0:fdfe93cb9255 313 /// \note MUST REMAIN UNCHANGED: \b osKernelInitialize shall be consistent in every CMSIS-RTOS.
vmihalcut 0:fdfe93cb9255 314 osStatus osKernelInitialize (void);
vmihalcut 0:fdfe93cb9255 315
vmihalcut 0:fdfe93cb9255 316 /// Start the RTOS Kernel.
vmihalcut 0:fdfe93cb9255 317 /// \return status code that indicates the execution status of the function.
vmihalcut 0:fdfe93cb9255 318 /// \note MUST REMAIN UNCHANGED: \b osKernelStart shall be consistent in every CMSIS-RTOS.
vmihalcut 0:fdfe93cb9255 319 osStatus osKernelStart (void);
vmihalcut 0:fdfe93cb9255 320
vmihalcut 0:fdfe93cb9255 321 /// Check if the RTOS kernel is already started.
vmihalcut 0:fdfe93cb9255 322 /// \note MUST REMAIN UNCHANGED: \b osKernelRunning shall be consistent in every CMSIS-RTOS.
vmihalcut 0:fdfe93cb9255 323 /// \return 0 RTOS is not started, 1 RTOS is started.
vmihalcut 0:fdfe93cb9255 324 int32_t osKernelRunning(void);
vmihalcut 0:fdfe93cb9255 325
vmihalcut 0:fdfe93cb9255 326
vmihalcut 0:fdfe93cb9255 327 // ==== Thread Management ====
vmihalcut 0:fdfe93cb9255 328
vmihalcut 0:fdfe93cb9255 329 /// Create a Thread Definition with function, priority, and stack requirements.
vmihalcut 0:fdfe93cb9255 330 /// \param name name of the thread function.
vmihalcut 0:fdfe93cb9255 331 /// \param priority initial priority of the thread function.
vmihalcut 0:fdfe93cb9255 332 /// \param stacksz stack size (in bytes) requirements for the thread function.
vmihalcut 0:fdfe93cb9255 333 /// \note CAN BE CHANGED: The parameters to \b osThreadDef shall be consistent but the
vmihalcut 0:fdfe93cb9255 334 /// macro body is implementation specific in every CMSIS-RTOS.
vmihalcut 0:fdfe93cb9255 335 #if defined (osObjectsExternal) // object is external
vmihalcut 0:fdfe93cb9255 336 #define osThreadDef(name, priority, stacksz) \
vmihalcut 0:fdfe93cb9255 337 extern osThreadDef_t os_thread_def_##name
vmihalcut 0:fdfe93cb9255 338 #else // define the object
vmihalcut 0:fdfe93cb9255 339 #define osThreadDef(name, priority, stacksz) \
vmihalcut 0:fdfe93cb9255 340 unsigned char os_thread_def_stack_##name [stacksz]; \
vmihalcut 0:fdfe93cb9255 341 osThreadDef_t os_thread_def_##name = \
vmihalcut 0:fdfe93cb9255 342 { (name), (priority), (stacksz), (os_thread_def_stack_##name)}
vmihalcut 0:fdfe93cb9255 343 #endif
vmihalcut 0:fdfe93cb9255 344
vmihalcut 0:fdfe93cb9255 345 /// Access a Thread definition.
vmihalcut 0:fdfe93cb9255 346 /// \param name name of the thread definition object.
vmihalcut 0:fdfe93cb9255 347 /// \note CAN BE CHANGED: The parameter to \b osThread shall be consistent but the
vmihalcut 0:fdfe93cb9255 348 /// macro body is implementation specific in every CMSIS-RTOS.
vmihalcut 0:fdfe93cb9255 349 #define osThread(name) \
vmihalcut 0:fdfe93cb9255 350 &os_thread_def_##name
vmihalcut 0:fdfe93cb9255 351
vmihalcut 0:fdfe93cb9255 352 /// Create a thread and add it to Active Threads and set it to state READY.
vmihalcut 0:fdfe93cb9255 353 /// \param[in] thread_def thread definition referenced with \ref osThread.
vmihalcut 0:fdfe93cb9255 354 /// \param[in] argument pointer that is passed to the thread function as start argument.
vmihalcut 0:fdfe93cb9255 355 /// \return thread ID for reference by other functions or NULL in case of error.
vmihalcut 0:fdfe93cb9255 356 /// \note MUST REMAIN UNCHANGED: \b osThreadCreate shall be consistent in every CMSIS-RTOS.
vmihalcut 0:fdfe93cb9255 357 osThreadId osThreadCreate (osThreadDef_t *thread_def, void *argument);
vmihalcut 0:fdfe93cb9255 358
vmihalcut 0:fdfe93cb9255 359 /// Return the thread ID of the current running thread.
vmihalcut 0:fdfe93cb9255 360 /// \return thread ID for reference by other functions or NULL in case of error.
vmihalcut 0:fdfe93cb9255 361 /// \note MUST REMAIN UNCHANGED: \b osThreadGetId shall be consistent in every CMSIS-RTOS.
vmihalcut 0:fdfe93cb9255 362 osThreadId osThreadGetId (void);
vmihalcut 0:fdfe93cb9255 363
vmihalcut 0:fdfe93cb9255 364 /// Terminate execution of a thread and remove it from Active Threads.
vmihalcut 0:fdfe93cb9255 365 /// \param[in] thread_id thread ID obtained by \ref osThreadCreate or \ref osThreadGetId.
vmihalcut 0:fdfe93cb9255 366 /// \return status code that indicates the execution status of the function.
vmihalcut 0:fdfe93cb9255 367 /// \note MUST REMAIN UNCHANGED: \b osThreadTerminate shall be consistent in every CMSIS-RTOS.
vmihalcut 0:fdfe93cb9255 368 osStatus osThreadTerminate (osThreadId thread_id);
vmihalcut 0:fdfe93cb9255 369
vmihalcut 0:fdfe93cb9255 370 /// Pass control to next thread that is in state \b READY.
vmihalcut 0:fdfe93cb9255 371 /// \return status code that indicates the execution status of the function.
vmihalcut 0:fdfe93cb9255 372 /// \note MUST REMAIN UNCHANGED: \b osThreadYield shall be consistent in every CMSIS-RTOS.
vmihalcut 0:fdfe93cb9255 373 osStatus osThreadYield (void);
vmihalcut 0:fdfe93cb9255 374
vmihalcut 0:fdfe93cb9255 375 /// Change priority of an active thread.
vmihalcut 0:fdfe93cb9255 376 /// \param[in] thread_id thread ID obtained by \ref osThreadCreate or \ref osThreadGetId.
vmihalcut 0:fdfe93cb9255 377 /// \param[in] priority new priority value for the thread function.
vmihalcut 0:fdfe93cb9255 378 /// \return status code that indicates the execution status of the function.
vmihalcut 0:fdfe93cb9255 379 /// \note MUST REMAIN UNCHANGED: \b osThreadSetPriority shall be consistent in every CMSIS-RTOS.
vmihalcut 0:fdfe93cb9255 380 osStatus osThreadSetPriority (osThreadId thread_id, osPriority priority);
vmihalcut 0:fdfe93cb9255 381
vmihalcut 0:fdfe93cb9255 382 /// Get current priority of an active thread.
vmihalcut 0:fdfe93cb9255 383 /// \param[in] thread_id thread ID obtained by \ref osThreadCreate or \ref osThreadGetId.
vmihalcut 0:fdfe93cb9255 384 /// \return current priority value of the thread function.
vmihalcut 0:fdfe93cb9255 385 /// \note MUST REMAIN UNCHANGED: \b osThreadGetPriority shall be consistent in every CMSIS-RTOS.
vmihalcut 0:fdfe93cb9255 386 osPriority osThreadGetPriority (osThreadId thread_id);
vmihalcut 0:fdfe93cb9255 387
vmihalcut 0:fdfe93cb9255 388
vmihalcut 0:fdfe93cb9255 389 // ==== Generic Wait Functions ====
vmihalcut 0:fdfe93cb9255 390
vmihalcut 0:fdfe93cb9255 391 /// Wait for Timeout (Time Delay).
vmihalcut 0:fdfe93cb9255 392 /// \param[in] millisec time delay value
vmihalcut 0:fdfe93cb9255 393 /// \return status code that indicates the execution status of the function.
vmihalcut 0:fdfe93cb9255 394 osStatus osDelay (uint32_t millisec);
vmihalcut 0:fdfe93cb9255 395
vmihalcut 0:fdfe93cb9255 396 #if (defined (osFeature_Wait) && (osFeature_Wait != 0)) // Generic Wait available
vmihalcut 0:fdfe93cb9255 397
vmihalcut 0:fdfe93cb9255 398 /// Wait for Signal, Message, Mail, or Timeout.
vmihalcut 0:fdfe93cb9255 399 /// \param[in] millisec timeout value or 0 in case of no time-out
vmihalcut 0:fdfe93cb9255 400 /// \return event that contains signal, message, or mail information or error code.
vmihalcut 0:fdfe93cb9255 401 /// \note MUST REMAIN UNCHANGED: \b osWait shall be consistent in every CMSIS-RTOS.
vmihalcut 0:fdfe93cb9255 402 os_InRegs osEvent osWait (uint32_t millisec);
vmihalcut 0:fdfe93cb9255 403
vmihalcut 0:fdfe93cb9255 404 #endif // Generic Wait available
vmihalcut 0:fdfe93cb9255 405
vmihalcut 0:fdfe93cb9255 406
vmihalcut 0:fdfe93cb9255 407 // ==== Timer Management Functions ====
vmihalcut 0:fdfe93cb9255 408 /// Define a Timer object.
vmihalcut 0:fdfe93cb9255 409 /// \param name name of the timer object.
vmihalcut 0:fdfe93cb9255 410 /// \param function name of the timer call back function.
vmihalcut 0:fdfe93cb9255 411 /// \note CAN BE CHANGED: The parameter to \b osTimerDef shall be consistent but the
vmihalcut 0:fdfe93cb9255 412 /// macro body is implementation specific in every CMSIS-RTOS.
vmihalcut 0:fdfe93cb9255 413 #if defined (osObjectsExternal) // object is external
vmihalcut 0:fdfe93cb9255 414 #define osTimerDef(name, function) \
vmihalcut 0:fdfe93cb9255 415 extern osTimerDef_t os_timer_def_##name
vmihalcut 0:fdfe93cb9255 416 #else // define the object
vmihalcut 0:fdfe93cb9255 417 #define osTimerDef(name, function) \
vmihalcut 0:fdfe93cb9255 418 uint32_t os_timer_cb_##name[5]; \
vmihalcut 0:fdfe93cb9255 419 osTimerDef_t os_timer_def_##name = \
vmihalcut 0:fdfe93cb9255 420 { (function), (os_timer_cb_##name) }
vmihalcut 0:fdfe93cb9255 421 #endif
vmihalcut 0:fdfe93cb9255 422
vmihalcut 0:fdfe93cb9255 423 /// Access a Timer definition.
vmihalcut 0:fdfe93cb9255 424 /// \param name name of the timer object.
vmihalcut 0:fdfe93cb9255 425 /// \note CAN BE CHANGED: The parameter to \b osTimer shall be consistent but the
vmihalcut 0:fdfe93cb9255 426 /// macro body is implementation specific in every CMSIS-RTOS.
vmihalcut 0:fdfe93cb9255 427 #define osTimer(name) \
vmihalcut 0:fdfe93cb9255 428 &os_timer_def_##name
vmihalcut 0:fdfe93cb9255 429
vmihalcut 0:fdfe93cb9255 430 /// Create a timer.
vmihalcut 0:fdfe93cb9255 431 /// \param[in] timer_def timer object referenced with \ref osTimer.
vmihalcut 0:fdfe93cb9255 432 /// \param[in] type osTimerOnce for one-shot or osTimerPeriodic for periodic behavior.
vmihalcut 0:fdfe93cb9255 433 /// \param[in] argument argument to the timer call back function.
vmihalcut 0:fdfe93cb9255 434 /// \return timer ID for reference by other functions or NULL in case of error.
vmihalcut 0:fdfe93cb9255 435 /// \note MUST REMAIN UNCHANGED: \b osTimerCreate shall be consistent in every CMSIS-RTOS.
vmihalcut 0:fdfe93cb9255 436 osTimerId osTimerCreate (osTimerDef_t *timer_def, os_timer_type type, void *argument);
vmihalcut 0:fdfe93cb9255 437
vmihalcut 0:fdfe93cb9255 438 /// Start or restart a timer.
vmihalcut 0:fdfe93cb9255 439 /// \param[in] timer_id timer ID obtained by \ref osTimerCreate.
vmihalcut 0:fdfe93cb9255 440 /// \param[in] millisec time delay value of the timer.
vmihalcut 0:fdfe93cb9255 441 /// \return status code that indicates the execution status of the function.
vmihalcut 0:fdfe93cb9255 442 /// \note MUST REMAIN UNCHANGED: \b osTimerStart shall be consistent in every CMSIS-RTOS.
vmihalcut 0:fdfe93cb9255 443 osStatus osTimerStart (osTimerId timer_id, uint32_t millisec);
vmihalcut 0:fdfe93cb9255 444
vmihalcut 0:fdfe93cb9255 445 /// Stop the timer.
vmihalcut 0:fdfe93cb9255 446 /// \param[in] timer_id timer ID obtained by \ref osTimerCreate.
vmihalcut 0:fdfe93cb9255 447 /// \return status code that indicates the execution status of the function.
vmihalcut 0:fdfe93cb9255 448 /// \note MUST REMAIN UNCHANGED: \b osTimerStop shall be consistent in every CMSIS-RTOS.
vmihalcut 0:fdfe93cb9255 449 osStatus osTimerStop (osTimerId timer_id);
vmihalcut 0:fdfe93cb9255 450
vmihalcut 0:fdfe93cb9255 451 /// Delete a timer that was created by \ref osTimerCreate.
vmihalcut 0:fdfe93cb9255 452 /// \param[in] timer_id timer ID obtained by \ref osTimerCreate.
vmihalcut 0:fdfe93cb9255 453 /// \return status code that indicates the execution status of the function.
vmihalcut 0:fdfe93cb9255 454 /// \note MUST REMAIN UNCHANGED: \b osTimerDelete shall be consistent in every CMSIS-RTOS.
vmihalcut 0:fdfe93cb9255 455 osStatus osTimerDelete (osTimerId timer_id);
vmihalcut 0:fdfe93cb9255 456
vmihalcut 0:fdfe93cb9255 457
vmihalcut 0:fdfe93cb9255 458 // ==== Signal Management ====
vmihalcut 0:fdfe93cb9255 459
vmihalcut 0:fdfe93cb9255 460 /// Set the specified Signal Flags of an active thread.
vmihalcut 0:fdfe93cb9255 461 /// \param[in] thread_id thread ID obtained by \ref osThreadCreate or \ref osThreadGetId.
vmihalcut 0:fdfe93cb9255 462 /// \param[in] signals specifies the signal flags of the thread that should be set.
vmihalcut 0:fdfe93cb9255 463 /// \return previous signal flags of the specified thread or 0x80000000 in case of incorrect parameters.
vmihalcut 0:fdfe93cb9255 464 /// \note MUST REMAIN UNCHANGED: \b osSignalSet shall be consistent in every CMSIS-RTOS.
vmihalcut 0:fdfe93cb9255 465 int32_t osSignalSet (osThreadId thread_id, int32_t signals);
vmihalcut 0:fdfe93cb9255 466
vmihalcut 0:fdfe93cb9255 467 /// Clear the specified Signal Flags of an active thread.
vmihalcut 0:fdfe93cb9255 468 /// \param[in] thread_id thread ID obtained by \ref osThreadCreate or \ref osThreadGetId.
vmihalcut 0:fdfe93cb9255 469 /// \param[in] signals specifies the signal flags of the thread that shall be cleared.
vmihalcut 0:fdfe93cb9255 470 /// \return previous signal flags of the specified thread or 0x80000000 in case of incorrect parameters.
vmihalcut 0:fdfe93cb9255 471 /// \note MUST REMAIN UNCHANGED: \b osSignalClear shall be consistent in every CMSIS-RTOS.
vmihalcut 0:fdfe93cb9255 472 int32_t osSignalClear (osThreadId thread_id, int32_t signals);
vmihalcut 0:fdfe93cb9255 473
vmihalcut 0:fdfe93cb9255 474 /// Get Signal Flags status of an active thread.
vmihalcut 0:fdfe93cb9255 475 /// \param[in] thread_id thread ID obtained by \ref osThreadCreate or \ref osThreadGetId.
vmihalcut 0:fdfe93cb9255 476 /// \return previous signal flags of the specified thread or 0x80000000 in case of incorrect parameters.
vmihalcut 0:fdfe93cb9255 477 /// \note MUST REMAIN UNCHANGED: \b osSignalGet shall be consistent in every CMSIS-RTOS.
vmihalcut 0:fdfe93cb9255 478 int32_t osSignalGet (osThreadId thread_id);
vmihalcut 0:fdfe93cb9255 479
vmihalcut 0:fdfe93cb9255 480 /// Wait for one or more Signal Flags to become signaled for the current \b RUNNING thread.
vmihalcut 0:fdfe93cb9255 481 /// \param[in] signals wait until all specified signal flags set or 0 for any single signal flag.
vmihalcut 0:fdfe93cb9255 482 /// \param[in] millisec timeout value or 0 in case of no time-out.
vmihalcut 0:fdfe93cb9255 483 /// \return event flag information or error code.
vmihalcut 0:fdfe93cb9255 484 /// \note MUST REMAIN UNCHANGED: \b osSignalWait shall be consistent in every CMSIS-RTOS.
vmihalcut 0:fdfe93cb9255 485 os_InRegs osEvent osSignalWait (int32_t signals, uint32_t millisec);
vmihalcut 0:fdfe93cb9255 486
vmihalcut 0:fdfe93cb9255 487
vmihalcut 0:fdfe93cb9255 488 // ==== Mutex Management ====
vmihalcut 0:fdfe93cb9255 489
vmihalcut 0:fdfe93cb9255 490 /// Define a Mutex.
vmihalcut 0:fdfe93cb9255 491 /// \param name name of the mutex object.
vmihalcut 0:fdfe93cb9255 492 /// \note CAN BE CHANGED: The parameter to \b osMutexDef shall be consistent but the
vmihalcut 0:fdfe93cb9255 493 /// macro body is implementation specific in every CMSIS-RTOS.
vmihalcut 0:fdfe93cb9255 494 #if defined (osObjectsExternal) // object is external
vmihalcut 0:fdfe93cb9255 495 #define osMutexDef(name) \
vmihalcut 0:fdfe93cb9255 496 extern osMutexDef_t os_mutex_def_##name
vmihalcut 0:fdfe93cb9255 497 #else // define the object
vmihalcut 0:fdfe93cb9255 498 #define osMutexDef(name) \
vmihalcut 0:fdfe93cb9255 499 uint32_t os_mutex_cb_##name[3]; \
vmihalcut 0:fdfe93cb9255 500 osMutexDef_t os_mutex_def_##name = { (os_mutex_cb_##name) }
vmihalcut 0:fdfe93cb9255 501 #endif
vmihalcut 0:fdfe93cb9255 502
vmihalcut 0:fdfe93cb9255 503 /// Access a Mutex definition.
vmihalcut 0:fdfe93cb9255 504 /// \param name name of the mutex object.
vmihalcut 0:fdfe93cb9255 505 /// \note CAN BE CHANGED: The parameter to \b osMutex shall be consistent but the
vmihalcut 0:fdfe93cb9255 506 /// macro body is implementation specific in every CMSIS-RTOS.
vmihalcut 0:fdfe93cb9255 507 #define osMutex(name) \
vmihalcut 0:fdfe93cb9255 508 &os_mutex_def_##name
vmihalcut 0:fdfe93cb9255 509
vmihalcut 0:fdfe93cb9255 510 /// Create and Initialize a Mutex object.
vmihalcut 0:fdfe93cb9255 511 /// \param[in] mutex_def mutex definition referenced with \ref osMutex.
vmihalcut 0:fdfe93cb9255 512 /// \return mutex ID for reference by other functions or NULL in case of error.
vmihalcut 0:fdfe93cb9255 513 /// \note MUST REMAIN UNCHANGED: \b osMutexCreate shall be consistent in every CMSIS-RTOS.
vmihalcut 0:fdfe93cb9255 514 osMutexId osMutexCreate (osMutexDef_t *mutex_def);
vmihalcut 0:fdfe93cb9255 515
vmihalcut 0:fdfe93cb9255 516 /// Wait until a Mutex becomes available.
vmihalcut 0:fdfe93cb9255 517 /// \param[in] mutex_id mutex ID obtained by \ref osMutexCreate.
vmihalcut 0:fdfe93cb9255 518 /// \param[in] millisec timeout value or 0 in case of no time-out.
vmihalcut 0:fdfe93cb9255 519 /// \return status code that indicates the execution status of the function.
vmihalcut 0:fdfe93cb9255 520 /// \note MUST REMAIN UNCHANGED: \b osMutexWait shall be consistent in every CMSIS-RTOS.
vmihalcut 0:fdfe93cb9255 521 osStatus osMutexWait (osMutexId mutex_id, uint32_t millisec);
vmihalcut 0:fdfe93cb9255 522
vmihalcut 0:fdfe93cb9255 523 /// Release a Mutex that was obtained by \ref osMutexWait.
vmihalcut 0:fdfe93cb9255 524 /// \param[in] mutex_id mutex ID obtained by \ref osMutexCreate.
vmihalcut 0:fdfe93cb9255 525 /// \return status code that indicates the execution status of the function.
vmihalcut 0:fdfe93cb9255 526 /// \note MUST REMAIN UNCHANGED: \b osMutexRelease shall be consistent in every CMSIS-RTOS.
vmihalcut 0:fdfe93cb9255 527 osStatus osMutexRelease (osMutexId mutex_id);
vmihalcut 0:fdfe93cb9255 528
vmihalcut 0:fdfe93cb9255 529 /// Delete a Mutex that was created by \ref osMutexCreate.
vmihalcut 0:fdfe93cb9255 530 /// \param[in] mutex_id mutex ID obtained by \ref osMutexCreate.
vmihalcut 0:fdfe93cb9255 531 /// \return status code that indicates the execution status of the function.
vmihalcut 0:fdfe93cb9255 532 /// \note MUST REMAIN UNCHANGED: \b osMutexDelete shall be consistent in every CMSIS-RTOS.
vmihalcut 0:fdfe93cb9255 533 osStatus osMutexDelete (osMutexId mutex_id);
vmihalcut 0:fdfe93cb9255 534
vmihalcut 0:fdfe93cb9255 535
vmihalcut 0:fdfe93cb9255 536 // ==== Semaphore Management Functions ====
vmihalcut 0:fdfe93cb9255 537
vmihalcut 0:fdfe93cb9255 538 #if (defined (osFeature_Semaphore) && (osFeature_Semaphore != 0)) // Semaphore available
vmihalcut 0:fdfe93cb9255 539
vmihalcut 0:fdfe93cb9255 540 /// Define a Semaphore object.
vmihalcut 0:fdfe93cb9255 541 /// \param name name of the semaphore object.
vmihalcut 0:fdfe93cb9255 542 /// \note CAN BE CHANGED: The parameter to \b osSemaphoreDef shall be consistent but the
vmihalcut 0:fdfe93cb9255 543 /// macro body is implementation specific in every CMSIS-RTOS.
vmihalcut 0:fdfe93cb9255 544 #if defined (osObjectsExternal) // object is external
vmihalcut 0:fdfe93cb9255 545 #define osSemaphoreDef(name) \
vmihalcut 0:fdfe93cb9255 546 extern osSemaphoreDef_t os_semaphore_def_##name
vmihalcut 0:fdfe93cb9255 547 #else // define the object
vmihalcut 0:fdfe93cb9255 548 #define osSemaphoreDef(name) \
vmihalcut 0:fdfe93cb9255 549 uint32_t os_semaphore_cb_##name[2]; \
vmihalcut 0:fdfe93cb9255 550 osSemaphoreDef_t os_semaphore_def_##name = { (os_semaphore_cb_##name) }
vmihalcut 0:fdfe93cb9255 551 #endif
vmihalcut 0:fdfe93cb9255 552
vmihalcut 0:fdfe93cb9255 553 /// Access a Semaphore definition.
vmihalcut 0:fdfe93cb9255 554 /// \param name name of the semaphore object.
vmihalcut 0:fdfe93cb9255 555 /// \note CAN BE CHANGED: The parameter to \b osSemaphore shall be consistent but the
vmihalcut 0:fdfe93cb9255 556 /// macro body is implementation specific in every CMSIS-RTOS.
vmihalcut 0:fdfe93cb9255 557 #define osSemaphore(name) \
vmihalcut 0:fdfe93cb9255 558 &os_semaphore_def_##name
vmihalcut 0:fdfe93cb9255 559
vmihalcut 0:fdfe93cb9255 560 /// Create and Initialize a Semaphore object used for managing resources.
vmihalcut 0:fdfe93cb9255 561 /// \param[in] semaphore_def semaphore definition referenced with \ref osSemaphore.
vmihalcut 0:fdfe93cb9255 562 /// \param[in] count number of available resources.
vmihalcut 0:fdfe93cb9255 563 /// \return semaphore ID for reference by other functions or NULL in case of error.
vmihalcut 0:fdfe93cb9255 564 /// \note MUST REMAIN UNCHANGED: \b osSemaphoreCreate shall be consistent in every CMSIS-RTOS.
vmihalcut 0:fdfe93cb9255 565 osSemaphoreId osSemaphoreCreate (osSemaphoreDef_t *semaphore_def, int32_t count);
vmihalcut 0:fdfe93cb9255 566
vmihalcut 0:fdfe93cb9255 567 /// Wait until a Semaphore token becomes available.
vmihalcut 0:fdfe93cb9255 568 /// \param[in] semaphore_id semaphore object referenced with \ref osSemaphoreCreate.
vmihalcut 0:fdfe93cb9255 569 /// \param[in] millisec timeout value or 0 in case of no time-out.
vmihalcut 0:fdfe93cb9255 570 /// \return number of available tokens, or -1 in case of incorrect parameters.
vmihalcut 0:fdfe93cb9255 571 /// \note MUST REMAIN UNCHANGED: \b osSemaphoreWait shall be consistent in every CMSIS-RTOS.
vmihalcut 0:fdfe93cb9255 572 int32_t osSemaphoreWait (osSemaphoreId semaphore_id, uint32_t millisec);
vmihalcut 0:fdfe93cb9255 573
vmihalcut 0:fdfe93cb9255 574 /// Release a Semaphore token.
vmihalcut 0:fdfe93cb9255 575 /// \param[in] semaphore_id semaphore object referenced with \ref osSemaphoreCreate.
vmihalcut 0:fdfe93cb9255 576 /// \return status code that indicates the execution status of the function.
vmihalcut 0:fdfe93cb9255 577 /// \note MUST REMAIN UNCHANGED: \b osSemaphoreRelease shall be consistent in every CMSIS-RTOS.
vmihalcut 0:fdfe93cb9255 578 osStatus osSemaphoreRelease (osSemaphoreId semaphore_id);
vmihalcut 0:fdfe93cb9255 579
vmihalcut 0:fdfe93cb9255 580 /// Delete a Semaphore that was created by \ref osSemaphoreCreate.
vmihalcut 0:fdfe93cb9255 581 /// \param[in] semaphore_id semaphore object referenced with \ref osSemaphoreCreate.
vmihalcut 0:fdfe93cb9255 582 /// \return status code that indicates the execution status of the function.
vmihalcut 0:fdfe93cb9255 583 /// \note MUST REMAIN UNCHANGED: \b osSemaphoreDelete shall be consistent in every CMSIS-RTOS.
vmihalcut 0:fdfe93cb9255 584 osStatus osSemaphoreDelete (osSemaphoreId semaphore_id);
vmihalcut 0:fdfe93cb9255 585
vmihalcut 0:fdfe93cb9255 586 #endif // Semaphore available
vmihalcut 0:fdfe93cb9255 587
vmihalcut 0:fdfe93cb9255 588
vmihalcut 0:fdfe93cb9255 589 // ==== Memory Pool Management Functions ====
vmihalcut 0:fdfe93cb9255 590
vmihalcut 0:fdfe93cb9255 591 #if (defined (osFeature_Pool) && (osFeature_Pool != 0)) // Memory Pool Management available
vmihalcut 0:fdfe93cb9255 592
vmihalcut 0:fdfe93cb9255 593 /// \brief Define a Memory Pool.
vmihalcut 0:fdfe93cb9255 594 /// \param name name of the memory pool.
vmihalcut 0:fdfe93cb9255 595 /// \param no maximum number of blocks (objects) in the memory pool.
vmihalcut 0:fdfe93cb9255 596 /// \param type data type of a single block (object).
vmihalcut 0:fdfe93cb9255 597 /// \note CAN BE CHANGED: The parameter to \b osPoolDef shall be consistent but the
vmihalcut 0:fdfe93cb9255 598 /// macro body is implementation specific in every CMSIS-RTOS.
vmihalcut 0:fdfe93cb9255 599 #if defined (osObjectsExternal) // object is external
vmihalcut 0:fdfe93cb9255 600 #define osPoolDef(name, no, type) \
vmihalcut 0:fdfe93cb9255 601 extern osPoolDef_t os_pool_def_##name
vmihalcut 0:fdfe93cb9255 602 #else // define the object
vmihalcut 0:fdfe93cb9255 603 #define osPoolDef(name, no, type) \
vmihalcut 0:fdfe93cb9255 604 uint32_t os_pool_m_##name[3+((sizeof(type)+3)/4)*(no)]; \
vmihalcut 0:fdfe93cb9255 605 osPoolDef_t os_pool_def_##name = \
vmihalcut 0:fdfe93cb9255 606 { (no), sizeof(type), (os_pool_m_##name) }
vmihalcut 0:fdfe93cb9255 607 #endif
vmihalcut 0:fdfe93cb9255 608
vmihalcut 0:fdfe93cb9255 609 /// \brief Access a Memory Pool definition.
vmihalcut 0:fdfe93cb9255 610 /// \param name name of the memory pool
vmihalcut 0:fdfe93cb9255 611 /// \note CAN BE CHANGED: The parameter to \b osPool shall be consistent but the
vmihalcut 0:fdfe93cb9255 612 /// macro body is implementation specific in every CMSIS-RTOS.
vmihalcut 0:fdfe93cb9255 613 #define osPool(name) \
vmihalcut 0:fdfe93cb9255 614 &os_pool_def_##name
vmihalcut 0:fdfe93cb9255 615
vmihalcut 0:fdfe93cb9255 616 /// Create and Initialize a memory pool.
vmihalcut 0:fdfe93cb9255 617 /// \param[in] pool_def memory pool definition referenced with \ref osPool.
vmihalcut 0:fdfe93cb9255 618 /// \return memory pool ID for reference by other functions or NULL in case of error.
vmihalcut 0:fdfe93cb9255 619 /// \note MUST REMAIN UNCHANGED: \b osPoolCreate shall be consistent in every CMSIS-RTOS.
vmihalcut 0:fdfe93cb9255 620 osPoolId osPoolCreate (osPoolDef_t *pool_def);
vmihalcut 0:fdfe93cb9255 621
vmihalcut 0:fdfe93cb9255 622 /// Allocate a memory block from a memory pool.
vmihalcut 0:fdfe93cb9255 623 /// \param[in] pool_id memory pool ID obtain referenced with \ref osPoolCreate.
vmihalcut 0:fdfe93cb9255 624 /// \return address of the allocated memory block or NULL in case of no memory available.
vmihalcut 0:fdfe93cb9255 625 /// \note MUST REMAIN UNCHANGED: \b osPoolAlloc shall be consistent in every CMSIS-RTOS.
vmihalcut 0:fdfe93cb9255 626 void *osPoolAlloc (osPoolId pool_id);
vmihalcut 0:fdfe93cb9255 627
vmihalcut 0:fdfe93cb9255 628 /// Allocate a memory block from a memory pool and set memory block to zero.
vmihalcut 0:fdfe93cb9255 629 /// \param[in] pool_id memory pool ID obtain referenced with \ref osPoolCreate.
vmihalcut 0:fdfe93cb9255 630 /// \return address of the allocated memory block or NULL in case of no memory available.
vmihalcut 0:fdfe93cb9255 631 /// \note MUST REMAIN UNCHANGED: \b osPoolCAlloc shall be consistent in every CMSIS-RTOS.
vmihalcut 0:fdfe93cb9255 632 void *osPoolCAlloc (osPoolId pool_id);
vmihalcut 0:fdfe93cb9255 633
vmihalcut 0:fdfe93cb9255 634 /// Return an allocated memory block back to a specific memory pool.
vmihalcut 0:fdfe93cb9255 635 /// \param[in] pool_id memory pool ID obtain referenced with \ref osPoolCreate.
vmihalcut 0:fdfe93cb9255 636 /// \param[in] block address of the allocated memory block that is returned to the memory pool.
vmihalcut 0:fdfe93cb9255 637 /// \return status code that indicates the execution status of the function.
vmihalcut 0:fdfe93cb9255 638 /// \note MUST REMAIN UNCHANGED: \b osPoolFree shall be consistent in every CMSIS-RTOS.
vmihalcut 0:fdfe93cb9255 639 osStatus osPoolFree (osPoolId pool_id, void *block);
vmihalcut 0:fdfe93cb9255 640
vmihalcut 0:fdfe93cb9255 641 #endif // Memory Pool Management available
vmihalcut 0:fdfe93cb9255 642
vmihalcut 0:fdfe93cb9255 643
vmihalcut 0:fdfe93cb9255 644 // ==== Message Queue Management Functions ====
vmihalcut 0:fdfe93cb9255 645
vmihalcut 0:fdfe93cb9255 646 #if (defined (osFeature_MessageQ) && (osFeature_MessageQ != 0)) // Message Queues available
vmihalcut 0:fdfe93cb9255 647
vmihalcut 0:fdfe93cb9255 648 /// \brief Create a Message Queue Definition.
vmihalcut 0:fdfe93cb9255 649 /// \param name name of the queue.
vmihalcut 0:fdfe93cb9255 650 /// \param queue_sz maximum number of messages in the queue.
vmihalcut 0:fdfe93cb9255 651 /// \param type data type of a single message element (for debugger).
vmihalcut 0:fdfe93cb9255 652 /// \note CAN BE CHANGED: The parameter to \b osMessageQDef shall be consistent but the
vmihalcut 0:fdfe93cb9255 653 /// macro body is implementation specific in every CMSIS-RTOS.
vmihalcut 0:fdfe93cb9255 654 #if defined (osObjectsExternal) // object is external
vmihalcut 0:fdfe93cb9255 655 #define osMessageQDef(name, queue_sz, type) \
vmihalcut 0:fdfe93cb9255 656 extern osMessageQDef_t os_messageQ_def_##name
vmihalcut 0:fdfe93cb9255 657 #else // define the object
vmihalcut 0:fdfe93cb9255 658 #define osMessageQDef(name, queue_sz, type) \
vmihalcut 0:fdfe93cb9255 659 uint32_t os_messageQ_q_##name[4+(queue_sz)]; \
vmihalcut 0:fdfe93cb9255 660 osMessageQDef_t os_messageQ_def_##name = \
vmihalcut 0:fdfe93cb9255 661 { (queue_sz), (os_messageQ_q_##name) }
vmihalcut 0:fdfe93cb9255 662 #endif
vmihalcut 0:fdfe93cb9255 663
vmihalcut 0:fdfe93cb9255 664 /// \brief Access a Message Queue Definition.
vmihalcut 0:fdfe93cb9255 665 /// \param name name of the queue
vmihalcut 0:fdfe93cb9255 666 /// \note CAN BE CHANGED: The parameter to \b osMessageQ shall be consistent but the
vmihalcut 0:fdfe93cb9255 667 /// macro body is implementation specific in every CMSIS-RTOS.
vmihalcut 0:fdfe93cb9255 668 #define osMessageQ(name) \
vmihalcut 0:fdfe93cb9255 669 &os_messageQ_def_##name
vmihalcut 0:fdfe93cb9255 670
vmihalcut 0:fdfe93cb9255 671 /// Create and Initialize a Message Queue.
vmihalcut 0:fdfe93cb9255 672 /// \param[in] queue_def queue definition referenced with \ref osMessageQ.
vmihalcut 0:fdfe93cb9255 673 /// \param[in] thread_id thread ID (obtained by \ref osThreadCreate or \ref osThreadGetId) or NULL.
vmihalcut 0:fdfe93cb9255 674 /// \return message queue ID for reference by other functions or NULL in case of error.
vmihalcut 0:fdfe93cb9255 675 /// \note MUST REMAIN UNCHANGED: \b osMessageCreate shall be consistent in every CMSIS-RTOS.
vmihalcut 0:fdfe93cb9255 676 osMessageQId osMessageCreate (osMessageQDef_t *queue_def, osThreadId thread_id);
vmihalcut 0:fdfe93cb9255 677
vmihalcut 0:fdfe93cb9255 678 /// Put a Message to a Queue.
vmihalcut 0:fdfe93cb9255 679 /// \param[in] queue_id message queue ID obtained with \ref osMessageCreate.
vmihalcut 0:fdfe93cb9255 680 /// \param[in] info message information.
vmihalcut 0:fdfe93cb9255 681 /// \param[in] millisec timeout value or 0 in case of no time-out.
vmihalcut 0:fdfe93cb9255 682 /// \return status code that indicates the execution status of the function.
vmihalcut 0:fdfe93cb9255 683 /// \note MUST REMAIN UNCHANGED: \b osMessagePut shall be consistent in every CMSIS-RTOS.
vmihalcut 0:fdfe93cb9255 684 osStatus osMessagePut (osMessageQId queue_id, uint32_t info, uint32_t millisec);
vmihalcut 0:fdfe93cb9255 685
vmihalcut 0:fdfe93cb9255 686 /// Get a Message or Wait for a Message from a Queue.
vmihalcut 0:fdfe93cb9255 687 /// \param[in] queue_id message queue ID obtained with \ref osMessageCreate.
vmihalcut 0:fdfe93cb9255 688 /// \param[in] millisec timeout value or 0 in case of no time-out.
vmihalcut 0:fdfe93cb9255 689 /// \return event information that includes status code.
vmihalcut 0:fdfe93cb9255 690 /// \note MUST REMAIN UNCHANGED: \b osMessageGet shall be consistent in every CMSIS-RTOS.
vmihalcut 0:fdfe93cb9255 691 os_InRegs osEvent osMessageGet (osMessageQId queue_id, uint32_t millisec);
vmihalcut 0:fdfe93cb9255 692
vmihalcut 0:fdfe93cb9255 693 #endif // Message Queues available
vmihalcut 0:fdfe93cb9255 694
vmihalcut 0:fdfe93cb9255 695
vmihalcut 0:fdfe93cb9255 696 // ==== Mail Queue Management Functions ====
vmihalcut 0:fdfe93cb9255 697
vmihalcut 0:fdfe93cb9255 698 #if (defined (osFeature_MailQ) && (osFeature_MailQ != 0)) // Mail Queues available
vmihalcut 0:fdfe93cb9255 699
vmihalcut 0:fdfe93cb9255 700 /// \brief Create a Mail Queue Definition.
vmihalcut 0:fdfe93cb9255 701 /// \param name name of the queue
vmihalcut 0:fdfe93cb9255 702 /// \param queue_sz maximum number of messages in queue
vmihalcut 0:fdfe93cb9255 703 /// \param type data type of a single message element
vmihalcut 0:fdfe93cb9255 704 /// \note CAN BE CHANGED: The parameter to \b osMailQDef shall be consistent but the
vmihalcut 0:fdfe93cb9255 705 /// macro body is implementation specific in every CMSIS-RTOS.
vmihalcut 0:fdfe93cb9255 706 #if defined (osObjectsExternal) // object is external
vmihalcut 0:fdfe93cb9255 707 #define osMailQDef(name, queue_sz, type) \
vmihalcut 0:fdfe93cb9255 708 extern osMailQDef_t os_mailQ_def_##name
vmihalcut 0:fdfe93cb9255 709 #else // define the object
vmihalcut 0:fdfe93cb9255 710 #define osMailQDef(name, queue_sz, type) \
vmihalcut 0:fdfe93cb9255 711 uint32_t os_mailQ_q_##name[4+(queue_sz)]; \
vmihalcut 0:fdfe93cb9255 712 uint32_t os_mailQ_m_##name[3+((sizeof(type)+3)/4)*(queue_sz)]; \
vmihalcut 0:fdfe93cb9255 713 void * os_mailQ_p_##name[2] = { (os_mailQ_q_##name), os_mailQ_m_##name }; \
vmihalcut 0:fdfe93cb9255 714 osMailQDef_t os_mailQ_def_##name = \
vmihalcut 0:fdfe93cb9255 715 { (queue_sz), sizeof(type), (os_mailQ_p_##name) }
vmihalcut 0:fdfe93cb9255 716 #endif
vmihalcut 0:fdfe93cb9255 717
vmihalcut 0:fdfe93cb9255 718 /// \brief Access a Mail Queue Definition.
vmihalcut 0:fdfe93cb9255 719 /// \param name name of the queue
vmihalcut 0:fdfe93cb9255 720 /// \note CAN BE CHANGED: The parameter to \b osMailQ shall be consistent but the
vmihalcut 0:fdfe93cb9255 721 /// macro body is implementation specific in every CMSIS-RTOS.
vmihalcut 0:fdfe93cb9255 722 #define osMailQ(name) \
vmihalcut 0:fdfe93cb9255 723 &os_mailQ_def_##name
vmihalcut 0:fdfe93cb9255 724
vmihalcut 0:fdfe93cb9255 725 /// Create and Initialize mail queue.
vmihalcut 0:fdfe93cb9255 726 /// \param[in] queue_def reference to the mail queue definition obtain with \ref osMailQ
vmihalcut 0:fdfe93cb9255 727 /// \param[in] thread_id thread ID (obtained by \ref osThreadCreate or \ref osThreadGetId) or NULL.
vmihalcut 0:fdfe93cb9255 728 /// \return mail queue ID for reference by other functions or NULL in case of error.
vmihalcut 0:fdfe93cb9255 729 /// \note MUST REMAIN UNCHANGED: \b osMailCreate shall be consistent in every CMSIS-RTOS.
vmihalcut 0:fdfe93cb9255 730 osMailQId osMailCreate (osMailQDef_t *queue_def, osThreadId thread_id);
vmihalcut 0:fdfe93cb9255 731
vmihalcut 0:fdfe93cb9255 732 /// Allocate a memory block from a mail.
vmihalcut 0:fdfe93cb9255 733 /// \param[in] queue_id mail queue ID obtained with \ref osMailCreate.
vmihalcut 0:fdfe93cb9255 734 /// \param[in] millisec timeout value or 0 in case of no time-out
vmihalcut 0:fdfe93cb9255 735 /// \return pointer to memory block that can be filled with mail or NULL in case of error.
vmihalcut 0:fdfe93cb9255 736 /// \note MUST REMAIN UNCHANGED: \b osMailAlloc shall be consistent in every CMSIS-RTOS.
vmihalcut 0:fdfe93cb9255 737 void *osMailAlloc (osMailQId queue_id, uint32_t millisec);
vmihalcut 0:fdfe93cb9255 738
vmihalcut 0:fdfe93cb9255 739 /// Allocate a memory block from a mail and set memory block to zero.
vmihalcut 0:fdfe93cb9255 740 /// \param[in] queue_id mail queue ID obtained with \ref osMailCreate.
vmihalcut 0:fdfe93cb9255 741 /// \param[in] millisec timeout value or 0 in case of no time-out
vmihalcut 0:fdfe93cb9255 742 /// \return pointer to memory block that can be filled with mail or NULL in case of error.
vmihalcut 0:fdfe93cb9255 743 /// \note MUST REMAIN UNCHANGED: \b osMailCAlloc shall be consistent in every CMSIS-RTOS.
vmihalcut 0:fdfe93cb9255 744 void *osMailCAlloc (osMailQId queue_id, uint32_t millisec);
vmihalcut 0:fdfe93cb9255 745
vmihalcut 0:fdfe93cb9255 746 /// Put a mail to a queue.
vmihalcut 0:fdfe93cb9255 747 /// \param[in] queue_id mail queue ID obtained with \ref osMailCreate.
vmihalcut 0:fdfe93cb9255 748 /// \param[in] mail memory block previously allocated with \ref osMailAlloc or \ref osMailCAlloc.
vmihalcut 0:fdfe93cb9255 749 /// \return status code that indicates the execution status of the function.
vmihalcut 0:fdfe93cb9255 750 /// \note MUST REMAIN UNCHANGED: \b osMailPut shall be consistent in every CMSIS-RTOS.
vmihalcut 0:fdfe93cb9255 751 osStatus osMailPut (osMailQId queue_id, void *mail);
vmihalcut 0:fdfe93cb9255 752
vmihalcut 0:fdfe93cb9255 753 /// Get a mail from a queue.
vmihalcut 0:fdfe93cb9255 754 /// \param[in] queue_id mail queue ID obtained with \ref osMailCreate.
vmihalcut 0:fdfe93cb9255 755 /// \param[in] millisec timeout value or 0 in case of no time-out
vmihalcut 0:fdfe93cb9255 756 /// \return event that contains mail information or error code.
vmihalcut 0:fdfe93cb9255 757 /// \note MUST REMAIN UNCHANGED: \b osMailGet shall be consistent in every CMSIS-RTOS.
vmihalcut 0:fdfe93cb9255 758 os_InRegs osEvent osMailGet (osMailQId queue_id, uint32_t millisec);
vmihalcut 0:fdfe93cb9255 759
vmihalcut 0:fdfe93cb9255 760 /// Free a memory block from a mail.
vmihalcut 0:fdfe93cb9255 761 /// \param[in] queue_id mail queue ID obtained with \ref osMailCreate.
vmihalcut 0:fdfe93cb9255 762 /// \param[in] mail pointer to the memory block that was obtained with \ref osMailGet.
vmihalcut 0:fdfe93cb9255 763 /// \return status code that indicates the execution status of the function.
vmihalcut 0:fdfe93cb9255 764 /// \note MUST REMAIN UNCHANGED: \b osMailFree shall be consistent in every CMSIS-RTOS.
vmihalcut 0:fdfe93cb9255 765 osStatus osMailFree (osMailQId queue_id, void *mail);
vmihalcut 0:fdfe93cb9255 766
vmihalcut 0:fdfe93cb9255 767 #endif // Mail Queues available
vmihalcut 0:fdfe93cb9255 768
vmihalcut 0:fdfe93cb9255 769
vmihalcut 0:fdfe93cb9255 770 #ifdef __cplusplus
vmihalcut 0:fdfe93cb9255 771 }
vmihalcut 0:fdfe93cb9255 772 #endif
vmihalcut 0:fdfe93cb9255 773
vmihalcut 0:fdfe93cb9255 774 #endif // _CMSIS_OS_H