Control a robot over the internet using UDP and a Wifly module (WiFi).

Dependencies:   Motor TextLCD WiflyInterface mbed-rtos mbed

Committer:
apatel336
Date:
Thu Oct 17 13:27:56 2013 +0000
Revision:
0:c0dc3a76f3d4
Initial Release

Who changed what in which revision?

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