From 3acf0be23103de66108bcbe68b77fdb3002d86f7 Mon Sep 17 00:00:00 2001 From: Pavel Kirienko Date: Thu, 17 Apr 2014 12:53:50 +0400 Subject: [PATCH] LPC11C24: Removed compiler-dependent code --- libuavcan_drivers/lpc11c24/driver/src/can.cpp | 2 +- libuavcan_drivers/lpc11c24/driver/src/clock.cpp | 4 +++- libuavcan_drivers/lpc11c24/driver/src/internal.hpp | 4 ++-- .../lpc11c24/test_olimex_lpc_p11c24/src/main.cpp | 2 ++ 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/libuavcan_drivers/lpc11c24/driver/src/can.cpp b/libuavcan_drivers/lpc11c24/driver/src/can.cpp index 4d077a3381..43f00e77f2 100644 --- a/libuavcan_drivers/lpc11c24/driver/src/can.cpp +++ b/libuavcan_drivers/lpc11c24/driver/src/can.cpp @@ -314,7 +314,7 @@ uavcan::int16_t CanDriver::select(uavcan::CanSelectMasks& inout_masks, uavcan::M * break WFE every once in a while. */ #if !UAVCAN_LPC11C24_NO_WFE - asm volatile ("wfe"); + __WFE(); #endif } diff --git a/libuavcan_drivers/lpc11c24/driver/src/clock.cpp b/libuavcan_drivers/lpc11c24/driver/src/clock.cpp index c689154e54..164e2608ab 100644 --- a/libuavcan_drivers/lpc11c24/driver/src/clock.cpp +++ b/libuavcan_drivers/lpc11c24/driver/src/clock.cpp @@ -31,7 +31,9 @@ const int32_t MaxUtcSpeedCorrectionX16 = 100 * 16; } -__attribute((noreturn)) +#if __GNUC__ +__attribute__((noreturn)) +#endif void fail() { while (true) { } diff --git a/libuavcan_drivers/lpc11c24/driver/src/internal.hpp b/libuavcan_drivers/lpc11c24/driver/src/internal.hpp index 29a458bf08..3bcf0d82c8 100644 --- a/libuavcan_drivers/lpc11c24/driver/src/internal.hpp +++ b/libuavcan_drivers/lpc11c24/driver/src/internal.hpp @@ -17,11 +17,11 @@ struct CriticalSectionLocker { CriticalSectionLocker() { - __asm volatile ("cpsid i"); + __disable_irq(); } ~CriticalSectionLocker() { - __asm volatile ("cpsie i"); + __enable_irq(); } }; diff --git a/libuavcan_drivers/lpc11c24/test_olimex_lpc_p11c24/src/main.cpp b/libuavcan_drivers/lpc11c24/test_olimex_lpc_p11c24/src/main.cpp index a1c4c521c1..6cce7251ba 100644 --- a/libuavcan_drivers/lpc11c24/test_olimex_lpc_p11c24/src/main.cpp +++ b/libuavcan_drivers/lpc11c24/test_olimex_lpc_p11c24/src/main.cpp @@ -32,7 +32,9 @@ uavcan::Logger& getLogger() return logger; } +#if __GNUC__ __attribute__((noreturn)) +#endif void die() { while (true) { }