]> begriffs open source - cmsis/blob - CMSIS/DoxyGen/RTOS2/src/cmsis_os2_Wait.txt
Updated documentation for release. Fixed issues raised in SDCMSIS-612.
[cmsis] / CMSIS / DoxyGen / RTOS2 / src / cmsis_os2_Wait.txt
1
2 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
3 //  ==== Generic Wait Functions ====
4 /** 
5 \addtogroup CMSIS_RTOS_Wait Generic Wait Functions
6 \ingroup CMSIS_RTOS
7 \brief Wait for a certain period of time.
8 \details 
9 The generic wait functions provide means for a time delay.
10
11 \note Generic wait functions cannot be called from \ref CMSIS_RTOS_ISR_Calls "Interrupt Service Routines".
12 @{
13 */
14
15 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
16 /** 
17 \fn osStatus_t osDelay (uint32_t ticks)
18 \details
19 The function \b osDelay waits for a time period specified in kernel \a ticks. For a value of \token{1}, the system waits
20 until the next timer tick occurs. That means that the actual time delay may be up to one timer tick less.
21
22 Possible \ref osStatus_t return values:
23  - \em osOK: the time delay is executed.
24  - \em osErrorISR: \ref osDelay cannot be called from \ref CMSIS_RTOS_ISR_Calls "Interrupt Service Routines".
25
26 \note This function \b cannot be called from \ref CMSIS_RTOS_ISR_Calls "Interrupt Service Routines".
27
28 <b>Code Example</b>
29 \code
30 #include "cmsis_os2.h"
31  
32 void Thread_1 (void *arg)  {                // Thread function
33   osStatus_t status;                        // capture the return status
34   uint32_t   delayTime;                     // delay time in milliseconds
35  
36   delayTime = 1000;                         // delay 1 second
37   status = osDelay (delayTime);             // suspend thread execution
38 }
39 \endcode
40 */ 
41
42 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
43 /** 
44 \fn osStatus_t osDelayUntil (uint64_t ticks)
45 \details
46 The function \b osDelayUntil waits until an absolute time (specified in kernel \a ticks) is reached. 
47
48 Possible \ref osStatus_t return values:
49  - \em osOK: the time delay is executed.
50  - \em osParameter: the time is either in the past or cannot be handled (out of bounds).
51  - \em osErrorISR: \ref osDelayUntil cannot be called from \ref CMSIS_RTOS_ISR_Calls "Interrupt Service Routines".
52
53 \note This function \b cannot be called from \ref CMSIS_RTOS_ISR_Calls "Interrupt Service Routines".
54
55 <b>Code Example</b>
56 \code
57 #include "cmsis_os2.h"
58  
59 void Thread_1 (void *arg)  {                // Thread function
60   uint64_t tick;
61
62   tick = osKernelGetTickCount();            // retrieve the number of system ticks
63   for (;;) {
64     tick += 1000;                           // delay 1000 ticks periodically
65     osDelayUntil(tick);
66     // ...
67   }
68 }
69 \endcode
70 */
71 /// @}