Glimworm Beacons / nRF51822

Fork of nRF51822 by Nordic Semiconductor

Committer:
rgrover1
Date:
Fri Jun 19 15:55:15 2015 +0100
Revision:
189:1e947b3b7cd1
Parent:
188:d78aa4278638
Child:
190:a7de684dfded
Synchronized with git rev 9b4e3f11
Author: Rohit Grover
update to S130 alpha

Who changed what in which revision?

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