Pierre Provent / USBHost

Dependents:   TEST_USB_Nucleo_F429ZI Essais_USB_Nucleo_F429ZI SID_V3_Nucleo_F429ZI SID_V4_Nucleo_F429ZI_copy

Committer:
pierreprovent
Date:
Fri Sep 25 10:17:49 2020 +0000
Revision:
0:77ca32e8e04e
Programme acquisition en enregistrement sur clef USB carte Nucleo F429ZI cours ELE118 Cnam

Who changed what in which revision?

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