]> begriffs open source - cmsis/blob - CMSIS/DoxyGen/RTOS2/src/cmsis_os2_ThreadFlags.txt
RTOS2: updated documentation (typo correction)
[cmsis] / CMSIS / DoxyGen / RTOS2 / src / cmsis_os2_ThreadFlags.txt
1 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
2 //  ==== Thread Flags Management ====
3 /** 
4 \addtogroup CMSIS_RTOS_ThreadFlagsMgmt Thread Flags
5 \ingroup CMSIS_RTOS
6 \brief Synchronize threads using flags.
7 \details
8 Thread Flags are a more specialized version of the Event Flags. See \ref CMSIS_RTOS_EventFlags.
9 While Event Flags can be used to globally signal a number of threads, thread flags are only send to a single specific thread.
10 Every thread instance can receive thread flags without any additional allocation of a thread flags object.
11
12 \note Thread flag management functions cannot be called from \ref CMSIS_RTOS_ISR_Calls "Interrupt Service Routines", except
13 for \ref osThreadFlagsSet.
14
15 @{
16 */
17
18 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
19 /** \fn uint32_t osThreadFlagsSet (osThreadId_t thread_id, uint32_t flags )
20 The function \b osThreadFlagsSet sets the thread flags for a thread specified by parameter \em thread_id. It returns the
21 flags set, or an error code if highest bit is set (refer to \ref osStatus_t). This function may
22 be used also within interrupt service routines. Threads waiting for a flag to be set will resume from \em BLOCKED state.
23 */
24
25 /*=======0=========1=========2=========3=========4=========5=========6=========7=======osThreadFlagsClear==8=========9=========0=========1====*/
26 /** \fn uint32_t osThreadFlagsClear (uint32_t flags)
27 \details
28 The function \b osThreadFlagsClear clears the specified flags for the currently running thread. It returns the
29 flags before clearing, or an error code if highest bit is set (refer to \ref osStatus_t).
30
31 \note Cannot be called from \ref CMSIS_RTOS_ISR_Calls "Interrupt Service Routines".
32 */
33 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
34 /** \fn uint32_t osThreadFlagsGet (void)
35 \details
36 The function \b osThreadFlagsGet returns the flags currently set for the currently running thread. 
37
38 \note Cannot be called from \ref CMSIS_RTOS_ISR_Calls "Interrupt Service Routines".
39 */
40
41 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
42 /** \fn uint32_t osThreadFlagsWait (uint32_t flags, uint32_t options, uint32_t timeout)
43 The function \b osThreadFlagsWait suspends the execution of the currently \b RUNNING thread until any or all of the thread
44 flags specified with the parameter \a flags are set. When these thread flags are already set, the function returns instantly.
45 Otherwise the thread is put into the state \b BLOCKED. The function then returns flags before clearing, or an error code
46 if highest bit is set (refer to \ref osStatus_t).
47
48 The parameter \em options specifies the wait condition:
49 |Option              |                                                       |
50 |--------------------|-------------------------------------------------------|
51 |\b osFlagsWaitAny   |   Wait for any flag (default).                        |
52 |\b osFlagsWaitAll   |   Wait for all flags.                                 |
53 |\b osFlagsNoClear   |   Do not clear flags which have been specified to wait for.  |
54
55 If \c osFlagsNoClear is set in the options \ref osThreadFlagsClear can be used to clear flags manually.
56
57 The parameter \ref CMSIS_RTOS_TimeOutValue "timeout" represents a number of timer ticks and is an upper bound. The
58 exact time delay depends on the actual time elapsed since the last timer tick. 
59
60 \note Cannot be called from \ref CMSIS_RTOS_ISR_Calls "Interrupt Service Routines".
61
62 <b>Code Example</b>
63 \code
64 #include "cmsis_os2.h"
65  
66 void Thread (void* arg) {
67   ;
68   osThreadFlagsWait (0x00000001U, osFlagsWaitAny, osWaitForever); //Wait forever until event 0x01 is set.
69   ;
70 }
71 \endcode
72 */
73 /// @}