Nordic nrf51 sdk sources. Mirrored from https://github.com/ARMmbed/nrf51-sdk.

Dependents:   nRF51822 nRF51822

Committer:
vcoubard
Date:
Thu Apr 07 17:37:56 2016 +0100
Revision:
28:041dac1366b2
Parent:
21:d9932bd925d0
Child:
29:286940b7ee5a
Synchronized with git rev 012b8118
Author: Liyou Zhou
Pull in files from sdk 10.0

Who changed what in which revision?

UserRevisionLine numberNew contents of line
vcoubard 28:041dac1366b2 1 /*
vcoubard 28:041dac1366b2 2 * Copyright (c) Nordic Semiconductor ASA
vcoubard 28:041dac1366b2 3 * All rights reserved.
vcoubard 28:041dac1366b2 4 *
vcoubard 28:041dac1366b2 5 * Redistribution and use in source and binary forms, with or without modification,
vcoubard 28:041dac1366b2 6 * are permitted provided that the following conditions are met:
vcoubard 28:041dac1366b2 7 *
vcoubard 28:041dac1366b2 8 * 1. Redistributions of source code must retain the above copyright notice, this
vcoubard 28:041dac1366b2 9 * list of conditions and the following disclaimer.
vcoubard 28:041dac1366b2 10 *
vcoubard 28:041dac1366b2 11 * 2. Redistributions in binary form must reproduce the above copyright notice, this
vcoubard 28:041dac1366b2 12 * list of conditions and the following disclaimer in the documentation and/or
vcoubard 28:041dac1366b2 13 * other materials provided with the distribution.
vcoubard 28:041dac1366b2 14 *
vcoubard 28:041dac1366b2 15 * 3. Neither the name of Nordic Semiconductor ASA nor the names of other
vcoubard 28:041dac1366b2 16 * contributors to this software may be used to endorse or promote products
vcoubard 28:041dac1366b2 17 * derived from this software without specific prior written permission.
vcoubard 28:041dac1366b2 18 *
vcoubard 28:041dac1366b2 19 * 4. This software must only be used in a processor manufactured by Nordic
vcoubard 28:041dac1366b2 20 * Semiconductor ASA, or in a processor manufactured by a third party that
vcoubard 28:041dac1366b2 21 * is used in combination with a processor manufactured by Nordic Semiconductor.
vcoubard 28:041dac1366b2 22 *
vcoubard 28:041dac1366b2 23 *
vcoubard 28:041dac1366b2 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
vcoubard 28:041dac1366b2 25 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
vcoubard 28:041dac1366b2 26 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
vcoubard 28:041dac1366b2 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
vcoubard 28:041dac1366b2 28 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
vcoubard 28:041dac1366b2 29 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
vcoubard 28:041dac1366b2 30 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
vcoubard 28:041dac1366b2 31 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
vcoubard 28:041dac1366b2 32 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
vcoubard 28:041dac1366b2 33 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
vcoubard 28:041dac1366b2 34 *
vcoubard 1:ebc0e0ef0a11 35 */
vcoubard 1:ebc0e0ef0a11 36
vcoubard 1:ebc0e0ef0a11 37 #ifndef NRF_SVC__
vcoubard 1:ebc0e0ef0a11 38 #define NRF_SVC__
vcoubard 1:ebc0e0ef0a11 39
vcoubard 1:ebc0e0ef0a11 40 #ifdef SVCALL_AS_NORMAL_FUNCTION
vcoubard 1:ebc0e0ef0a11 41 #define SVCALL(number, return_type, signature) return_type signature
vcoubard 1:ebc0e0ef0a11 42 #else
vcoubard 1:ebc0e0ef0a11 43
vcoubard 1:ebc0e0ef0a11 44 #ifndef SVCALL
vcoubard 1:ebc0e0ef0a11 45 #if defined (__CC_ARM)
vcoubard 1:ebc0e0ef0a11 46 #define SVCALL(number, return_type, signature) return_type __svc(number) signature
vcoubard 1:ebc0e0ef0a11 47 #elif defined (__GNUC__)
vcoubard 1:ebc0e0ef0a11 48 #define SVCALL(number, return_type, signature) \
vcoubard 1:ebc0e0ef0a11 49 _Pragma("GCC diagnostic ignored \"-Wunused-function\"") \
vcoubard 1:ebc0e0ef0a11 50 _Pragma("GCC diagnostic push") \
vcoubard 1:ebc0e0ef0a11 51 _Pragma("GCC diagnostic ignored \"-Wreturn-type\"") \
vcoubard 1:ebc0e0ef0a11 52 __attribute__((naked)) static return_type signature \
vcoubard 1:ebc0e0ef0a11 53 { \
vcoubard 1:ebc0e0ef0a11 54 __asm( \
vcoubard 1:ebc0e0ef0a11 55 "svc %0\n" \
vcoubard 28:041dac1366b2 56 "bx r14" : : "I" (number) : "r0" \
vcoubard 1:ebc0e0ef0a11 57 ); \
vcoubard 1:ebc0e0ef0a11 58 } \
vcoubard 1:ebc0e0ef0a11 59 _Pragma("GCC diagnostic pop")
vcoubard 1:ebc0e0ef0a11 60 #elif defined (__ICCARM__)
vcoubard 1:ebc0e0ef0a11 61 #define PRAGMA(x) _Pragma(#x)
vcoubard 1:ebc0e0ef0a11 62 #define SVCALL(number, return_type, signature) \
vcoubard 1:ebc0e0ef0a11 63 PRAGMA(swi_number = number) \
vcoubard 1:ebc0e0ef0a11 64 __swi return_type signature;
vcoubard 1:ebc0e0ef0a11 65 #else
vcoubard 1:ebc0e0ef0a11 66 #define SVCALL(number, return_type, signature) return_type signature
vcoubard 1:ebc0e0ef0a11 67 #endif
vcoubard 1:ebc0e0ef0a11 68 #endif // SVCALL
vcoubard 1:ebc0e0ef0a11 69
vcoubard 1:ebc0e0ef0a11 70 #endif // SVCALL_AS_NORMAL_FUNCTION
vcoubard 1:ebc0e0ef0a11 71 #endif // NRF_SVC__