summaryrefslogtreecommitdiffstats
path: root/cpukit/include/rtems/rtems/status.h
blob: 872bb9b2b3321b0b1ff5c2940198ec592e7423d1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
/* SPDX-License-Identifier: BSD-2-Clause */

/**
 * @file
 *
 * @brief This header file provides the status codes of Classic API directives
 *   and support functions.
 */

/*
 * Copyright (C) 2014, 2020 embedded brains GmbH (http://www.embedded-brains.de)
 * Copyright (C) 1989, 2008 On-Line Applications Research Corporation (OAR)
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */

/*
 * This file is part of the RTEMS quality process and was automatically
 * generated.  If you find something that needs to be fixed or
 * worded better please post a report or patch to an RTEMS mailing list
 * or raise a bug report:
 *
 * https://www.rtems.org/bugs.html
 *
 * For information on updating and regenerating please refer to the How-To
 * section in the Software Requirements Engineering chapter of the
 * RTEMS Software Engineering manual.  The manual is provided as a part of
 * a release.  For development sources please refer to the online
 * documentation at:
 *
 * https://docs.rtems.org
 */

/* Generated from spec:/rtems/status/if/header */

#ifndef _RTEMS_RTEMS_STATUS_H
#define _RTEMS_RTEMS_STATUS_H

#include <stdbool.h>

