3 * (C) COPYRIGHT 2009-2011 ARM Limited. All rights reserved.
5 * This program is free software and is provided to you under the terms of the GNU General Public License version 2
6 * as published by the Free Software Foundation, and any use by you of this program is subject to the terms of such GNU licence.
8 * A copy of the licence is included with the program, and can also be obtained from Free Software
9 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15 #ifndef _ARM_CSTD_TYPES_RVCT_H_
16 #define _ARM_CSTD_TYPES_RVCT_H_
18 /* ============================================================================
20 ============================================================================ */
24 #if 199901L <= __STDC_VERSION__
27 typedef unsigned char uint8_t;
28 typedef signed char int8_t;
29 typedef unsigned short uint16_t;
30 typedef signed short int16_t;
31 typedef unsigned int uint32_t;
32 typedef signed int int32_t;
33 typedef unsigned __int64 uint64_t;
34 typedef signed __int64 int64_t;
35 typedef ptrdiff_t intptr_t;
36 typedef size_t uintptr_t;
39 typedef uint32_t bool_t;
42 #define TRUE ((bool_t)1)
46 #define FALSE ((bool_t)0)
49 /* ============================================================================
51 ============================================================================ */
53 * @addtogroup arm_cstd_coding_standard
60 * Mark an assembler block. Such blocks are often compiler specific, so often
61 * need to be surrounded in appropriate @c ifdef and @c endif blocks
62 * using the relevant @c CSTD_TOOLCHAIN macro.
69 * Mark a definition as something which should be inlined. This is not always
70 * possible on a given compiler, and may be disabled at lower optimization
73 #define INLINE __inline
78 * Mark a definition as something which should be inlined. This provides a much
79 * stronger hint to the compiler than @c INLINE, and if supported should always
80 * result in an inlined function being emitted. If not supported this falls
81 * back to using the @c INLINE definition.
83 #define FORCE_INLINE __forceinline
88 * Mark a definition as something which should not be inlined. This provides a
89 * stronger hint to the compiler than the function should not be inlined,
90 * bypassing any heuristic rules the compiler normally applies. If not
91 * supported by a toolchain this falls back to being an empty macro.
93 #define NEVER_INLINE __declspec(noinline)
98 * Denotes that a function's return is only dependent on its inputs, enabling
99 * more efficient optimizations. Falls back to an empty macro if not supported.
106 * Denotes that a structure should be stored in a packed form. This macro must
107 * be used in conjunction with the @c arm_cstd_pack_* headers for portability:
110 * #include <cstd/arm_cstd_pack_push.h>
112 * struct PACKED myStruct {
116 * #include <cstd/arm_cstd_pack_pop.h>
120 #define PACKED __packed
125 * Denotes that a pointer points to a buffer with lower alignment than the
126 * natural alignment required by the C standard. This should only be used
127 * in extreme cases, as the emitted code is normally more efficient if memory
130 * @warning This is \b NON-PORTABLE. The GNU tools are anti-unaligned pointers
131 * and have no support for such a construction.
133 #define UNALIGNED __packed
138 * Denotes that a pointer does not overlap with any other points currently in
139 * scope, increasing the range of optimizations which can be performed by the
142 * @warning Specification of @c RESTRICT is a contract between the programmer
143 * and the compiler. If you place @c RESTICT on buffers which do actually
144 * overlap the behavior is undefined, and likely to vary at different
145 * optimization levels.!
147 #define RESTRICT __restrict
152 * Function attribute which causes a warning to be emitted if the compiler's
153 * return value is not used by the caller. Compiles to an empty macro if
154 * there is no supported mechanism for this check in the underlying compiler.
156 * @note At the time of writing this is only supported by GCC. RVCT does not
157 * support this attribute, even in GCC mode, so engineers are encouraged to
158 * compile their code using GCC even if primarily working with another
162 * CHECK_RESULT int my_func( void );
169 * Specify the @c CSTD_FUNC macro, a portable construct containing the name of
170 * the current function. On most compilers it is illegal to use this macro
171 * outside of a function scope. If not supported by the compiler we define
172 * @c CSTD_FUNC as an empty string.
174 * @warning Due to the implementation of this on most modern compilers this
175 * expands to a magically defined "static const" variable, not a constant
176 * string. This makes injecting @c CSTD_FUNC directly in to compile-time
177 * strings impossible, so if you want to make the function name part of a
178 * larger string you must use a printf-like function with a @c @%s template
179 * which is populated with @c CSTD_FUNC
181 #define CSTD_FUNC __FUNCTION__
187 #endif /* End (_ARM_CSTD_TYPES_RVCT_H_) */