mbed library
Fork of mbed by
TARGET_NRF51822/nrf_svc.h@80:8e73be2a2ac1, 2014-02-21 (annotated)
- Committer:
- emilmont
- Date:
- Fri Feb 21 12:21:39 2014 +0000
- Revision:
- 80:8e73be2a2ac1
First alpha release for the NRF51822 target (to be tested in the online IDE)
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
emilmont | 80:8e73be2a2ac1 | 1 | #ifndef NRF_SVC__ |
emilmont | 80:8e73be2a2ac1 | 2 | #define NRF_SVC__ |
emilmont | 80:8e73be2a2ac1 | 3 | |
emilmont | 80:8e73be2a2ac1 | 4 | #ifdef SVCALL_AS_NORMAL_FUNCTION |
emilmont | 80:8e73be2a2ac1 | 5 | #define SVCALL(number, return_type, signature) return_type signature |
emilmont | 80:8e73be2a2ac1 | 6 | #else |
emilmont | 80:8e73be2a2ac1 | 7 | |
emilmont | 80:8e73be2a2ac1 | 8 | #ifndef SVCALL |
emilmont | 80:8e73be2a2ac1 | 9 | #if defined (__CC_ARM) |
emilmont | 80:8e73be2a2ac1 | 10 | #define SVCALL(number, return_type, signature) return_type __svc(number) signature |
emilmont | 80:8e73be2a2ac1 | 11 | #elif defined (__GNUC__) |
emilmont | 80:8e73be2a2ac1 | 12 | #define SVCALL(number, return_type, signature) \ |
emilmont | 80:8e73be2a2ac1 | 13 | _Pragma("GCC diagnostic ignored \"-Wreturn-type\"") \ |
emilmont | 80:8e73be2a2ac1 | 14 | _Pragma("GCC diagnostic ignored \"-Wunused-function\"") \ |
emilmont | 80:8e73be2a2ac1 | 15 | __attribute__((naked)) static return_type signature \ |
emilmont | 80:8e73be2a2ac1 | 16 | { \ |
emilmont | 80:8e73be2a2ac1 | 17 | __asm( \ |
emilmont | 80:8e73be2a2ac1 | 18 | "svc %0\n" \ |
emilmont | 80:8e73be2a2ac1 | 19 | "bx r14" : : "I" (number) : "r0" \ |
emilmont | 80:8e73be2a2ac1 | 20 | ); \ |
emilmont | 80:8e73be2a2ac1 | 21 | } |
emilmont | 80:8e73be2a2ac1 | 22 | #elif defined (__ICCARM__) |
emilmont | 80:8e73be2a2ac1 | 23 | #define PRAGMA(x) _Pragma(#x) |
emilmont | 80:8e73be2a2ac1 | 24 | #define SVCALL(number, return_type, signature) \ |
emilmont | 80:8e73be2a2ac1 | 25 | PRAGMA(swi_number = number) \ |
emilmont | 80:8e73be2a2ac1 | 26 | __swi return_type signature; |
emilmont | 80:8e73be2a2ac1 | 27 | #else |
emilmont | 80:8e73be2a2ac1 | 28 | #define SVCALL(number, return_type, signature) return_type signature |
emilmont | 80:8e73be2a2ac1 | 29 | #endif |
emilmont | 80:8e73be2a2ac1 | 30 | #endif // SVCALL |
emilmont | 80:8e73be2a2ac1 | 31 | |
emilmont | 80:8e73be2a2ac1 | 32 | #endif // SVCALL_AS_NORMAL_FUNCTION |
emilmont | 80:8e73be2a2ac1 | 33 | #endif // NRF_SVC__ |