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