1 | /** |
---|
2 | * @file |
---|
3 | * |
---|
4 | * @ingroup Score |
---|
5 | * |
---|
6 | * @brief Basic definitions. |
---|
7 | */ |
---|
8 | |
---|
9 | /* |
---|
10 | * COPYRIGHT (c) 1989-2007. |
---|
11 | * On-Line Applications Research Corporation (OAR). |
---|
12 | * |
---|
13 | * Copyright (c) 2010 embedded brains GmbH. |
---|
14 | * |
---|
15 | * The license and distribution terms for this file may be |
---|
16 | * found in the file LICENSE in this distribution or at |
---|
17 | * http://www.rtems.com/license/LICENSE. |
---|
18 | * |
---|
19 | * $Id$ |
---|
20 | */ |
---|
21 | |
---|
22 | #ifndef _RTEMS_BASEDEFS_H |
---|
23 | #define _RTEMS_BASEDEFS_H |
---|
24 | |
---|
25 | #include <rtems/score/cpuopts.h> |
---|
26 | |
---|
27 | #ifndef ASM |
---|
28 | #include <stddef.h> |
---|
29 | #include <stdbool.h> |
---|
30 | #include <stdint.h> |
---|
31 | #endif |
---|
32 | |
---|
33 | #ifndef TRUE |
---|
34 | /** |
---|
35 | * This ensures that RTEMS has TRUE defined in all situations. |
---|
36 | */ |
---|
37 | #define TRUE 1 |
---|
38 | #endif |
---|
39 | |
---|
40 | #ifndef FALSE |
---|
41 | /** |
---|
42 | * This ensures that RTEMS has FALSE defined in all situations. |
---|
43 | */ |
---|
44 | #define FALSE 0 |
---|
45 | #endif |
---|
46 | |
---|
47 | #if TRUE == FALSE |
---|
48 | #error "TRUE equals FALSE" |
---|
49 | #endif |
---|
50 | |
---|
51 | /** |
---|
52 | * The following ensures that all data is declared in the space |
---|
53 | * of the initialization routine for either the Initialization Manager |
---|
54 | * or the initialization file for the appropriate API. It is |
---|
55 | * referenced as "external" in every other file. |
---|
56 | */ |
---|
57 | #ifdef SCORE_INIT |
---|
58 | #undef SCORE_EXTERN |
---|
59 | #define SCORE_EXTERN |
---|
60 | #else |
---|
61 | #undef SCORE_EXTERN |
---|
62 | #define SCORE_EXTERN extern |
---|
63 | #endif |
---|
64 | |
---|
65 | /** |
---|
66 | * The following ensures that all data is declared in the space |
---|
67 | * of the initialization routine for either the Initialization Manager |
---|
68 | * or the initialization file for the appropriate API. It is |
---|
69 | * referenced as "external" in every other file. |
---|
70 | */ |
---|
71 | #ifdef SAPI_INIT |
---|
72 | #undef SAPI_EXTERN |
---|
73 | #define SAPI_EXTERN |
---|
74 | #else |
---|
75 | #undef SAPI_EXTERN |
---|
76 | #define SAPI_EXTERN extern |
---|
77 | #endif |
---|
78 | |
---|
79 | /** |
---|
80 | * The following ensures that all data is declared in the space |
---|
81 | * of the initialization routine for either the Initialization Manager |
---|
82 | * or the initialization file for the appropriate API. It is |
---|
83 | * referenced as "external" in every other file. |
---|
84 | */ |
---|
85 | #ifdef RTEMS_API_INIT |
---|
86 | #undef RTEMS_EXTERN |
---|
87 | #define RTEMS_EXTERN |
---|
88 | #else |
---|
89 | #undef RTEMS_EXTERN |
---|
90 | #define RTEMS_EXTERN extern |
---|
91 | #endif |
---|
92 | |
---|
93 | /** |
---|
94 | * The following ensures that all data is declared in the space |
---|
95 | * of the initialization routine for either the Initialization Manager |
---|
96 | * or the initialization file for the appropriate API. It is |
---|
97 | * referenced as "external" in every other file. |
---|
98 | */ |
---|
99 | #ifdef POSIX_API_INIT |
---|
100 | #undef POSIX_EXTERN |
---|
101 | #define POSIX_EXTERN |
---|
102 | #else |
---|
103 | #undef POSIX_EXTERN |
---|
104 | #define POSIX_EXTERN extern |
---|
105 | #endif |
---|
106 | |
---|
107 | /** |
---|
108 | * The following (in conjunction with compiler arguments) are used |
---|
109 | * to choose between the use of static inline functions and macro |
---|
110 | * functions. The static inline implementation allows better |
---|
111 | * type checking with no cost in code size or execution speed. |
---|
112 | */ |
---|
113 | #ifdef __GNUC__ |
---|
114 | #define RTEMS_INLINE_ROUTINE static __inline__ |
---|
115 | #else |
---|
116 | #define RTEMS_INLINE_ROUTINE static inline |
---|
117 | #endif |
---|
118 | |
---|
119 | /** |
---|
120 | * The following macro is a compiler specific way to ensure that memory |
---|
121 | * writes are not reordered around certian points. This specifically can |
---|
122 | * impact interrupt disable and thread dispatching critical sections. |
---|
123 | */ |
---|
124 | #ifdef __GNUC__ |
---|
125 | #define RTEMS_COMPILER_MEMORY_BARRIER() __asm__ volatile("" ::: "memory") |
---|
126 | #else |
---|
127 | #define RTEMS_COMPILER_MEMORY_BARRIER() |
---|
128 | #endif |
---|
129 | |
---|
130 | /** |
---|
131 | * The following macro is a compiler specific way to indicate that |
---|
132 | * the method will NOT return to the caller. This can assist the |
---|
133 | * compiler in code generation and avoid unreachable paths. This |
---|
134 | * can impact the code generated following calls to |
---|
135 | * rtems_fatal_error_occurred and _Internal_error_Occurred. |
---|
136 | */ |
---|
137 | #ifdef __GNUC__ |
---|
138 | #define RTEMS_COMPILER_NO_RETURN_ATTRIBUTE \ |
---|
139 | __attribute__ ((noreturn)) |
---|
140 | #else |
---|
141 | #define RTEMS_COMPILER_NO_RETURN_ATTRIBUTE |
---|
142 | #endif |
---|
143 | |
---|
144 | /** |
---|
145 | * The following defines a compiler specific attribute which informs |
---|
146 | * the compiler that the method has no effect except the return value |
---|
147 | * and that the return value depends only on parameters and/or global |
---|
148 | * variables. |
---|
149 | */ |
---|
150 | #ifdef __GNUC__ |
---|
151 | #define RTEMS_COMPILER_PURE_ATTRIBUTE \ |
---|
152 | __attribute__ ((pure)) |
---|
153 | #else |
---|
154 | #define RTEMS_COMPILER_PURE_ATTRIBUTE |
---|
155 | #endif |
---|
156 | |
---|
157 | /** |
---|
158 | * Instructs the compiler to issue a warning whenever a variable or function |
---|
159 | * with this attribute will be used. |
---|
160 | */ |
---|
161 | #ifdef __GNUC__ |
---|
162 | #define RTEMS_COMPILER_DEPRECATED_ATTRIBUTE \ |
---|
163 | __attribute__ ((deprecated)) |
---|
164 | #else |
---|
165 | #define RTEMS_COMPILER_DEPRECATED_ATTRIBUTE |
---|
166 | #endif |
---|
167 | |
---|
168 | #ifndef ASM |
---|
169 | #ifdef RTEMS_DEPRECATED_TYPES |
---|
170 | typedef bool boolean; |
---|
171 | typedef float single_precision; |
---|
172 | typedef double double_precision; |
---|
173 | #endif |
---|
174 | |
---|
175 | /** |
---|
176 | * XXX: Eventually proc_ptr needs to disappear!!! |
---|
177 | */ |
---|
178 | typedef void * proc_ptr; |
---|
179 | #endif |
---|
180 | |
---|
181 | #endif /* _RTEMS_BASEDEFS_H */ |
---|