This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit 7134220ae256b651ce66765c9aa91c44a9008cfd
Author: Huang Qi <[email protected]>
AuthorDate: Thu Feb 10 11:04:14 2022 +0800

    risc-v: Remove duplicated up_idle logic
    
    Signed-off-by: Huang Qi <[email protected]>
---
 arch/risc-v/src/bl602/Make.defs        |  3 +-
 arch/risc-v/src/bl602/bl602_idle.c     | 67 ---------------------------------
 arch/risc-v/src/c906/Make.defs         |  4 +-
 arch/risc-v/src/c906/c906_idle.c       | 65 --------------------------------
 arch/risc-v/src/fe310/Make.defs        |  3 +-
 arch/risc-v/src/k210/Make.defs         |  4 +-
 arch/risc-v/src/k210/k210_idle.c       | 65 --------------------------------
 arch/risc-v/src/litex/Make.defs        |  3 +-
 arch/risc-v/src/litex/litex_idle.c     | 67 ---------------------------------
 arch/risc-v/src/mpfs/Make.defs         |  3 +-
 arch/risc-v/src/mpfs/mpfs_idle.c       | 65 --------------------------------
 arch/risc-v/src/qemu-rv/Make.defs      |  3 +-
 arch/risc-v/src/qemu-rv/qemu_rv_idle.c | 69 ----------------------------------
 arch/risc-v/src/rv32m1/Make.defs       |  3 +-
 arch/risc-v/src/rv32m1/rv32m1_idle.c   | 69 ----------------------------------
 15 files changed, 16 insertions(+), 477 deletions(-)

diff --git a/arch/risc-v/src/bl602/Make.defs b/arch/risc-v/src/bl602/Make.defs
index 435c712..5d929ff 100644
--- a/arch/risc-v/src/bl602/Make.defs
+++ b/arch/risc-v/src/bl602/Make.defs
@@ -33,6 +33,7 @@ CMN_CSRCS += riscv_interruptcontext.c riscv_modifyreg32.c 
riscv_puts.c riscv_mde
 CMN_CSRCS += riscv_releasepending.c riscv_reprioritizertr.c 
riscv_copyfullstate.c
 CMN_CSRCS += riscv_releasestack.c riscv_stackframe.c riscv_schedulesigaction.c
 CMN_CSRCS += riscv_sigdeliver.c riscv_udelay.c riscv_unblocktask.c 
riscv_usestack.c
+CMN_CSRCS += riscv_idle.c
 
 ifeq ($(CONFIG_SCHED_BACKTRACE),y)
 CMN_CSRCS += riscv_backtrace.c
@@ -52,7 +53,7 @@ endif
 
 # Specify our C code within this directory to be included
 CHIP_CSRCS  = bl602_allocateheap.c
-CHIP_CSRCS += bl602_idle.c bl602_irq.c bl602_irq_dispatch.c
+CHIP_CSRCS += bl602_irq.c bl602_irq_dispatch.c
 CHIP_CSRCS += bl602_serial.c bl602_lowputc.c bl602_tim.c
 CHIP_CSRCS += bl602_start.c bl602_timerisr.c bl602_efuse.c
 CHIP_CSRCS += bl602_os_hal.c