#ifdef __cplusplus
extern "C" {
#endif

/* Generated from spec:/rtems/status/if/group */

/**
 * @defgroup RTEMSAPIClassicStatus Directive Status Codes
 *
 * @ingroup RTEMSAPIClassic
 *
 * @brief This group contains the Classic API directive status codes and
 *   support functions.
 */

/* Generated from spec:/rtems/status/if/code */

/**
 * @ingroup RTEMSAPIClassicStatus
 *
 * @brief This enumeration provides status codes for directives of the Classic
 *   API.
 */
typedef enum {
  /**
   * @brief This status code indicates successful completion of a requested
   *   operation.
   */
  RTEMS_SUCCESSFUL = 0,

  /**
   * @brief This status code indicates that a thread exitted.
   */
  RTEMS_TASK_EXITTED = 1,

  /**
   * @brief This status code indicates that multiprocessing was not configured.
   */
  RTEMS_MP_NOT_CONFIGURED = 2,

  /**
   * @brief This status code indicates that an object name was invalid.
   */
  RTEMS_INVALID_NAME = 3,

  /**
   * @brief This status code indicates that an object identifier was invalid.
   */
  RTEMS_INVALID_ID = 4,

  /**
   * @brief This status code indicates you have attempted to create too many
   *   instances of a particular object class.
   */
  RTEMS_TOO_MANY = 5,

  /**
   * @brief This status code indicates that a blocking directive timed out.
   */
  RTEMS_TIMEOUT = 6,

  /**
   * @brief This status code indicates the object was deleted while the thread
   *   was blocked waiting.
   */
  RTEMS_OBJECT_WAS_DELETED = 7,

  /**
   * @brief This status code indicates that a specified size was invalid.
   */
  RTEMS_INVALID_SIZE = 8,

  /**
   * @brief This status code indicates that a specified address was invalid.
   */
  RTEMS_INVALID_ADDRESS = 9,

  /**
   * @brief This status code indicates that a specified number was invalid.
   */
  RTEMS_INVALID_NUMBER = 10,

  /**
   * @brief This status code indicates that the item has not been initialized.
   */
  RTEMS_NOT_DEFINED = 11,

  /**
   * @brief This status code indicates that the object still had resources in
   *   use.
   */
  RTEMS_RESOURCE_IN_USE = 12,

  /**
   * @brief This status code indicates that the request was not satisfied.
   */
  RTEMS_UNSATISFIED = 13,

  /**
   * @brief This status code indicates that an object was in wrong state for the
   *   requested operation.
   */
  RTEMS_INCORRECT_STATE = 14,

  /**
   * @brief This status code indicates that the thread was already suspended.
   */
  RTEMS_ALREADY_SUSPENDED = 15,

  /**
   * @brief This status code indicates that the operation was illegal on the
   *   calling thread.
   */
  RTEMS_ILLEGAL_ON_SELF = 16,

  /**
   * @brief This status code indicates that the operation was illegal on a remote
   *   object.
   */
  RTEMS_ILLEGAL_ON_REMOTE_OBJECT = 17,

  /**
   * @brief This status code indicates that the operation should not be called
   *   from this execution environment.
   */
  RTEMS_CALLED_FROM_ISR = 18,

  /**
   * @brief This status code indicates that an invalid thread priority was
   *   provided.
   */
  RTEMS_INVALID_PRIORITY = 19,

  /**
   * @brief This status code indicates that a specified date or time was invalid.
   */
  RTEMS_INVALID_CLOCK = 20,

  /**
   * @brief This status code indicates that a specified node identifier was
   *   invalid.
   */
  RTEMS_INVALID_NODE = 21,

  /**
   * @brief This status code indicates that the directive was not configured.
   */
  RTEMS_NOT_CONFIGURED = 22,

  /**
   * @brief This status code indicates that the caller was not the owner of the
   *   resource.
   */
  RTEMS_NOT_OWNER_OF_RESOURCE = 23,

  /**
   * @brief This status code indicates the directive or requested portion of the
   *   directive is not implemented.
   *
   * This is a hint that you have stumbled across an opportunity to submit code
   * to the RTEMS Project.
   */
  RTEMS_NOT_IMPLEMENTED = 24,

  /**
   * @brief This status code indicates that an internal RTEMS inconsistency was
   *   detected.
   */
  RTEMS_INTERNAL_ERROR = 25,

  /**
   * @brief This status code indicates that the directive attempted to allocate
   *   memory but was unable to do so.
   */
  RTEMS_NO_MEMORY = 26,

  /**
   * @brief This status code indicates a device driver IO error.
   */
  RTEMS_IO_ERROR = 27,

  /**
   * @brief This status code is used internally by the implementation to indicate
   *   a blocking device driver call has been interrupted and should be reflected
   *   to the caller as interrupted.
   */
  RTEMS_INTERRUPTED = 28,

  /**
   * @brief This status code is used internally by the implementation when
   *   performing operations on behalf of remote tasks.
   *
   * This is referred to as proxying operations and this status indicates that
   * the operation could not be completed immediately and the proxy is blocking.
   *
   * @par Notes
   * This status will not be returned to the user.
   */
  RTEMS_PROXY_BLOCKING = 29
} rtems_status_code;

/* Generated from spec:/rtems/status/if/code-to-errno */

/**
 * @ingroup RTEMSAPIClassicStatus
 *
 * @brief Maps the RTEMS status code to a POSIX error number.
 *
 * @param status_code is the status code to map.
 *
 * @retval 0 The status code was ::RTEMS_SUCCESSFUL.
 *
 * @retval EBADF The status code was ::RTEMS_INVALID_NUMBER.
 *
 * @retval EBUSY The status code was ::RTEMS_RESOURCE_IN_USE.
 *
 * @retval EINTR The status code was ::RTEMS_INTERRUPTED.
 *
 * @retval EINVAL The status code was ::RTEMS_INVALID_CLOCK,
 *   ::RTEMS_INVALID_NAME, or ::RTEMS_INVALID_NODE.
 *
 * @retval EIO The status code was ::RTEMS_ALREADY_SUSPENDED,
 *   ::RTEMS_CALLED_FROM_ISR, ::RTEMS_ILLEGAL_ON_REMOTE_OBJECT,
 *   ::RTEMS_ILLEGAL_ON_SELF, ::RTEMS_INCORRECT_STATE, ::RTEMS_INTERNAL_ERROR,
 *   ::RTEMS_INVALID_ADDRESS, ::RTEMS_INVALID_ID, ::RTEMS_INVALID_PRIORITY,
 *   ::RTEMS_INVALID_SIZE, ::RTEMS_IO_ERROR, ::RTEMS_MP_NOT_CONFIGURED,
 *   ::RTEMS_NOT_DEFINED, ::RTEMS_OBJECT_WAS_DELETED, ::RTEMS_PROXY_BLOCKING,
 *   ::RTEMS_TASK_EXITTED, or ::RTEMS_TOO_MANY.
 *
 * @retval ENODEV The status code was ::RTEMS_UNSATISFIED.
 *
 * @retval ENOMEM The status code was ::RTEMS_NO_MEMORY.
 *
 * @retval ENOSYS The status code was ::RTEMS_NOT_CONFIGURED or
 *   ::RTEMS_NOT_IMPLEMENTED.
 *
 * @retval EPERM The status code was ::RTEMS_NOT_OWNER_OF_RESOURCE.
 *
 * @retval ETIMEDOUT The status code was ::RTEMS_TIMEOUT.
 */
int rtems_status_code_to_errno( rtems_status_code status_code );

/* Generated from spec:/rtems/status/if/first */

/**
 * @ingroup RTEMSAPIClassicStatus
 *
 * @brief This constant represents the lowest valid value for a Classic API
 *   directive status code.
 */
#define RTEMS_STATUS_CODES_FIRST RTEMS_SUCCESSFUL

/* Generated from spec:/rtems/status/if/is-equal */

/**
 * @ingroup RTEMSAPIClassicStatus
 *
 * @brief Checks if the status codes are equal.
 *
 * @param left_status_code is the left hand side status code.
 *
 * @param right_status_code is the right hand side status code.
 *
 * @return Returns true, if the left hand side status code is equal to the
 *   right hand side status code, otherwise false.
 */
static inline bool rtems_are_statuses_equal(
  rtems_status_code left_status_code,
  rtems_status_code right_status_code
)
{
  return left_status_code == right_status_code;
}

/* Generated from spec:/rtems/status/if/is-successful */

/**
 * @ingroup RTEMSAPIClassicStatus
 *
 * @brief Checks if the status code is ::RTEMS_SUCCESSFUL.
 *
 * @param status_code is the status code.
 *
 * @return Returns true, if the status code is equal to ::RTEMS_SUCCESSFUL,
 *   otherwise false.
 */
static inline bool rtems_is_status_successful( rtems_status_code status_code )
{
  return status_code == RTEMS_SUCCESSFUL;
}

/* Generated from spec:/rtems/status/if/last */

/**
 * @ingroup RTEMSAPIClassicStatus
 *
 * @brief This constant represents the highest valid value for a Classic API
 *   directive status code.
 */
#define RTEMS_STATUS_CODES_LAST RTEMS_PROXY_BLOCKING

/* Generated from spec:/rtems/status/if/text */

/**
 * @ingroup RTEMSAPIClassicStatus
 *
 * @brief Maps the status code to a descriptive text.
 *
 * @param status_code is the status code.
 *
 * The text for each status code is the enumerator constant.
 *
 * @retval "?" The status code is invalid.
 *
 * @return Returns a text describing the status code, if the status code is
 *   valid.
 */
const char *rtems_status_text( rtems_status_code status_code );

#ifdef __cplusplus
}
#endif

#endif /* _RTEMS_RTEMS_STATUS_H */