WallbotBLE default code

Dependencies:   mbed

Fork of BLE_WallbotBLE_Challenge by Wallbot BLE Developer

Committer:
jksoft
Date:
Wed Nov 12 02:40:34 2014 +0000
Revision:
0:76dfa9657d9d
????????

Who changed what in which revision?

UserRevisionLine numberNew contents of line
jksoft 0:76dfa9657d9d 1 /**************************************************************************/
jksoft 0:76dfa9657d9d 2 /*!
jksoft 0:76dfa9657d9d 3 @file compiler.h
jksoft 0:76dfa9657d9d 4 @author hathach (tinyusb.org)
jksoft 0:76dfa9657d9d 5
jksoft 0:76dfa9657d9d 6 @section LICENSE
jksoft 0:76dfa9657d9d 7
jksoft 0:76dfa9657d9d 8 Software License Agreement (BSD License)
jksoft 0:76dfa9657d9d 9
jksoft 0:76dfa9657d9d 10 Copyright (c) 2013, K. Townsend (microBuilder.eu)
jksoft 0:76dfa9657d9d 11 All rights reserved.
jksoft 0:76dfa9657d9d 12
jksoft 0:76dfa9657d9d 13 Redistribution and use in source and binary forms, with or without
jksoft 0:76dfa9657d9d 14 modification, are permitted provided that the following conditions are met:
jksoft 0:76dfa9657d9d 15 1. Redistributions of source code must retain the above copyright
jksoft 0:76dfa9657d9d 16 notice, this list of conditions and the following disclaimer.
jksoft 0:76dfa9657d9d 17 2. Redistributions in binary form must reproduce the above copyright
jksoft 0:76dfa9657d9d 18 notice, this list of conditions and the following disclaimer in the
jksoft 0:76dfa9657d9d 19 documentation and/or other materials provided with the distribution.
jksoft 0:76dfa9657d9d 20 3. Neither the name of the copyright holders nor the
jksoft 0:76dfa9657d9d 21 names of its contributors may be used to endorse or promote products
jksoft 0:76dfa9657d9d 22 derived from this software without specific prior written permission.
jksoft 0:76dfa9657d9d 23
jksoft 0:76dfa9657d9d 24 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
jksoft 0:76dfa9657d9d 25 EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
jksoft 0:76dfa9657d9d 26 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
jksoft 0:76dfa9657d9d 27 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
jksoft 0:76dfa9657d9d 28 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
jksoft 0:76dfa9657d9d 29 INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
jksoft 0:76dfa9657d9d 30 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION HOWEVER CAUSED AND
jksoft 0:76dfa9657d9d 31 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
jksoft 0:76dfa9657d9d 32 INCLUDING NEGLIGENCE OR OTHERWISE ARISING IN ANY WAY OUT OF THE USE OF THIS
jksoft 0:76dfa9657d9d 33 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
jksoft 0:76dfa9657d9d 34 */
jksoft 0:76dfa9657d9d 35 /**************************************************************************/
jksoft 0:76dfa9657d9d 36
jksoft 0:76dfa9657d9d 37 /** \file
jksoft 0:76dfa9657d9d 38 * \brief GCC Header
jksoft 0:76dfa9657d9d 39 */
jksoft 0:76dfa9657d9d 40
jksoft 0:76dfa9657d9d 41 /** \ingroup Group_Compiler
jksoft 0:76dfa9657d9d 42 * \defgroup Group_GCC GNU GCC
jksoft 0:76dfa9657d9d 43 * @{
jksoft 0:76dfa9657d9d 44 */
jksoft 0:76dfa9657d9d 45
jksoft 0:76dfa9657d9d 46 #ifndef _COMPILER_GCC_H_
jksoft 0:76dfa9657d9d 47 #define _COMPILER_GCC_H_
jksoft 0:76dfa9657d9d 48
jksoft 0:76dfa9657d9d 49 #ifdef __cplusplus
jksoft 0:76dfa9657d9d 50 extern "C" {
jksoft 0:76dfa9657d9d 51 #endif
jksoft 0:76dfa9657d9d 52
jksoft 0:76dfa9657d9d 53 #include "projectconfig.h"
jksoft 0:76dfa9657d9d 54
jksoft 0:76dfa9657d9d 55 //#ifndef __GNUC__
jksoft 0:76dfa9657d9d 56 // #define ATTR_ALWAYS_INLINE
jksoft 0:76dfa9657d9d 57 // #define ATTR_CONST
jksoft 0:76dfa9657d9d 58 //#else
jksoft 0:76dfa9657d9d 59
jksoft 0:76dfa9657d9d 60 #ifdef _TEST_
jksoft 0:76dfa9657d9d 61 #define ATTR_ALWAYS_INLINE
jksoft 0:76dfa9657d9d 62 #define STATIC_
jksoft 0:76dfa9657d9d 63 #define INLINE_
jksoft 0:76dfa9657d9d 64 #else
jksoft 0:76dfa9657d9d 65 #define STATIC_ static
jksoft 0:76dfa9657d9d 66 #define INLINE_ inline
jksoft 0:76dfa9657d9d 67
jksoft 0:76dfa9657d9d 68 #if CFG_DEBUG == 3
jksoft 0:76dfa9657d9d 69 #define ATTR_ALWAYS_INLINE // no inline for debug = 3
jksoft 0:76dfa9657d9d 70 #endif
jksoft 0:76dfa9657d9d 71 #endif
jksoft 0:76dfa9657d9d 72
jksoft 0:76dfa9657d9d 73 #define ALIGN_OF(x) __alignof__(x)
jksoft 0:76dfa9657d9d 74
jksoft 0:76dfa9657d9d 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
jksoft 0:76dfa9657d9d 76 #define ATTR_SECTION(section) __attribute__ ((#section))
jksoft 0:76dfa9657d9d 77
jksoft 0:76dfa9657d9d 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
jksoft 0:76dfa9657d9d 79 #define ATTR_ERROR(Message) __attribute__ ((error(Message)))
jksoft 0:76dfa9657d9d 80
jksoft 0:76dfa9657d9d 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
jksoft 0:76dfa9657d9d 82 #define ATTR_WARNING(Message) __attribute__ ((warning(Message)))
jksoft 0:76dfa9657d9d 83
jksoft 0:76dfa9657d9d 84 /**
jksoft 0:76dfa9657d9d 85 * \defgroup Group_VariableAttr Variable Attributes
jksoft 0:76dfa9657d9d 86 * @{
jksoft 0:76dfa9657d9d 87 */
jksoft 0:76dfa9657d9d 88
jksoft 0:76dfa9657d9d 89 /// This attribute specifies a minimum alignment for the variable or structure field, measured in bytes
jksoft 0:76dfa9657d9d 90 #define ATTR_ALIGNED(Bytes) __attribute__ ((aligned(Bytes)))
jksoft 0:76dfa9657d9d 91
jksoft 0:76dfa9657d9d 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
jksoft 0:76dfa9657d9d 93 #define ATTR_PACKED __attribute__ ((packed))
jksoft 0:76dfa9657d9d 94
jksoft 0:76dfa9657d9d 95 #define ATTR_PREPACKED
jksoft 0:76dfa9657d9d 96
jksoft 0:76dfa9657d9d 97 #define ATTR_PACKED_STRUCT(x) x __attribute__ ((packed))
jksoft 0:76dfa9657d9d 98 /** @} */
jksoft 0:76dfa9657d9d 99
jksoft 0:76dfa9657d9d 100 /**
jksoft 0:76dfa9657d9d 101 * \defgroup Group_FuncAttr Function Attributes
jksoft 0:76dfa9657d9d 102 * @{
jksoft 0:76dfa9657d9d 103 */
jksoft 0:76dfa9657d9d 104
jksoft 0:76dfa9657d9d 105 #ifndef ATTR_ALWAYS_INLINE
jksoft 0:76dfa9657d9d 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
jksoft 0:76dfa9657d9d 107 #define ATTR_ALWAYS_INLINE __attribute__ ((always_inline))
jksoft 0:76dfa9657d9d 108 #endif
jksoft 0:76dfa9657d9d 109
jksoft 0:76dfa9657d9d 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
jksoft 0:76dfa9657d9d 111 #define ATTR_NON_NULL __attribute__ ((nonull))
jksoft 0:76dfa9657d9d 112
jksoft 0:76dfa9657d9d 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
jksoft 0:76dfa9657d9d 114 #define ATTR_PURE __attribute__ ((pure))
jksoft 0:76dfa9657d9d 115
jksoft 0:76dfa9657d9d 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.
jksoft 0:76dfa9657d9d 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
jksoft 0:76dfa9657d9d 118 #define ATTR_CONST __attribute__ ((const))
jksoft 0:76dfa9657d9d 119
jksoft 0:76dfa9657d9d 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
jksoft 0:76dfa9657d9d 121 #define ATTR_DEPRECATED __attribute__ ((deprecated))
jksoft 0:76dfa9657d9d 122
jksoft 0:76dfa9657d9d 123 /// Same as the deprecated attribute with optional message in the warning
jksoft 0:76dfa9657d9d 124 #define ATTR_DEPRECATED_MESS(mess) __attribute__ ((deprecated(mess)))
jksoft 0:76dfa9657d9d 125
jksoft 0:76dfa9657d9d 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
jksoft 0:76dfa9657d9d 127 #define ATTR_WEAK __attribute__ ((weak))
jksoft 0:76dfa9657d9d 128
jksoft 0:76dfa9657d9d 129 /// The alias attribute causes the declaration to be emitted as an alias for another symbol, which must be specified
jksoft 0:76dfa9657d9d 130 #define ATTR_ALIAS(func) __attribute__ ((alias(#func)))
jksoft 0:76dfa9657d9d 131
jksoft 0:76dfa9657d9d 132 /// The weakref attribute marks a declaration as a weak reference. It is equivalent with weak + alias attribute, but require function is static
jksoft 0:76dfa9657d9d 133 #define ATTR_WEAKREF(func) __attribute__ ((weakref(#func)))
jksoft 0:76dfa9657d9d 134
jksoft 0:76dfa9657d9d 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
jksoft 0:76dfa9657d9d 136 #define ATTR_WARN_UNUSED_RESULT __attribute__ ((warn_unused_result))
jksoft 0:76dfa9657d9d 137
jksoft 0:76dfa9657d9d 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.
jksoft 0:76dfa9657d9d 139 #define ATTR_USED __attribute__ ((used))
jksoft 0:76dfa9657d9d 140
jksoft 0:76dfa9657d9d 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.
jksoft 0:76dfa9657d9d 142 #define ATTR_UNUSED __attribute__ ((unused))
jksoft 0:76dfa9657d9d 143
jksoft 0:76dfa9657d9d 144 /** @} */
jksoft 0:76dfa9657d9d 145
jksoft 0:76dfa9657d9d 146 #ifdef __cplusplus
jksoft 0:76dfa9657d9d 147 }
jksoft 0:76dfa9657d9d 148 #endif
jksoft 0:76dfa9657d9d 149
jksoft 0:76dfa9657d9d 150 #endif /* _COMPILER_GCC_H_ */
jksoft 0:76dfa9657d9d 151
jksoft 0:76dfa9657d9d 152 /// @}