1 | /** |
---|
2 | * @file rtems/error.h |
---|
3 | */ |
---|
4 | |
---|
5 | /* |
---|
6 | * Defines and externs for rtems error reporting |
---|
7 | * |
---|
8 | * $Id$ |
---|
9 | */ |
---|
10 | |
---|
11 | #ifndef _RTEMS_RTEMS_ERROR_H |
---|
12 | #define _RTEMS_RTEMS_ERROR_H |
---|
13 | |
---|
14 | #include <rtems/score/interr.h> |
---|
15 | |
---|
16 | #ifdef __cplusplus |
---|
17 | extern "C" { |
---|
18 | #endif |
---|
19 | |
---|
20 | typedef Internal_errors_t rtems_error_code_t; |
---|
21 | |
---|
22 | /* |
---|
23 | * rtems_error() and rtems_panic() support |
---|
24 | */ |
---|
25 | |
---|
26 | #if 0 |
---|
27 | /* not 16bit-int host clean */ |
---|
28 | #define RTEMS_ERROR_ERRNO (1<<((sizeof(rtems_error_code_t) * CHAR_BIT) - 2)) /* hi bit; use 'errno' */ |
---|
29 | #define RTEMS_ERROR_PANIC (RTEMS_ERROR_ERRNO / 2) /* err fatal; no return */ |
---|
30 | #define RTEMS_ERROR_ABORT (RTEMS_ERROR_ERRNO / 4) /* err is fatal; panic */ |
---|
31 | #else |
---|
32 | #define RTEMS_ERROR_ERRNO (0x40000000) /* hi bit; use 'errno' */ |
---|
33 | #define RTEMS_ERROR_PANIC (0x20000000) /* err fatal; no return */ |
---|
34 | #define RTEMS_ERROR_ABORT (0x10000000) /* err is fatal; panic */ |
---|
35 | #endif |
---|
36 | |
---|
37 | #define RTEMS_ERROR_MASK (RTEMS_ERROR_ERRNO | RTEMS_ERROR_ABORT | \ |
---|
38 | RTEMS_ERROR_PANIC) /* all */ |
---|
39 | |
---|
40 | const char *rtems_status_text(rtems_status_code); |
---|
41 | int rtems_error(rtems_error_code_t error_code, const char *printf_format, ...); |
---|
42 | #ifdef __GNUC__ |
---|
43 | void rtems_panic(const char *printf_format, ...); |
---|
44 | /* |
---|
45 | * We should be able to use this attribute but gcc complains that |
---|
46 | * rtems_panic does in fact return. :( |
---|
47 | * |
---|
48 | * __attribute__ ((__noreturn__)); |
---|
49 | */ |
---|
50 | #else |
---|
51 | void rtems_panic(const char *printf_format, ...); |
---|
52 | #endif |
---|
53 | |
---|
54 | extern int rtems_panic_in_progress; |
---|
55 | |
---|
56 | #ifdef __cplusplus |
---|
57 | } |
---|
58 | #endif |
---|
59 | |
---|
60 | |
---|
61 | #endif |
---|
62 | /* end of include file */ |
---|