Ethernetwebsoc

Dependencies:   C12832_lcd LM75B WebSocketClient mbed-rtos mbed Socket lwip-eth lwip-sys lwip

Committer:
GordonSin
Date:
Fri May 31 04:09:54 2013 +0000
Revision:
0:0ed2a7c7190c
31/5/2013;

Who changed what in which revision?

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