CSSE4011_BLE_IMU IMU Seeed Tiny Ble

Dependencies:   BLE_API_Tiny_BLE MPU6050-DMP-Seeed-Tiny-BLE mbed

Committer:
flywind
Date:
Wed Jun 10 09:46:16 2015 +0000
Revision:
0:f90c3452d779
CSSE4011_Seed-Tiny-BLE

Who changed what in which revision?

UserRevisionLine numberNew contents of line
flywind 0:f90c3452d779 1 /**************************************************************************/
flywind 0:f90c3452d779 2 /*!
flywind 0:f90c3452d779 3 @file compiler.h
flywind 0:f90c3452d779 4 @author hathach (tinyusb.org)
flywind 0:f90c3452d779 5
flywind 0:f90c3452d779 6 @section LICENSE
flywind 0:f90c3452d779 7
flywind 0:f90c3452d779 8 Software License Agreement (BSD License)
flywind 0:f90c3452d779 9
flywind 0:f90c3452d779 10 Copyright (c) 2013, K. Townsend (microBuilder.eu)
flywind 0:f90c3452d779 11 All rights reserved.
flywind 0:f90c3452d779 12
flywind 0:f90c3452d779 13 Redistribution and use in source and binary forms, with or without
flywind 0:f90c3452d779 14 modification, are permitted provided that the following conditions are met:
flywind 0:f90c3452d779 15 1. Redistributions of source code must retain the above copyright
flywind 0:f90c3452d779 16 notice, this list of conditions and the following disclaimer.
flywind 0:f90c3452d779 17 2. Redistributions in binary form must reproduce the above copyright
flywind 0:f90c3452d779 18 notice, this list of conditions and the following disclaimer in the
flywind 0:f90c3452d779 19 documentation and/or other materials provided with the distribution.
flywind 0:f90c3452d779 20 3. Neither the name of the copyright holders nor the
flywind 0:f90c3452d779 21 names of its contributors may be used to endorse or promote products
flywind 0:f90c3452d779 22 derived from this software without specific prior written permission.
flywind 0:f90c3452d779 23
flywind 0:f90c3452d779 24 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
flywind 0:f90c3452d779 25 EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
flywind 0:f90c3452d779 26 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
flywind 0:f90c3452d779 27 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
flywind 0:f90c3452d779 28 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
flywind 0:f90c3452d779 29 INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
flywind 0:f90c3452d779 30 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION HOWEVER CAUSED AND
flywind 0:f90c3452d779 31 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
flywind 0:f90c3452d779 32 INCLUDING NEGLIGENCE OR OTHERWISE ARISING IN ANY WAY OUT OF THE USE OF THIS
flywind 0:f90c3452d779 33 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
flywind 0:f90c3452d779 34 */
flywind 0:f90c3452d779 35 /**************************************************************************/
flywind 0:f90c3452d779 36
flywind 0:f90c3452d779 37 /** \file
flywind 0:f90c3452d779 38 * \brief GCC Header
flywind 0:f90c3452d779 39 */
flywind 0:f90c3452d779 40
flywind 0:f90c3452d779 41 /** \ingroup Group_Compiler
flywind 0:f90c3452d779 42 * \defgroup Group_GCC GNU GCC
flywind 0:f90c3452d779 43 * @{
flywind 0:f90c3452d779 44 */
flywind 0:f90c3452d779 45
flywind 0:f90c3452d779 46 #ifndef _COMPILER_GCC_H_
flywind 0:f90c3452d779 47 #define _COMPILER_GCC_H_
flywind 0:f90c3452d779 48
flywind 0:f90c3452d779 49 #ifdef __cplusplus
flywind 0:f90c3452d779 50 extern "C" {
flywind 0:f90c3452d779 51 #endif
flywind 0:f90c3452d779 52
flywind 0:f90c3452d779 53 #include "projectconfig.h"
flywind 0:f90c3452d779 54
flywind 0:f90c3452d779 55 //#ifndef __GNUC__
flywind 0:f90c3452d779 56 // #define ATTR_ALWAYS_INLINE
flywind 0:f90c3452d779 57 // #define ATTR_CONST
flywind 0:f90c3452d779 58 //#else
flywind 0:f90c3452d779 59
flywind 0:f90c3452d779 60 #ifdef _TEST_
flywind 0:f90c3452d779 61 #define ATTR_ALWAYS_INLINE
flywind 0:f90c3452d779 62 #define STATIC_
flywind 0:f90c3452d779 63 #define INLINE_
flywind 0:f90c3452d779 64 #else
flywind 0:f90c3452d779 65 #define STATIC_ static
flywind 0:f90c3452d779 66 #define INLINE_ inline
flywind 0:f90c3452d779 67
flywind 0:f90c3452d779 68 #if CFG_DEBUG == 3
flywind 0:f90c3452d779 69 #define ATTR_ALWAYS_INLINE // no inline for debug = 3
flywind 0:f90c3452d779 70 #endif
flywind 0:f90c3452d779 71 #endif
flywind 0:f90c3452d779 72
flywind 0:f90c3452d779 73 #define ALIGN_OF(x) __alignof__(x)
flywind 0:f90c3452d779 74
flywind 0:f90c3452d779 75 /// Normally, the compiler places the objects it generates in sections like data or bss & function in text. Sometimes, however, you need additional sections, or you need certain particular variables to appear in special sections, for example to map to special hardware. The section attribute specifies that a variable (or function) lives in a particular section
flywind 0:f90c3452d779 76 #define ATTR_SECTION(section) __attribute__ ((#section))
flywind 0:f90c3452d779 77
flywind 0:f90c3452d779 78 /// If this attribute is used on a function declaration and a call to such a function is not eliminated through dead code elimination or other optimizations, an error that includes message is diagnosed. This is useful for compile-time checking
flywind 0:f90c3452d779 79 #define ATTR_ERROR(Message) __attribute__ ((error(Message)))
flywind 0:f90c3452d779 80
flywind 0:f90c3452d779 81 /// If this attribute is used on a function declaration and a call to such a function is not eliminated through dead code elimination or other optimizations, a warning that includes message is diagnosed. This is useful for compile-time checking
flywind 0:f90c3452d779 82 #define ATTR_WARNING(Message) __attribute__ ((warning(Message)))
flywind 0:f90c3452d779 83
flywind 0:f90c3452d779 84 /**
flywind 0:f90c3452d779 85 * \defgroup Group_VariableAttr Variable Attributes
flywind 0:f90c3452d779 86 * @{
flywind 0:f90c3452d779 87 */
flywind 0:f90c3452d779 88
flywind 0:f90c3452d779 89 /// This attribute specifies a minimum alignment for the variable or structure field, measured in bytes
flywind 0:f90c3452d779 90 #define ATTR_ALIGNED(Bytes) __attribute__ ((aligned(Bytes)))
flywind 0:f90c3452d779 91
flywind 0:f90c3452d779 92 /// The packed attribute specifies that a variable or structure field should have the smallest possible alignment—one byte for a variable, and one bit for a field, unless you specify a larger value with the aligned attribute
flywind 0:f90c3452d779 93 #define ATTR_PACKED __attribute__ ((packed))
flywind 0:f90c3452d779 94
flywind 0:f90c3452d779 95 #define ATTR_PREPACKED
flywind 0:f90c3452d779 96
flywind 0:f90c3452d779 97 #define ATTR_PACKED_STRUCT(x) x __attribute__ ((packed))
flywind 0:f90c3452d779 98 /** @} */
flywind 0:f90c3452d779 99
flywind 0:f90c3452d779 100 /**
flywind 0:f90c3452d779 101 * \defgroup Group_FuncAttr Function Attributes
flywind 0:f90c3452d779 102 * @{
flywind 0:f90c3452d779 103 */
flywind 0:f90c3452d779 104
flywind 0:f90c3452d779 105 #ifndef ATTR_ALWAYS_INLINE
flywind 0:f90c3452d779 106 /// Generally, functions are not inlined unless optimization is specified. For functions declared inline, this attribute inlines the function even if no optimization level is specified
flywind 0:f90c3452d779 107 #define ATTR_ALWAYS_INLINE __attribute__ ((always_inline))
flywind 0:f90c3452d779 108 #endif
flywind 0:f90c3452d779 109
flywind 0:f90c3452d779 110 /// The nonnull attribute specifies that some function parameters should be non-null pointers. f the compiler determines that a null pointer is passed in an argument slot marked as non-null, and the -Wnonnull option is enabled, a warning is issued. All pointer arguments are marked as non-null
flywind 0:f90c3452d779 111 #define ATTR_NON_NULL __attribute__ ((nonull))
flywind 0:f90c3452d779 112
flywind 0:f90c3452d779 113 /// Many functions have no effects except the return value and their return value depends only on the parameters and/or global variables. Such a function can be subject to common subexpression elimination and loop optimization just as an arithmetic operator would be. These functions should be declared with the attribute pure
flywind 0:f90c3452d779 114 #define ATTR_PURE __attribute__ ((pure))
flywind 0:f90c3452d779 115
flywind 0:f90c3452d779 116 /// Many functions do not examine any values except their arguments, and have no effects except the return value. Basically this is just slightly more strict class than the pure attribute below, since function is not allowed to read global memory.
flywind 0:f90c3452d779 117 /// Note that a function that has pointer arguments and examines the data pointed to must not be declared const. Likewise, a function that calls a non-const function usually must not be const. It does not make sense for a const function to return void
flywind 0:f90c3452d779 118 #define ATTR_CONST __attribute__ ((const))
flywind 0:f90c3452d779 119
flywind 0:f90c3452d779 120 /// The deprecated attribute results in a warning if the function is used anywhere in the source file. This is useful when identifying functions that are expected to be removed in a future version of a program. The warning also includes the location of the declaration of the deprecated function, to enable users to easily find further information about why the function is deprecated, or what they should do instead. Note that the warnings only occurs for uses
flywind 0:f90c3452d779 121 #define ATTR_DEPRECATED __attribute__ ((deprecated))
flywind 0:f90c3452d779 122
flywind 0:f90c3452d779 123 /// Same as the deprecated attribute with optional message in the warning
flywind 0:f90c3452d779 124 #define ATTR_DEPRECATED_MESS(mess) __attribute__ ((deprecated(mess)))
flywind 0:f90c3452d779 125
flywind 0:f90c3452d779 126 /// The weak attribute causes the declaration to be emitted as a weak symbol rather than a global. This is primarily useful in defining library functions that can be overridden in user code
flywind 0:f90c3452d779 127 #define ATTR_WEAK __attribute__ ((weak))
flywind 0:f90c3452d779 128
flywind 0:f90c3452d779 129 /// The alias attribute causes the declaration to be emitted as an alias for another symbol, which must be specified
flywind 0:f90c3452d779 130 #define ATTR_ALIAS(func) __attribute__ ((alias(#func)))
flywind 0:f90c3452d779 131
flywind 0:f90c3452d779 132 /// The weakref attribute marks a declaration as a weak reference. It is equivalent with weak + alias attribute, but require function is static
flywind 0:f90c3452d779 133 #define ATTR_WEAKREF(func) __attribute__ ((weakref(#func)))
flywind 0:f90c3452d779 134
flywind 0:f90c3452d779 135 /// The warn_unused_result attribute causes a warning to be emitted if a caller of the function with this attribute does not use its return value. This is useful for functions where not checking the result is either a security problem or always a bug
flywind 0:f90c3452d779 136 #define ATTR_WARN_UNUSED_RESULT __attribute__ ((warn_unused_result))
flywind 0:f90c3452d779 137
flywind 0:f90c3452d779 138 /// This attribute, attached to a function, means that code must be emitted for the function even if it appears that the function is not referenced. This is useful, for example, when the function is referenced only in inline assembly.
flywind 0:f90c3452d779 139 #define ATTR_USED __attribute__ ((used))
flywind 0:f90c3452d779 140
flywind 0:f90c3452d779 141 /// This attribute, attached to a function, means that the function is meant to be possibly unused. GCC does not produce a warning for this function.
flywind 0:f90c3452d779 142 #define ATTR_UNUSED __attribute__ ((unused))
flywind 0:f90c3452d779 143
flywind 0:f90c3452d779 144 /** @} */
flywind 0:f90c3452d779 145
flywind 0:f90c3452d779 146 #ifdef __cplusplus
flywind 0:f90c3452d779 147 }
flywind 0:f90c3452d779 148 #endif
flywind 0:f90c3452d779 149
flywind 0:f90c3452d779 150 #endif /* _COMPILER_GCC_H_ */
flywind 0:f90c3452d779 151
flywind 0:f90c3452d779 152 /// @}