From d9bd5cd699ecad35e4319020db42d42f01871d4e Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Wed, 22 May 2013 09:54:34 +0200 Subject: arm: Add CPU specific idle thread for ARMv7 --- cpukit/score/cpu/arm/Makefile.am | 2 +- cpukit/score/cpu/arm/armv7-thread-idle.c | 36 +++++++++++++++++++++++++++++++ cpukit/score/cpu/arm/armv7m-thread-idle.c | 36 ------------------------------- cpukit/score/cpu/arm/rtems/score/arm.h | 6 ++++++ cpukit/score/cpu/arm/rtems/score/cpu.h | 2 +- 5 files changed, 44 insertions(+), 38 deletions(-) create mode 100644 cpukit/score/cpu/arm/armv7-thread-idle.c delete mode 100644 cpukit/score/cpu/arm/armv7m-thread-idle.c diff --git a/cpukit/score/cpu/arm/Makefile.am b/cpukit/score/cpu/arm/Makefile.am index 37ab9010fd..46ce58c1b5 100644 --- a/cpukit/score/cpu/arm/Makefile.am +++ b/cpukit/score/cpu/arm/Makefile.am @@ -25,6 +25,7 @@ libscorecpu_a_SOURCES += arm_exc_handler_high.c libscorecpu_a_SOURCES += arm-exception-frame-print.c libscorecpu_a_SOURCES += arm-exception-default.c libscorecpu_a_SOURCES += armv4-exception-default.S +libscorecpu_a_SOURCES += armv7-thread-idle.c libscorecpu_a_SOURCES += armv7m-context-initialize.c libscorecpu_a_SOURCES += armv7m-context-restore.c libscorecpu_a_SOURCES += armv7m-context-switch.c @@ -41,7 +42,6 @@ libscorecpu_a_SOURCES += armv7m-isr-level-get.c libscorecpu_a_SOURCES += armv7m-isr-level-set.c libscorecpu_a_SOURCES += armv7m-isr-vector-install.c libscorecpu_a_SOURCES += armv7m-multitasking-start-stop.c -libscorecpu_a_SOURCES += armv7m-thread-idle.c include $(srcdir)/preinstall.am include $(top_srcdir)/automake/local.am diff --git a/cpukit/score/cpu/arm/armv7-thread-idle.c b/cpukit/score/cpu/arm/armv7-thread-idle.c new file mode 100644 index 0000000000..7dfbc7feab --- /dev/null +++ b/cpukit/score/cpu/arm/armv7-thread-idle.c @@ -0,0 +1,36 @@ +/** + * @file + * + * @brief CPU Thread Idle Body + */ + +/* + * Copyright (c) 2012 embedded brains GmbH. All rights reserved. + * + * embedded brains GmbH + * Obere Lagerstr. 30 + * 82178 Puchheim + * Germany + * + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + */ + +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + +#include + +#ifdef ARM_MULTILIB_HAS_WFI + +void *_CPU_Thread_Idle_body( uintptr_t ignored ) +{ + while ( true ) { + __asm__ volatile ("wfi"); + } +} + +#endif /* ARM_MULTILIB_HAS_WFI */ diff --git a/cpukit/score/cpu/arm/armv7m-thread-idle.c b/cpukit/score/cpu/arm/armv7m-thread-idle.c deleted file mode 100644 index 52a3dbd179..0000000000 --- a/cpukit/score/cpu/arm/armv7m-thread-idle.c +++ /dev/null @@ -1,36 +0,0 @@ -/** - * @file - * - * @brief CPU Thread Idle Body - */ - -/* - * Copyright (c) 2012 embedded brains GmbH. All rights reserved. - * - * embedded brains GmbH - * Obere Lagerstr. 30 - * 82178 Puchheim - * Germany - * - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.com/license/LICENSE. - */ - -#ifdef HAVE_CONFIG_H - #include "config.h" -#endif - -#include - -#ifdef ARM_MULTILIB_ARCH_V7M - -void *_CPU_Thread_Idle_body( uintptr_t ignored ) -{ - while ( true ) { - __asm__ volatile ("wfi"); - } -} - -#endif /* ARM_MULTILIB_ARCH_V7M */ diff --git a/cpukit/score/cpu/arm/rtems/score/arm.h b/cpukit/score/cpu/arm/rtems/score/arm.h index fb0f98e4e8..0a3e7247f8 100644 --- a/cpukit/score/cpu/arm/rtems/score/arm.h +++ b/cpukit/score/cpu/arm/rtems/score/arm.h @@ -37,6 +37,12 @@ extern "C" { #define ARM_MULTILIB_ARCH_V4 #endif +#if defined(__ARM_ARCH_7A__) \ + || defined(__ARM_ARCH_7R__) \ + || defined(__ARM_ARCH_7M__) + #define ARM_MULTILIB_HAS_WFI +#endif + #if defined(__ARM_NEON__) #define ARM_MULTILIB_VFP_D32 #elif !defined(__SOFTFP__) diff --git a/cpukit/score/cpu/arm/rtems/score/cpu.h b/cpukit/score/cpu/arm/rtems/score/cpu.h index f00de7352f..e606146cb7 100644 --- a/cpukit/score/cpu/arm/rtems/score/cpu.h +++ b/cpukit/score/cpu/arm/rtems/score/cpu.h @@ -138,7 +138,7 @@ #define CPU_USE_DEFERRED_FP_SWITCH FALSE -#if defined(ARM_MULTILIB_ARCH_V7M) +#if defined(ARM_MULTILIB_HAS_WFI) #define CPU_PROVIDES_IDLE_THREAD_BODY TRUE #else #define CPU_PROVIDES_IDLE_THREAD_BODY FALSE -- cgit v1.2.3