diff --git a/arch/risc-v/src/bl602/bl602_idle.c 
b/arch/risc-v/src/bl602/bl602_idle.c
deleted file mode 100644
index f860773..0000000
--- a/arch/risc-v/src/bl602/bl602_idle.c
+++ /dev/null
@@ -1,67 +0,0 @@
-/****************************************************************************
- * arch/risc-v/src/bl602/bl602_idle.c
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.  The
- * ASF licenses this file to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the
- * License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
- * License for the specific language governing permissions and limitations
- * under the License.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include <nuttx/config.h>
-#include <nuttx/irq.h>
-#include <nuttx/arch.h>
-#include <nuttx/board.h>
-#include <arch/board/board.h>
-
-#include "riscv_internal.h"
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: up_idle
- *
- * Description:
- *   up_idle() is the logic that will be executed when their is no other
- *   ready-to-run task.  This is processor idle time and will continue until
- *   some interrupt occurs to cause a context switch from the idle task.
- *
- *   Processing in this state may be processor-specific. e.g., this is where
- *   power management operations might be performed.
- *
- ****************************************************************************/
-
-void up_idle(void)
-{
-#if defined(CONFIG_SUPPRESS_INTERRUPTS) || defined(CONFIG_SUPPRESS_TIMER_INTS)
-  /* If the system is idle and there are no timer interrupts, then process
-   * "fake" timer interrupts. Hopefully, something will wake up.
-   */
-
-  nxsched_process_timer();
-#else
-
-  /* This would be an appropriate place to put some MCU-specific logic to
-   * sleep in a reduced power mode until an interrupt occurs to save power
-   */
-
-  asm("WFI");
-
-#endif
-}
diff --git a/arch/risc-v/src/c906/Make.defs b/arch/risc-v/src/c906/Make.defs
index f2a982e..7310719 100644
--- a/arch/risc-v/src/c906/Make.defs
+++ b/arch/risc-v/src/c906/Make.defs
@@ -33,7 +33,7 @@ CMN_CSRCS += riscv_interruptcontext.c riscv_modifyreg32.c 
riscv_puts.c
 CMN_CSRCS += riscv_releasepending.c riscv_reprioritizertr.c
 CMN_CSRCS += riscv_releasestack.c riscv_stackframe.c riscv_schedulesigaction.c
 CMN_CSRCS += riscv_sigdeliver.c riscv_unblocktask.c riscv_usestack.c
-CMN_CSRCS += riscv_mdelay.c riscv_copyfullstate.c
+CMN_CSRCS += riscv_mdelay.c riscv_copyfullstate.c riscv_idle.c
 
 ifeq ($(CONFIG_SCHED_BACKTRACE),y)
 CMN_CSRCS += riscv_backtrace.c
@@ -53,7 +53,7 @@ endif
 
 # Specify our C code within this directory to be included
 CHIP_CSRCS  = c906_allocateheap.c c906_clockconfig.c
-CHIP_CSRCS += c906_idle.c c906_irq.c c906_irq_dispatch.c
+CHIP_CSRCS += c906_irq.c c906_irq_dispatch.c
 CHIP_CSRCS += c906_lowputc.c c906_serial.c
 CHIP_CSRCS += c906_start.c c906_timerisr.c
 
diff --git a/arch/risc-v/src/c906/c906_idle.c b/arch/risc-v/src/c906/c906_idle.c
deleted file mode 100644
index f0e6ac9..0000000
--- a/arch/risc-v/src/c906/c906_idle.c
+++ /dev/null
@@ -1,65 +0,0 @@
-/****************************************************************************
- * arch/risc-v/src/c906/c906_idle.c
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.  The
- * ASF licenses this file to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the
- * License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
- * License for the specific language governing permissions and limitations
- * under the License.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include <nuttx/config.h>
-#include <nuttx/irq.h>
-#include <nuttx/arch.h>
-
-#include "riscv_internal.h"
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: up_idle
- *
- * Description:
- *   up_idle() is the logic that will be executed when their is no other
- *   ready-to-run task.  This is processor idle time and will continue until
- *   some interrupt occurs to cause a context switch from the idle task.
- *
- *   Processing in this state may be processor-specific. e.g., this is where
- *   power management operations might be performed.
- *
- ****************************************************************************/
-
-void up_idle(void)
-{
-#if defined(CONFIG_SUPPRESS_INTERRUPTS) || defined(CONFIG_SUPPRESS_TIMER_INTS)
-  /* If the system is idle and there are no timer interrupts, then process
-   * "fake" timer interrupts. Hopefully, something will wake up.
-   */
-
-  nxsched_process_timer();
-#else
-
-  /* This would be an appropriate place to put some MCU-specific logic to
-   * sleep in a reduced power mode until an interrupt occurs to save power
-   */
-
-  asm("WFI");
-
-#endif
-}
diff --git a/arch/risc-v/src/fe310/Make.defs b/arch/risc-v/src/fe310/Make.defs
index 668feeb..ac1a896 100644
--- a/arch/risc-v/src/fe310/Make.defs
+++ b/arch/risc-v/src/fe310/Make.defs
@@ -33,6 +33,7 @@ CMN_CSRCS += riscv_interruptcontext.c riscv_modifyreg32.c 
riscv_puts.c riscv_mde
 CMN_CSRCS += riscv_releasepending.c riscv_reprioritizertr.c 
