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