Integrating the ublox LISA C200 modem

Fork of SprintUSBModemHTTPClientTest by Donatien Garnier

Committer:
sam_grove
Date:
Thu Sep 26 00:44:20 2013 -0500
Revision:
5:3f93dd1d4cb3
Exported program and replaced contents of the repo with the source
to build and debug using keil mdk. Libs NOT upto date are lwip, lwip-sys
and socket. these have newer versions under mbed_official but were starting
from a know working point

Who changed what in which revision?

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