riscv_copyfullstate.c
 CMN_CSRCS += riscv_releasestack.c riscv_stackframe.c riscv_schedulesigaction.c
 CMN_CSRCS += riscv_sigdeliver.c riscv_udelay.c riscv_unblocktask.c 
riscv_usestack.c
+CMN_CSRCS += riscv_idle.c
 
 ifeq ($(CONFIG_SCHED_BACKTRACE),y)
 CMN_CSRCS += riscv_backtrace.c
@@ -48,6 +49,6 @@ endif
 
 # Specify our C code within this directory to be included
 CHIP_CSRCS  = fe310_allocateheap.c fe310_clockconfig.c fe310_gpio.c
-CHIP_CSRCS += fe310_idle.c fe310_irq.c fe310_irq_dispatch.c
+CHIP_CSRCS += fe310_irq.c fe310_irq_dispatch.c
 CHIP_CSRCS += fe310_lowputc.c fe310_serial.c
 CHIP_CSRCS += fe310_start.c fe310_timerisr.c
diff --git a/arch/risc-v/src/k210/Make.defs b/arch/risc-v/src/k210/Make.defs
index 05ff580..ee76998 100644
--- a/arch/risc-v/src/k210/Make.defs
+++ b/arch/risc-v/src/k210/Make.defs
@@ -33,7 +33,7 @@ CMN_CSRCS += riscv_interruptcontext.c riscv_modifyreg32.c 
riscv_puts.c
 CMN_CSRCS += riscv_releasepending.c riscv_reprioritizertr.c
 CMN_CSRCS += riscv_releasestack.c riscv_stackframe.c riscv_schedulesigaction.c
 CMN_CSRCS += riscv_sigdeliver.c riscv_unblocktask.c riscv_usestack.c
-CMN_CSRCS += riscv_mdelay.c riscv_copyfullstate.c
+CMN_CSRCS += riscv_mdelay.c riscv_copyfullstate.c riscv_idle.c
 
 ifeq ($(CONFIG_SMP), y)
 CMN_CSRCS += riscv_cpuindex.c riscv_cpupause.c riscv_cpustart.c
@@ -53,7 +53,7 @@ endif
 
 # Specify our C code within this directory to be included
 CHIP_CSRCS  = k210_allocateheap.c k210_clockconfig.c
-CHIP_CSRCS += k210_idle.c k210_irq.c k210_irq_dispatch.c
+CHIP_CSRCS += k210_irq.c k210_irq_dispatch.c
 CHIP_CSRCS += k210_lowputc.c k210_serial.c k210_fpioa.c
 CHIP_CSRCS += k210_start.c k210_timerisr.c k210_gpiohs.c
 
diff --git a/arch/risc-v/src/k210/k210_idle.c b/arch/risc-v/src/k210/k210_idle.c
deleted file mode 100644
index 37de430..0000000
--- a/arch/risc-v/src/k210/k210_idle.c
+++ /dev/null
@@ -1,65 +0,0 @@
-/****************************************************************************
- * arch/risc-v/src/k210/k210_idle.c
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.  The
- * ASF licenses this file to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the
- * License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
- * License for the specific language governing permissions and limitations
- * under the License.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include <nuttx/config.h>
-#include <nuttx/irq.h>
-#include <nuttx/arch.h>
-
-#include "riscv_internal.h"
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: up_idle
- *
- * Description:
- *   up_idle() is the logic that will be executed when there is no other
- *   ready-to-run task.  This is processor idle time and will continue until
- *   some interrupt occurs to cause a context switch from the idle task.
- *
- *   Processing in this state may be processor-specific. e.g., this is where
- *   power management operations might be performed.
- *
- ****************************************************************************/
-
-void up_idle(void)
-{
-#if defined(CONFIG_SUPPRESS_INTERRUPTS) || defined(CONFIG_SUPPRESS_TIMER_INTS)
-  /* If the system is idle and there are no timer interrupts, then process
-   * "fake" timer interrupts. Hopefully, something will wake up.
-   */
-
-  nxsched_process_timer();
-#else
-
-  /* This would be an appropriate place to put some MCU-specific logic to
-   * sleep in a reduced power mode until an interrupt occurs to save power
-   */
-
-  asm("WFI");
-
-#endif
-}
diff --git a/arch/risc-v/src/litex/Make.defs b/arch/risc-v/src/litex/Make.defs
index 3a1a812..fe27e78 100644
--- a/arch/risc-v/src/litex/Make.defs
+++ b/arch/risc-v/src/litex/Make.defs
@@ -33,6 +33,7 @@ CMN_CSRCS += riscv_interruptcontext.c riscv_modifyreg32.c 
riscv_puts.c riscv_mde
 CMN_CSRCS += riscv_releasepending.c riscv_reprioritizertr.c 
