test
Fork of nrf51-sdk by
Embed:
(wiki syntax)
Show/hide line numbers
nrf_svc.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 00033 #ifndef NRF_SVC__ 00034 #define NRF_SVC__ 00035 00036 #ifdef SVCALL_AS_NORMAL_FUNCTION 00037 #define SVCALL(number, return_type, signature) return_type signature 00038 #else 00039 00040 #ifndef SVCALL 00041 #if defined (__CC_ARM) 00042 #define SVCALL(number, return_type, signature) return_type __svc(number) signature 00043 #elif defined (__GNUC__) 00044 #define SVCALL(number, return_type, signature) \ 00045 _Pragma("GCC diagnostic ignored \"-Wunused-function\"") \ 00046 _Pragma("GCC diagnostic ignored \"-Wunused-parameter\"") \ 00047 _Pragma("GCC diagnostic push") \ 00048 _Pragma("GCC diagnostic ignored \"-Wreturn-type\"") \ 00049 __attribute__((naked)) static return_type signature \ 00050 { \ 00051 __asm( \ 00052 "svc %0\n" \ 00053 "bx r14" : : "I" ((uint32_t) number) : "r0" \ 00054 ); \ 00055 } \ 00056 _Pragma("GCC diagnostic pop") 00057 #elif defined (__ICCARM__) 00058 #define PRAGMA(x) _Pragma(#x) 00059 #define SVCALL(number, return_type, signature) \ 00060 PRAGMA(swi_number = number) \ 00061 __swi return_type signature; 00062 #else 00063 #define SVCALL(number, return_type, signature) return_type signature 00064 #endif 00065 #endif // SVCALL 00066 00067 #endif // SVCALL_AS_NORMAL_FUNCTION 00068 #endif // NRF_SVC__
Generated on Tue Jul 12 2022 15:51:27 by 1.7.2