Birkbeck College Mobile and Ubiquitous Computing IoT Lab Exercise 2
Dependencies: BLE_API_Native_blog
Diff: mbed/TARGET_NRF51822/nrf_svc.h
- Revision:
- 0:e8fdba0ed044
diff -r 000000000000 -r e8fdba0ed044 mbed/TARGET_NRF51822/nrf_svc.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed/TARGET_NRF51822/nrf_svc.h Sat Mar 07 16:34:53 2015 +0000 @@ -0,0 +1,33 @@ +#ifndef NRF_SVC__ +#define NRF_SVC__ + +#ifdef SVCALL_AS_NORMAL_FUNCTION +#define SVCALL(number, return_type, signature) return_type signature +#else + +#ifndef SVCALL +#if defined (__CC_ARM) +#define SVCALL(number, return_type, signature) return_type __svc(number) signature +#elif defined (__GNUC__) +#define SVCALL(number, return_type, signature) \ + _Pragma("GCC diagnostic ignored \"-Wreturn-type\"") \ + _Pragma("GCC diagnostic ignored \"-Wunused-function\"") \ + __attribute__((naked)) static return_type signature \ + { \ + __asm( \ + "svc %0\n" \ + "bx r14" : : "I" (number) : "r0" \ + ); \ + } +#elif defined (__ICCARM__) +#define PRAGMA(x) _Pragma(#x) +#define SVCALL(number, return_type, signature) \ +PRAGMA(swi_number = number) \ + __swi return_type signature; +#else +#define SVCALL(number, return_type, signature) return_type signature +#endif +#endif // SVCALL + +#endif // SVCALL_AS_NORMAL_FUNCTION +#endif // NRF_SVC__