riscv_copyfullstate.c
 CMN_CSRCS += riscv_releasestack.c riscv_stackframe.c riscv_schedulesigaction.c
 CMN_CSRCS += riscv_sigdeliver.c riscv_udelay.c riscv_unblocktask.c 
riscv_usestack.c
+CMN_CSRCS += riscv_idle.c
 
 ifeq ($(CONFIG_SCHED_BACKTRACE),y)
 CMN_CSRCS += riscv_backtrace.c
@@ -48,6 +49,6 @@ endif
 
 # Specify our C code within this directory to be included
 CHIP_CSRCS  = litex_allocateheap.c litex_clockconfig.c
-CHIP_CSRCS += litex_idle.c litex_irq.c litex_irq_dispatch.c
+CHIP_CSRCS += litex_irq.c litex_irq_dispatch.c
 CHIP_CSRCS += litex_lowputc.c litex_serial.c
 CHIP_CSRCS += litex_start.c litex_timerisr.c
diff --git a/arch/risc-v/src/litex/litex_idle.c 
b/arch/risc-v/src/litex/litex_idle.c
deleted file mode 100644
index e551dea..0000000
--- a/arch/risc-v/src/litex/litex_idle.c
+++ /dev/null
@@ -1,67 +0,0 @@
-/****************************************************************************
- * arch/risc-v/src/litex/litex_idle.c
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.  The
- * ASF licenses this file to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the
- * License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
- * License for the specific language governing permissions and limitations
- * under the License.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include <nuttx/config.h>
-#include <nuttx/irq.h>
-#include <nuttx/arch.h>
-#include <nuttx/board.h>
-#include <arch/board/board.h>
-
-#include "riscv_internal.h"
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: up_idle
- *
- * Description:
- *   up_idle() is the logic that will be executed when there is no other
- *   ready-to-run task.  This is processor idle time and will continue until
- *   some interrupt occurs to cause a context switch from the idle task.
- *
- *   Processing in this state may be processor-specific. e.g., this is where
- *   power management operations might be performed.
- *
- ****************************************************************************/
-
-void up_idle(void)
-{
-#if defined(CONFIG_SUPPRESS_INTERRUPTS) || defined(CONFIG_SUPPRESS_TIMER_INTS)
-  /* If the system is idle and there are no timer interrupts, then process
-   * "fake" timer interrupts. Hopefully, something will wake up.
-   */
-
-  nxsched_process_timer();
-#else
-
-  /* This would be an appropriate place to put some MCU-specific logic to
-   * sleep in a reduced power mode until an interrupt occurs to save power
-   */
-
-  asm("WFI");
-
-#endif
-}
diff --git a/arch/risc-v/src/mpfs/Make.defs b/arch/risc-v/src/mpfs/Make.defs
index 83b0e16..5105222 100755
--- a/arch/risc-v/src/mpfs/Make.defs
+++ b/arch/risc-v/src/mpfs/Make.defs
@@ -31,6 +31,7 @@ CMN_CSRCS += riscv_releasepending.c riscv_reprioritizertr.c
 CMN_CSRCS += riscv_releasestack.c riscv_stackframe.c riscv_schedulesigaction.c
 CMN_CSRCS += riscv_sigdeliver.c riscv_unblocktask.c riscv_usestack.c
 CMN_CSRCS += riscv_mdelay.c riscv_udelay.c riscv_copyfullstate.c
+CMN_CSRCS += riscv_idle.c
 
 ifeq ($(CONFIG_SCHED_BACKTRACE),y)
 CMN_CSRCS += riscv_backtrace.c
@@ -50,7 +51,7 @@ endif
 
 # Specify our C code within this directory to be included
 CHIP_CSRCS  = mpfs_allocateheap.c mpfs_clockconfig.c
