Nordic stack and drivers for the mbed BLE API

Dependents:   Sensen-classic-v8-IAQ_copy_4

Fork of nRF51822 by Nordic Semiconductor

Committer:
amithy
Date:
Fri Nov 10 20:27:44 2017 +0000
Revision:
639:7f459d371b75
Parent:
638:c90ae1400bf2
t

Who changed what in which revision?

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