mbed library sources. Supersedes mbed-src.
Fork of mbed by
targets/cmsis/TARGET_NORDIC/TARGET_MCU_NRF51822/compiler_abstraction.h@144:ef7eb2e8f9f7, 2016-09-02 (annotated)
- Committer:
- <>
- Date:
- Fri Sep 02 15:07:44 2016 +0100
- Revision:
- 144:ef7eb2e8f9f7
- Parent:
- 0:9b334a45a8ff
This updates the lib to the mbed lib v125
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
<> | 144:ef7eb2e8f9f7 | 1 | /* Copyright (c) 2013, Nordic Semiconductor ASA |
<> | 144:ef7eb2e8f9f7 | 2 | * All rights reserved. |
<> | 144:ef7eb2e8f9f7 | 3 | * |
<> | 144:ef7eb2e8f9f7 | 4 | * Redistribution and use in source and binary forms, with or without |
<> | 144:ef7eb2e8f9f7 | 5 | * modification, are permitted provided that the following conditions are met: |
<> | 144:ef7eb2e8f9f7 | 6 | * |
<> | 144:ef7eb2e8f9f7 | 7 | * * Redistributions of source code must retain the above copyright notice, this |
<> | 144:ef7eb2e8f9f7 | 8 | * list of conditions and the following disclaimer. |
<> | 144:ef7eb2e8f9f7 | 9 | * |
<> | 144:ef7eb2e8f9f7 | 10 | * * Redistributions in binary form must reproduce the above copyright notice, |
<> | 144:ef7eb2e8f9f7 | 11 | * this list of conditions and the following disclaimer in the documentation |
<> | 144:ef7eb2e8f9f7 | 12 | * and/or other materials provided with the distribution. |
<> | 144:ef7eb2e8f9f7 | 13 | * |
<> | 144:ef7eb2e8f9f7 | 14 | * * Neither the name of Nordic Semiconductor ASA nor the names of its |
<> | 144:ef7eb2e8f9f7 | 15 | * contributors may be used to endorse or promote products derived from |
<> | 144:ef7eb2e8f9f7 | 16 | * this software without specific prior written permission. |
<> | 144:ef7eb2e8f9f7 | 17 | * |
<> | 144:ef7eb2e8f9f7 | 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
<> | 144:ef7eb2e8f9f7 | 19 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
<> | 144:ef7eb2e8f9f7 | 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
<> | 144:ef7eb2e8f9f7 | 21 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
<> | 144:ef7eb2e8f9f7 | 22 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
<> | 144:ef7eb2e8f9f7 | 23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
<> | 144:ef7eb2e8f9f7 | 24 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
<> | 144:ef7eb2e8f9f7 | 25 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
<> | 144:ef7eb2e8f9f7 | 26 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
<> | 144:ef7eb2e8f9f7 | 27 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
<> | 144:ef7eb2e8f9f7 | 28 | * |
<> | 144:ef7eb2e8f9f7 | 29 | */ |
<> | 144:ef7eb2e8f9f7 | 30 | #ifndef _COMPILER_ABSTRACTION_H |
<> | 144:ef7eb2e8f9f7 | 31 | #define _COMPILER_ABSTRACTION_H |
<> | 144:ef7eb2e8f9f7 | 32 | |
<> | 144:ef7eb2e8f9f7 | 33 | /*lint ++flb "Enter library region" */ |
<> | 144:ef7eb2e8f9f7 | 34 | |
<> | 144:ef7eb2e8f9f7 | 35 | #if defined ( __CC_ARM ) |
<> | 144:ef7eb2e8f9f7 | 36 | |
<> | 144:ef7eb2e8f9f7 | 37 | #ifndef __ASM |
<> | 144:ef7eb2e8f9f7 | 38 | #define __ASM __asm /*!< asm keyword for ARM Compiler */ |
<> | 144:ef7eb2e8f9f7 | 39 | #endif |
<> | 144:ef7eb2e8f9f7 | 40 | |
<> | 144:ef7eb2e8f9f7 | 41 | #ifndef __INLINE |
<> | 144:ef7eb2e8f9f7 | 42 | #define __INLINE __inline /*!< inline keyword for ARM Compiler */ |
<> | 144:ef7eb2e8f9f7 | 43 | #endif |
<> | 144:ef7eb2e8f9f7 | 44 | |
<> | 144:ef7eb2e8f9f7 | 45 | #ifndef __WEAK |
<> | 144:ef7eb2e8f9f7 | 46 | #define __WEAK __weak /*!< weak keyword for ARM Compiler */ |
<> | 144:ef7eb2e8f9f7 | 47 | #endif |
<> | 144:ef7eb2e8f9f7 | 48 | |
<> | 144:ef7eb2e8f9f7 | 49 | #define GET_SP() __current_sp() /*!> read current SP function for ARM Compiler */ |
<> | 144:ef7eb2e8f9f7 | 50 | |
<> | 144:ef7eb2e8f9f7 | 51 | #elif defined ( __ICCARM__ ) |
<> | 144:ef7eb2e8f9f7 | 52 | |
<> | 144:ef7eb2e8f9f7 | 53 | #ifndef __ASM |
<> | 144:ef7eb2e8f9f7 | 54 | #define __ASM __asm /*!< asm keyword for IAR Compiler */ |
<> | 144:ef7eb2e8f9f7 | 55 | #endif |
<> | 144:ef7eb2e8f9f7 | 56 | |
<> | 144:ef7eb2e8f9f7 | 57 | #ifndef __INLINE |
<> | 144:ef7eb2e8f9f7 | 58 | #define __INLINE inline /*!< inline keyword for IAR Compiler. Only available in High optimization mode! */ |
<> | 144:ef7eb2e8f9f7 | 59 | #endif |
<> | 144:ef7eb2e8f9f7 | 60 | |
<> | 144:ef7eb2e8f9f7 | 61 | #ifndef __WEAK |
<> | 144:ef7eb2e8f9f7 | 62 | #define __WEAK __weak /*!> define weak function for IAR Compiler */ |
<> | 144:ef7eb2e8f9f7 | 63 | #endif |
<> | 144:ef7eb2e8f9f7 | 64 | |
<> | 144:ef7eb2e8f9f7 | 65 | #define GET_SP() __get_SP() /*!> read current SP function for IAR Compiler */ |
<> | 144:ef7eb2e8f9f7 | 66 | |
<> | 144:ef7eb2e8f9f7 | 67 | #elif defined ( __GNUC__ ) |
<> | 144:ef7eb2e8f9f7 | 68 | |
<> | 144:ef7eb2e8f9f7 | 69 | #ifndef __ASM |
<> | 144:ef7eb2e8f9f7 | 70 | #define __ASM __asm /*!< asm keyword for GNU Compiler */ |
<> | 144:ef7eb2e8f9f7 | 71 | #endif |
<> | 144:ef7eb2e8f9f7 | 72 | |
<> | 144:ef7eb2e8f9f7 | 73 | #ifndef __INLINE |
<> | 144:ef7eb2e8f9f7 | 74 | #define __INLINE inline /*!< inline keyword for GNU Compiler */ |
<> | 144:ef7eb2e8f9f7 | 75 | #endif |
<> | 144:ef7eb2e8f9f7 | 76 | |
<> | 144:ef7eb2e8f9f7 | 77 | #ifndef __WEAK |
<> | 144:ef7eb2e8f9f7 | 78 | #define __WEAK __attribute__((weak)) /*!< weak keyword for GNU Compiler */ |
<> | 144:ef7eb2e8f9f7 | 79 | #endif |
<> | 144:ef7eb2e8f9f7 | 80 | |
<> | 144:ef7eb2e8f9f7 | 81 | #define GET_SP() gcc_current_sp() /*!> read current SP function for GNU Compiler */ |
<> | 144:ef7eb2e8f9f7 | 82 | |
<> | 144:ef7eb2e8f9f7 | 83 | static inline unsigned int gcc_current_sp(void) |
<> | 144:ef7eb2e8f9f7 | 84 | { |
<> | 144:ef7eb2e8f9f7 | 85 | register unsigned sp asm("sp"); |
<> | 144:ef7eb2e8f9f7 | 86 | return sp; |
<> | 144:ef7eb2e8f9f7 | 87 | } |
<> | 144:ef7eb2e8f9f7 | 88 | |
<> | 144:ef7eb2e8f9f7 | 89 | #elif defined ( __TASKING__ ) |
<> | 144:ef7eb2e8f9f7 | 90 | |
<> | 144:ef7eb2e8f9f7 | 91 | #ifndef __ASM |
<> | 144:ef7eb2e8f9f7 | 92 | #define __ASM __asm /*!< asm keyword for TASKING Compiler */ |
<> | 144:ef7eb2e8f9f7 | 93 | #endif |
<> | 144:ef7eb2e8f9f7 | 94 | |
<> | 144:ef7eb2e8f9f7 | 95 | #ifndef __INLINE |
<> | 144:ef7eb2e8f9f7 | 96 | #define __INLINE inline /*!< inline keyword for TASKING Compiler */ |
<> | 144:ef7eb2e8f9f7 | 97 | #endif |
<> | 144:ef7eb2e8f9f7 | 98 | |
<> | 144:ef7eb2e8f9f7 | 99 | #ifndef __WEAK |
<> | 144:ef7eb2e8f9f7 | 100 | #define __WEAK __attribute__((weak)) /*!< weak keyword for TASKING Compiler */ |
<> | 144:ef7eb2e8f9f7 | 101 | #endif |
<> | 144:ef7eb2e8f9f7 | 102 | |
<> | 144:ef7eb2e8f9f7 | 103 | #define GET_SP() __get_MSP() /*!> read current SP function for TASKING Compiler */ |
<> | 144:ef7eb2e8f9f7 | 104 | |
<> | 144:ef7eb2e8f9f7 | 105 | #endif |
<> | 144:ef7eb2e8f9f7 | 106 | |
<> | 144:ef7eb2e8f9f7 | 107 | /*lint --flb "Leave library region" */ |
<> | 144:ef7eb2e8f9f7 | 108 | |
<> | 144:ef7eb2e8f9f7 | 109 | #endif |