-CHIP_CSRCS += mpfs_idle.c mpfs_irq.c mpfs_irq_dispatch.c
+CHIP_CSRCS += mpfs_irq.c mpfs_irq_dispatch.c
 CHIP_CSRCS += mpfs_lowputc.c mpfs_serial.c
 CHIP_CSRCS += mpfs_start.c mpfs_timerisr.c
 CHIP_CSRCS += mpfs_gpio.c mpfs_systemreset.c
diff --git a/arch/risc-v/src/mpfs/mpfs_idle.c b/arch/risc-v/src/mpfs/mpfs_idle.c
deleted file mode 100755
index 53960bb..0000000
--- a/arch/risc-v/src/mpfs/mpfs_idle.c
+++ /dev/null
@@ -1,65 +0,0 @@
-/****************************************************************************
- * arch/risc-v/src/mpfs/mpfs_idle.c
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.  The
- * ASF licenses this file to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the
- * License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
- * License for the specific language governing permissions and limitations
- * under the License.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include <nuttx/config.h>
-#include <nuttx/irq.h>
-#include <nuttx/arch.h>
-
-#include "riscv_internal.h"
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: up_idle
- *
- * Description:
- *   up_idle() is the logic that will be executed when their is no other
- *   ready-to-run task.  This is processor idle time and will continue until
- *   some interrupt occurs to cause a context switch from the idle task.
- *
- *   Processing in this state may be processor-specific. e.g., this is where
- *   power management operations might be performed.
- *
- ****************************************************************************/
-
-void up_idle(void)
-{
-#if defined(CONFIG_SUPPRESS_INTERRUPTS) || defined(CONFIG_SUPPRESS_TIMER_INTS)
-  /* If the system is idle and there are no timer interrupts, then process
-   * "fake" timer interrupts. Hopefully, something will wake up.
-   */
-
-  nxsched_process_timer();
-#else
-
-  /* This would be an appropriate place to put some MCU-specific logic to
-   * sleep in a reduced power mode until an interrupt occurs to save power
-   */
-
-  asm("WFI");
-
-#endif
-}
diff --git a/arch/risc-v/src/qemu-rv/Make.defs 
b/arch/risc-v/src/qemu-rv/Make.defs
index ba5f9c8..fef6a8f 100644
--- a/arch/risc-v/src/qemu-rv/Make.defs
+++ b/arch/risc-v/src/qemu-rv/Make.defs
@@ -33,6 +33,7 @@ CMN_CSRCS += riscv_interruptcontext.c riscv_modifyreg32.c 
riscv_puts.c
 CMN_CSRCS += riscv_releasepending.c riscv_reprioritizertr.c 
riscv_copyfullstate.c
 CMN_CSRCS += riscv_releasestack.c riscv_stackframe.c riscv_schedulesigaction.c
 CMN_CSRCS += riscv_sigdeliver.c riscv_unblocktask.c riscv_usestack.c
+CMN_CSRCS += riscv_idle.c
 
 ifeq ($(CONFIG_SCHED_BACKTRACE),y)
 CMN_CSRCS += riscv_backtrace.c
@@ -60,4 +61,4 @@ endif
 
 # Specify our C code within this directory to be included
 CHIP_CSRCS  = qemu_rv_start.c qemu_rv_irq_dispatch.c qemu_rv_irq.c
