Oscar Ariza / nRF51822

Fork of nRF51822 by Nordic Semiconductor

Committer:
vcoubard
Date:
Mon Jan 11 10:29:13 2016 +0000
Revision:
608:e98331f1d6b5
Import nordic sdk from https://github.com/ARMmbed/nrf51-sdk.git#a0faa63aae1f6351ac36cd70f28ce037d6f4ae11

Who changed what in which revision?

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