[rtems commit] riscv: Use wfi instruction for idle task

Sebastian Huber sebh at rtems.org
Wed Jul 25 08:11:41 UTC 2018


Module:    rtems
Branch:    master
Commit:    c2670deb496d2535bcdb67705b046530c8a6b49a
Changeset: http://git.rtems.org/rtems/commit/?id=c2670deb496d2535bcdb67705b046530c8a6b49a

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Fri Jul 20 09:07:40 2018 +0200

riscv: Use wfi instruction for idle task

Update #3433.

---

 cpukit/score/cpu/riscv/cpu.c                     |  5 +++--
 cpukit/score/cpu/riscv/include/rtems/score/cpu.h | 10 ----------
 2 files changed, 3 insertions(+), 12 deletions(-)

diff --git a/cpukit/score/cpu/riscv/cpu.c b/cpukit/score/cpu/riscv/cpu.c
index 64eef96..62150d4 100644
--- a/cpukit/score/cpu/riscv/cpu.c
+++ b/cpukit/score/cpu/riscv/cpu.c
@@ -204,8 +204,9 @@ uint32_t _CPU_ISR_Get_level( void )
 
 void *_CPU_Thread_Idle_body( uintptr_t ignored )
 {
-  do {
-  } while (1);
+  while ( true ) {
+    __asm__ volatile ( "wfi" );
+  }
 
   return NULL;
 }
diff --git a/cpukit/score/cpu/riscv/include/rtems/score/cpu.h b/cpukit/score/cpu/riscv/include/rtems/score/cpu.h
index 724385c..039595d 100644
--- a/cpukit/score/cpu/riscv/include/rtems/score/cpu.h
+++ b/cpukit/score/cpu/riscv/include/rtems/score/cpu.h
@@ -360,16 +360,6 @@ void _CPU_Initialize(
   void
 );
 
-/*
- *  _CPU_Thread_Idle_body
- *
- *  This routine is the CPU dependent IDLE thread body.
- *
- *  NOTE:  It need only be provided if CPU_PROVIDES_IDLE_THREAD_BODY
- *         is TRUE.
- *
- */
-
 void *_CPU_Thread_Idle_body( uintptr_t ignored );
 
 /*



More information about the vc mailing list