Nirvana Jay / Mbed 2 deprecated F7DISCO_Demo

Dependencies:   BSP_DISCO_F746NG_patch mbed-rtos mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers cmsis_os.h Source File

cmsis_os.h

00001 /* ----------------------------------------------------------------------
00002  * $Date:        5. February 2013
00003  * $Revision:    V1.02
00004  *
00005  * Project:      CMSIS-RTOS API
00006  * Title:        cmsis_os.h header file
00007  *
00008  * Version 0.02
00009  *    Initial Proposal Phase
00010  * Version 0.03
00011  *    osKernelStart added, optional feature: main started as thread
00012  *    osSemaphores have standard behavior
00013  *    osTimerCreate does not start the timer, added osTimerStart
00014  *    osThreadPass is renamed to osThreadYield
00015  * Version 1.01
00016  *    Support for C++ interface
00017  *     - const attribute removed from the osXxxxDef_t typedef's
00018  *     - const attribute added to the osXxxxDef macros
00019  *    Added: osTimerDelete, osMutexDelete, osSemaphoreDelete
00020  *    Added: osKernelInitialize
00021  * Version 1.02
00022  *    Control functions for short timeouts in microsecond resolution:
00023  *    Added: osKernelSysTick, osKernelSysTickFrequency, osKernelSysTickMicroSec
00024  *    Removed: osSignalGet 
00025  *    
00026  *  
00027  *----------------------------------------------------------------------------
00028  *
00029  * Portions COPYRIGHT 2015 STMicroelectronics
00030  * Portions Copyright (c) 2013 ARM LIMITED
00031  * All rights reserved.
00032  * Redistribution and use in source and binary forms, with or without
00033  * modification, are permitted provided that the following conditions are met:
00034  *  - Redistributions of source code must retain the above copyright
00035  *    notice, this list of conditions and the following disclaimer.
00036  *  - Redistributions in binary form must reproduce the above copyright
00037  *    notice, this list of conditions and the following disclaimer in the
00038  *    documentation and/or other materials provided with the distribution.
00039  *  - Neither the name of ARM  nor the names of its contributors may be used
00040  *    to endorse or promote products derived from this software without
00041  *    specific prior written permission.
00042  *
00043  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00044  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00045  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00046  * ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE
00047  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
00048  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
00049  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
00050  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
00051  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
00052  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00053  * POSSIBILITY OF SUCH DAMAGE.
00054  *---------------------------------------------------------------------------*/
00055 
00056  /**
00057   ******************************************************************************
00058   * @file    cmsis_os.h
00059   * @author  MCD Application Team
00060   * @date    27-March-2015
00061   * @brief   Header of cmsis_os.c
00062   *          A new set of APIs are added in addition to existing ones, these APIs 
00063   *          are specific to FreeRTOS.
00064   ******************************************************************************
00065   * @attention
00066   *
00067   * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
00068   * You may not use this file except in compliance with the License.
00069   * You may obtain a copy of the License at:
00070   *
00071   *        http://www.st.com/software_license_agreement_liberty_v2
00072   *
00073   * Unless required by applicable law or agreed to in writing, software 
00074   * distributed under the License is distributed on an "AS IS" BASIS, 
00075   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00076   * See the License for the specific language governing permissions and
00077   * limitations under the License.
00078   *
00079   ******************************************************************************
00080   */ 
00081 
00082  #if   defined ( __CC_ARM )
00083   #define __ASM            __asm                                      /*!< asm keyword for ARM Compiler          */
00084   #define __INLINE         __inline                                   /*!< inline keyword for ARM Compiler       */
00085   #define __STATIC_INLINE  static __inline
00086 #elif defined ( __ICCARM__ )
00087   #define __ASM            __asm                                      /*!< asm keyword for IAR Compiler          */
00088   #define __INLINE         inline                                     /*!< inline keyword for IAR Compiler. Only available in High optimization mode! */
00089   #define __STATIC_INLINE  static inline
00090 #elif defined ( __GNUC__ )
00091   #define __ASM            __asm                                      /*!< asm keyword for GNU Compiler          */
00092   #define __INLINE         inline                                     /*!< inline keyword for GNU Compiler       */
00093   #define __STATIC_INLINE  static inline
00094 #endif
00095 
00096 #include <stdint.h>
00097 #include <stddef.h>
00098 #include "core_cmFunc.h"
00099     
00100 #include "FreeRTOS.h"
00101 #include "task.h"
00102 #include "timers.h"
00103 #include "queue.h"
00104 #include "semphr.h"
00105 #include "event_groups.h"
00106 
00107 /**
00108 \page cmsis_os_h Header File Template: cmsis_os.h
00109 
00110 The file \b cmsis_os.h is a template header file for a CMSIS-RTOS compliant Real-Time Operating System (RTOS).
00111 Each RTOS that is compliant with CMSIS-RTOS shall provide a specific \b cmsis_os.h header file that represents
00112 its implementation.
00113 
00114 The file cmsis_os.h contains:
00115  - CMSIS-RTOS API function definitions
00116  - struct definitions for parameters and return types
00117  - status and priority values used by CMSIS-RTOS API functions
00118  - macros for defining threads and other kernel objects
00119 
00120 
00121 <b>Name conventions and header file modifications</b>
00122 
00123 All definitions are prefixed with \b os to give an unique name space for CMSIS-RTOS functions.
00124 Definitions that are prefixed \b os_ are not used in the application code but local to this header file.
00125 All definitions and functions that belong to a module are grouped and have a common prefix, i.e. \b osThread.
00126 
00127 Definitions that are marked with <b>CAN BE CHANGED</b> can be adapted towards the needs of the actual CMSIS-RTOS implementation.
00128 These definitions can be specific to the underlying RTOS kernel.
00129 
00130 Definitions that are marked with <b>MUST REMAIN UNCHANGED</b> cannot be altered. Otherwise the CMSIS-RTOS implementation is no longer
00131 compliant to the standard. Note that some functions are optional and need not to be provided by every CMSIS-RTOS implementation.
00132 
00133 
00134 <b>Function calls from interrupt service routines</b>
00135 
00136 The following CMSIS-RTOS functions can be called from threads and interrupt service routines (ISR):
00137   - \ref osSignalSet
00138   - \ref osSemaphoreRelease
00139   - \ref osPoolAlloc, \ref osPoolCAlloc, \ref osPoolFree
00140   - \ref osMessagePut, \ref osMessageGet
00141   - \ref osMailAlloc, \ref osMailCAlloc, \ref osMailGet, \ref osMailPut, \ref osMailFree
00142 
00143 Functions that cannot be called from an ISR are verifying the interrupt status and return in case that they are called
00144 from an ISR context the status code \b osErrorISR. In some implementations this condition might be caught using the HARD FAULT vector.
00145 
00146 Some CMSIS-RTOS implementations support CMSIS-RTOS function calls from multiple ISR at the same time.
00147 If this is impossible, the CMSIS-RTOS rejects calls by nested ISR functions with the status code \b osErrorISRRecursive.
00148 
00149 
00150 <b>Define and reference object definitions</b>
00151 
00152 With <b>\#define osObjectsExternal</b> objects are defined as external symbols. This allows to create a consistent header file
00153 that is used throughout a project as shown below:
00154 
00155 <i>Header File</i>
00156 \code
00157 #include <cmsis_os.h>                                         // CMSIS RTOS header file
00158 
00159 // Thread definition
00160 extern void thread_sample (void const *argument);             // function prototype
00161 osThreadDef (thread_sample, osPriorityBelowNormal, 1, 100);
00162 
00163 // Pool definition
00164 osPoolDef(MyPool, 10, long);
00165 \endcode
00166 
00167 
00168 This header file defines all objects when included in a C/C++ source file. When <b>\#define osObjectsExternal</b> is
00169 present before the header file, the objects are defined as external symbols. A single consistent header file can therefore be
00170 used throughout the whole project.
00171 
00172 <i>Example</i>
00173 \code
00174 #include "osObjects.h"     // Definition of the CMSIS-RTOS objects
00175 \endcode
00176 
00177 \code
00178 #define osObjectExternal   // Objects will be defined as external symbols
00179 #include "osObjects.h"     // Reference to the CMSIS-RTOS objects
00180 \endcode
00181 
00182 */
00183 
00184 #ifndef _CMSIS_OS_H
00185 #define _CMSIS_OS_H
00186 
00187 /// \note MUST REMAIN UNCHANGED: \b osCMSIS identifies the CMSIS-RTOS API version.
00188 #define osCMSIS           0x10002      ///< API version (main [31:16] .sub [15:0])
00189 
00190 /// \note CAN BE CHANGED: \b osCMSIS_KERNEL identifies the underlying RTOS kernel and version number.
00191 #define osCMSIS_KERNEL    0x10000      ///< RTOS identification and version (main [31:16] .sub [15:0])
00192 
00193 /// \note MUST REMAIN UNCHANGED: \b osKernelSystemId shall be consistent in every CMSIS-RTOS.
00194 #define osKernelSystemId "KERNEL V1.00"   ///< RTOS identification string
00195 
00196 /// \note MUST REMAIN UNCHANGED: \b osFeature_xxx shall be consistent in every CMSIS-RTOS.
00197 #define osFeature_MainThread   1       ///< main thread      1=main can be thread, 0=not available
00198 #define osFeature_Pool         1       ///< Memory Pools:    1=available, 0=not available
00199 #define osFeature_MailQ        1       ///< Mail Queues:     1=available, 0=not available
00200 #define osFeature_MessageQ     1       ///< Message Queues:  1=available, 0=not available
00201 #define osFeature_Signals      8       ///< maximum number of Signal Flags available per thread
00202 #define osFeature_Semaphore    1      ///< osFeature_Semaphore function: 1=available, 0=not available
00203 #define osFeature_Wait         0       ///< osWait function: 1=available, 0=not available
00204 #define osFeature_SysTick      1       ///< osKernelSysTick functions: 1=available, 0=not available
00205 
00206 #ifdef  __cplusplus
00207 extern "C"
00208 {
00209 #endif
00210 
00211 
00212 // ==== Enumeration, structures, defines ====
00213 
00214 /// Priority used for thread control.
00215 /// \note MUST REMAIN UNCHANGED: \b osPriority shall be consistent in every CMSIS-RTOS.
00216 typedef enum  {
00217   osPriorityIdle          = -3,          ///< priority: idle (lowest)
00218   osPriorityLow           = -2,          ///< priority: low
00219   osPriorityBelowNormal   = -1,          ///< priority: below normal
00220   osPriorityNormal        =  0,          ///< priority: normal (default)
00221   osPriorityAboveNormal   = +1,          ///< priority: above normal
00222   osPriorityHigh          = +2,          ///< priority: high
00223   osPriorityRealtime      = +3,          ///< priority: realtime (highest)
00224   osPriorityError         =  0x84        ///< system cannot determine priority or thread has illegal priority
00225 } osPriority;
00226 
00227 /// Timeout value.
00228 /// \note MUST REMAIN UNCHANGED: \b osWaitForever shall be consistent in every CMSIS-RTOS.
00229 #define osWaitForever     0xFFFFFFFF     ///< wait forever timeout value
00230 
00231 /// Status code values returned by CMSIS-RTOS functions.
00232 /// \note MUST REMAIN UNCHANGED: \b osStatus shall be consistent in every CMSIS-RTOS.
00233 typedef enum  {
00234   osOK                    =     0,       ///< function completed; no error or event occurred.
00235   osEventSignal           =  0x08,       ///< function completed; signal event occurred.
00236   osEventMessage          =  0x10,       ///< function completed; message event occurred.
00237   osEventMail             =  0x20,       ///< function completed; mail event occurred.
00238   osEventTimeout          =  0x40,       ///< function completed; timeout occurred.
00239   osErrorParameter        =  0x80,       ///< parameter error: a mandatory parameter was missing or specified an incorrect object.
00240   osErrorResource         =  0x81,       ///< resource not available: a specified resource was not available.
00241   osErrorTimeoutResource  =  0xC1,       ///< resource not available within given time: a specified resource was not available within the timeout period.
00242   osErrorISR              =  0x82,       ///< not allowed in ISR context: the function cannot be called from interrupt service routines.
00243   osErrorISRRecursive     =  0x83,       ///< function called multiple times from ISR with same object.
00244   osErrorPriority         =  0x84,       ///< system cannot determine priority or thread has illegal priority.
00245   osErrorNoMemory         =  0x85,       ///< system is out of memory: it was impossible to allocate or reserve memory for the operation.
00246   osErrorValue            =  0x86,       ///< value of a parameter is out of range.
00247   osErrorOS               =  0xFF,       ///< unspecified RTOS error: run-time error but no other error message fits.
00248   os_status_reserved      =  0x7FFFFFFF  ///< prevent from enum down-size compiler optimization.
00249 } osStatus;
00250 
00251 #if ( INCLUDE_eTaskGetState == 1 )
00252 /* Thread state returned by osThreadGetState */
00253 typedef enum {
00254     osThreadRunning   = 0x0,          /* A thread is querying the state of itself, so must be running. */
00255     osThreadReady     = 0x1 ,                   /* The thread being queried is in a read or pending ready list. */
00256     osThreadBlocked   = 0x2,                /* The thread being queried is in the Blocked state. */
00257     osThreadSuspended = 0x3,          /* The thread being queried is in the Suspended state, or is in the Blocked state with an infinite time out. */
00258     osThreadDeleted   = 0x4,                  /* The thread being queried has been deleted, but its TCB has not yet been freed. */   
00259   osThreadError     = 0x7FFFFFFF
00260 } osThreadState;
00261 #endif /* INCLUDE_eTaskGetState */
00262 
00263 /// Timer type value for the timer definition.
00264 /// \note MUST REMAIN UNCHANGED: \b os_timer_type shall be consistent in every CMSIS-RTOS.
00265 typedef enum  {
00266   osTimerOnce             =     0,       ///< one-shot timer
00267   osTimerPeriodic         =     1        ///< repeating timer
00268 } os_timer_type;
00269 
00270 /// Entry point of a thread.
00271 /// \note MUST REMAIN UNCHANGED: \b os_pthread shall be consistent in every CMSIS-RTOS.
00272 typedef void (*os_pthread) (void const *argument);
00273 
00274 /// Entry point of a timer call back function.
00275 /// \note MUST REMAIN UNCHANGED: \b os_ptimer shall be consistent in every CMSIS-RTOS.
00276 typedef void (*os_ptimer) (void const *argument);
00277 
00278 // >>> the following data type definitions may shall adapted towards a specific RTOS
00279 
00280 /// Thread ID identifies the thread (pointer to a thread control block).
00281 /// \note CAN BE CHANGED: \b os_thread_cb is implementation specific in every CMSIS-RTOS.
00282 typedef TaskHandle_t osThreadId;
00283 
00284 /// Timer ID identifies the timer (pointer to a timer control block).
00285 /// \note CAN BE CHANGED: \b os_timer_cb is implementation specific in every CMSIS-RTOS.
00286 typedef TimerHandle_t osTimerId;
00287 
00288 /// Mutex ID identifies the mutex (pointer to a mutex control block).
00289 /// \note CAN BE CHANGED: \b os_mutex_cb is implementation specific in every CMSIS-RTOS.
00290 typedef SemaphoreHandle_t osMutexId;
00291 
00292 /// Semaphore ID identifies the semaphore (pointer to a semaphore control block).
00293 /// \note CAN BE CHANGED: \b os_semaphore_cb is implementation specific in every CMSIS-RTOS.
00294 typedef SemaphoreHandle_t osSemaphoreId;
00295 
00296 /// Pool ID identifies the memory pool (pointer to a memory pool control block).
00297 /// \note CAN BE CHANGED: \b os_pool_cb is implementation specific in every CMSIS-RTOS.
00298 typedef struct os_pool_cb *osPoolId;
00299 
00300 /// Message ID identifies the message queue (pointer to a message queue control block).
00301 /// \note CAN BE CHANGED: \b os_messageQ_cb is implementation specific in every CMSIS-RTOS.
00302 typedef QueueHandle_t osMessageQId;
00303 
00304 /// Mail ID identifies the mail queue (pointer to a mail queue control block).
00305 /// \note CAN BE CHANGED: \b os_mailQ_cb is implementation specific in every CMSIS-RTOS.
00306 typedef struct os_mailQ_cb *osMailQId;
00307 
00308 
00309 /// Thread Definition structure contains startup information of a thread.
00310 /// \note CAN BE CHANGED: \b os_thread_def is implementation specific in every CMSIS-RTOS.
00311 typedef struct os_thread_def  {
00312   char                   *name;        ///< Thread name 
00313   os_pthread             pthread;      ///< start address of thread function
00314   osPriority             tpriority;    ///< initial thread priority
00315   uint32_t               instances;    ///< maximum number of instances of that thread function
00316   uint32_t               stacksize;    ///< stack size requirements in bytes; 0 is default stack size
00317 } osThreadDef_t;
00318 
00319 /// Timer Definition structure contains timer parameters.
00320 /// \note CAN BE CHANGED: \b os_timer_def is implementation specific in every CMSIS-RTOS.
00321 typedef struct os_timer_def  {
00322   os_ptimer                 ptimer;    ///< start address of a timer function
00323 } osTimerDef_t;
00324 
00325 /// Mutex Definition structure contains setup information for a mutex.
00326 /// \note CAN BE CHANGED: \b os_mutex_def is implementation specific in every CMSIS-RTOS.
00327 typedef struct os_mutex_def  {
00328   uint32_t                   dummy;    ///< dummy value.
00329 } osMutexDef_t;
00330 
00331 /// Semaphore Definition structure contains setup information for a semaphore.
00332 /// \note CAN BE CHANGED: \b os_semaphore_def is implementation specific in every CMSIS-RTOS.
00333 typedef struct os_semaphore_def  {
00334   uint32_t                   dummy;    ///< dummy value.
00335 } osSemaphoreDef_t;
00336 
00337 /// Definition structure for memory block allocation.
00338 /// \note CAN BE CHANGED: \b os_pool_def is implementation specific in every CMSIS-RTOS.
00339 typedef struct os_pool_def  {
00340   uint32_t                 pool_sz;    ///< number of items (elements) in the pool
00341   uint32_t                 item_sz;    ///< size of an item
00342   void                       *pool;    ///< pointer to memory for pool
00343 } osPoolDef_t;
00344 
00345 /// Definition structure for message queue.
00346 /// \note CAN BE CHANGED: \b os_messageQ_def is implementation specific in every CMSIS-RTOS.
00347 typedef struct os_messageQ_def  {
00348   uint32_t                queue_sz;    ///< number of elements in the queue
00349   uint32_t                 item_sz;    ///< size of an item
00350   //void                       *pool;    ///< memory array for messages
00351 } osMessageQDef_t;
00352 
00353 /// Definition structure for mail queue.
00354 /// \note CAN BE CHANGED: \b os_mailQ_def is implementation specific in every CMSIS-RTOS.
00355 typedef struct os_mailQ_def  {
00356   uint32_t                queue_sz;    ///< number of elements in the queue
00357   uint32_t                 item_sz;    ///< size of an item
00358   struct os_mailQ_cb **cb;
00359 } osMailQDef_t;
00360 
00361 /// Event structure contains detailed information about an event.
00362 /// \note MUST REMAIN UNCHANGED: \b os_event shall be consistent in every CMSIS-RTOS.
00363 ///       However the struct may be extended at the end.
00364 typedef struct  {
00365   osStatus                 status;     ///< status code: event or error information
00366   union  {
00367     uint32_t                    v;     ///< message as 32-bit value
00368     void                       *p;     ///< message or mail as void pointer
00369     int32_t               signals;     ///< signal flags
00370   } value;                             ///< event value
00371   union  {
00372     osMailQId             mail_id;     ///< mail id obtained by \ref osMailCreate
00373     osMessageQId       message_id;     ///< message id obtained by \ref osMessageCreate
00374   } def;                               ///< event definition
00375 } osEvent;
00376 
00377 
00378 //  ==== Kernel Control Functions ====
00379 
00380 /// Initialize the RTOS Kernel for creating objects.
00381 /// \return status code that indicates the execution status of the function.
00382 /// \note MUST REMAIN UNCHANGED: \b osKernelInitialize shall be consistent in every CMSIS-RTOS.
00383 osStatus osKernelInitialize (void);
00384 
00385 /// Start the RTOS Kernel.
00386 /// \return status code that indicates the execution status of the function.
00387 /// \note MUST REMAIN UNCHANGED: \b osKernelStart shall be consistent in every CMSIS-RTOS.
00388 osStatus osKernelStart (void);
00389 
00390 /// Check if the RTOS kernel is already started.
00391 /// \note MUST REMAIN UNCHANGED: \b osKernelRunning shall be consistent in every CMSIS-RTOS.
00392 /// \return 0 RTOS is not started, 1 RTOS is started.
00393 int32_t osKernelRunning(void);
00394 
00395 #if (defined (osFeature_SysTick)  &&  (osFeature_SysTick != 0))     // System Timer available
00396 
00397 /// Get the RTOS kernel system timer counter 
00398 /// \note MUST REMAIN UNCHANGED: \b osKernelSysTick shall be consistent in every CMSIS-RTOS.
00399 /// \return RTOS kernel system timer as 32-bit value 
00400 uint32_t osKernelSysTick (void);
00401 
00402 /// The RTOS kernel system timer frequency in Hz
00403 /// \note Reflects the system timer setting and is typically defined in a configuration file.
00404 #define osKernelSysTickFrequency      (configTICK_RATE_HZ)
00405 
00406 /// Convert a microseconds value to a RTOS kernel system timer value.
00407 /// \param         microsec     time value in microseconds.
00408 /// \return time value normalized to the \ref osKernelSysTickFrequency
00409 #define osKernelSysTickMicroSec(microsec) (((uint64_t)microsec * (osKernelSysTickFrequency)) / 1000000)
00410 
00411 #endif    // System Timer available
00412 
00413 //  ==== Thread Management ====
00414 
00415 /// Create a Thread Definition with function, priority, and stack requirements.
00416 /// \param         name         name of the thread function.
00417 /// \param         priority     initial priority of the thread function.
00418 /// \param         instances    number of possible thread instances.
00419 /// \param         stacksz      stack size (in bytes) requirements for the thread function.
00420 /// \note CAN BE CHANGED: The parameters to \b osThreadDef shall be consistent but the
00421 ///       macro body is implementation specific in every CMSIS-RTOS.
00422 #if defined (osObjectsExternal)  // object is external
00423 #define osThreadDef(name, thread, priority, instances, stacksz)  \
00424 extern const osThreadDef_t os_thread_def_##name
00425 #else                            // define the object
00426 #define osThreadDef(name, thread, priority, instances, stacksz)  \
00427 const osThreadDef_t os_thread_def_##name = \
00428 { #name, (thread), (priority), (instances), (stacksz)  }
00429 #endif
00430 
00431 /// Access a Thread definition.
00432 /// \param         name          name of the thread definition object.
00433 /// \note CAN BE CHANGED: The parameter to \b osThread shall be consistent but the
00434 ///       macro body is implementation specific in every CMSIS-RTOS.
00435 #define osThread(name)  \
00436 &os_thread_def_##name
00437 
00438 /// Create a thread and add it to Active Threads and set it to state READY.
00439 /// \param[in]     thread_def    thread definition referenced with \ref osThread.
00440 /// \param[in]     argument      pointer that is passed to the thread function as start argument.
00441 /// \return thread ID for reference by other functions or NULL in case of error.
00442 /// \note MUST REMAIN UNCHANGED: \b osThreadCreate shall be consistent in every CMSIS-RTOS.
00443 osThreadId osThreadCreate (const osThreadDef_t *thread_def, void *argument);
00444 
00445 /// Return the thread ID of the current running thread.
00446 /// \return thread ID for reference by other functions or NULL in case of error.
00447 /// \note MUST REMAIN UNCHANGED: \b osThreadGetId shall be consistent in every CMSIS-RTOS.
00448 osThreadId osThreadGetId (void);
00449 
00450 /// Terminate execution of a thread and remove it from Active Threads.
00451 /// \param[in]     thread_id   thread ID obtained by \ref osThreadCreate or \ref osThreadGetId.
00452 /// \return status code that indicates the execution status of the function.
00453 /// \note MUST REMAIN UNCHANGED: \b osThreadTerminate shall be consistent in every CMSIS-RTOS.
00454 osStatus osThreadTerminate (osThreadId thread_id);
00455 
00456 /// Pass control to next thread that is in state \b READY.
00457 /// \return status code that indicates the execution status of the function.
00458 /// \note MUST REMAIN UNCHANGED: \b osThreadYield shall be consistent in every CMSIS-RTOS.
00459 osStatus osThreadYield (void);
00460 
00461 /// Change priority of an active thread.
00462 /// \param[in]     thread_id     thread ID obtained by \ref osThreadCreate or \ref osThreadGetId.
00463 /// \param[in]     priority      new priority value for the thread function.
00464 /// \return status code that indicates the execution status of the function.
00465 /// \note MUST REMAIN UNCHANGED: \b osThreadSetPriority shall be consistent in every CMSIS-RTOS.
00466 osStatus osThreadSetPriority (osThreadId thread_id, osPriority priority);
00467 
00468 /// Get current priority of an active thread.
00469 /// \param[in]     thread_id     thread ID obtained by \ref osThreadCreate or \ref osThreadGetId.
00470 /// \return current priority value of the thread function.
00471 /// \note MUST REMAIN UNCHANGED: \b osThreadGetPriority shall be consistent in every CMSIS-RTOS.
00472 osPriority osThreadGetPriority (osThreadId thread_id);
00473 
00474 
00475 //  ==== Generic Wait Functions ====
00476 
00477 /// Wait for Timeout (Time Delay).
00478 /// \param[in]     millisec      time delay value
00479 /// \return status code that indicates the execution status of the function.
00480 osStatus osDelay (uint32_t millisec);
00481 
00482 #if (defined (osFeature_Wait)  &&  (osFeature_Wait != 0))     // Generic Wait available
00483 
00484 /// Wait for Signal, Message, Mail, or Timeout.
00485 /// \param[in] millisec          timeout value or 0 in case of no time-out
00486 /// \return event that contains signal, message, or mail information or error code.
00487 /// \note MUST REMAIN UNCHANGED: \b osWait shall be consistent in every CMSIS-RTOS.
00488 osEvent osWait (uint32_t millisec);
00489 
00490 #endif  // Generic Wait available
00491 
00492 
00493 //  ==== Timer Management Functions ====
00494 /// Define a Timer object.
00495 /// \param         name          name of the timer object.
00496 /// \param         function      name of the timer call back function.
00497 /// \note CAN BE CHANGED: The parameter to \b osTimerDef shall be consistent but the
00498 ///       macro body is implementation specific in every CMSIS-RTOS.
00499 #if defined (osObjectsExternal)  // object is external
00500 #define osTimerDef(name, function)  \
00501 extern const osTimerDef_t os_timer_def_##name
00502 #else                            // define the object
00503 #define osTimerDef(name, function)  \
00504 const osTimerDef_t os_timer_def_##name = \
00505 { (function) }
00506 #endif
00507 
00508 /// Access a Timer definition.
00509 /// \param         name          name of the timer object.
00510 /// \note CAN BE CHANGED: The parameter to \b osTimer shall be consistent but the
00511 ///       macro body is implementation specific in every CMSIS-RTOS.
00512 #define osTimer(name) \
00513 &os_timer_def_##name
00514 
00515 /// Create a timer.
00516 /// \param[in]     timer_def     timer object referenced with \ref osTimer.
00517 /// \param[in]     type          osTimerOnce for one-shot or osTimerPeriodic for periodic behavior.
00518 /// \param[in]     argument      argument to the timer call back function.
00519 /// \return timer ID for reference by other functions or NULL in case of error.
00520 /// \note MUST REMAIN UNCHANGED: \b osTimerCreate shall be consistent in every CMSIS-RTOS.
00521 osTimerId osTimerCreate (const osTimerDef_t *timer_def, os_timer_type type, void *argument);
00522 
00523 /// Start or restart a timer.
00524 /// \param[in]     timer_id      timer ID obtained by \ref osTimerCreate.
00525 /// \param[in]     millisec      time delay value of the timer.
00526 /// \return status code that indicates the execution status of the function.
00527 /// \note MUST REMAIN UNCHANGED: \b osTimerStart shall be consistent in every CMSIS-RTOS.
00528 osStatus osTimerStart (osTimerId timer_id, uint32_t millisec);
00529 
00530 /// Stop the timer.
00531 /// \param[in]     timer_id      timer ID obtained by \ref osTimerCreate.
00532 /// \return status code that indicates the execution status of the function.
00533 /// \note MUST REMAIN UNCHANGED: \b osTimerStop shall be consistent in every CMSIS-RTOS.
00534 osStatus osTimerStop (osTimerId timer_id);
00535 
00536 /// Delete a timer that was created by \ref osTimerCreate.
00537 /// \param[in]     timer_id      timer ID obtained by \ref osTimerCreate.
00538 /// \return status code that indicates the execution status of the function.
00539 /// \note MUST REMAIN UNCHANGED: \b osTimerDelete shall be consistent in every CMSIS-RTOS.
00540 osStatus osTimerDelete (osTimerId timer_id);
00541 
00542 
00543 //  ==== Signal Management ====
00544 
00545 /// Set the specified Signal Flags of an active thread.
00546 /// \param[in]     thread_id     thread ID obtained by \ref osThreadCreate or \ref osThreadGetId.
00547 /// \param[in]     signals       specifies the signal flags of the thread that should be set.
00548 /// \return osOK if successful, osErrorOS if failed.
00549 /// \note MUST REMAIN UNCHANGED: \b osSignalSet shall be consistent in every CMSIS-RTOS.
00550 int32_t osSignalSet (osThreadId thread_id, int32_t signals);
00551 
00552 /// Clear the specified Signal Flags of an active thread.
00553 /// \param[in]     thread_id     thread ID obtained by \ref osThreadCreate or \ref osThreadGetId.
00554 /// \param[in]     signals       specifies the signal flags of the thread that shall be cleared.
00555 /// \return previous signal flags of the specified thread or 0x80000000 in case of incorrect parameters.
00556 /// \note MUST REMAIN UNCHANGED: \b osSignalClear shall be consistent in every CMSIS-RTOS.
00557 int32_t osSignalClear (osThreadId thread_id, int32_t signals);
00558 
00559 /// Wait for one or more Signal Flags to become signaled for the current \b RUNNING thread.
00560 /// \param[in]     signals       wait until all specified signal flags set or 0 for any single signal flag.
00561 /// \param[in]     millisec      timeout value or 0 in case of no time-out.
00562 /// \return event flag information or error code.
00563 /// \note MUST REMAIN UNCHANGED: \b osSignalWait shall be consistent in every CMSIS-RTOS.
00564 osEvent osSignalWait (int32_t signals, uint32_t millisec);
00565 
00566 
00567 //  ==== Mutex Management ====
00568 
00569 /// Define a Mutex.
00570 /// \param         name          name of the mutex object.
00571 /// \note CAN BE CHANGED: The parameter to \b osMutexDef shall be consistent but the
00572 ///       macro body is implementation specific in every CMSIS-RTOS.
00573 #if defined (osObjectsExternal)  // object is external
00574 #define osMutexDef(name)  \
00575 extern const osMutexDef_t os_mutex_def_##name
00576 #else                            // define the object
00577 #define osMutexDef(name)  \
00578 const osMutexDef_t os_mutex_def_##name = { 0 }
00579 #endif
00580 
00581 /// Access a Mutex definition.
00582 /// \param         name          name of the mutex object.
00583 /// \note CAN BE CHANGED: The parameter to \b osMutex shall be consistent but the
00584 ///       macro body is implementation specific in every CMSIS-RTOS.
00585 #define osMutex(name)  \
00586 &os_mutex_def_##name
00587 
00588 /// Create and Initialize a Mutex object.
00589 /// \param[in]     mutex_def     mutex definition referenced with \ref osMutex.
00590 /// \return mutex ID for reference by other functions or NULL in case of error.
00591 /// \note MUST REMAIN UNCHANGED: \b osMutexCreate shall be consistent in every CMSIS-RTOS.
00592 osMutexId osMutexCreate (const osMutexDef_t *mutex_def);
00593 
00594 /// Wait until a Mutex becomes available.
00595 /// \param[in]     mutex_id      mutex ID obtained by \ref osMutexCreate.
00596 /// \param[in]     millisec      timeout value or 0 in case of no time-out.
00597 /// \return status code that indicates the execution status of the function.
00598 /// \note MUST REMAIN UNCHANGED: \b osMutexWait shall be consistent in every CMSIS-RTOS.
00599 osStatus osMutexWait (osMutexId mutex_id, uint32_t millisec);
00600 
00601 /// Release a Mutex that was obtained by \ref osMutexWait.
00602 /// \param[in]     mutex_id      mutex ID obtained by \ref osMutexCreate.
00603 /// \return status code that indicates the execution status of the function.
00604 /// \note MUST REMAIN UNCHANGED: \b osMutexRelease shall be consistent in every CMSIS-RTOS.
00605 osStatus osMutexRelease (osMutexId mutex_id);
00606 
00607 /// Delete a Mutex that was created by \ref osMutexCreate.
00608 /// \param[in]     mutex_id      mutex ID obtained by \ref osMutexCreate.
00609 /// \return status code that indicates the execution status of the function.
00610 /// \note MUST REMAIN UNCHANGED: \b osMutexDelete shall be consistent in every CMSIS-RTOS.
00611 osStatus osMutexDelete (osMutexId mutex_id);
00612 
00613 
00614 //  ==== Semaphore Management Functions ====
00615 
00616 #if (defined (osFeature_Semaphore)  &&  (osFeature_Semaphore != 0))     // Semaphore available
00617 
00618 /// Define a Semaphore object.
00619 /// \param         name          name of the semaphore object.
00620 /// \note CAN BE CHANGED: The parameter to \b osSemaphoreDef shall be consistent but the
00621 ///       macro body is implementation specific in every CMSIS-RTOS.
00622 #if defined (osObjectsExternal)  // object is external
00623 #define osSemaphoreDef(name)  \
00624 extern const osSemaphoreDef_t os_semaphore_def_##name
00625 #else                            // define the object
00626 #define osSemaphoreDef(name)  \
00627 const osSemaphoreDef_t os_semaphore_def_##name = { 0 }
00628 #endif
00629 
00630 /// Access a Semaphore definition.
00631 /// \param         name          name of the semaphore object.
00632 /// \note CAN BE CHANGED: The parameter to \b osSemaphore shall be consistent but the
00633 ///       macro body is implementation specific in every CMSIS-RTOS.
00634 #define osSemaphore(name)  \
00635 &os_semaphore_def_##name
00636 
00637 /// Create and Initialize a Semaphore object used for managing resources.
00638 /// \param[in]     semaphore_def semaphore definition referenced with \ref osSemaphore.
00639 /// \param[in]     count         number of available resources.
00640 /// \return semaphore ID for reference by other functions or NULL in case of error.
00641 /// \note MUST REMAIN UNCHANGED: \b osSemaphoreCreate shall be consistent in every CMSIS-RTOS.
00642 osSemaphoreId osSemaphoreCreate (const osSemaphoreDef_t *semaphore_def, int32_t count);
00643 
00644 /// Wait until a Semaphore token becomes available.
00645 /// \param[in]     semaphore_id  semaphore object referenced with \ref osSemaphoreCreate.
00646 /// \param[in]     millisec      timeout value or 0 in case of no time-out.
00647 /// \return number of available tokens, or -1 in case of incorrect parameters.
00648 /// \note MUST REMAIN UNCHANGED: \b osSemaphoreWait shall be consistent in every CMSIS-RTOS.
00649 int32_t osSemaphoreWait (osSemaphoreId semaphore_id, uint32_t millisec);
00650 
00651 /// Release a Semaphore token.
00652 /// \param[in]     semaphore_id  semaphore object referenced with \ref osSemaphoreCreate.
00653 /// \return status code that indicates the execution status of the function.
00654 /// \note MUST REMAIN UNCHANGED: \b osSemaphoreRelease shall be consistent in every CMSIS-RTOS.
00655 osStatus osSemaphoreRelease (osSemaphoreId semaphore_id);
00656 
00657 /// Delete a Semaphore that was created by \ref osSemaphoreCreate.
00658 /// \param[in]     semaphore_id  semaphore object referenced with \ref osSemaphoreCreate.
00659 /// \return status code that indicates the execution status of the function.
00660 /// \note MUST REMAIN UNCHANGED: \b osSemaphoreDelete shall be consistent in every CMSIS-RTOS.
00661 osStatus osSemaphoreDelete (osSemaphoreId semaphore_id);
00662 
00663 #endif     // Semaphore available
00664 
00665 
00666 //  ==== Memory Pool Management Functions ====
00667 
00668 #if (defined (osFeature_Pool)  &&  (osFeature_Pool != 0))  // Memory Pool Management available
00669 
00670 /// \brief Define a Memory Pool.
00671 /// \param         name          name of the memory pool.
00672 /// \param         no            maximum number of blocks (objects) in the memory pool.
00673 /// \param         type          data type of a single block (object).
00674 /// \note CAN BE CHANGED: The parameter to \b osPoolDef shall be consistent but the
00675 ///       macro body is implementation specific in every CMSIS-RTOS.
00676 #if defined (osObjectsExternal)  // object is external
00677 #define osPoolDef(name, no, type)   \
00678 extern const osPoolDef_t os_pool_def_##name
00679 #else                            // define the object
00680 #define osPoolDef(name, no, type)   \
00681 const osPoolDef_t os_pool_def_##name = \
00682 { (no), sizeof(type), NULL }
00683 #endif
00684 
00685 /// \brief Access a Memory Pool definition.
00686 /// \param         name          name of the memory pool
00687 /// \note CAN BE CHANGED: The parameter to \b osPool shall be consistent but the
00688 ///       macro body is implementation specific in every CMSIS-RTOS.
00689 #define osPool(name) \
00690 &os_pool_def_##name
00691 
00692 /// Create and Initialize a memory pool.
00693 /// \param[in]     pool_def      memory pool definition referenced with \ref osPool.
00694 /// \return memory pool ID for reference by other functions or NULL in case of error.
00695 /// \note MUST REMAIN UNCHANGED: \b osPoolCreate shall be consistent in every CMSIS-RTOS.
00696 osPoolId osPoolCreate (const osPoolDef_t *pool_def);
00697 
00698 /// Allocate a memory block from a memory pool.
00699 /// \param[in]     pool_id       memory pool ID obtain referenced with \ref osPoolCreate.
00700 /// \return address of the allocated memory block or NULL in case of no memory available.
00701 /// \note MUST REMAIN UNCHANGED: \b osPoolAlloc shall be consistent in every CMSIS-RTOS.
00702 void *osPoolAlloc (osPoolId pool_id);
00703 
00704 /// Allocate a memory block from a memory pool and set memory block to zero.
00705 /// \param[in]     pool_id       memory pool ID obtain referenced with \ref osPoolCreate.
00706 /// \return address of the allocated memory block or NULL in case of no memory available.
00707 /// \note MUST REMAIN UNCHANGED: \b osPoolCAlloc shall be consistent in every CMSIS-RTOS.
00708 void *osPoolCAlloc (osPoolId pool_id);
00709 
00710 /// Return an allocated memory block back to a specific memory pool.
00711 /// \param[in]     pool_id       memory pool ID obtain referenced with \ref osPoolCreate.
00712 /// \param[in]     block         address of the allocated memory block that is returned to the memory pool.
00713 /// \return status code that indicates the execution status of the function.
00714 /// \note MUST REMAIN UNCHANGED: \b osPoolFree shall be consistent in every CMSIS-RTOS.
00715 osStatus osPoolFree (osPoolId pool_id, void *block);
00716 
00717 #endif   // Memory Pool Management available
00718 
00719 
00720 //  ==== Message Queue Management Functions ====
00721 
00722 #if (defined (osFeature_MessageQ)  &&  (osFeature_MessageQ != 0))     // Message Queues available
00723 
00724 /// \brief Create a Message Queue Definition.
00725 /// \param         name          name of the queue.
00726 /// \param         queue_sz      maximum number of messages in the queue.
00727 /// \param         type          data type of a single message element (for debugger).
00728 /// \note CAN BE CHANGED: The parameter to \b osMessageQDef shall be consistent but the
00729 ///       macro body is implementation specific in every CMSIS-RTOS.
00730 #if defined (osObjectsExternal)  // object is external
00731 #define osMessageQDef(name, queue_sz, type)   \
00732 extern const osMessageQDef_t os_messageQ_def_##name
00733 #else                            // define the object
00734 #define osMessageQDef(name, queue_sz, type)   \
00735 const osMessageQDef_t os_messageQ_def_##name = \
00736 { (queue_sz), sizeof (type)  }
00737 #endif
00738 
00739 /// \brief Access a Message Queue Definition.
00740 /// \param         name          name of the queue
00741 /// \note CAN BE CHANGED: The parameter to \b osMessageQ shall be consistent but the
00742 ///       macro body is implementation specific in every CMSIS-RTOS.
00743 #define osMessageQ(name) \
00744 &os_messageQ_def_##name
00745 
00746 /// Create and Initialize a Message Queue.
00747 /// \param[in]     queue_def     queue definition referenced with \ref osMessageQ.
00748 /// \param[in]     thread_id     thread ID (obtained by \ref osThreadCreate or \ref osThreadGetId) or NULL.
00749 /// \return message queue ID for reference by other functions or NULL in case of error.
00750 /// \note MUST REMAIN UNCHANGED: \b osMessageCreate shall be consistent in every CMSIS-RTOS.
00751 osMessageQId osMessageCreate (const osMessageQDef_t *queue_def, osThreadId thread_id);
00752 
00753 /// Put a Message to a Queue.
00754 /// \param[in]     queue_id      message queue ID obtained with \ref osMessageCreate.
00755 /// \param[in]     info          message information.
00756 /// \param[in]     millisec      timeout value or 0 in case of no time-out.
00757 /// \return status code that indicates the execution status of the function.
00758 /// \note MUST REMAIN UNCHANGED: \b osMessagePut shall be consistent in every CMSIS-RTOS.
00759 osStatus osMessagePut (osMessageQId queue_id, uint32_t info, uint32_t millisec);
00760 
00761 /// Get a Message or Wait for a Message from a Queue.
00762 /// \param[in]     queue_id      message queue ID obtained with \ref osMessageCreate.
00763 /// \param[in]     millisec      timeout value or 0 in case of no time-out.
00764 /// \return event information that includes status code.
00765 /// \note MUST REMAIN UNCHANGED: \b osMessageGet shall be consistent in every CMSIS-RTOS.
00766 osEvent osMessageGet (osMessageQId queue_id, uint32_t millisec);
00767 
00768 #endif     // Message Queues available
00769 
00770 
00771 //  ==== Mail Queue Management Functions ====
00772 
00773 #if (defined (osFeature_MailQ)  &&  (osFeature_MailQ != 0))     // Mail Queues available
00774 
00775 /// \brief Create a Mail Queue Definition.
00776 /// \param         name          name of the queue
00777 /// \param         queue_sz      maximum number of messages in queue
00778 /// \param         type          data type of a single message element
00779 /// \note CAN BE CHANGED: The parameter to \b osMailQDef shall be consistent but the
00780 ///       macro body is implementation specific in every CMSIS-RTOS.
00781 #if defined (osObjectsExternal)  // object is external
00782 #define osMailQDef(name, queue_sz, type) \
00783 extern struct os_mailQ_cb *os_mailQ_cb_##name \
00784 extern osMailQDef_t os_mailQ_def_##name
00785 #else                            // define the object
00786 #define osMailQDef(name, queue_sz, type) \
00787 struct os_mailQ_cb *os_mailQ_cb_##name; \
00788 const osMailQDef_t os_mailQ_def_##name =  \
00789 { (queue_sz), sizeof (type), (&os_mailQ_cb_##name) }
00790 #endif
00791 
00792 /// \brief Access a Mail Queue Definition.
00793 /// \param         name          name of the queue
00794 /// \note CAN BE CHANGED: The parameter to \b osMailQ shall be consistent but the
00795 ///       macro body is implementation specific in every CMSIS-RTOS.
00796 #define osMailQ(name)  \
00797 &os_mailQ_def_##name
00798 
00799 /// Create and Initialize mail queue.
00800 /// \param[in]     queue_def     reference to the mail queue definition obtain with \ref osMailQ
00801 /// \param[in]     thread_id     thread ID (obtained by \ref osThreadCreate or \ref osThreadGetId) or NULL.
00802 /// \return mail queue ID for reference by other functions or NULL in case of error.
00803 /// \note MUST REMAIN UNCHANGED: \b osMailCreate shall be consistent in every CMSIS-RTOS.
00804 osMailQId osMailCreate (const osMailQDef_t *queue_def, osThreadId thread_id);
00805 
00806 /// Allocate a memory block from a mail.
00807 /// \param[in]     queue_id      mail queue ID obtained with \ref osMailCreate.
00808 /// \param[in]     millisec      timeout value or 0 in case of no time-out
00809 /// \return pointer to memory block that can be filled with mail or NULL in case of error.
00810 /// \note MUST REMAIN UNCHANGED: \b osMailAlloc shall be consistent in every CMSIS-RTOS.
00811 void *osMailAlloc (osMailQId queue_id, uint32_t millisec);
00812 
00813 /// Allocate a memory block from a mail and set memory block to zero.
00814 /// \param[in]     queue_id      mail queue ID obtained with \ref osMailCreate.
00815 /// \param[in]     millisec      timeout value or 0 in case of no time-out
00816 /// \return pointer to memory block that can be filled with mail or NULL in case of error.
00817 /// \note MUST REMAIN UNCHANGED: \b osMailCAlloc shall be consistent in every CMSIS-RTOS.
00818 void *osMailCAlloc (osMailQId queue_id, uint32_t millisec);
00819 
00820 /// Put a mail to a queue.
00821 /// \param[in]     queue_id      mail queue ID obtained with \ref osMailCreate.
00822 /// \param[in]     mail          memory block previously allocated with \ref osMailAlloc or \ref osMailCAlloc.
00823 /// \return status code that indicates the execution status of the function.
00824 /// \note MUST REMAIN UNCHANGED: \b osMailPut shall be consistent in every CMSIS-RTOS.
00825 osStatus osMailPut (osMailQId queue_id, void *mail);
00826 
00827 /// Get a mail from a queue.
00828 /// \param[in]     queue_id      mail queue ID obtained with \ref osMailCreate.
00829 /// \param[in]     millisec      timeout value or 0 in case of no time-out
00830 /// \return event that contains mail information or error code.
00831 /// \note MUST REMAIN UNCHANGED: \b osMailGet shall be consistent in every CMSIS-RTOS.
00832 osEvent osMailGet (osMailQId queue_id, uint32_t millisec);
00833 
00834 /// Free a memory block from a mail.
00835 /// \param[in]     queue_id      mail queue ID obtained with \ref osMailCreate.
00836 /// \param[in]     mail          pointer to the memory block that was obtained with \ref osMailGet.
00837 /// \return status code that indicates the execution status of the function.
00838 /// \note MUST REMAIN UNCHANGED: \b osMailFree shall be consistent in every CMSIS-RTOS.
00839 osStatus osMailFree (osMailQId queue_id, void *mail);
00840 
00841 #endif  // Mail Queues available
00842 
00843 /*************************** Additional specific APIs to Free RTOS ************/
00844 /**
00845 * @brief  Handles the tick increment
00846 * @param  none.
00847 * @retval none.
00848 */
00849 void osSystickHandler(void);
00850 
00851 #if ( INCLUDE_eTaskGetState == 1 )
00852 /**
00853 * @brief  Obtain the state of any thread.
00854 * @param   thread_id   thread ID obtained by \ref osThreadCreate or \ref osThreadGetId.
00855 * @retval  the stae of the thread, states are encoded by the osThreadState enumerated type.
00856 */
00857 osThreadState osThreadGetState(osThreadId thread_id);
00858 #endif /* INCLUDE_eTaskGetState */
00859 
00860 #if ( INCLUDE_eTaskGetState == 1 )
00861 /**
00862 * @brief Check if a thread is already suspended or not.
00863 * @param thread_id thread ID obtained by \ref osThreadCreate or \ref osThreadGetId.
00864 * @retval status code that indicates the execution status of the function.
00865 */
00866 
00867 osStatus osThreadIsSuspended(osThreadId thread_id);
00868 
00869 #endif /* INCLUDE_eTaskGetState */
00870 
00871 /**
00872 * @brief  Suspend execution of a thread.
00873 * @param   thread_id   thread ID obtained by \ref osThreadCreate or \ref osThreadGetId.
00874 * @retval  status code that indicates the execution status of the function.
00875 */
00876 osStatus osThreadSuspend (osThreadId thread_id);
00877 
00878 /**
00879 * @brief  Resume execution of a suspended thread.
00880 * @param   thread_id   thread ID obtained by \ref osThreadCreate or \ref osThreadGetId.
00881 * @retval  status code that indicates the execution status of the function.
00882 */
00883 osStatus osThreadResume (osThreadId thread_id);
00884 
00885 /**
00886 * @brief  Suspend execution of a all active threads.
00887 * @retval  status code that indicates the execution status of the function.
00888 */
00889 osStatus osThreadSuspendAll (void);
00890 
00891 /**
00892 * @brief  Resume execution of a all suspended threads.
00893 * @retval  status code that indicates the execution status of the function.
00894 */
00895 osStatus osThreadResumeAll (void);
00896 
00897 /**
00898 * @brief  Delay a task until a specified time
00899 * @param   PreviousWakeTime   Pointer to a variable that holds the time at which the 
00900 *          task was last unblocked. PreviousWakeTime must be initialised with the current time
00901 *          prior to its first use (PreviousWakeTime = osKernelSysTick() )
00902 * @param   millisec    time delay value
00903 * @retval  status code that indicates the execution status of the function.
00904 */
00905 osStatus osDelayUntil (uint32_t *PreviousWakeTime, uint32_t millisec);
00906 
00907 /**
00908 * @brief   Lists all the current threads, along with their current state 
00909 *          and stack usage high water mark.
00910 * @param   buffer   A buffer into which the above mentioned details
00911 *          will be written
00912 * @retval  status code that indicates the execution status of the function.
00913 */
00914 osStatus osThreadList (uint8_t *buffer);
00915 
00916 /**
00917 * @brief  Receive an item from a queue without removing the item from the queue.
00918 * @param  queue_id  message queue ID obtained with \ref osMessageCreate.
00919 * @param  millisec  timeout value or 0 in case of no time-out.
00920 * @retval event information that includes status code.
00921 */
00922 osEvent osMessagePeek (osMessageQId queue_id, uint32_t millisec);
00923 
00924 /**
00925 * @brief  Create and Initialize a Recursive Mutex
00926 * @param  mutex_def     mutex definition referenced with \ref osMutex.
00927 * @retval  mutex ID for reference by other functions or NULL in case of error..
00928 */
00929 osMutexId osRecursiveMutexCreate (const osMutexDef_t *mutex_def);
00930 
00931 /**
00932 * @brief  Release a Recursive Mutex
00933 * @param   mutex_id      mutex ID obtained by \ref osRecursiveMutexCreate.
00934 * @retval  status code that indicates the execution status of the function.
00935 */
00936 osStatus osRecursiveMutexRelease (osMutexId mutex_id);
00937 
00938 /**
00939 * @brief  Release a Recursive Mutex
00940 * @param   mutex_id    mutex ID obtained by \ref osRecursiveMutexCreate.
00941 * @param millisec      timeout value or 0 in case of no time-out.
00942 * @retval  status code that indicates the execution status of the function.
00943 */
00944 osStatus osRecursiveMutexWait (osMutexId mutex_id, uint32_t millisec);
00945 
00946 #ifdef  __cplusplus
00947 }
00948 #endif
00949 
00950 #endif  // _CMSIS_OS_H
00951