1 | /** |
---|
2 | * @file rtems/rtems/status.h |
---|
3 | * |
---|
4 | * @defgroup ClassicStatus Status Codes |
---|
5 | * |
---|
6 | * @ingroup ClassicRTEMS |
---|
7 | * @brief Status Codes Returned from Executive Directives |
---|
8 | * |
---|
9 | * This include file contains the status codes returned from the |
---|
10 | * executive directives. |
---|
11 | */ |
---|
12 | |
---|
13 | /* COPYRIGHT (c) 1989-2013. |
---|
14 | * On-Line Applications Research Corporation (OAR). |
---|
15 | * |
---|
16 | * The license and distribution terms for this file may be |
---|
17 | * found in the file LICENSE in this distribution or at |
---|
18 | * http://www.rtems.com/license/LICENSE. |
---|
19 | */ |
---|
20 | |
---|
21 | #ifndef _RTEMS_RTEMS_STATUS_H |
---|
22 | #define _RTEMS_RTEMS_STATUS_H |
---|
23 | |
---|
24 | #include <rtems/score/basedefs.h> |
---|
25 | |
---|
26 | #ifdef __cplusplus |
---|
27 | extern "C" { |
---|
28 | #endif |
---|
29 | |
---|
30 | /** |
---|
31 | * @defgroup ClassicStatus Status Codes |
---|
32 | * |
---|
33 | * @ingroup ClassicRTEMS |
---|
34 | * |
---|
35 | * This encapsulates functionality related to the status codes returned |
---|
36 | * by Classic API directives. |
---|
37 | */ |
---|
38 | /**@{*/ |
---|
39 | |
---|
40 | /** |
---|
41 | * @brief Classic API Status |
---|
42 | * |
---|
43 | * This enumerates the possible status values returned b |
---|
44 | * Classic API directives. |
---|
45 | */ |
---|
46 | typedef enum { |
---|
47 | /** |
---|
48 | * This is the status to indicate successful completion. |
---|
49 | */ |
---|
50 | RTEMS_SUCCESSFUL = 0, |
---|
51 | /** |
---|
52 | * This is the status to indicate that a thread exited. |
---|
53 | */ |
---|
54 | RTEMS_TASK_EXITTED = 1, |
---|
55 | /** |
---|
56 | * This is the status to indicate multiprocessing is not configured. |
---|
57 | */ |
---|
58 | RTEMS_MP_NOT_CONFIGURED = 2, |
---|
59 | /** |
---|
60 | * This is the status to indicate that the object name was invalid. |
---|
61 | */ |
---|
62 | RTEMS_INVALID_NAME = 3, |
---|
63 | /** |
---|
64 | * This is the status to indicate that the object Id was invalid. |
---|
65 | */ |
---|
66 | RTEMS_INVALID_ID = 4, |
---|
67 | /** |
---|
68 | * This is the status to indicate you have attempted to create too many |
---|
69 | * instances of a particular object class. |
---|
70 | */ |
---|
71 | RTEMS_TOO_MANY = 5, |
---|
72 | /** |
---|
73 | * This is the status to indicate that a blocking directive timed out. |
---|
74 | */ |
---|
75 | RTEMS_TIMEOUT = 6, |
---|
76 | /** |
---|
77 | * This is the status to indicate the the object was deleted |
---|
78 | * while the task was blocked waiting. |
---|
79 | */ |
---|
80 | RTEMS_OBJECT_WAS_DELETED = 7, |
---|
81 | /** |
---|
82 | * This is the status to indicate that the specified size was invalid. |
---|
83 | */ |
---|
84 | RTEMS_INVALID_SIZE = 8, |
---|
85 | /** |
---|
86 | * This is the status to indicate that the specified address is invalid. |
---|
87 | */ |
---|
88 | RTEMS_INVALID_ADDRESS = 9, |
---|
89 | /** |
---|
90 | * This is the status to indicate that the specified number was invalid. |
---|
91 | */ |
---|
92 | RTEMS_INVALID_NUMBER = 10, |
---|
93 | /** |
---|
94 | * This is the status to indicate that the item has not been initialized. |
---|
95 | */ |
---|
96 | RTEMS_NOT_DEFINED = 11, |
---|
97 | /** |
---|
98 | * This is the status to indicate that the object still has |
---|
99 | * resources in use. |
---|
100 | */ |
---|
101 | RTEMS_RESOURCE_IN_USE = 12, |
---|
102 | /** |
---|
103 | * This is the status to indicate that the request was not satisfied. |
---|
104 | */ |
---|
105 | RTEMS_UNSATISFIED = 13, |
---|
106 | /** |
---|
107 | * This is the status to indicate that a thread is in wrong state |
---|
108 | * was in the wrong execution state for the requested operation. |
---|
109 | */ |
---|
110 | RTEMS_INCORRECT_STATE = 14, |
---|
111 | /** |
---|
112 | * This is the status to indicate thread was already suspended. |
---|
113 | */ |
---|
114 | RTEMS_ALREADY_SUSPENDED = 15, |
---|
115 | /** |
---|
116 | * This is the status to indicate that the operation is illegal |
---|
117 | * on calling thread. |
---|
118 | */ |
---|
119 | RTEMS_ILLEGAL_ON_SELF = 16, |
---|
120 | /** |
---|
121 | * This is the status to indicate illegal for remote object. |
---|
122 | */ |
---|
123 | RTEMS_ILLEGAL_ON_REMOTE_OBJECT = 17, |
---|
124 | /** |
---|
125 | * This is the status to indicate that the operation should not be |
---|
126 | * called from from this excecution environment. |
---|
127 | */ |
---|
128 | RTEMS_CALLED_FROM_ISR = 18, |
---|
129 | /** |
---|
130 | * This is the status to indicate that an invalid thread priority |
---|
131 | * was provided. |
---|
132 | */ |
---|
133 | RTEMS_INVALID_PRIORITY = 19, |
---|
134 | /** |
---|
135 | * This is the status to indicate that the specified date/time was invalid. |
---|
136 | */ |
---|
137 | RTEMS_INVALID_CLOCK = 20, |
---|
138 | /** |
---|
139 | * This is the status to indicate that the specified node Id was invalid. |
---|
140 | */ |
---|
141 | RTEMS_INVALID_NODE = 21, |
---|
142 | /** |
---|
143 | * This is the status to indicate that the directive was not configured. |
---|
144 | */ |
---|
145 | RTEMS_NOT_CONFIGURED = 22, |
---|
146 | /** |
---|
147 | * This is the status to indicate that the caller is not the |
---|
148 | * owner of the resource. |
---|
149 | */ |
---|
150 | RTEMS_NOT_OWNER_OF_RESOURCE = 23, |
---|
151 | /** |
---|
152 | * This is the status to indicate the the directive or requested |
---|
153 | * portion of the directive is not implemented. This is a hint |
---|
154 | * that you have stumbled across an opportunity to submit code |
---|
155 | * to the RTEMS Project. |
---|
156 | */ |
---|
157 | RTEMS_NOT_IMPLEMENTED = 24, |
---|
158 | /** |
---|
159 | * This is the status to indicate that an internal RTEMS inconsistency |
---|
160 | * was detected. |
---|
161 | */ |
---|
162 | RTEMS_INTERNAL_ERROR = 25, |
---|
163 | /** |
---|
164 | * This is the status to indicate that the directive attempted to allocate |
---|
165 | * memory but was unable to do so. |
---|
166 | */ |
---|
167 | RTEMS_NO_MEMORY = 26, |
---|
168 | /** |
---|
169 | * This is the status to indicate an driver IO error. |
---|
170 | */ |
---|
171 | RTEMS_IO_ERROR = 27, |
---|
172 | /** |
---|
173 | * This is the status is used internally to RTEMS when performing |
---|
174 | * operations on behalf of remote tasks. This is referred to as |
---|
175 | * proxying operations and this status indicates that the operation |
---|
176 | * could not be completed immediately and the "proxy is blocking." |
---|
177 | * |
---|
178 | * @note This status will @b NOT be returned to the user. |
---|
179 | */ |
---|
180 | RTEMS_PROXY_BLOCKING = 28 |
---|
181 | } rtems_status_code; |
---|
182 | |
---|
183 | /** |
---|
184 | * This is the lowest valid value for a Classic API status code. |
---|
185 | */ |
---|
186 | #define RTEMS_STATUS_CODES_FIRST RTEMS_SUCCESSFUL |
---|
187 | |
---|
188 | /** |
---|
189 | * This is the highest valid value for a Classic API status code. |
---|
190 | */ |
---|
191 | #define RTEMS_STATUS_CODES_LAST RTEMS_PROXY_BLOCKING |
---|
192 | |
---|
193 | /** |
---|
194 | * @brief Checks if the status code is equal to RTEMS_SUCCESSFUL. |
---|
195 | * |
---|
196 | * This function returns TRUE if the status code is equal to RTEMS_SUCCESSFUL, |
---|
197 | * and FALSE otherwise. |
---|
198 | */ |
---|
199 | RTEMS_INLINE_ROUTINE bool rtems_is_status_successful( |
---|
200 | rtems_status_code code |
---|
201 | ) |
---|
202 | { |
---|
203 | return (code == RTEMS_SUCCESSFUL); |
---|
204 | } |
---|
205 | |
---|
206 | /** |
---|
207 | * @brief Checks if the status code1 is equal to code2. |
---|
208 | * |
---|
209 | * This function returns TRUE if the status code1 is equal to code2, |
---|
210 | * and FALSE otherwise. |
---|
211 | */ |
---|
212 | RTEMS_INLINE_ROUTINE bool rtems_are_statuses_equal( |
---|
213 | rtems_status_code code1, |
---|
214 | rtems_status_code code2 |
---|
215 | ) |
---|
216 | { |
---|
217 | return (code1 == code2); |
---|
218 | } |
---|
219 | |
---|
220 | /** |
---|
221 | * @brief RTEMS Status Code to Errno Mapping Function |
---|
222 | * |
---|
223 | * This function recieves an RTEMS status code and returns an |
---|
224 | * errno error code. The retval values show the mappings between |
---|
225 | * rtems_status_codes and errno error codes. |
---|
226 | * |
---|
227 | * @retval 0 RTEMS_SUCCESSFUL |
---|
228 | * @retval EIO RTEMS_TASK_EXITED, RTEMS_MP_NOT_CONFIGURED, RTEMS_INVALID_ID, |
---|
229 | * RTEMS_TOO_MANY, RTEMS_OBJECT_WAS_DELETED, RTEMS_INVALID_SIZE, |
---|
230 | * RTEMS_INVALID_ADDRESS, RTEMS_NOT_DEFINED, RTEMS_INCORRECT_STATE, |
---|
231 | * RTEMS_ILLEGAL_ON_SELF, RTEMS_ILLEGAL_ON_REMOTE_OBJECT, |
---|
232 | * RTEMS_CALLED_FROM_ISR, RTEMS_INVALID_PRIORITY, RTEMS_INTERNAL_ERROR, |
---|
233 | * RTEMS_IO_ERROR, RTEMS_PROXY_BLOCKING |
---|
234 | * @retval EINVAL RTEMS_INVALID_NAME, RTEMS_INVALID_CLOCK, RTEMS_INVALID_NODE |
---|
235 | * @retval ETIMEDOUT RTEMS_TIMEOUT |
---|
236 | * @retval EBADF RTEMS_INVALID_NUMBER |
---|
237 | * @retval EBUSY RTEMS_RESOURCE_IN_USE |
---|
238 | * @retval ENODEV RTEMS_UNSATISFIED |
---|
239 | * @retval ENOSYS RTEMS_NOT_IMPLEMENTED, RTEMS_NOT_CONFIGURED |
---|
240 | * @retval ENOMEM RTEMS_NO_MEMORY |
---|
241 | */ |
---|
242 | int rtems_status_code_to_errno(rtems_status_code sc); |
---|
243 | |
---|
244 | /** |
---|
245 | * @brief Returns a description for a status code. |
---|
246 | * |
---|
247 | * @param[in] code The status code. |
---|
248 | * |
---|
249 | * @retval description The status code description. |
---|
250 | * @retval ? The passed status code is invalid. |
---|
251 | */ |
---|
252 | const char *rtems_status_code_description( rtems_status_code code ); |
---|
253 | |
---|
254 | /**@}*/ |
---|
255 | |
---|
256 | #ifdef __cplusplus |
---|
257 | } |
---|
258 | #endif |
---|
259 | |
---|
260 | #endif |
---|
261 | /* end of include file */ |
---|