Toyomasa Watarai / nrf51-sdk

Fork of nrf51-sdk by Nordic Semiconductor

Committer:
MACRUM
Date:
Thu Aug 18 02:22:51 2016 +0000
Revision:
46:05ead4407322
Parent:
29:286940b7ee5a
Minor fixes

Who changed what in which revision?

UserRevisionLine numberNew contents of line
vcoubard 29:286940b7ee5a 1 /*
vcoubard 29:286940b7ee5a 2 * Copyright (c) Nordic Semiconductor ASA
vcoubard 29:286940b7ee5a 3 * All rights reserved.
vcoubard 29:286940b7ee5a 4 *
vcoubard 29:286940b7ee5a 5 * Redistribution and use in source and binary forms, with or without modification,
vcoubard 29:286940b7ee5a 6 * are permitted provided that the following conditions are met:
vcoubard 29:286940b7ee5a 7 *
vcoubard 29:286940b7ee5a 8 * 1. Redistributions of source code must retain the above copyright notice, this
vcoubard 29:286940b7ee5a 9 * list of conditions and the following disclaimer.
vcoubard 29:286940b7ee5a 10 *
vcoubard 29:286940b7ee5a 11 * 2. Redistributions in binary form must reproduce the above copyright notice, this
vcoubard 29:286940b7ee5a 12 * list of conditions and the following disclaimer in the documentation and/or
vcoubard 29:286940b7ee5a 13 * other materials provided with the distribution.
vcoubard 29:286940b7ee5a 14 *
vcoubard 29:286940b7ee5a 15 * 3. Neither the name of Nordic Semiconductor ASA nor the names of other
vcoubard 29:286940b7ee5a 16 * contributors to this software may be used to endorse or promote products
vcoubard 29:286940b7ee5a 17 * derived from this software without specific prior written permission.
vcoubard 29:286940b7ee5a 18 *
vcoubard 29:286940b7ee5a 19 *
vcoubard 29:286940b7ee5a 20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
vcoubard 29:286940b7ee5a 21 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
vcoubard 29:286940b7ee5a 22 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
vcoubard 29:286940b7ee5a 23 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
vcoubard 29:286940b7ee5a 24 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
vcoubard 29:286940b7ee5a 25 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
vcoubard 29:286940b7ee5a 26 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
vcoubard 29:286940b7ee5a 27 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
vcoubard 29:286940b7ee5a 28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
vcoubard 29:286940b7ee5a 29 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
vcoubard 29:286940b7ee5a 30 *
vcoubard 1:ebc0e0ef0a11 31 */
vcoubard 1:ebc0e0ef0a11 32 #ifndef _COMPILER_ABSTRACTION_H
vcoubard 1:ebc0e0ef0a11 33 #define _COMPILER_ABSTRACTION_H
vcoubard 1:ebc0e0ef0a11 34
vcoubard 1:ebc0e0ef0a11 35 /*lint ++flb "Enter library region" */
vcoubard 1:ebc0e0ef0a11 36
vcoubard 1:ebc0e0ef0a11 37 #if defined ( __CC_ARM )
vcoubard 1:ebc0e0ef0a11 38
vcoubard 1:ebc0e0ef0a11 39 #ifndef __ASM
vcoubard 1:ebc0e0ef0a11 40 #define __ASM __asm
vcoubard 1:ebc0e0ef0a11 41 #endif
vcoubard 1:ebc0e0ef0a11 42
vcoubard 1:ebc0e0ef0a11 43 #ifndef __INLINE
vcoubard 1:ebc0e0ef0a11 44 #define __INLINE __inline
vcoubard 1:ebc0e0ef0a11 45 #endif
vcoubard 1:ebc0e0ef0a11 46
vcoubard 1:ebc0e0ef0a11 47 #ifndef __WEAK
vcoubard 1:ebc0e0ef0a11 48 #define __WEAK __weak
vcoubard 1:ebc0e0ef0a11 49 #endif
vcoubard 1:ebc0e0ef0a11 50
vcoubard 1:ebc0e0ef0a11 51 #ifndef __ALIGN
vcoubard 1:ebc0e0ef0a11 52 #define __ALIGN(n) __align(n)
vcoubard 1:ebc0e0ef0a11 53 #endif
vcoubard 1:ebc0e0ef0a11 54
vcoubard 1:ebc0e0ef0a11 55 #define GET_SP() __current_sp()
vcoubard 1:ebc0e0ef0a11 56
vcoubard 1:ebc0e0ef0a11 57 #elif defined ( __ICCARM__ )
vcoubard 1:ebc0e0ef0a11 58
vcoubard 1:ebc0e0ef0a11 59 #ifndef __ASM
vcoubard 1:ebc0e0ef0a11 60 #define __ASM __asm
vcoubard 1:ebc0e0ef0a11 61 #endif
vcoubard 1:ebc0e0ef0a11 62
vcoubard 1:ebc0e0ef0a11 63 #ifndef __INLINE
vcoubard 1:ebc0e0ef0a11 64 #define __INLINE inline
vcoubard 1:ebc0e0ef0a11 65 #endif
vcoubard 1:ebc0e0ef0a11 66
vcoubard 1:ebc0e0ef0a11 67 #ifndef __WEAK
vcoubard 1:ebc0e0ef0a11 68 #define __WEAK __weak
vcoubard 1:ebc0e0ef0a11 69 #endif
vcoubard 1:ebc0e0ef0a11 70
vcoubard 1:ebc0e0ef0a11 71 /* Not defined for IAR since it requires a new line to work, and C preprocessor does not allow that. */
vcoubard 1:ebc0e0ef0a11 72 #ifndef __ALIGN
vcoubard 1:ebc0e0ef0a11 73 #define __ALIGN(n)
vcoubard 1:ebc0e0ef0a11 74 #endif
vcoubard 1:ebc0e0ef0a11 75
vcoubard 1:ebc0e0ef0a11 76 #define GET_SP() __get_SP()
vcoubard 1:ebc0e0ef0a11 77
vcoubard 1:ebc0e0ef0a11 78 #elif defined ( __GNUC__ )
vcoubard 1:ebc0e0ef0a11 79
vcoubard 1:ebc0e0ef0a11 80 #ifndef __ASM
vcoubard 1:ebc0e0ef0a11 81 #define __ASM __asm
vcoubard 1:ebc0e0ef0a11 82 #endif
vcoubard 1:ebc0e0ef0a11 83
vcoubard 1:ebc0e0ef0a11 84 #ifndef __INLINE
vcoubard 1:ebc0e0ef0a11 85 #define __INLINE inline
vcoubard 1:ebc0e0ef0a11 86 #endif
vcoubard 1:ebc0e0ef0a11 87
vcoubard 1:ebc0e0ef0a11 88 #ifndef __WEAK
vcoubard 1:ebc0e0ef0a11 89 #define __WEAK __attribute__((weak))
vcoubard 1:ebc0e0ef0a11 90 #endif
vcoubard 1:ebc0e0ef0a11 91
vcoubard 1:ebc0e0ef0a11 92 #ifndef __ALIGN
vcoubard 1:ebc0e0ef0a11 93 #define __ALIGN(n) __attribute__((aligned(n)))
vcoubard 1:ebc0e0ef0a11 94 #endif
vcoubard 1:ebc0e0ef0a11 95
vcoubard 1:ebc0e0ef0a11 96 #define GET_SP() gcc_current_sp()
vcoubard 1:ebc0e0ef0a11 97
vcoubard 1:ebc0e0ef0a11 98 static inline unsigned int gcc_current_sp(void)
vcoubard 1:ebc0e0ef0a11 99 {
vcoubard 1:ebc0e0ef0a11 100 register unsigned sp __ASM("sp");
vcoubard 1:ebc0e0ef0a11 101 return sp;
vcoubard 1:ebc0e0ef0a11 102 }
vcoubard 1:ebc0e0ef0a11 103
vcoubard 1:ebc0e0ef0a11 104 #elif defined ( __TASKING__ )
vcoubard 1:ebc0e0ef0a11 105
vcoubard 1:ebc0e0ef0a11 106 #ifndef __ASM
vcoubard 1:ebc0e0ef0a11 107 #define __ASM __asm
vcoubard 1:ebc0e0ef0a11 108 #endif
vcoubard 1:ebc0e0ef0a11 109
vcoubard 1:ebc0e0ef0a11 110 #ifndef __INLINE
vcoubard 1:ebc0e0ef0a11 111 #define __INLINE inline
vcoubard 1:ebc0e0ef0a11 112 #endif
vcoubard 1:ebc0e0ef0a11 113
vcoubard 1:ebc0e0ef0a11 114 #ifndef __WEAK
vcoubard 1:ebc0e0ef0a11 115 #define __WEAK __attribute__((weak))
vcoubard 1:ebc0e0ef0a11 116 #endif
vcoubard 1:ebc0e0ef0a11 117
vcoubard 1:ebc0e0ef0a11 118 #ifndef __ALIGN
vcoubard 1:ebc0e0ef0a11 119 #define __ALIGN(n) __align(n)
vcoubard 1:ebc0e0ef0a11 120 #endif
vcoubard 1:ebc0e0ef0a11 121
vcoubard 1:ebc0e0ef0a11 122 #define GET_SP() __get_MSP()
vcoubard 1:ebc0e0ef0a11 123
vcoubard 1:ebc0e0ef0a11 124 #endif
vcoubard 1:ebc0e0ef0a11 125
vcoubard 1:ebc0e0ef0a11 126 /*lint --flb "Leave library region" */
vcoubard 1:ebc0e0ef0a11 127
vcoubard 1:ebc0e0ef0a11 128 #endif