test
Fork of nRF51822 by
Embed:
(wiki syntax)
Show/hide line numbers
compiler_abstraction.h
00001 /* 00002 * Copyright (c) Nordic Semiconductor ASA 00003 * All rights reserved. 00004 * 00005 * Redistribution and use in source and binary forms, with or without modification, 00006 * are permitted provided that the following conditions are met: 00007 * 00008 * 1. Redistributions of source code must retain the above copyright notice, this 00009 * list of conditions and the following disclaimer. 00010 * 00011 * 2. Redistributions in binary form must reproduce the above copyright notice, this 00012 * list of conditions and the following disclaimer in the documentation and/or 00013 * other materials provided with the distribution. 00014 * 00015 * 3. Neither the name of Nordic Semiconductor ASA nor the names of other 00016 * contributors to this software may be used to endorse or promote products 00017 * derived from this software without specific prior written permission. 00018 * 00019 * 00020 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 00021 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 00022 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00023 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 00024 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 00025 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00026 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 00027 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00028 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00029 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00030 * 00031 */ 00032 #ifndef _COMPILER_ABSTRACTION_H 00033 #define _COMPILER_ABSTRACTION_H 00034 00035 /*lint ++flb "Enter library region" */ 00036 00037 #if defined ( __CC_ARM ) 00038 00039 #ifndef __ASM 00040 #define __ASM __asm /*!< asm keyword for ARM Compiler */ 00041 #endif 00042 00043 #ifndef __INLINE 00044 #define __INLINE __inline /*!< inline keyword for ARM Compiler */ 00045 #endif 00046 00047 #ifndef __WEAK 00048 #define __WEAK __weak /*!< weak keyword for ARM Compiler */ 00049 #endif 00050 00051 #define GET_SP() __current_sp() /*!> read current SP function for ARM Compiler */ 00052 00053 #elif defined ( __ICCARM__ ) 00054 00055 #ifndef __ASM 00056 #define __ASM __asm /*!< asm keyword for IAR Compiler */ 00057 #endif 00058 00059 #ifndef __INLINE 00060 #define __INLINE inline /*!< inline keyword for IAR Compiler. Only available in High optimization mode! */ 00061 #endif 00062 00063 #ifndef __WEAK 00064 #define __WEAK __weak /*!> define weak function for IAR Compiler */ 00065 #endif 00066 00067 #define GET_SP() __get_SP() /*!> read current SP function for IAR Compiler */ 00068 00069 #elif defined ( __GNUC__ ) 00070 00071 #ifndef __ASM 00072 #define __ASM __asm__ /*!< asm keyword for GNU Compiler */ 00073 #endif 00074 00075 #ifndef __INLINE 00076 #define __INLINE inline /*!< inline keyword for GNU Compiler */ 00077 #endif 00078 00079 #ifndef __WEAK 00080 #define __WEAK __attribute__((weak)) /*!< weak keyword for GNU Compiler */ 00081 #endif 00082 00083 #define GET_SP() gcc_current_sp() /*!> read current SP function for GNU Compiler */ 00084 00085 static inline unsigned int gcc_current_sp(void) 00086 { 00087 register unsigned sp __ASM("sp"); 00088 return sp; 00089 } 00090 00091 #elif defined ( __TASKING__ ) 00092 00093 #ifndef __ASM 00094 #define __ASM __asm /*!< asm keyword for TASKING Compiler */ 00095 #endif 00096 00097 #ifndef __INLINE 00098 #define __INLINE inline /*!< inline keyword for TASKING Compiler */ 00099 #endif 00100 00101 #ifndef __WEAK 00102 #define __WEAK __attribute__((weak)) /*!< weak keyword for TASKING Compiler */ 00103 #endif 00104 00105 #define GET_SP() __get_MSP() /*!> read current SP function for TASKING Compiler */ 00106 00107 #endif 00108 00109 /*lint --flb "Leave library region" */ 00110 00111 #endif
Generated on Tue Jul 12 2022 21:00:16 by 1.7.2