project for nrf51822 qfab
Dependencies: eddystone_URL mbed
Fork of eddystone_URL by
nRF51822/nordic/nrf-sdk/s110/nrf_svc.h@5:267bdacf5508, 2017-11-23 (annotated)
- Committer:
- tridung141196
- Date:
- Thu Nov 23 15:38:48 2017 +0000
- Revision:
- 5:267bdacf5508
- Parent:
- 0:76dfa9657d9d
ibeacon
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jksoft | 0:76dfa9657d9d | 1 | #ifndef NRF_SVC__ |
jksoft | 0:76dfa9657d9d | 2 | #define NRF_SVC__ |
jksoft | 0:76dfa9657d9d | 3 | |
jksoft | 0:76dfa9657d9d | 4 | #ifdef SVCALL_AS_NORMAL_FUNCTION |
jksoft | 0:76dfa9657d9d | 5 | #define SVCALL(number, return_type, signature) return_type signature |
jksoft | 0:76dfa9657d9d | 6 | #else |
jksoft | 0:76dfa9657d9d | 7 | |
jksoft | 0:76dfa9657d9d | 8 | #ifndef SVCALL |
jksoft | 0:76dfa9657d9d | 9 | #if defined (__CC_ARM) |
jksoft | 0:76dfa9657d9d | 10 | #define SVCALL(number, return_type, signature) return_type __svc(number) signature |
jksoft | 0:76dfa9657d9d | 11 | #elif defined (__GNUC__) |
jksoft | 0:76dfa9657d9d | 12 | #define SVCALL(number, return_type, signature) \ |
jksoft | 0:76dfa9657d9d | 13 | _Pragma("GCC diagnostic ignored \"-Wreturn-type\"") \ |
jksoft | 0:76dfa9657d9d | 14 | _Pragma("GCC diagnostic ignored \"-Wunused-function\"") \ |
jksoft | 0:76dfa9657d9d | 15 | __attribute__((naked)) static return_type signature \ |
jksoft | 0:76dfa9657d9d | 16 | { \ |
jksoft | 0:76dfa9657d9d | 17 | __asm( \ |
jksoft | 0:76dfa9657d9d | 18 | "svc %0\n" \ |
jksoft | 0:76dfa9657d9d | 19 | "bx r14" : : "I" ((uint32_t)number) : "r0" \ |
jksoft | 0:76dfa9657d9d | 20 | ); \ |
jksoft | 0:76dfa9657d9d | 21 | } |
jksoft | 0:76dfa9657d9d | 22 | #elif defined (__ICCARM__) |
jksoft | 0:76dfa9657d9d | 23 | #define PRAGMA(x) _Pragma(#x) |
jksoft | 0:76dfa9657d9d | 24 | #define SVCALL(number, return_type, signature) \ |
jksoft | 0:76dfa9657d9d | 25 | PRAGMA(swi_number = number) \ |
jksoft | 0:76dfa9657d9d | 26 | __swi return_type signature; |
jksoft | 0:76dfa9657d9d | 27 | #else |
jksoft | 0:76dfa9657d9d | 28 | #define SVCALL(number, return_type, signature) return_type signature |
jksoft | 0:76dfa9657d9d | 29 | #endif |
jksoft | 0:76dfa9657d9d | 30 | #endif // SVCALL |
jksoft | 0:76dfa9657d9d | 31 | |
jksoft | 0:76dfa9657d9d | 32 | #endif // SVCALL_AS_NORMAL_FUNCTION |
jksoft | 0:76dfa9657d9d | 33 | #endif // NRF_SVC__ |