Mistake on this page?
Report an issue in GitHub or email us
mbed_rtos_types.h
1 /* mbed Microcontroller Library
2  * Copyright (c) 2006-2019, ARM Limited, All Rights Reserved
3  * SPDX-License-Identifier: Apache-2.0
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 #ifndef RTOS_TYPES_H_
18 #define RTOS_TYPES_H_
19 
20 #if MBED_CONF_RTOS_PRESENT || defined(DOXYGEN_ONLY) || defined(UNITTEST)
21 #include "cmsis_os2.h"
22 #else
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
28 /** \addtogroup rtos-public-api */
29 /** @{*/
30 
31 /* Minimal definitions for bare metal form of RTOS */
32 
33 // Timeout value.
34 #define osWaitForever 0xFFFFFFFFU ///< Wait forever timeout value.
35 
36 // Flags options (\ref osThreadFlagsWait and \ref osEventFlagsWait).
37 #define osFlagsWaitAny 0x00000000U ///< Wait for any flag (default).
38 #define osFlagsWaitAll 0x00000001U ///< Wait for all flags.
39 #define osFlagsNoClear 0x00000002U ///< Do not clear flags which have been specified to wait for.
40 
41 // Flags errors (returned by osThreadFlagsXxxx and osEventFlagsXxxx).
42 #define osFlagsError 0x80000000U ///< Error indicator.
43 #define osFlagsErrorUnknown 0xFFFFFFFFU ///< osError (-1).
44 #define osFlagsErrorTimeout 0xFFFFFFFEU ///< osErrorTimeout (-2).
45 #define osFlagsErrorResource 0xFFFFFFFDU ///< osErrorResource (-3).
46 #define osFlagsErrorParameter 0xFFFFFFFCU ///< osErrorParameter (-4).
47 #define osFlagsErrorISR 0xFFFFFFFAU ///< osErrorISR (-6).
48 
49 // Status code values returned by CMSIS-RTOS functions.
50 typedef enum {
51  osOK = 0, ///< Operation completed successfully.
52  osError = -1, ///< Unspecified RTOS error: run-time error but no other error message fits.
53  osErrorTimeout = -2, ///< Operation not completed within the timeout period.
54  osErrorResource = -3, ///< Resource not available.
55  osErrorParameter = -4, ///< Parameter error.
56  osErrorNoMemory = -5, ///< System is out of memory: it was impossible to allocate or reserve memory for the operation.
57  osErrorISR = -6, ///< Not allowed in ISR context: the function cannot be called from interrupt service routines.
58  osStatusReserved = 0x7FFFFFFF ///< Prevents enum down-size compiler optimization.
59 } osStatus_t;
60 
61 
62 // \details Thread ID identifies the thread.
63 typedef void *osThreadId_t;
64 
65 // Set the specified Thread Flags of a thread.
66 // \param[in] thread_id thread ID obtained by \ref osThreadNew or \ref osThreadGetId.
67 // \param[in] flags specifies the flags of the thread that shall be set.
68 // \return thread flags after setting or error code if highest bit set.
69 uint32_t osThreadFlagsSet(osThreadId_t thread_id, uint32_t flags);
70 
71 /** @}*/
72 
73 #ifdef __cplusplus
74 }
75 #endif
76 
77 #endif
78 
79 
80 #endif /* RTOS_TYPES_H_ */
Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.