-CHIP_CSRCS += qemu_rv_idle.c qemu_rv_timerisr.c
+CHIP_CSRCS += qemu_rv_timerisr.c
diff --git a/arch/risc-v/src/qemu-rv/qemu_rv_idle.c 
b/arch/risc-v/src/qemu-rv/qemu_rv_idle.c
deleted file mode 100644
index be63b64..0000000
--- a/arch/risc-v/src/qemu-rv/qemu_rv_idle.c
+++ /dev/null
@@ -1,69 +0,0 @@
-/****************************************************************************
- * arch/risc-v/src/qemu-rv/qemu_rv_idle.c
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.  The
- * ASF licenses this file to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the
- * License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
- * License for the specific language governing permissions and limitations
- * under the License.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include <nuttx/config.h>
-#include <nuttx/irq.h>
-#include <nuttx/arch.h>
-#include <nuttx/board.h>
-#include <arch/board/board.h>
-
-#include "riscv_internal.h"
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: up_idle
- *
- * Description:
- *   up_idle() is the logic that will be executed when there is no other
- *   ready-to-run task.  This is processor idle time and will continue until
- *   some interrupt occurs to cause a context switch from the idle task.
- *
- *   Processing in this state may be processor-specific. e.g., this is where
- *   power management operations might be performed.
- *
- ****************************************************************************/
-
-void up_idle(void)
-{
-#if defined(CONFIG_SUPPRESS_INTERRUPTS) || defined(CONFIG_SUPPRESS_TIMER_INTS)
-  /* If the system is idle and there are no timer interrupts, then process
-   * "fake" timer interrupts. Hopefully, something will wake up.
-   */
-
-  nxsched_process_timer();
-#else
-
-  board_autoled_off(LED_CPU);
-
-  /* This would be an appropriate place to put some MCU-specific logic to
-   * sleep in a reduced power mode until an interrupt occurs to save power
-   */
-
-  asm("WFI");
-
-#endif
-}
diff --git a/arch/risc-v/src/rv32m1/Make.defs b/arch/risc-v/src/rv32m1/Make.defs
index d65ef33..db11bb5 100644
--- a/arch/risc-v/src/rv32m1/Make.defs
+++ b/arch/risc-v/src/rv32m1/Make.defs
@@ -33,6 +33,7 @@ CMN_CSRCS += riscv_interruptcontext.c riscv_modifyreg32.c 
riscv_puts.c
 CMN_CSRCS += riscv_releasepending.c riscv_reprioritizertr.c 
riscv_copyfullstate.c
 CMN_CSRCS += riscv_releasestack.c riscv_stackframe.c riscv_schedulesigaction.c
 CMN_CSRCS += riscv_sigdeliver.c riscv_unblocktask.c riscv_usestack.c
+CMN_CSRCS += riscv_idle.c
 
 ifeq ($(CONFIG_SCHED_BACKTRACE),y)
 CMN_CSRCS += riscv_backtrace.c
@@ -48,7 +49,7 @@ endif
 
 # Specify our C code within this directory to be included
 CHIP_CSRCS  = rv32m1_allocateheap.c rv32m1_clockconfig.c rv32m1_gpio.c
-CHIP_CSRCS += rv32m1_idle.c rv32m1_irq.c rv32m1_irq_dispatch.c
+CHIP_CSRCS += rv32m1_irq.c rv32m1_irq_dispatch.c
 CHIP_CSRCS += rv32m1_lowputc.c rv32m1_serial.c
 CHIP_CSRCS += rv32m1_start.c rv32m1_timerisr.c
 CHIP_CSRCS += rv32m1_pcc.c
diff --git a/arch/risc-v/src/rv32m1/rv32m1_idle.c 
b/arch/risc-v/src/rv32m1/rv32m1_idle.c
deleted file mode 100644
index cb29886..0000000
--- a/arch/risc-v/src/rv32m1/rv32m1_idle.c
+++ /dev/null
@@ -1,69 +0,0 @@
-/****************************************************************************
- * arch/risc-v/src/rv32m1/rv32m1_idle.c
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.  The
- * ASF licenses this file to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the
- * License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
- * License for the specific language governing permissions and limitations
- * under the License.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include <nuttx/config.h>
-#include <nuttx/irq.h>
-#include <nuttx/arch.h>
-#include <nuttx/board.h>
-#include <arch/board/board.h>
-
-#include "riscv_internal.h"
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: up_idle
- *
- * Description:
- *   up_idle() is the logic that will be executed when there is no other
- *   ready-to-run task.  This is processor idle time and will continue until
- *   some interrupt occurs to cause a context switch from the idle task.
- *
- *   Processing in this state may be processor-specific. e.g., this is where
- *   power management operations might be performed.
- *
- ****************************************************************************/
-
-void up_idle(void)
-{
-#if defined(CONFIG_SUPPRESS_INTERRUPTS) || defined(CONFIG_SUPPRESS_TIMER_INTS)
-  /* If the system is idle and there are no timer interrupts, then process
-   * "fake" timer interrupts. Hopefully, something will wake up.
-   */
-
-  nxsched_process_timer();
-#else
-
-  board_autoled_off(LED_CPU);
-
-  /* This would be an appropriate place to put some MCU-specific logic to
-   * sleep in a reduced power mode until an interrupt occurs to save power
-   */
-
-  asm("WFI");
-
-#endif
-}

Reply via email to