You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ma...@apache.org on 2022/11/22 06:29:09 UTC
[incubator-nuttx] 03/03: nuttx/sched: move reprioritize process to public function
This is an automated email from the ASF dual-hosted git repository.
masayuki pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
commit 5c1b518314b13c1e151e7f26a65abea1f92d1534
Author: zhangyuan21 <zh...@xiaomi.com>
AuthorDate: Tue Nov 15 10:05:50 2022 +0800
nuttx/sched: move reprioritize process to public function
---
Documentation/reference/os/arch.rst | 18 ---
arch/arm/src/common/Make.defs | 2 +-
arch/arm/src/common/arm_reprioritizertr.c | 175 ---------------------
arch/arm64/src/common/Make.defs | 2 +-
arch/arm64/src/common/arm64_reprioritizertr.c | 173 ---------------------
arch/avr/src/at32uc3/Make.defs | 2 +-
arch/avr/src/at90usb/Make.defs | 2 +-
arch/avr/src/atmega/Make.defs | 2 +-
arch/avr/src/avr/up_reprioritizertr.c | 172 ---------------------
arch/avr/src/avr32/up_reprioritizertr.c | 186 ----------------------
arch/ceva/src/common/up_reprioritizertr.c | 170 ---------------------
arch/hc/src/common/up_reprioritizertr.c | 183 ----------------------
arch/hc/src/m9s12/Make.defs | 2 +-
arch/mips/src/mips32/mips_reprioritizertr.c | 178 ---------------------
arch/mips/src/pic32mx/Make.defs | 2 +-
arch/mips/src/pic32mz/Make.defs | 2 +-
arch/misoc/src/lm32/Make.defs | 2 +-
arch/misoc/src/lm32/lm32_reprioritizertr.c | 179 ----------------------
arch/misoc/src/minerva/Make.defs | 2 +-
arch/misoc/src/minerva/minerva_reprioritizertr.c | 178 ---------------------
arch/or1k/src/common/up_reprioritizertr.c | 183 ----------------------
arch/or1k/src/mor1kx/Make.defs | 1 -
arch/renesas/src/common/up_reprioritizertr.c | 183 ----------------------
arch/renesas/src/m16c/Make.defs | 2 +-
arch/renesas/src/rx65n/Make.defs | 2 +-
arch/renesas/src/sh1/Make.defs | 2 +-
arch/risc-v/src/common/Make.defs | 2 +-
arch/risc-v/src/common/riscv_reprioritizertr.c | 179 ----------------------
arch/sim/src/Makefile | 2 +-
arch/sim/src/sim/up_reprioritizertr.c | 168 --------------------
arch/sparc/src/common/Make.defs | 2 +-
arch/sparc/src/sparc_v8/up_reprioritizertr.c | 175 ---------------------
arch/x86/src/common/up_reprioritizertr.c | 183 ----------------------
arch/x86/src/qemu/Make.defs | 2 +-
arch/x86_64/src/common/up_reprioritizertr.c | 185 ----------------------
arch/x86_64/src/intel64/Make.defs | 2 +-
arch/xtensa/src/common/Make.defs | 2 +-
arch/xtensa/src/common/xtensa_reprioritizertr.c | 177 ---------------------
arch/z16/src/common/z16_reprioritizertr.c | 175 ---------------------
arch/z16/src/z16f/Make.defs | 2 +-
arch/z80/src/common/z80_reprioritizertr.c | 187 -----------------------
arch/z80/src/ez80/Make.defs | 2 +-
arch/z80/src/z180/Make.defs | 2 +-
arch/z80/src/z8/Make.defs | 2 +-
arch/z80/src/z80/Make.defs | 2 +-
include/nuttx/arch.h | 25 ---
sched/sched/Make.defs | 2 +-
sched/sched/sched.h | 1 +
sched/sched/sched_reprioritizertr.c | 91 +++++++++++
sched/sched/sched_roundrobin.c | 7 +-
sched/sched/sched_setpriority.c | 12 +-
51 files changed, 133 insertions(+), 3461 deletions(-)
diff --git a/Documentation/reference/os/arch.rst b/Documentation/reference/os/arch.rst
index 627f6a1af7..4db8f49644 100644
--- a/Documentation/reference/os/arch.rst
+++ b/Documentation/reference/os/arch.rst
@@ -211,24 +211,6 @@ APIs Exported by Architecture-Specific Logic to NuttX
pre-emption is re-enabled. Interrupts will always be disabled when
this function is called.
-.. c:function:: void up_reprioritize_rtr(FAR struct tcb_s *tcb, uint8_t priority)
-
- Called when the priority of a running or
- ready-to-run task changes and the reprioritization will cause a
- context switch. Two cases:
-
- #. The priority of the currently running task drops and the next
- task in the ready to run list has priority.
- #. An idle, ready to run task's priority has been raised above the
- the priority of the current, running task and it now has the
- priority.
-
- This function is called only from the NuttX scheduling logic.
- Interrupts will always be disabled when this function is called.
-
- :param tcb: The TCB of the task that has been reprioritized
- :param priority: The new task priority
-
.. c:macro:: noreturn_function
.. c:function:: void up_exit(int status) noreturn_function;
diff --git a/arch/arm/src/common/Make.defs b/arch/arm/src/common/Make.defs
index 1bbc155cd0..c20e7a137e 100644
--- a/arch/arm/src/common/Make.defs
+++ b/arch/arm/src/common/Make.defs
@@ -25,7 +25,7 @@ CMN_CSRCS += arm_createstack.c arm_exit.c
CMN_CSRCS += arm_initialize.c arm_lowputs.c
CMN_CSRCS += arm_modifyreg16.c arm_modifyreg32.c
CMN_CSRCS += arm_modifyreg8.c arm_nputs.c arm_releasepending.c
-CMN_CSRCS += arm_releasestack.c arm_reprioritizertr.c arm_saveusercontext.c
+CMN_CSRCS += arm_releasestack.c arm_saveusercontext.c
CMN_CSRCS += arm_stackframe.c
CMN_CSRCS += arm_vfork.c arm_unblocktask.c arm_usestack.c
diff --git a/arch/arm/src/common/arm_reprioritizertr.c b/arch/arm/src/common/arm_reprioritizertr.c
deleted file mode 100644
index 6a44fb5147..0000000000
--- a/arch/arm/src/common/arm_reprioritizertr.c
+++ /dev/null
@@ -1,175 +0,0 @@
-/****************************************************************************
- * arch/arm/src/common/arm_reprioritizertr.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 <stdint.h>
-#include <stdbool.h>
-#include <sched.h>
-#include <assert.h>
-#include <debug.h>
-#include <nuttx/arch.h>
-#include <nuttx/sched.h>
-
-#include "sched/sched.h"
-#include "group/group.h"
-#include "arm_internal.h"
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: up_reprioritize_rtr
- *
- * Description:
- * Called when the priority of a running or
- * ready-to-run task changes and the reprioritization will
- * cause a context switch. Two cases:
- *
- * 1) The priority of the currently running task drops and the next
- * task in the ready to run list has priority.
- * 2) An idle, ready to run task's priority has been raised above the
- * priority of the current, running task and it now has the priority.
- *
- * Input Parameters:
- * tcb: The TCB of the task that has been reprioritized
- * priority: The new task priority
- *
- ****************************************************************************/
-
-void up_reprioritize_rtr(struct tcb_s *tcb, uint8_t priority)
-{
- /* Verify that the caller is sane */
-
- if (tcb->task_state < FIRST_READY_TO_RUN_STATE ||
- tcb->task_state > LAST_READY_TO_RUN_STATE
-#if SCHED_PRIORITY_MIN > 0
- || priority < SCHED_PRIORITY_MIN
-#endif
-#if SCHED_PRIORITY_MAX < UINT8_MAX
- || priority > SCHED_PRIORITY_MAX
-#endif
- )
- {
- DEBUGPANIC();
- }
- else
- {
- struct tcb_s *rtcb = this_task();
- bool switch_needed;
-
- sinfo("TCB=%p PRI=%d\n", tcb, priority);
-
- /* Remove the tcb task from the ready-to-run list.
- * nxsched_remove_readytorun will return true if we just
- * remove the head of the ready to run list.
- */
-
- switch_needed = nxsched_remove_readytorun(tcb, false);
-
- /* Setup up the new task priority */
-
- tcb->sched_priority = (uint8_t)priority;
-
- /* Return the task to the specified blocked task list.
- * nxsched_add_readytorun will return true if the task was
- * added to the new list. We will need to perform a context
- * switch only if the EXCLUSIVE or of the two calls is non-zero
- * (i.e., one and only one the calls changes the head of the
- * ready-to-run list).
- */
-
- switch_needed ^= nxsched_add_readytorun(tcb);
-
- /* Now, perform the context switch if one is needed */
-
- if (switch_needed)
- {
- /* If we are going to do a context switch, then now is the right
- * time to add any pending tasks back into the ready-to-run list.
- */
-
- if (g_pendingtasks.head)
- {
- nxsched_merge_pending();
- }
-
- /* Update scheduler parameters */
-
- nxsched_suspend_scheduler(rtcb);
-
- /* Are we in an interrupt handler? */
-
- if (CURRENT_REGS)
- {
- /* Yes, then we have to do things differently.
- * Just copy the CURRENT_REGS into the OLD rtcb.
- */
-
- arm_savestate(rtcb->xcp.regs);
-
- /* Restore the exception context of the rtcb at the (new) head
- * of the ready-to-run task list.
- */
-
- rtcb = this_task();
-
- /* Update scheduler parameters */
-
- nxsched_resume_scheduler(rtcb);
-
- /* Then switch contexts. Any necessary address environment
- * changes will be made when the interrupt returns.
- */
-
- arm_restorestate(rtcb->xcp.regs);
- }
-
- /* No, then we will need to perform the user context switch */
-
- else
- {
- struct tcb_s *nexttcb = this_task();
-
- /* Update scheduler parameters */
-
- nxsched_resume_scheduler(nexttcb);
-
- /* Switch context to the context of the task at the head of the
- * ready to run list.
- */
-
- arm_switchcontext(&rtcb->xcp.regs, nexttcb->xcp.regs);
-
- /* arm_switchcontext forces a context switch to the task at the
- * head of the ready-to-run list. It does not 'return' in the
- * normal sense. When it does return, it is because the
- * blocked task is again ready to run and has execution
- * priority.
- */
- }
- }
- }
-}
diff --git a/arch/arm64/src/common/Make.defs b/arch/arm64/src/common/Make.defs
index 515b85f793..3839593628 100644
--- a/arch/arm64/src/common/Make.defs
+++ b/arch/arm64/src/common/Make.defs
@@ -45,7 +45,7 @@ endif
CMN_CSRCS = arm64_initialize.c arm64_initialstate.c arm64_boot.c
CMN_CSRCS += arm64_nputs.c arm64_idle.c arm64_copystate.c
CMN_CSRCS += arm64_createstack.c arm64_releasestack.c arm64_stackframe.c arm64_usestack.c
-CMN_CSRCS += arm64_task_sched.c arm64_exit.c arm64_vfork.c arm64_reprioritizertr.c
+CMN_CSRCS += arm64_task_sched.c arm64_exit.c arm64_vfork.c
CMN_CSRCS += arm64_releasepending.c arm64_unblocktask.c arm64_blocktask.c
CMN_CSRCS += arm64_assert.c arm64_schedulesigaction.c arm64_backtrace.c
CMN_CSRCS += arm64_sigdeliver.c
diff --git a/arch/arm64/src/common/arm64_reprioritizertr.c b/arch/arm64/src/common/arm64_reprioritizertr.c
deleted file mode 100644
index 437902b31d..0000000000
--- a/arch/arm64/src/common/arm64_reprioritizertr.c
+++ /dev/null
@@ -1,173 +0,0 @@
-/****************************************************************************
- * arch/arm64/src/common/arm64_reprioritizertr.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 <stdint.h>
-#include <stdbool.h>
-#include <sched.h>
-#include <assert.h>
-#include <debug.h>
-#include <nuttx/arch.h>
-#include <nuttx/sched.h>
-
-#include "sched/sched.h"
-#include "group/group.h"
-#include "arm64_internal.h"
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: up_reprioritize_rtr
- *
- * Description:
- * Called when the priority of a running or
- * ready-to-run task changes and the reprioritization will
- * cause a context switch. Two cases:
- *
- * 1) The priority of the currently running task drops and the next
- * task in the ready to run list has priority.
- * 2) An idle, ready to run task's priority has been raised above the
- * priority of the current, running task and it now has the priority.
- *
- * Input Parameters:
- * tcb: The TCB of the task that has been reprioritized
- * priority: The new task priority
- *
- ****************************************************************************/
-
-void up_reprioritize_rtr(struct tcb_s *tcb, uint8_t priority)
-{
- /* Verify that the caller is sane */
-
- if (tcb->task_state < FIRST_READY_TO_RUN_STATE ||
- tcb->task_state > LAST_READY_TO_RUN_STATE
-#if SCHED_PRIORITY_MIN > 0
- || priority < SCHED_PRIORITY_MIN
-#endif
-#if SCHED_PRIORITY_MAX < UINT8_MAX
- || priority > SCHED_PRIORITY_MAX
-#endif
- )
- {
- DEBUGPANIC();
- }
- else
- {
- struct tcb_s *rtcb = this_task();
- bool switch_needed;
-
- /* Remove the tcb task from the ready-to-run list.
- * nxsched_remove_readytorun will return true if we just
- * remove the head of the ready to run list.
- */
-
- switch_needed = nxsched_remove_readytorun(tcb, false);
-
- /* Setup up the new task priority */
-
- tcb->sched_priority = (uint8_t)priority;
-
- /* Return the task to the specified blocked task list.
- * nxsched_add_readytorun will return true if the task was
- * added to the new list. We will need to perform a context
- * switch only if the EXCLUSIVE or of the two calls is non-zero
- * (i.e., one and only one the calls changes the head of the
- * ready-to-run list).
- */
-
- switch_needed ^= nxsched_add_readytorun(tcb);
-
- /* Now, perform the context switch if one is needed */
-
- if (switch_needed)
- {
- /* If we are going to do a context switch, then now is the right
- * time to add any pending tasks back into the ready-to-run list.
- */
-
- if (g_pendingtasks.head)
- {
- nxsched_merge_pending();
- }
-
- /* Update scheduler parameters */
-
- nxsched_suspend_scheduler(rtcb);
-
- /* Are we in an interrupt handler? */
-
- if (CURRENT_REGS)
- {
- /* Yes, then we have to do things differently.
- * Just copy the CURRENT_REGS into the OLD rtcb.
- */
-
- arm64_savestate(rtcb->xcp.regs);
-
- /* Restore the exception context of the rtcb at the (new) head
- * of the ready-to-run task list.
- */
-
- rtcb = this_task();
-
- /* Update scheduler parameters */
-
- nxsched_resume_scheduler(rtcb);
-
- /* Then switch contexts. Any necessary address environment
- * changes will be made when the interrupt returns.
- */
-
- arm64_restorestate(rtcb->xcp.regs);
- }
-
- /* No, then we will need to perform the user context switch */
-
- else
- {
- struct tcb_s *nexttcb = this_task();
-
- /* Update scheduler parameters */
-
- nxsched_resume_scheduler(nexttcb);
-
- /* Switch context to the context of the task at the head of the
- * ready to run list.
- */
-
- arm64_switchcontext(&rtcb->xcp.regs, nexttcb->xcp.regs);
-
- /* arm_switchcontext forces a context switch to the task at the
- * head of the ready-to-run list. It does not 'return' in the
- * normal sense. When it does return, it is because the
- * blocked task is again ready to run and has execution
- * priority.
- */
- }
- }
- }
-}
diff --git a/arch/avr/src/at32uc3/Make.defs b/arch/avr/src/at32uc3/Make.defs
index f697097f30..3455bdc9a7 100644
--- a/arch/avr/src/at32uc3/Make.defs
+++ b/arch/avr/src/at32uc3/Make.defs
@@ -29,7 +29,7 @@ CMN_CSRCS = up_assert.c up_allocateheap.c up_blocktask.c up_copystate.c
CMN_CSRCS += up_createstack.c up_mdelay.c up_udelay.c up_exit.c up_idle.c
CMN_CSRCS += up_initialize.c up_initialstate.c
CMN_CSRCS += up_modifyreg8.c up_modifyreg16.c up_modifyreg32.c
-CMN_CSRCS += up_releasepending.c up_releasestack.c up_reprioritizertr.c
+CMN_CSRCS += up_releasepending.c up_releasestack.c
CMN_CSRCS += up_schedulesigaction.c up_sigdeliver.c up_stackframe.c
CMN_CSRCS += up_unblocktask.c up_usestack.c up_doirq.c up_nputs.c
diff --git a/arch/avr/src/at90usb/Make.defs b/arch/avr/src/at90usb/Make.defs
index ecc0bfc7ad..31ae54b553 100644
--- a/arch/avr/src/at90usb/Make.defs
+++ b/arch/avr/src/at90usb/Make.defs
@@ -30,7 +30,7 @@ CMN_CSRCS += up_createstack.c up_doirq.c up_exit.c up_idle.c up_initialize.c
CMN_CSRCS += up_initialstate.c up_irq.c up_lowputs.c
CMN_CSRCS += up_mdelay.c up_modifyreg8.c up_modifyreg16.c up_modifyreg32.c
CMN_CSRCS += up_nputs.c up_releasepending.c up_releasestack.c
-CMN_CSRCS += up_reprioritizertr.c up_schedulesigaction.c up_sigdeliver.c
+CMN_CSRCS += up_schedulesigaction.c up_sigdeliver.c
CMN_CSRCS += up_stackframe.c up_udelay.c up_unblocktask.c up_usestack.c
# Configuration-dependent common files
diff --git a/arch/avr/src/atmega/Make.defs b/arch/avr/src/atmega/Make.defs
index 52e9c0b711..5e43e2c028 100644
--- a/arch/avr/src/atmega/Make.defs
+++ b/arch/avr/src/atmega/Make.defs
@@ -30,7 +30,7 @@ CMN_CSRCS += up_createstack.c up_doirq.c up_exit.c up_idle.c up_initialize.c
CMN_CSRCS += up_initialstate.c up_irq.c up_lowputs.c
CMN_CSRCS += up_mdelay.c up_modifyreg8.c up_modifyreg16.c up_modifyreg32.c
CMN_CSRCS += up_nputs.c up_releasepending.c up_releasestack.c
-CMN_CSRCS += up_reprioritizertr.c up_schedulesigaction.c up_sigdeliver.c
+CMN_CSRCS += up_schedulesigaction.c up_sigdeliver.c
CMN_CSRCS += up_stackframe.c up_udelay.c up_unblocktask.c up_usestack.c
# Configuration-dependent common files
diff --git a/arch/avr/src/avr/up_reprioritizertr.c b/arch/avr/src/avr/up_reprioritizertr.c
deleted file mode 100644
index 51c504afd6..0000000000
--- a/arch/avr/src/avr/up_reprioritizertr.c
+++ /dev/null
@@ -1,172 +0,0 @@
-/****************************************************************************
- * arch/avr/src/avr/up_reprioritizertr.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 <stdint.h>
-#include <stdbool.h>
-#include <sched.h>
-#include <assert.h>
-#include <debug.h>
-#include <nuttx/arch.h>
-#include <nuttx/sched.h>
-
-#include "sched/sched.h"
-#include "up_internal.h"
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: up_reprioritize_rtr
- *
- * Description:
- * Called when the priority of a running or
- * ready-to-run task changes and the reprioritization will
- * cause a context switch. Two cases:
- *
- * 1) The priority of the currently running task drops and the next
- * task in the ready to run list has priority.
- * 2) An idle, ready to run task's priority has been raised above the
- * priority of the current, running task and it now has the priority.
- *
- * Input Parameters:
- * tcb: The TCB of the task that has been reprioritized
- * priority: The new task priority
- *
- ****************************************************************************/
-
-void up_reprioritize_rtr(struct tcb_s *tcb, uint8_t priority)
-{
- /* Verify that the caller is sane */
-
- if (tcb->task_state < FIRST_READY_TO_RUN_STATE ||
- tcb->task_state > LAST_READY_TO_RUN_STATE
-#if SCHED_PRIORITY_MIN > 0
- || priority < SCHED_PRIORITY_MIN
-#endif
-#if SCHED_PRIORITY_MAX < UINT8_MAX
- || priority > SCHED_PRIORITY_MAX
-#endif
- )
- {
- DEBUGPANIC();
- }
- else
- {
- struct tcb_s *rtcb = this_task();
- bool switch_needed;
-
- sinfo("TCB=%p PRI=%d\n", tcb, priority);
-
- /* Remove the tcb task from the ready-to-run list.
- * nxsched_remove_readytorun will return true if we just
- * remove the head of the ready to run list.
- */
-
- switch_needed = nxsched_remove_readytorun(tcb, false);
-
- /* Setup up the new task priority */
-
- tcb->sched_priority = (uint8_t)priority;
-
- /* Return the task to the specified blocked task list.
- * nxsched_add_readytorun will return true if the task was
- * added to the new list. We will need to perform a context
- * switch only if the EXCLUSIVE or of the two calls is non-zero
- * (i.e., one and only one the calls changes the head of the
- * ready-to-run list).
- */
-
- switch_needed ^= nxsched_add_readytorun(tcb);
-
- /* Now, perform the context switch if one is needed */
-
- if (switch_needed)
- {
- /* If we are going to do a context switch, then now is the right
- * time to add any pending tasks back into the ready-to-run list.
- */
-
- if (g_pendingtasks.head)
- {
- nxsched_merge_pending();
- }
-
- /* Update scheduler parameters */
-
- nxsched_suspend_scheduler(rtcb);
-
- /* Are we in an interrupt handler? */
-
- if (g_current_regs)
- {
- /* Yes, then we have to do things differently.
- * Just copy the g_current_regs into the OLD rtcb.
- */
-
- up_savestate(rtcb->xcp.regs);
-
- /* Restore the exception context of the rtcb at the (new) head
- * of the ready-to-run task list.
- */
-
- rtcb = this_task();
-
- /* Update scheduler parameters */
-
- nxsched_resume_scheduler(rtcb);
-
- /* Then switch contexts */
-
- up_restorestate(rtcb->xcp.regs);
- }
-
- /* No, then we will need to perform the user context switch */
-
- else
- {
- struct tcb_s *nexttcb = this_task();
-
- /* Update scheduler parameters */
-
- nxsched_resume_scheduler(nexttcb);
-
- /* Switch context to the context of the task at the head of the
- * ready to run list.
- */
-
- up_switchcontext(rtcb->xcp.regs, nexttcb->xcp.regs);
-
- /* up_switchcontext forces a context switch to the task at the
- * head of the ready-to-run list. It does not 'return' in the
- * normal sense. When it does return, it is because the
- * blocked task is again ready to run and has execution
- * priority.
- */
- }
- }
- }
-}
diff --git a/arch/avr/src/avr32/up_reprioritizertr.c b/arch/avr/src/avr32/up_reprioritizertr.c
deleted file mode 100644
index 7a841387c0..0000000000
--- a/arch/avr/src/avr32/up_reprioritizertr.c
+++ /dev/null
@@ -1,186 +0,0 @@
-/****************************************************************************
- * arch/avr/src/avr32/up_reprioritizertr.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 <stdint.h>
-#include <stdbool.h>
-#include <sched.h>
-#include <assert.h>
-#include <debug.h>
-#include <nuttx/arch.h>
-#include <nuttx/sched.h>
-
-#include "sched/sched.h"
-#include "group/group.h"
-#include "up_internal.h"
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: up_reprioritize_rtr
- *
- * Description:
- * Called when the priority of a running or
- * ready-to-run task changes and the reprioritization will
- * cause a context switch. Two cases:
- *
- * 1) The priority of the currently running task drops and the next
- * task in the ready to run list has priority.
- * 2) An idle, ready to run task's priority has been raised above the
- * priority of the current, running task and it now has the priority.
- *
- * Input Parameters:
- * tcb: The TCB of the task that has been reprioritized
- * priority: The new task priority
- *
- ****************************************************************************/
-
-void up_reprioritize_rtr(struct tcb_s *tcb, uint8_t priority)
-{
- /* Verify that the caller is sane */
-
- if (tcb->task_state < FIRST_READY_TO_RUN_STATE ||
- tcb->task_state > LAST_READY_TO_RUN_STATE
-#if SCHED_PRIORITY_MIN > 0
- || priority < SCHED_PRIORITY_MIN
-#endif
-#if SCHED_PRIORITY_MAX < UINT8_MAX
- || priority > SCHED_PRIORITY_MAX
-#endif
- )
- {
- DEBUGPANIC();
- }
- else
- {
- struct tcb_s *rtcb = this_task();
- bool switch_needed;
-
- sinfo("TCB=%p PRI=%d\n", tcb, priority);
-
- /* Remove the tcb task from the ready-to-run list.
- * nxsched_remove_readytorun will return true if we just
- * remove the head of the ready to run list.
- */
-
- switch_needed = nxsched_remove_readytorun(tcb, false);
-
- /* Setup up the new task priority */
-
- tcb->sched_priority = (uint8_t)priority;
-
- /* Return the task to the specified blocked task list.
- * nxsched_add_readytorun will return true if the task was
- * added to the new list. We will need to perform a context
- * switch only if the EXCLUSIVE or of the two calls is non-zero
- * (i.e., one and only one the calls changes the head of the
- * ready-to-run list).
- */
-
- switch_needed ^= nxsched_add_readytorun(tcb);
-
- /* Now, perform the context switch if one is needed */
-
- if (switch_needed)
- {
- /* If we are going to do a context switch, then now is the right
- * time to add any pending tasks back into the ready-to-run list.
- */
-
- if (g_pendingtasks.head)
- {
- nxsched_merge_pending();
- }
-
- /* Update scheduler parameters */
-
- nxsched_suspend_scheduler(rtcb);
-
- /* Are we in an interrupt handler? */
-
- if (g_current_regs)
- {
- /* Yes, then we have to do things differently.
- * Just copy the g_current_regs into the OLD rtcb.
- */
-
- up_savestate(rtcb->xcp.regs);
-
- /* Restore the exception context of the rtcb at the (new) head
- * of the ready-to-run task list.
- */
-
- rtcb = this_task();
-
- /* Update scheduler parameters */
-
- nxsched_resume_scheduler(rtcb);
-
- /* Then switch contexts. Any necessary address environment
- * changes will be made when the interrupt returns.
- */
-
- up_restorestate(rtcb->xcp.regs);
- }
-
- /* No, then we will need to perform the user context switch */
-
- else
- {
- /* Switch context to the context of the task at the head of the
- * ready to run list.
- */
-
- struct tcb_s *nexttcb = this_task();
-
-#ifdef CONFIG_ARCH_ADDRENV
- /* Make sure that the address environment for the previously
- * running task is closed down gracefully (data caches dump,
- * MMU flushed) and set up the address environment for the new
- * thread at the head of the ready-to-run list.
- */
-
- group_addrenv(nexttcb);
-#endif
- /* Update scheduler parameters */
-
- nxsched_resume_scheduler(nexttcb);
-
- /* Then switch contexts */
-
- up_switchcontext(rtcb->xcp.regs, nexttcb->xcp.regs);
-
- /* up_switchcontext forces a context switch to the task at the
- * head of the ready-to-run list. It does not 'return' in the
- * normal sense. When it does return, it is because the
- * blocked task is again ready to run and has execution
- * priority.
- */
- }
- }
- }
-}
diff --git a/arch/ceva/src/common/up_reprioritizertr.c b/arch/ceva/src/common/up_reprioritizertr.c
deleted file mode 100644
index d2aab1bd70..0000000000
--- a/arch/ceva/src/common/up_reprioritizertr.c
+++ /dev/null
@@ -1,170 +0,0 @@
-/****************************************************************************
- * arch/ceva/src/common/up_reprioritizertr.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 <debug.h>
-#include <nuttx/arch.h>
-
-#include "sched/sched.h"
-#include "up_internal.h"
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: up_reprioritize_rtr
- *
- * Description:
- * Called when the priority of a running or
- * ready-to-run task changes and the reprioritization will
- * cause a context switch. Two cases:
- *
- * 1) The priority of the currently running task drops and the next
- * task in the ready to run list has priority.
- * 2) An idle, ready to run task's priority has been raised above the
- * the priority of the current, running task and it now has the
- * priority.
- *
- * Inputs:
- * tcb: The TCB of the task that has been reprioritized
- * priority: The new task priority
- *
- ****************************************************************************/
-
-void up_reprioritize_rtr(struct tcb_s *tcb, uint8_t priority)
-{
- /* Verify that the caller is sane */
-
- if (tcb->task_state < FIRST_READY_TO_RUN_STATE ||
- tcb->task_state > LAST_READY_TO_RUN_STATE
-#if SCHED_PRIORITY_MIN > 0
- || priority < SCHED_PRIORITY_MIN
-#endif
-#if SCHED_PRIORITY_MAX < UINT8_MAX
- || priority > SCHED_PRIORITY_MAX
-#endif
- )
- {
- DEBUGPANIC();
- }
- else
- {
- struct tcb_s *rtcb = this_task();
- bool switch_needed;
-
- sinfo("TCB=%p PRI=%d\n", tcb, priority);
-
- /* Remove the tcb task from the ready-to-run list.
- * sched_removereadytorun will return true if we just removed the head
- * of the ready to run list.
- */
-
- switch_needed = sched_removereadytorun(tcb);
-
- /* Setup up the new task priority */
-
- tcb->sched_priority = (uint8_t)priority;
-
- /* Return the task to the ready-to-run task list. sched_addreadytorun
- * will return true if the task was added to the head of ready-to-run
- * list. We will need to perform a context switch only if the
- * EXCLUSIVE or of the two calls is non-zero (i.e., one and only one
- * the calls changes the head of the ready-to-run list).
- */
-
- switch_needed ^= sched_addreadytorun(tcb);
-
- /* Now, perform the context switch if one is needed (i.e. if the head
- * of the ready-to-run list is no longer the same).
- */
-
- if (switch_needed)
- {
- /* If we are going to do a context switch, then now is the right
- * time to add any pending tasks back into the ready-to-run list.
- * task list now
- */
-
- if (g_pendingtasks.head)
- {
- sched_mergepending();
- }
-
- /* Update scheduler parameters */
-
- sched_suspend_scheduler(rtcb);
-
- /* Are we in an interrupt handler? */
-
- if (CURRENT_REGS)
- {
- /* Yes, then we have to do things differently.
- * Just copy the CURRENT_REGS into the OLD rtcb.
- */
-
- rtcb->xcp.regs = CURRENT_REGS;
-
- /* Restore the exception context of the rtcb at the (new) head
- * of the ready-to-run task list.
- */
-
- rtcb = this_task();
-
- /* Update scheduler parameters */
-
- sched_resume_scheduler(rtcb);
-
- /* Then switch contexts */
-
- CURRENT_REGS = rtcb->xcp.regs;
- }
-
- /* No, then we will need to perform the user context switch */
-
- else
- {
- struct tcb_s *nexttcb = this_task();
-
- /* Update scheduler parameters */
-
- sched_resume_scheduler(nexttcb);
-
- /* Switch context to the context of the task at the head of the
- * ready to run list.
- */
-
- up_switchcontext(&rtcb->xcp.regs, nexttcb->xcp.regs);
-
- /* up_switchcontext forces a context switch to the task at the
- * head of the ready-to-run list. It does not 'return' in the
- * normal sense. When it does return, it is because the
- * blocked task is again ready to run and has execution
- * priority.
- */
- }
- }
- }
-}
diff --git a/arch/hc/src/common/up_reprioritizertr.c b/arch/hc/src/common/up_reprioritizertr.c
deleted file mode 100644
index 4d7c830998..0000000000
--- a/arch/hc/src/common/up_reprioritizertr.c
+++ /dev/null
@@ -1,183 +0,0 @@
-/****************************************************************************
- * arch/hc/src/common/up_reprioritizertr.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 <stdint.h>
-#include <stdbool.h>
-#include <sched.h>
-#include <assert.h>
-#include <debug.h>
-#include <nuttx/arch.h>
-#include <nuttx/sched.h>
-
-#include "sched/sched.h"
-#include "group/group.h"
-#include "up_internal.h"
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: up_reprioritize_rtr
- *
- * Description:
- * Called when the priority of a running or
- * ready-to-run task changes and the reprioritization will
- * cause a context switch. Two cases:
- *
- * 1) The priority of the currently running task drops and the next
- * task in the ready to run list has priority.
- * 2) An idle, ready to run task's priority has been raised above the
- * priority of the current, running task and it now has the priority.
- *
- * Input Parameters:
- * tcb: The TCB of the task that has been reprioritized
- * priority: The new task priority
- *
- ****************************************************************************/
-
-void up_reprioritize_rtr(struct tcb_s *tcb, uint8_t priority)
-{
- /* Verify that the caller is sane */
-
- if (tcb->task_state < FIRST_READY_TO_RUN_STATE ||
- tcb->task_state > LAST_READY_TO_RUN_STATE
-#if SCHED_PRIORITY_MIN > 0
- || priority < SCHED_PRIORITY_MIN
-#endif
-#if SCHED_PRIORITY_MAX < UINT8_MAX
- || priority > SCHED_PRIORITY_MAX
-#endif
- )
- {
- DEBUGPANIC();
- }
- else
- {
- struct tcb_s *rtcb = this_task();
- bool switch_needed;
-
- sinfo("TCB=%p PRI=%d\n", tcb, priority);
-
- /* Remove the tcb task from the ready-to-run list.
- * nxsched_remove_readytorun will return true if we just
- * remove the head of the ready to run list.
- */
-
- switch_needed = nxsched_remove_readytorun(tcb, false);
-
- /* Setup up the new task priority */
-
- tcb->sched_priority = (uint8_t)priority;
-
- /* Return the task to the specified blocked task list.
- * nxsched_add_readytorun will return true if the task was
- * added to the new list. We will need to perform a context
- * switch only if the EXCLUSIVE or of the two calls is non-zero
- * (i.e., one and only one the calls changes the head of the
- * ready-to-run list).
- */
-
- switch_needed ^= nxsched_add_readytorun(tcb);
-
- /* Now, perform the context switch if one is needed */
-
- if (switch_needed)
- {
- /* If we are going to do a context switch, then now is the right
- * time to add any pending tasks back into the ready-to-run list.
- */
-
- if (g_pendingtasks.head)
- {
- nxsched_merge_pending();
- }
-
- /* Update scheduler parameters */
-
- nxsched_suspend_scheduler(rtcb);
-
- /* Are we in an interrupt handler? */
-
- if (g_current_regs)
- {
- /* Yes, then we have to do things differently.
- * Just copy the g_current_regs into the OLD rtcb.
- */
-
- up_savestate(rtcb->xcp.regs);
-
- /* Restore the exception context of the rtcb at the (new) head
- * of the ready-to-run task list.
- */
-
- rtcb = this_task();
-
- /* Update scheduler parameters */
-
- nxsched_resume_scheduler(rtcb);
-
- /* Then switch contexts. Any necessary address environment
- * changes will be made when the interrupt returns.
- */
-
- up_restorestate(rtcb->xcp.regs);
- }
-
- /* Copy the exception context into the TCB at the (old) head of the
- * ready-to-run Task list. if up_saveusercontext returns a non-zero
- * value, then this is really the previously running task
- * restarting!
- */
-
- else if (!up_saveusercontext(rtcb->xcp.regs))
- {
- /* Restore the exception context of the rtcb at the (new) head
- * of the ready-to-run task list.
- */
-
- rtcb = this_task();
-
-#ifdef CONFIG_ARCH_ADDRENV
- /* Make sure that the address environment for the previously
- * running task is closed down gracefully (data caches dump,
- * MMU flushed) and set up the address environment for the new
- * thread at the head of the ready-to-run list.
- */
-
- group_addrenv(rtcb);
-#endif
- /* Update scheduler parameters */
-
- nxsched_resume_scheduler(rtcb);
-
- /* Then switch contexts */
-
- up_fullcontextrestore(rtcb->xcp.regs);
- }
- }
- }
-}
diff --git a/arch/hc/src/m9s12/Make.defs b/arch/hc/src/m9s12/Make.defs
index f9a6a79d99..d1f73e7125 100644
--- a/arch/hc/src/m9s12/Make.defs
+++ b/arch/hc/src/m9s12/Make.defs
@@ -23,7 +23,7 @@ HEAD_ASRC = m9s12_vectors.S
CMN_CSRCS = up_allocateheap.c up_blocktask.c up_copystate.c up_createstack.c
CMN_CSRCS += up_doirq.c up_exit.c up_idle.c up_initialize.c
CMN_CSRCS += up_mdelay.c up_modifyreg16.c up_modifyreg32.c up_modifyreg8.c
-CMN_CSRCS += up_nputs.c up_releasepending.c up_releasestack.c up_reprioritizertr.c
+CMN_CSRCS += up_nputs.c up_releasepending.c up_releasestack.c
CMN_CSRCS += up_stackframe.c up_udelay.c up_unblocktask.c up_usestack.c
CHIP_ASRCS = m9s12_start.S m9s12_lowputc.S m9s12_saveusercontext.S
diff --git a/arch/mips/src/mips32/mips_reprioritizertr.c b/arch/mips/src/mips32/mips_reprioritizertr.c
deleted file mode 100644
index c424592e55..0000000000
--- a/arch/mips/src/mips32/mips_reprioritizertr.c
+++ /dev/null
@@ -1,178 +0,0 @@
-/****************************************************************************
- * arch/mips/src/mips32/mips_reprioritizertr.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 <stdint.h>
-#include <stdbool.h>
-#include <sched.h>
-#include <syscall.h>
-#include <assert.h>
-#include <debug.h>
-
-#include <nuttx/arch.h>
-#include <nuttx/sched.h>
-
-#include "sched/sched.h"
-#include "group/group.h"
-#include "mips_internal.h"
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: up_reprioritize_rtr
- *
- * Description:
- * Called when the priority of a running or
- * ready-to-run task changes and the reprioritization will
- * cause a context switch. Two cases:
- *
- * 1) The priority of the currently running task drops and the next
- * task in the ready to run list has priority.
- * 2) An idle, ready to run task's priority has been raised above the
- * priority of the current, running task and it now has the priority.
- *
- * Input Parameters:
- * tcb: The TCB of the task that has been reprioritized
- * priority: The new task priority
- *
- ****************************************************************************/
-
-void up_reprioritize_rtr(struct tcb_s *tcb, uint8_t priority)
-{
- /* Verify that the caller is sane */
-
- if (tcb->task_state < FIRST_READY_TO_RUN_STATE ||
- tcb->task_state > LAST_READY_TO_RUN_STATE
-#if SCHED_PRIORITY_MIN > 0
- || priority < SCHED_PRIORITY_MIN
-#endif
-#if SCHED_PRIORITY_MAX < UINT8_MAX
- || priority > SCHED_PRIORITY_MAX
-#endif
- )
- {
- DEBUGPANIC();
- }
- else
- {
- struct tcb_s *rtcb = this_task();
- bool switch_needed;
-
- sinfo("TCB=%p PRI=%d\n", tcb, priority);
-
- /* Remove the tcb task from the ready-to-run list.
- * nxsched_remove_readytorun will return true if we just
- * remove the head of the ready to run list.
- */
-
- switch_needed = nxsched_remove_readytorun(tcb, false);
-
- /* Setup up the new task priority */
-
- tcb->sched_priority = (uint8_t)priority;
-
- /* Return the task to the specified blocked task list.
- * nxsched_add_readytorun will return true if the task was
- * added to the new list. We will need to perform a context
- * switch only if the EXCLUSIVE or of the two calls is non-zero
- * (i.e., one and only one the calls changes the head of the
- * ready-to-run list).
- */
-
- switch_needed ^= nxsched_add_readytorun(tcb);
-
- /* Now, perform the context switch if one is needed */
-
- if (switch_needed)
- {
- /* If we are going to do a context switch, then now is the right
- * time to add any pending tasks back into the ready-to-run list.
- */
-
- if (g_pendingtasks.head)
- {
- nxsched_merge_pending();
- }
-
- /* Update scheduler parameters */
-
- nxsched_suspend_scheduler(rtcb);
-
- /* Are we in an interrupt handler? */
-
- if (CURRENT_REGS)
- {
- /* Yes, then we have to do things differently.
- * Just copy the g_current_regs into the OLD rtcb.
- */
-
- up_savestate(rtcb->xcp.regs);
-
- /* Restore the exception context of the rtcb at the (new) head
- * of the ready-to-run task list.
- */
-
- rtcb = this_task();
-
- /* Update scheduler parameters */
-
- nxsched_resume_scheduler(rtcb);
-
- /* Then switch contexts. Any necessary address environment
- * changes will be made when the interrupt returns.
- */
-
- up_restorestate(rtcb->xcp.regs);
- }
-
- /* No, then we will need to perform the user context switch */
-
- else
- {
- /* Switch context to the context of the task at the head of the
- * ready to run list.
- */
-
- struct tcb_s *nexttcb = this_task();
-
- /* Update scheduler parameters */
-
- nxsched_resume_scheduler(nexttcb);
-
- /* Then switch contexts */
-
- up_switchcontext(rtcb->xcp.regs, nexttcb->xcp.regs);
-
- /* up_switchcontext forces a context switch to the task at the
- * head of the ready-to-run list. It does not 'return' in the
- * normal sense. When it does return, it is because the blocked
- * task is again ready to run and has execution priority.
- */
- }
- }
- }
-}
diff --git a/arch/mips/src/pic32mx/Make.defs b/arch/mips/src/pic32mx/Make.defs
index 9e18bc4f7c..edfcc7cae3 100644
--- a/arch/mips/src/pic32mx/Make.defs
+++ b/arch/mips/src/pic32mx/Make.defs
@@ -30,7 +30,7 @@ CMN_CSRCS += mips_createstack.c mips_doirq.c mips_exit.c mips_initialize.c
CMN_CSRCS += mips_initialstate.c mips_irq.c mips_lowputs.c
CMN_CSRCS += mips_mdelay.c mips_modifyreg8.c mips_modifyreg16.c mips_modifyreg32.c
CMN_CSRCS += mips_nputs.c mips_releasepending.c mips_releasestack.c
-CMN_CSRCS += mips_reprioritizertr.c mips_schedulesigaction.c mips_sigdeliver.c
+CMN_CSRCS += mips_schedulesigaction.c mips_sigdeliver.c
CMN_CSRCS += mips_stackframe.c mips_swint0.c mips_udelay.c mips_unblocktask.c
CMN_CSRCS += mips_usestack.c mips_vfork.c
diff --git a/arch/mips/src/pic32mz/Make.defs b/arch/mips/src/pic32mz/Make.defs
index 9af3182333..231d5fc01f 100644
--- a/arch/mips/src/pic32mz/Make.defs
+++ b/arch/mips/src/pic32mz/Make.defs
@@ -30,7 +30,7 @@ CMN_CSRCS += mips_createstack.c mips_doirq.c mips_exit.c mips_initialize.c
CMN_CSRCS += mips_initialstate.c mips_irq.c mips_lowputs.c
CMN_CSRCS += mips_mdelay.c mips_modifyreg8.c mips_modifyreg16.c mips_modifyreg32.c
CMN_CSRCS += mips_nputs.c mips_releasepending.c mips_releasestack.c
-CMN_CSRCS += mips_reprioritizertr.c mips_schedulesigaction.c mips_sigdeliver.c
+CMN_CSRCS += mips_schedulesigaction.c mips_sigdeliver.c
CMN_CSRCS += mips_stackframe.c mips_swint0.c mips_udelay.c mips_unblocktask.c
CMN_CSRCS += mips_usestack.c mips_vfork.c
diff --git a/arch/misoc/src/lm32/Make.defs b/arch/misoc/src/lm32/Make.defs
index 0b797361d8..337a6a0f18 100644
--- a/arch/misoc/src/lm32/Make.defs
+++ b/arch/misoc/src/lm32/Make.defs
@@ -32,6 +32,6 @@ CHIP_CSRCS += lm32_copystate.c lm32_createstack.c lm32_decodeirq.c
CHIP_CSRCS += lm32_doirq.c lm32_dumpstate.c lm32_exit.c lm32_idle.c
CHIP_CSRCS += lm32_initialstate.c lm32_irq.c lm32_releasepending.c
CHIP_CSRCS += lm32_releasestack.c lm32_stackframe.c lm32_swint.c
-CHIP_CSRCS += lm32_unblocktask.c lm32_reprioritizertr.c
+CHIP_CSRCS += lm32_unblocktask.c
CHIP_CSRCS += lm32_schedulesigaction.c lm32_sigdeliver.c
CHIP_CSRCS += lm32_flushcache.c lm32_usetack.c
diff --git a/arch/misoc/src/lm32/lm32_reprioritizertr.c b/arch/misoc/src/lm32/lm32_reprioritizertr.c
deleted file mode 100644
index dd4e766a98..0000000000
--- a/arch/misoc/src/lm32/lm32_reprioritizertr.c
+++ /dev/null
@@ -1,179 +0,0 @@
-/****************************************************************************
- * arch/misoc/src/lm32/lm32_reprioritizertr.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 <stdint.h>
-#include <stdbool.h>
-#include <sched.h>
-#include <syscall.h>
-#include <assert.h>
-#include <debug.h>
-
-#include <nuttx/arch.h>
-#include <nuttx/sched.h>
-
-#include "sched/sched.h"
-#include "group/group.h"
-#include "lm32.h"
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: up_reprioritize_rtr
- *
- * Description:
- * Called when the priority of a running or
- * ready-to-run task changes and the reprioritization will
- * cause a context switch. Two cases:
- *
- * 1) The priority of the currently running task drops and the next
- * task in the ready to run list has priority.
- * 2) An idle, ready to run task's priority has been raised above the
- * priority of the current, running task and it now has the priority.
- *
- * Input Parameters:
- * tcb: The TCB of the task that has been reprioritized
- * priority: The new task priority
- *
- ****************************************************************************/
-
-void up_reprioritize_rtr(struct tcb_s *tcb, uint8_t priority)
-{
- /* Verify that the caller is sane */
-
- if (tcb->task_state < FIRST_READY_TO_RUN_STATE ||
- tcb->task_state > LAST_READY_TO_RUN_STATE
-#if SCHED_PRIORITY_MIN > 0
- || priority < SCHED_PRIORITY_MIN
-#endif
-#if SCHED_PRIORITY_MAX < UINT8_MAX
- || priority > SCHED_PRIORITY_MAX
-#endif
- )
- {
- DEBUGPANIC();
- }
- else
- {
- struct tcb_s *rtcb = this_task();
- bool switch_needed;
-
- sinfo("TCB=%p PRI=%d\n", tcb, priority);
-
- /* Remove the tcb task from the ready-to-run list.
- * nxsched_remove_readytorun will return true if we just
- * remove the head of the ready to run list.
- */
-
- switch_needed = nxsched_remove_readytorun(tcb, false);
-
- /* Setup up the new task priority */
-
- tcb->sched_priority = (uint8_t)priority;
-
- /* Return the task to the specified blocked task list.
- * nxsched_add_readytorun will return true if the task was
- * added to the new list. We will need to perform a context
- * switch only if the EXCLUSIVE or of the two calls is non-zero
- * (i.e., one and only one the calls changes the head of the
- * ready-to-run list).
- */
-
- switch_needed ^= nxsched_add_readytorun(tcb);
-
- /* Now, perform the context switch if one is needed */
-
- if (switch_needed)
- {
- /* If we are going to do a context switch, then now is the right
- * time to add any pending tasks back into the ready-to-run list.
- */
-
- if (g_pendingtasks.head)
- {
- nxsched_merge_pending();
- }
-
- /* Update scheduler parameters */
-
- nxsched_suspend_scheduler(rtcb);
-
- /* Are we in an interrupt handler? */
-
- if (g_current_regs)
- {
- /* Yes, then we have to do things differently.
- * Just copy the g_current_regs into the OLD rtcb.
- */
-
- up_savestate(rtcb->xcp.regs);
-
- /* Restore the exception context of the rtcb at the (new) head
- * of the ready-to-run task list.
- */
-
- rtcb = this_task();
-
- /* Update scheduler parameters */
-
- nxsched_resume_scheduler(rtcb);
-
- /* Then switch contexts. Any necessary address environment
- * changes will be made when the interrupt returns.
- */
-
- up_restorestate(rtcb->xcp.regs);
- }
-
- /* No, then we will need to perform the user context switch */
-
- else
- {
- /* Switch context to the context of the task at the head of the
- * ready to run list.
- */
-
- struct tcb_s *nexttcb = this_task();
-
- /* Update scheduler parameters */
-
- nxsched_resume_scheduler(nexttcb);
-
- /* Then switch contexts */
-
- up_switchcontext(rtcb->xcp.regs, nexttcb->xcp.regs);
-
- /* up_switchcontext forces a context switch to the task at the
- * head of the ready-to-run list. It does not 'return' in the
- * normal sense. When it does return, it is because the
- * blocked task is again ready to run and has execution
- * priority.
- */
- }
- }
- }
-}
diff --git a/arch/misoc/src/minerva/Make.defs b/arch/misoc/src/minerva/Make.defs
index 8c9002f450..52ce077a35 100644
--- a/arch/misoc/src/minerva/Make.defs
+++ b/arch/misoc/src/minerva/Make.defs
@@ -32,6 +32,6 @@ CHIP_CSRCS += minerva_copystate.c minerva_createstack.c minerva_decodeirq.c
CHIP_CSRCS += minerva_doirq.c minerva_dumpstate.c minerva_exit.c minerva_idle.c
CHIP_CSRCS += minerva_initialstate.c minerva_irq.c minerva_releasepending.c
CHIP_CSRCS += minerva_releasestack.c minerva_stackframe.c minerva_swint.c
-CHIP_CSRCS += minerva_unblocktask.c minerva_reprioritizertr.c
+CHIP_CSRCS += minerva_unblocktask.c
CHIP_CSRCS += minerva_schedulesigaction.c minerva_sigdeliver.c
CHIP_CSRCS += minerva_flushcache.c minerva_doexceptions.c minerva_usetack.c
diff --git a/arch/misoc/src/minerva/minerva_reprioritizertr.c b/arch/misoc/src/minerva/minerva_reprioritizertr.c
deleted file mode 100644
index 387fd0c30e..0000000000
--- a/arch/misoc/src/minerva/minerva_reprioritizertr.c
+++ /dev/null
@@ -1,178 +0,0 @@
-/****************************************************************************
- * arch/misoc/src/minerva/minerva_reprioritizertr.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 <stdint.h>
-#include <stdbool.h>
-#include <sched.h>
-#include <syscall.h>
-#include <assert.h>
-#include <debug.h>
-
-#include <nuttx/arch.h>
-#include <nuttx/sched.h>
-
-#include "sched/sched.h"
-#include "group/group.h"
-#include "minerva.h"
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: up_reprioritize_rtr
- *
- * Description:
- * Called when the priority of a running or
- * ready-to-run task changes and the reprioritization will
- * cause a context switch. Two cases:
- *
- * 1) The priority of the currently running task drops and the next
- * task in the ready to run list has priority.
- * 2) An idle, ready to run task's priority has been raised above the
- * priority of the current, running task and it now has the priority.
- *
- * Input Parameters:
- * tcb: The TCB of the task that has been reprioritized
- * priority: The new task priority
- *
- ****************************************************************************/
-
-void up_reprioritize_rtr(struct tcb_s *tcb, uint8_t priority)
-{
- /* Verify that the caller is sane */
-
- if (tcb->task_state < FIRST_READY_TO_RUN_STATE ||
- tcb->task_state > LAST_READY_TO_RUN_STATE
-#if SCHED_PRIORITY_MIN > 0
- || priority < SCHED_PRIORITY_MIN
-#endif
-#if SCHED_PRIORITY_MAX < UINT8_MAX
- || priority > SCHED_PRIORITY_MAX
-#endif
- )
- {
- DEBUGPANIC();
- }
- else
- {
- struct tcb_s *rtcb = this_task();
- bool switch_needed;
-
- sinfo("TCB=%p PRI=%d\n", tcb, priority);
-
- /* Remove the tcb task from the ready-to-run list.
- * nxsched_remove_readytorun() will return true if we just remove the
- * head of the ready to run list.
- */
-
- switch_needed = nxsched_remove_readytorun(tcb, false);
-
- /* Setup up the new task priority */
-
- tcb->sched_priority = (uint8_t) priority;
-
- /* Return the task to the specified blocked task list.
- * nxsched_add_readytorun will return true if the task was added to the
- * new list. We will need to perform a context switch only if the
- * EXCLUSIVE or of the two calls is non-zero (i.e., one and only one
- * the calls changes the head of the ready-to-run list).
- */
-
- switch_needed ^= nxsched_add_readytorun(tcb);
-
- /* Now, perform the context switch if one is needed */
-
- if (switch_needed)
- {
- /* If we are going to do a context switch, then now is the right
- * time to add any pending tasks back into the ready-to-run list.
- */
-
- if (g_pendingtasks.head)
- {
- nxsched_merge_pending();
- }
-
- /* Update scheduler parameters */
-
- nxsched_suspend_scheduler(rtcb);
-
- /* Are we in an interrupt handler? */
-
- if (g_current_regs)
- {
- /* Yes, then we have to do things differently. Just copy the
- * g_current_regs into the OLD rtcb.
- */
-
- up_savestate(rtcb->xcp.regs);
-
- /* Restore the exception context of the rtcb at the (new) head
- * of the ready-to-run task list.
- */
-
- rtcb = this_task();
-
- /* Update scheduler parameters */
-
- nxsched_resume_scheduler(rtcb);
-
- /* Then switch contexts. Any necessary address environment
- * changes will be made when the interrupt returns.
- */
-
- up_restorestate(rtcb->xcp.regs);
- }
-
- /* No, then we will need to perform the user context switch */
-
- else
- {
- /* Switch context to the context of the task at the head of the
- * ready to run list.
- */
-
- struct tcb_s *nexttcb = this_task();
-
- /* Update scheduler parameters */
-
- nxsched_resume_scheduler(nexttcb);
-
- /* Then switch contexts */
-
- up_switchcontext(rtcb->xcp.regs, nexttcb->xcp.regs);
-
- /* up_switchcontext forces a context switch to the task at the
- * head of the ready-to-run list. It does not 'return' in the
- * normal sense. When it does return, it is because the
- * blocked task is again ready to run and has execution
- * priority.
- */
- }
- }
- }
-}
diff --git a/arch/or1k/src/common/up_reprioritizertr.c b/arch/or1k/src/common/up_reprioritizertr.c
deleted file mode 100644
index 363e11a900..0000000000
--- a/arch/or1k/src/common/up_reprioritizertr.c
+++ /dev/null
@@ -1,183 +0,0 @@
-/****************************************************************************
- * arch/or1k/src/common/up_reprioritizertr.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 <stdint.h>
-#include <stdbool.h>
-#include <sched.h>
-#include <assert.h>
-#include <debug.h>
-#include <nuttx/arch.h>
-#include <nuttx/sched.h>
-
-#include "sched/sched.h"
-#include "group/group.h"
-#include "up_internal.h"
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: up_reprioritize_rtr
- *
- * Description:
- * Called when the priority of a running or
- * ready-to-run task changes and the reprioritization will
- * cause a context switch. Two cases:
- *
- * 1) The priority of the currently running task drops and the next
- * task in the ready to run list has priority.
- * 2) An idle, ready to run task's priority has been raised above the
- * priority of the current, running task and it now has the priority.
- *
- * Input Parameters:
- * tcb: The TCB of the task that has been reprioritized
- * priority: The new task priority
- *
- ****************************************************************************/
-
-void up_reprioritize_rtr(struct tcb_s *tcb, uint8_t priority)
-{
- /* Verify that the caller is sane */
-
- if (tcb->task_state < FIRST_READY_TO_RUN_STATE ||
- tcb->task_state > LAST_READY_TO_RUN_STATE
-#if SCHED_PRIORITY_MIN > 0
- || priority < SCHED_PRIORITY_MIN
-#endif
-#if SCHED_PRIORITY_MAX < UINT8_MAX
- || priority > SCHED_PRIORITY_MAX
-#endif
- )
- {
- DEBUGPANIC();
- }
- else
- {
- struct tcb_s *rtcb = this_task();
- bool switch_needed;
-
- sinfo("TCB=%p PRI=%d\n", tcb, priority);
-
- /* Remove the tcb task from the ready-to-run list.
- * nxsched_remove_readytorun will return true if we just
- * remove the head of the ready to run list.
- */
-
- switch_needed = nxsched_remove_readytorun(tcb, false);
-
- /* Setup up the new task priority */
-
- tcb->sched_priority = (uint8_t)priority;
-
- /* Return the task to the specified blocked task list.
- * nxsched_add_readytorun will return true if the task was
- * added to the new list. We will need to perform a context
- * switch only if the EXCLUSIVE or of the two calls is non-zero
- * (i.e., one and only one the calls changes the head of the
- * ready-to-run list).
- */
-
- switch_needed ^= nxsched_add_readytorun(tcb);
-
- /* Now, perform the context switch if one is needed */
-
- if (switch_needed)
- {
- /* If we are going to do a context switch, then now is the right
- * time to add any pending tasks back into the ready-to-run list.
- */
-
- if (g_pendingtasks.head)
- {
- nxsched_merge_pending();
- }
-
- /* Update scheduler parameters */
-
- nxsched_suspend_scheduler(rtcb);
-
- /* Are we in an interrupt handler? */
-
- if (CURRENT_REGS)
- {
- /* Yes, then we have to do things differently.
- * Just copy the CURRENT_REGS into the OLD rtcb.
- */
-
- up_savestate(rtcb->xcp.regs);
-
- /* Restore the exception context of the rtcb at the (new) head
- * of the ready-to-run task list.
- */
-
- rtcb = this_task();
-
- /* Update scheduler parameters */
-
- nxsched_resume_scheduler(rtcb);
-
- /* Then switch contexts. Any necessary address environment
- * changes will be made when the interrupt returns.
- */
-
- up_restorestate(rtcb->xcp.regs);
- }
-
- /* Copy the exception context into the TCB at the (old) head of the
- * ready-to-run Task list. if up_saveusercontext returns a non-zero
- * value, then this is really the previously running task
- * restarting!
- */
-
- else if (!up_saveusercontext(rtcb->xcp.regs))
- {
- /* Restore the exception context of the rtcb at the (new) head
- * of the ready-to-run task list.
- */
-
- rtcb = this_task();
-
-#ifdef CONFIG_ARCH_ADDRENV
- /* Make sure that the address environment for the previously
- * running task is closed down gracefully (data caches dump,
- * MMU flushed) and set up the address environment for the new
- * thread at the head of the ready-to-run list.
- */
-
- group_addrenv(rtcb);
-#endif
- /* Update scheduler parameters */
-
- nxsched_resume_scheduler(rtcb);
-
- /* Then switch contexts */
-
- up_fullcontextrestore(rtcb->xcp.regs);
- }
- }
- }
-}
diff --git a/arch/or1k/src/mor1kx/Make.defs b/arch/or1k/src/mor1kx/Make.defs
index aa5a8a8796..689d942854 100644
--- a/arch/or1k/src/mor1kx/Make.defs
+++ b/arch/or1k/src/mor1kx/Make.defs
@@ -34,7 +34,6 @@ CMN_CSRCS = up_initialize.c \
up_releasepending.c \
up_schedulesigaction.c \
up_copyfullstate.c \
- up_reprioritizertr.c \
up_assert.c \
up_exit.c \
up_udelay.c \
diff --git a/arch/renesas/src/common/up_reprioritizertr.c b/arch/renesas/src/common/up_reprioritizertr.c
deleted file mode 100644
index cc41f8ace6..0000000000
--- a/arch/renesas/src/common/up_reprioritizertr.c
+++ /dev/null
@@ -1,183 +0,0 @@
-/****************************************************************************
- * arch/renesas/src/common/up_reprioritizertr.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 <stdint.h>
-#include <stdbool.h>
-#include <sched.h>
-#include <assert.h>
-#include <debug.h>
-#include <nuttx/arch.h>
-#include <nuttx/sched.h>
-
-#include "sched/sched.h"
-#include "group/group.h"
-#include "up_internal.h"
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: up_reprioritize_rtr
- *
- * Description:
- * Called when the priority of a running or
- * ready-to-run task changes and the reprioritization will
- * cause a context switch. Two cases:
- *
- * 1) The priority of the currently running task drops and the next
- * task in the ready to run list has priority.
- * 2) An idle, ready to run task's priority has been raised above the
- * priority of the current, running task and it now has the priority.
- *
- * Input Parameters:
- * tcb: The TCB of the task that has been reprioritized
- * priority: The new task priority
- *
- ****************************************************************************/
-
-void up_reprioritize_rtr(struct tcb_s *tcb, uint8_t priority)
-{
- /* Verify that the caller is sane */
-
- if (tcb->task_state < FIRST_READY_TO_RUN_STATE ||
- tcb->task_state > LAST_READY_TO_RUN_STATE
-#if SCHED_PRIORITY_MIN > 0
- || priority < SCHED_PRIORITY_MIN
-#endif
-#if SCHED_PRIORITY_MAX < UINT8_MAX
- || priority > SCHED_PRIORITY_MAX
-#endif
- )
- {
- DEBUGPANIC();
- }
- else
- {
- struct tcb_s *rtcb = this_task();
- bool switch_needed;
-
- sinfo("TCB=%p PRI=%d\n", tcb, priority);
-
- /* Remove the tcb task from the ready-to-run list.
- * nxsched_remove_readytorun will return true if we just
- * remove the head of the ready to run list.
- */
-
- switch_needed = nxsched_remove_readytorun(tcb, false);
-
- /* Setup up the new task priority */
-
- tcb->sched_priority = (uint8_t)priority;
-
- /* Return the task to the specified blocked task list.
- * nxsched_add_readytorun will return true if the task was
- * added to the new list. We will need to perform a context
- * switch only if the EXCLUSIVE or of the two calls is non-zero
- * (i.e., one and only one the calls changes the head of the
- * ready-to-run list).
- */
-
- switch_needed ^= nxsched_add_readytorun(tcb);
-
- /* Now, perform the context switch if one is needed */
-
- if (switch_needed)
- {
- /* If we are going to do a context switch, then now is the right
- * time to add any pending tasks back into the ready-to-run list.
- */
-
- if (g_pendingtasks.head)
- {
- nxsched_merge_pending();
- }
-
- /* Update scheduler parameters */
-
- nxsched_suspend_scheduler(rtcb);
-
- /* Are we in an interrupt handler? */
-
- if (g_current_regs)
- {
- /* Yes, then we have to do things differently.
- * Just copy the g_current_regs into the OLD rtcb.
- */
-
- up_savestate(rtcb->xcp.regs);
-
- /* Restore the exception context of the rtcb at the (new) head
- * of the ready-to-run task list.
- */
-
- rtcb = this_task();
-
- /* Update scheduler parameters */
-
- nxsched_resume_scheduler(rtcb);
-
- /* Then switch contexts. Any necessary address environment
- * changes will be made when the interrupt returns.
- */
-
- g_current_regs = rtcb->xcp.regs;
- }
-
- /* Copy the exception context into the TCB at the (old) head of the
- * ready-to-run Task list. if up_saveusercontext returns a non-zero
- * value, then this is really the previously running task
- * restarting!
- */
-
- else if (!up_saveusercontext(rtcb->xcp.regs))
- {
- /* Restore the exception context of the rtcb at the (new) head
- * of the ready-to-run task list.
- */
-
- rtcb = this_task();
-
-#ifdef CONFIG_ARCH_ADDRENV
- /* Make sure that the address environment for the previously
- * running task is closed down gracefully (data caches dump,
- * MMU flushed) and set up the address environment for the
- * new thread at the head of the ready-to-run list.
- */
-
- group_addrenv(rtcb);
-#endif
- /* Update scheduler parameters */
-
- nxsched_resume_scheduler(rtcb);
-
- /* Then switch contexts */
-
- up_fullcontextrestore(rtcb->xcp.regs);
- }
- }
- }
-}
diff --git a/arch/renesas/src/m16c/Make.defs b/arch/renesas/src/m16c/Make.defs
index 9c5326a2ac..a59716ca3f 100644
--- a/arch/renesas/src/m16c/Make.defs
+++ b/arch/renesas/src/m16c/Make.defs
@@ -23,7 +23,7 @@ HEAD_ASRC = m16c_head.S
CMN_CSRCS = up_allocateheap.c up_assert.c up_blocktask.c
CMN_CSRCS += up_createstack.c up_doirq.c up_exit.c up_idle.c up_initialize.c
CMN_CSRCS += up_lowputs.c up_mdelay.c up_nputs.c
-CMN_CSRCS += up_releasepending.c up_releasestack.c up_reprioritizertr.c
+CMN_CSRCS += up_releasepending.c up_releasestack.c
CMN_CSRCS += up_stackframe.c up_udelay.c up_unblocktask.c up_usestack.c
CHIP_ASRCS = m16c_vectors.S
diff --git a/arch/renesas/src/rx65n/Make.defs b/arch/renesas/src/rx65n/Make.defs
index 2d77e89226..042c7091af 100644
--- a/arch/renesas/src/rx65n/Make.defs
+++ b/arch/renesas/src/rx65n/Make.defs
@@ -23,7 +23,7 @@ HEAD_ASRC = rx65n_head.S
CMN_CSRCS = up_allocateheap.c up_assert.c up_blocktask.c
CMN_CSRCS += up_createstack.c up_doirq.c up_exit.c up_idle.c up_initialize.c
CMN_CSRCS += up_lowputs.c up_mdelay.c up_nputs.c
-CMN_CSRCS += up_releasepending.c up_releasestack.c up_reprioritizertr.c
+CMN_CSRCS += up_releasepending.c up_releasestack.c
CMN_CSRCS += up_stackframe.c up_udelay.c up_unblocktask.c up_usestack.c
CHIP_ASRCS = rx65n_vector.S
diff --git a/arch/renesas/src/sh1/Make.defs b/arch/renesas/src/sh1/Make.defs
index 4ff0cd13c2..7151a41bef 100644
--- a/arch/renesas/src/sh1/Make.defs
+++ b/arch/renesas/src/sh1/Make.defs
@@ -24,7 +24,7 @@ CMN_CSRCS = up_allocateheap.c up_assert.c up_blocktask.c
CMN_CSRCS += up_createstack.c up_doirq.c up_exit.c up_idle.c up_initialize.c
CMN_CSRCS += up_initialstate.c up_lowputs.c
CMN_CSRCS += up_mdelay.c up_nputs.c up_releasepending.c up_releasestack.c
-CMN_CSRCS += up_reprioritizertr.c up_stackframe.c up_udelay.c
+CMN_CSRCS += up_stackframe.c up_udelay.c
CMN_CSRCS += sh1_schedulesigaction.c sh1_sigdeliver.c
CMN_CSRCS += up_unblocktask.c up_usestack.c
diff --git a/arch/risc-v/src/common/Make.defs b/arch/risc-v/src/common/Make.defs
index 7b8bcfc417..bcfdb10da6 100644
--- a/arch/risc-v/src/common/Make.defs
+++ b/arch/risc-v/src/common/Make.defs
@@ -30,7 +30,7 @@ CMN_CSRCS += riscv_initialize.c riscv_swint.c riscv_mtimer.c
CMN_CSRCS += riscv_allocateheap.c riscv_createstack.c riscv_exit.c
CMN_CSRCS += riscv_assert.c riscv_blocktask.c riscv_copystate.c riscv_initialstate.c
CMN_CSRCS += riscv_modifyreg32.c riscv_nputs.c
-CMN_CSRCS += riscv_releasepending.c riscv_reprioritizertr.c
+CMN_CSRCS += riscv_releasepending.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 riscv_tcbinfo.c riscv_cpuidlestack.c
diff --git a/arch/risc-v/src/common/riscv_reprioritizertr.c b/arch/risc-v/src/common/riscv_reprioritizertr.c
deleted file mode 100644
index 53fd2abb34..0000000000
--- a/arch/risc-v/src/common/riscv_reprioritizertr.c
+++ /dev/null
@@ -1,179 +0,0 @@
-/****************************************************************************
- * arch/risc-v/src/common/riscv_reprioritizertr.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 <stdint.h>
-#include <stdbool.h>
-#include <sched.h>
-#include <syscall.h>
-#include <assert.h>
-#include <debug.h>
-
-#include <nuttx/arch.h>
-#include <nuttx/sched.h>
-
-#include "sched/sched.h"
-#include "group/group.h"
-#include "riscv_internal.h"
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: up_reprioritize_rtr
- *
- * Description:
- * Called when the priority of a running or
- * ready-to-run task changes and the reprioritization will
- * cause a context switch. Two cases:
- *
- * 1) The priority of the currently running task drops and the next
- * task in the ready to run list has priority.
- * 2) An idle, ready to run task's priority has been raised above the
- * priority of the current, running task and it now has the priority.
- *
- * Input Parameters:
- * tcb: The TCB of the task that has been reprioritized
- * priority: The new task priority
- *
- ****************************************************************************/
-
-void up_reprioritize_rtr(struct tcb_s *tcb, uint8_t priority)
-{
- /* Verify that the caller is sane */
-
- if (tcb->task_state < FIRST_READY_TO_RUN_STATE ||
- tcb->task_state > LAST_READY_TO_RUN_STATE
-#if SCHED_PRIORITY_MIN > 0
- || priority < SCHED_PRIORITY_MIN
-#endif
-#if SCHED_PRIORITY_MAX < UINT8_MAX
- || priority > SCHED_PRIORITY_MAX
-#endif
- )
- {
- DEBUGPANIC();
- }
- else
- {
- struct tcb_s *rtcb = this_task();
- bool switch_needed;
-
- sinfo("TCB=%p PRI=%d\n", tcb, priority);
-
- /* Remove the tcb task from the ready-to-run list.
- * nxsched_remove_readytorun will return true if we just
- * remove the head of the ready to run list.
- */
-
- switch_needed = nxsched_remove_readytorun(tcb, false);
-
- /* Setup up the new task priority */
-
- tcb->sched_priority = (uint8_t)priority;
-
- /* Return the task to the specified blocked task list.
- * nxsched_add_readytorun will return true if the task was
- * added to the new list. We will need to perform a context
- * switch only if the EXCLUSIVE or of the two calls is non-zero
- * (i.e., one and only one the calls changes the head of the
- * ready-to-run list).
- */
-
- switch_needed ^= nxsched_add_readytorun(tcb);
-
- /* Now, perform the context switch if one is needed */
-
- if (switch_needed)
- {
- /* If we are going to do a context switch, then now is the right
- * time to add any pending tasks back into the ready-to-run list.
- */
-
- if (g_pendingtasks.head)
- {
- nxsched_merge_pending();
- }
-
- /* Update scheduler parameters */
-
- nxsched_suspend_scheduler(rtcb);
-
- /* Are we in an interrupt handler? */
-
- if (CURRENT_REGS)
- {
- /* Yes, then we have to do things differently.
- * Just copy the CURRENT_REGS into the OLD rtcb.
- */
-
- riscv_savestate(rtcb->xcp.regs);
-
- /* Restore the exception context of the rtcb at the (new) head
- * of the ready-to-run task list.
- */
-
- rtcb = this_task();
-
- /* Update scheduler parameters */
-
- nxsched_resume_scheduler(rtcb);
-
- /* Then switch contexts. Any necessary address environment
- * changes will be made when the interrupt returns.
- */
-
- riscv_restorestate(rtcb->xcp.regs);
- }
-
- /* No, then we will need to perform the user context switch */
-
- else
- {
- /* Switch context to the context of the task at the head of the
- * ready to run list.
- */
-
- struct tcb_s *nexttcb = this_task();
-
- /* Update scheduler parameters */
-
- nxsched_resume_scheduler(nexttcb);
-
- /* Then switch contexts */
-
- riscv_switchcontext(&rtcb->xcp.regs, nexttcb->xcp.regs);
-
- /* riscv_switchcontext forces a context switch to the task at
- * the head of the ready-to-run list. It does not 'return' in
- * the normal sense. When it does return, it is because the
- * blocked task is again ready to run and has execution
- * priority.
- */
- }
- }
- }
-}
diff --git a/arch/sim/src/Makefile b/arch/sim/src/Makefile
index 0357923b0b..da4614f222 100644
--- a/arch/sim/src/Makefile
+++ b/arch/sim/src/Makefile
@@ -60,7 +60,7 @@ AOBJS = $(ASRCS:.S=$(OBJEXT))
CSRCS = up_initialize.c up_idle.c up_interruptcontext.c up_initialstate.c
CSRCS += up_createstack.c up_usestack.c up_releasestack.c up_stackframe.c
CSRCS += up_unblocktask.c up_blocktask.c up_releasepending.c
-CSRCS += up_reprioritizertr.c up_exit.c up_schedulesigaction.c
+CSRCS += up_exit.c up_schedulesigaction.c
CSRCS += up_heap.c up_uart.c up_assert.c up_nputs.c
CSRCS += up_copyfullstate.c
CSRCS += up_sigdeliver.c
diff --git a/arch/sim/src/sim/up_reprioritizertr.c b/arch/sim/src/sim/up_reprioritizertr.c
deleted file mode 100644
index 2b5b0807b0..0000000000
--- a/arch/sim/src/sim/up_reprioritizertr.c
+++ /dev/null
@@ -1,168 +0,0 @@
-/****************************************************************************
- * arch/sim/src/sim/up_reprioritizertr.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 <stdint.h>
-#include <stdbool.h>
-#include <sched.h>
-#include <assert.h>
-#include <debug.h>
-
-#include <nuttx/arch.h>
-#include <nuttx/sched.h>
-
-#include "sched/sched.h"
-#include "up_internal.h"
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: up_reprioritize_rtr
- *
- * Description:
- * Called when the priority of a running or
- * ready-to-run task changes and the reprioritization will
- * cause a context switch. Two cases:
- *
- * 1) The priority of the currently running task drops and the next
- * task in the ready to run list has priority.
- * 2) An idle, ready to run task's priority has been raised above the
- * priority of the current, running task and it now has the priority.
- *
- * Input Parameters:
- * tcb: The TCB of the task that has been reprioritized
- * priority: The new task priority
- *
- ****************************************************************************/
-
-void up_reprioritize_rtr(struct tcb_s *tcb, uint8_t priority)
-{
- /* Verify that the caller is sane */
-
- if (tcb->task_state < FIRST_READY_TO_RUN_STATE ||
- tcb->task_state > LAST_READY_TO_RUN_STATE
-#if SCHED_PRIORITY_MIN > 0
- || priority < SCHED_PRIORITY_MIN
-#endif
-#if SCHED_PRIORITY_MAX < UINT8_MAX
- || priority > SCHED_PRIORITY_MAX
-#endif
- )
- {
- DEBUGPANIC();
- }
- else
- {
- struct tcb_s *rtcb = this_task();
- bool switch_needed;
-
- sinfo("TCB=%p PRI=%d\n", tcb, priority);
-
- /* Remove the tcb task from the ready-to-run list.
- * nxsched_remove_readytorun will return true if we just
- * remove the head of the ready to run list.
- */
-
- switch_needed = nxsched_remove_readytorun(tcb, false);
-
- /* Setup up the new task priority */
-
- tcb->sched_priority = (uint8_t)priority;
-
- /* Return the task to the specified blocked task list.
- * nxsched_add_readytorun will return true if the task was
- * added to the new list. We will need to perform a context
- * switch only if the EXCLUSIVE or of the two calls is non-zero
- * (i.e., one and only one the calls changes the head of the
- * ready-to-run list).
- */
-
- switch_needed ^= nxsched_add_readytorun(tcb);
-
- /* Now, perform the context switch if one is needed */
-
- if (switch_needed)
- {
- /* If we are going to do a context switch, then now is the right
- * time to add any pending tasks back into the ready-to-run list.
- */
-
- if (g_pendingtasks.head)
- {
- nxsched_merge_pending();
- }
-
- /* Update scheduler parameters */
-
- nxsched_suspend_scheduler(rtcb);
-
- if (CURRENT_REGS)
- {
- /* TODO */
-
- ASSERT(false);
- }
-
- /* Copy the exception context into the TCB at the (old) head of the
- * ready-to-run Task list. if setjmp returns a non-zero
- * value, then this is really the previously running task
- * restarting!
- */
-
- else if (!setjmp(rtcb->xcp.regs))
- {
- /* Restore the exception context of the rtcb at the (new) head
- * of the ready-to-run task list.
- */
-
- rtcb = this_task();
- sinfo("New Active Task TCB=%p\n", rtcb);
-
- /* Update scheduler parameters */
-
- nxsched_resume_scheduler(rtcb);
-
- /* Restore the cpu lock */
-
- restore_critical_section();
-
- /* Then switch contexts */
-
- longjmp(rtcb->xcp.regs, 1);
- }
- else
- {
- /* The way that we handle signals in the simulation is kind of
- * a kludge. This would be unsafe in a truly multi-threaded,
- * interrupt driven environment.
- */
-
- sim_sigdeliver();
- }
- }
- }
-}
diff --git a/arch/sparc/src/common/Make.defs b/arch/sparc/src/common/Make.defs
index 9483b5a014..22dafd2287 100644
--- a/arch/sparc/src/common/Make.defs
+++ b/arch/sparc/src/common/Make.defs
@@ -26,7 +26,7 @@ CMN_CSRCS += up_createstack.c up_doirq.c up_exit.c up_idle.c up_initialize.c
CMN_CSRCS += up_initialstate.c up_irq.c up_lowputs.c
CMN_CSRCS += up_mdelay.c up_modifyreg8.c up_modifyreg16.c up_modifyreg32.c
CMN_CSRCS += up_nputs.c up_releasepending.c up_releasestack.c
-CMN_CSRCS += up_reprioritizertr.c up_schedulesigaction.c up_sigdeliver.c
+CMN_CSRCS += up_schedulesigaction.c up_sigdeliver.c
CMN_CSRCS += up_stackframe.c up_swint1.c up_udelay.c up_unblocktask.c up_usestack.c
# Configuration-dependent common files
diff --git a/arch/sparc/src/sparc_v8/up_reprioritizertr.c b/arch/sparc/src/sparc_v8/up_reprioritizertr.c
deleted file mode 100644
index cf5946fbae..0000000000
--- a/arch/sparc/src/sparc_v8/up_reprioritizertr.c
+++ /dev/null
@@ -1,175 +0,0 @@
-/****************************************************************************
- * arch/sparc/src/sparc_v8/up_reprioritizertr.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 <stdint.h>
-#include <stdbool.h>
-#include <sched.h>
-#include <syscall.h>
-#include <assert.h>
-#include <debug.h>
-#include <nuttx/arch.h>
-#include <nuttx/sched.h>
-
-#include "sched/sched.h"
-#include "up_internal.h"
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: up_reprioritize_rtr
- *
- * Description:
- * Called when the priority of a running or
- * ready-to-run task changes and the reprioritization will
- * cause a context switch. Two cases:
- *
- * 1) The priority of the currently running task drops and the next
- * task in the ready to run list has priority.
- * 2) An idle, ready to run task's priority has been raised above the
- * the priority of the current, running task and it now has the
- * priority.
- *
- * Input Parameters:
- * tcb: The TCB of the task that has been reprioritized
- * priority: The new task priority
- *
- ****************************************************************************/
-
-void up_reprioritize_rtr(struct tcb_s *tcb, uint8_t priority)
-{
- /* Verify that the caller is sane */
-
- if (tcb->task_state < FIRST_READY_TO_RUN_STATE ||
- tcb->task_state > LAST_READY_TO_RUN_STATE
-#if SCHED_PRIORITY_MIN > 0
- || priority < SCHED_PRIORITY_MIN
-#endif
-#if SCHED_PRIORITY_MAX < UINT8_MAX
- || priority > SCHED_PRIORITY_MAX
-#endif
- )
- {
- DEBUGPANIC();
- }
- else
- {
- struct tcb_s *rtcb = this_task();
- bool switch_needed;
-
- sinfo("TCB=%p PRI=%d\n", tcb, priority);
-
- /* Remove the tcb task from the ready-to-run list.
- * nxsched_remove_readytorun will return true if we just
- * remove the head of the ready to run list.
- */
-
- switch_needed = nxsched_remove_readytorun(tcb, false);
-
- /* Setup up the new task priority */
-
- tcb->sched_priority = (uint8_t)priority;
-
- /* Return the task to the specified blocked task list.
- * nxsched_add_readytorun will return true if the task was
- * added to the new list. We will need to perform a context
- * switch only if the EXCLUSIVE or of the two calls is non-zero
- * (i.e., one and only one the calls changes the head of the
- * ready-to-run list).
- */
-
- switch_needed ^= nxsched_add_readytorun(tcb);
-
- /* Now, perform the context switch if one is needed */
-
- if (switch_needed)
- {
- /* If we are going to do a context switch, then now is the right
- * time to add any pending tasks back into the ready-to-run list.
- * task list now
- */
-
- if (g_pendingtasks.head)
- {
- nxsched_merge_pending();
- }
-
- /* Update scheduler parameters */
-
- nxsched_suspend_scheduler(rtcb);
-
- /* Are we in an interrupt handler? */
-
- if (CURRENT_REGS)
- {
- /* Yes, then we have to do things differently.
- * Just copy the CURRENT_REGS into the OLD rtcb.
- */
-
- up_savestate(rtcb->xcp.regs);
-
- /* Restore the exception context of the rtcb at the (new) head
- * of the ready-to-run task list.
- */
-
- rtcb = this_task();
-
- /* Update scheduler parameters */
-
- nxsched_resume_scheduler(rtcb);
-
- /* Then switch contexts */
-
- up_restorestate(rtcb->xcp.regs);
- }
-
- /* No, then we will need to perform the user context switch */
-
- else
- {
- struct tcb_s *nexttcb = this_task();
-
- /* Update scheduler parameters */
-
- nxsched_resume_scheduler(nexttcb);
-
- /* Switch context to the context of the task at the head of the
- * ready to run list.
- */
-
- up_switchcontext(rtcb->xcp.regs, nexttcb->xcp.regs);
-
- /* up_switchcontext forces a context switch to the task at the
- * head of the ready-to-run list. It does not 'return' in the
- * normal sense. When it does return,it is because the blocked
- * task is again ready to run and has execution priority.
- */
- }
- }
- }
-}
-
diff --git a/arch/x86/src/common/up_reprioritizertr.c b/arch/x86/src/common/up_reprioritizertr.c
deleted file mode 100644
index 3489854c87..0000000000
--- a/arch/x86/src/common/up_reprioritizertr.c
+++ /dev/null
@@ -1,183 +0,0 @@
-/****************************************************************************
- * arch/x86/src/common/up_reprioritizertr.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 <stdint.h>
-#include <stdbool.h>
-#include <sched.h>
-#include <assert.h>
-#include <debug.h>
-#include <nuttx/arch.h>
-#include <nuttx/sched.h>
-
-#include "sched/sched.h"
-#include "group/group.h"
-#include "up_internal.h"
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: up_reprioritize_rtr
- *
- * Description:
- * Called when the priority of a running or
- * ready-to-run task changes and the reprioritization will
- * cause a context switch. Two cases:
- *
- * 1) The priority of the currently running task drops and the next
- * task in the ready to run list has priority.
- * 2) An idle, ready to run task's priority has been raised above the
- * priority of the current, running task and it now has the priority.
- *
- * Input Parameters:
- * tcb: The TCB of the task that has been reprioritized
- * priority: The new task priority
- *
- ****************************************************************************/
-
-void up_reprioritize_rtr(struct tcb_s *tcb, uint8_t priority)
-{
- /* Verify that the caller is sane */
-
- if (tcb->task_state < FIRST_READY_TO_RUN_STATE ||
- tcb->task_state > LAST_READY_TO_RUN_STATE
-#if SCHED_PRIORITY_MIN > 0
- || priority < SCHED_PRIORITY_MIN
-#endif
-#if SCHED_PRIORITY_MAX < UINT8_MAX
- || priority > SCHED_PRIORITY_MAX
-#endif
- )
- {
- DEBUGPANIC();
- }
- else
- {
- struct tcb_s *rtcb = this_task();
- bool switch_needed;
-
- sinfo("TCB=%p PRI=%d\n", tcb, priority);
-
- /* Remove the tcb task from the ready-to-run list.
- * nxsched_remove_readytorun will return true if we just
- * remove the head of the ready to run list.
- */
-
- switch_needed = nxsched_remove_readytorun(tcb, false);
-
- /* Setup up the new task priority */
-
- tcb->sched_priority = (uint8_t)priority;
-
- /* Return the task to the specified blocked task list.
- * nxsched_add_readytorun will return true if the task was
- * added to the new list. We will need to perform a context
- * switch only if the EXCLUSIVE or of the two calls is non-zero
- * (i.e., one and only one the calls changes the head of the
- * ready-to-run list).
- */
-
- switch_needed ^= nxsched_add_readytorun(tcb);
-
- /* Now, perform the context switch if one is needed */
-
- if (switch_needed)
- {
- /* If we are going to do a context switch, then now is the right
- * time to add any pending tasks back into the ready-to-run list.
- */
-
- if (g_pendingtasks.head)
- {
- nxsched_merge_pending();
- }
-
- /* Update scheduler parameters */
-
- nxsched_suspend_scheduler(rtcb);
-
- /* Are we in an interrupt handler? */
-
- if (g_current_regs)
- {
- /* Yes, then we have to do things differently.
- * Just copy the g_current_regs into the OLD rtcb.
- */
-
- up_savestate(rtcb->xcp.regs);
-
- /* Restore the exception context of the rtcb at the (new) head
- * of the ready-to-run task list.
- */
-
- rtcb = this_task();
-
- /* Update scheduler parameters */
-
- nxsched_resume_scheduler(rtcb);
-
- /* Then switch contexts. Any necessary address environment
- * changes will be made when the interrupt returns.
- */
-
- up_restorestate(rtcb->xcp.regs);
- }
-
- /* Copy the exception context into the TCB at the (old) head of the
- * ready-to-run Task list. if up_saveusercontext returns a non-zero
- * value, then this is really the previously running task
- * restarting!
- */
-
- else if (!up_saveusercontext(rtcb->xcp.regs))
- {
- /* Restore the exception context of the rtcb at the (new) head
- * of the ready-to-run task list.
- */
-
- rtcb = this_task();
-
-#ifdef CONFIG_ARCH_ADDRENV
- /* Make sure that the address environment for the previously
- * running task is closed down gracefully (data caches dump,
- * MMU flushed) and set up the address environment for the new
- * thread at the head of the ready-to-run list.
- */
-
- group_addrenv(rtcb);
-#endif
- /* Update scheduler parameters */
-
- nxsched_resume_scheduler(rtcb);
-
- /* Then switch contexts */
-
- up_fullcontextrestore(rtcb->xcp.regs);
- }
- }
- }
-}
diff --git a/arch/x86/src/qemu/Make.defs b/arch/x86/src/qemu/Make.defs
index 4cd986f79d..71d628213e 100644
--- a/arch/x86/src/qemu/Make.defs
+++ b/arch/x86/src/qemu/Make.defs
@@ -30,7 +30,7 @@ CMN_CSRCS += up_createstack.c up_mdelay.c up_udelay.c up_exit.c
CMN_CSRCS += up_initialize.c up_initialstate.c
CMN_CSRCS += up_irq.c up_modifyreg8.c up_modifyreg16.c up_modifyreg32.c
CMN_CSRCS += up_regdump.c up_releasepending.c up_releasestack.c
-CMN_CSRCS += up_reprioritizertr.c up_savestate.c up_sigdeliver.c
+CMN_CSRCS += up_savestate.c up_sigdeliver.c
CMN_CSRCS += up_schedulesigaction.c up_stackframe.c up_unblocktask.c
CMN_CSRCS += up_usestack.c up_nputs.c
diff --git a/arch/x86_64/src/common/up_reprioritizertr.c b/arch/x86_64/src/common/up_reprioritizertr.c
deleted file mode 100644
index 15f4ae9c7c..0000000000
--- a/arch/x86_64/src/common/up_reprioritizertr.c
+++ /dev/null
@@ -1,185 +0,0 @@
-/****************************************************************************
- * arch/x86_64/src/common/up_reprioritizertr.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 <stdint.h>
-#include <stdbool.h>
-#include <sched.h>
-#include <assert.h>
-#include <debug.h>
-#include <nuttx/arch.h>
-#include <nuttx/sched.h>
-
-#include "sched/sched.h"
-#include "group/group.h"
-#include "up_internal.h"
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: up_reprioritize_rtr
- *
- * Description:
- * Called when the priority of a running or
- * ready-to-run task changes and the reprioritization will
- * cause a context switch. Two cases:
- *
- * 1) The priority of the currently running task drops and the next
- * task in the ready to run list has priority.
- * 2) An idle, ready to run task's priority has been raised above the
- * priority of the current, running task and it now has the priority.
- *
- * Input Parameters:
- * tcb: The TCB of the task that has been reprioritized
- * priority: The new task priority
- *
- ****************************************************************************/
-
-void up_reprioritize_rtr(struct tcb_s *tcb, uint8_t priority)
-{
- /* Verify that the caller is sane */
-
- if (tcb->task_state < FIRST_READY_TO_RUN_STATE ||
- tcb->task_state > LAST_READY_TO_RUN_STATE
-#if SCHED_PRIORITY_MIN > 0
- || priority < SCHED_PRIORITY_MIN
-#endif
-#if SCHED_PRIORITY_MAX < UINT8_MAX
- || priority > SCHED_PRIORITY_MAX
-#endif
- )
- {
- PANIC();
- }
- else
- {
- struct tcb_s *rtcb = this_task();
- bool switch_needed;
-
- sinfo("TCB=%p PRI=%d\n", tcb, priority);
-
- /* Remove the tcb task from the ready-to-run list.
- * nxsched_remove_readytorun will return true if we just
- * remove the head of the ready to run list.
- */
-
- switch_needed = nxsched_remove_readytorun(tcb, false);
-
- /* Setup up the new task priority */
-
- tcb->sched_priority = (uint8_t)priority;
-
- /* Return the task to the specified blocked task list.
- * nxsched_add_readytorun will return true if the task was
- * added to the new list. We will need to perform a context
- * switch only if the EXCLUSIVE or of the two calls is non-zero
- * (i.e., one and only one the calls changes the head of the
- * ready-to-run list).
- */
-
- switch_needed ^= nxsched_add_readytorun(tcb);
-
- /* Now, perform the context switch if one is needed */
-
- if (switch_needed)
- {
- /* If we are going to do a context switch, then now is the right
- * time to add any pending tasks back into the ready-to-run list.
- */
-
- if (g_pendingtasks.head)
- {
- nxsched_merge_pending();
- }
-
- /* Update scheduler parameters */
-
- nxsched_suspend_scheduler(rtcb);
-
- /* Are we in an interrupt handler? */
-
- if (g_current_regs)
- {
- /* Yes, then we have to do things differently.
- * Just copy the g_current_regs into the OLD rtcb.
- */
-
- up_savestate(rtcb->xcp.regs);
-
- /* Restore the exception context of the rtcb at the (new) head
- * of the ready-to-run task list.
- */
-
- rtcb = this_task();
- up_restore_auxstate(rtcb);
-
- /* Update scheduler parameters */
-
- nxsched_resume_scheduler(rtcb);
-
- /* Then switch contexts. Any necessary address environment
- * changes will be made when the interrupt returns.
- */
-
- up_restorestate(rtcb->xcp.regs);
- }
-
- /* Copy the exception context into the TCB at the (old) head of the
- * ready-to-run Task list. if up_saveusercontext returns a non-zero
- * value, then this is really the previously running task
- * restarting!
- */
-
- else if (!up_saveusercontext(rtcb->xcp.regs))
- {
- /* Restore the exception context of the rtcb at the (new) head
- * of the ready-to-run task list.
- */
-
- rtcb = this_task();
- up_restore_auxstate(rtcb);
-
-#ifdef CONFIG_ARCH_ADDRENV
- /* Make sure that the address environment for the previously
- * running task is closed down gracefully (data caches dump,
- * MMU flushed) and set up the address environment for the new
- * thread at the head of the ready-to-run list.
- */
-
- group_addrenv(rtcb);
-#endif
- /* Update scheduler parameters */
-
- nxsched_resume_scheduler(rtcb);
-
- /* Then switch contexts */
-
- up_fullcontextrestore(rtcb->xcp.regs);
- }
- }
- }
-}
diff --git a/arch/x86_64/src/intel64/Make.defs b/arch/x86_64/src/intel64/Make.defs
index 503a27504a..09661b547a 100644
--- a/arch/x86_64/src/intel64/Make.defs
+++ b/arch/x86_64/src/intel64/Make.defs
@@ -25,7 +25,7 @@ CMN_CSRCS += up_createstack.c up_mdelay.c up_udelay.c up_exit.c
CMN_CSRCS += up_initialize.c up_initialstate.c
CMN_CSRCS += up_irq.c up_modifyreg8.c up_modifyreg16.c up_modifyreg32.c
CMN_CSRCS += up_regdump.c up_releasepending.c up_releasestack.c
-CMN_CSRCS += up_reprioritizertr.c up_savestate.c up_sigdeliver.c
+CMN_CSRCS += up_savestate.c up_sigdeliver.c
CMN_CSRCS += up_schedulesigaction.c up_stackframe.c up_unblocktask.c
CMN_CSRCS += up_usestack.c up_nputs.c
CMN_CSRCS += up_rtc.c
diff --git a/arch/xtensa/src/common/Make.defs b/arch/xtensa/src/common/Make.defs
index 3685ae9f45..00a67d8dad 100644
--- a/arch/xtensa/src/common/Make.defs
+++ b/arch/xtensa/src/common/Make.defs
@@ -33,7 +33,7 @@ CMN_CSRCS += xtensa_initialize.c xtensa_initialstate.c
CMN_CSRCS += xtensa_irqdispatch.c xtensa_lowputs.c xtensa_mdelay.c
CMN_CSRCS += xtensa_modifyreg8.c xtensa_modifyreg16.c xtensa_modifyreg32.c
CMN_CSRCS += xtensa_nputs.c xtensa_releasepending.c xtensa_releasestack.c
-CMN_CSRCS += xtensa_reprioritizertr.c xtensa_schedsigaction.c
+CMN_CSRCS += xtensa_schedsigaction.c
CMN_CSRCS += xtensa_sigdeliver.c xtensa_stackframe.c xtensa_udelay.c
CMN_CSRCS += xtensa_unblocktask.c xtensa_usestack.c xtensa_swint.c
CMN_CSRCS += xtensa_saveusercontext.c
diff --git a/arch/xtensa/src/common/xtensa_reprioritizertr.c b/arch/xtensa/src/common/xtensa_reprioritizertr.c
deleted file mode 100644
index 55eec2dd82..0000000000
--- a/arch/xtensa/src/common/xtensa_reprioritizertr.c
+++ /dev/null
@@ -1,177 +0,0 @@
-/****************************************************************************
- * arch/xtensa/src/common/xtensa_reprioritizertr.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 <stdint.h>
-#include <stdbool.h>
-#include <sched.h>
-#include <assert.h>
-#include <debug.h>
-
-#include <nuttx/arch.h>
-#include <nuttx/sched.h>
-#include <arch/chip/core-isa.h>
-
-#include "sched/sched.h"
-#include "group/group.h"
-#include "xtensa.h"
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: up_reprioritize_rtr
- *
- * Description:
- * Called when the priority of a running or
- * ready-to-run task changes and the reprioritization will
- * cause a context switch. Two cases:
- *
- * 1) The priority of the currently running task drops and the next
- * task in the ready to run list has priority.
- * 2) An idle, ready to run task's priority has been raised above the
- * priority of the current, running task and it now has the priority.
- *
- * Input Parameters:
- * tcb: The TCB of the task that has been reprioritized
- * priority: The new task priority
- *
- ****************************************************************************/
-
-void up_reprioritize_rtr(struct tcb_s *tcb, uint8_t priority)
-{
- /* Verify that the caller is sane */
-
- if (tcb->task_state < FIRST_READY_TO_RUN_STATE ||
- tcb->task_state > LAST_READY_TO_RUN_STATE
-#if SCHED_PRIORITY_MIN > 0
- || priority < SCHED_PRIORITY_MIN
-#endif
-#if SCHED_PRIORITY_MAX < UINT8_MAX
- || priority > SCHED_PRIORITY_MAX
-#endif
- )
- {
- DEBUGPANIC();
- }
- else
- {
- struct tcb_s *rtcb = this_task();
- bool switch_needed;
-
- sinfo("TCB=%p PRI=%d\n", tcb, priority);
-
- /* Remove the tcb task from the ready-to-run list.
- * nxsched_remove_readytorun will return true if we just
- * remove the head of the ready to run list.
- */
-
- switch_needed = nxsched_remove_readytorun(tcb, false);
-
- /* Setup up the new task priority */
-
- tcb->sched_priority = (uint8_t)priority;
-
- /* Return the task to the specified blocked task list.
- * nxsched_add_readytorun will return true if the task was
- * added to the new list. We will need to perform a context
- * switch only if the EXCLUSIVE or of the two calls is non-zero
- * (i.e., one and only one the calls changes the head of the
- * ready-to-run list).
- */
-
- switch_needed ^= nxsched_add_readytorun(tcb);
-
- /* Now, perform the context switch if one is needed */
-
- if (switch_needed)
- {
- /* If we are going to do a context switch, then now is the right
- * time to add any pending tasks back into the ready-to-run list.
- */
-
- if (g_pendingtasks.head)
- {
- nxsched_merge_pending();
- }
-
- /* Update scheduler parameters */
-
- nxsched_suspend_scheduler(rtcb);
-
- /* Are we in an interrupt handler? */
-
- if (CURRENT_REGS)
- {
- /* Yes, then we have to do things differently.
- * Just copy the CURRENT_REGS into the OLD rtcb.
- */
-
- xtensa_savestate(rtcb->xcp.regs);
-
- /* Restore the exception context of the rtcb at the (new) head
- * of the ready-to-run task list.
- */
-
- rtcb = this_task();
-
- /* Update scheduler parameters */
-
- nxsched_resume_scheduler(rtcb);
-
- /* Then switch contexts. Any necessary address environment
- * changes will be made when the interrupt returns.
- */
-
- xtensa_restorestate(rtcb->xcp.regs);
- }
-
- /* No, then we will need to perform the user context switch */
-
- else
- {
- struct tcb_s *nexttcb = this_task();
-
- /* Reset scheduler parameters */
-
- nxsched_resume_scheduler(nexttcb);
-
- /* Switch context to the context of the task at the head of the
- * ready to run list.
- */
-
- xtensa_switchcontext(&rtcb->xcp.regs, nexttcb->xcp.regs);
-
- /* xtensa_switchcontext forces a context switch to the task at
- * the head of the ready-to-run list. It does not 'return' in
- * the normal sense. When it does return, it is because the
- * blocked task is again ready to run and has execution
- * priority.
- */
- }
- }
- }
-}
diff --git a/arch/z16/src/common/z16_reprioritizertr.c b/arch/z16/src/common/z16_reprioritizertr.c
deleted file mode 100644
index 8e57088d2a..0000000000
--- a/arch/z16/src/common/z16_reprioritizertr.c
+++ /dev/null
@@ -1,175 +0,0 @@
-/****************************************************************************
- * arch/z16/src/common/z16_reprioritizertr.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 <stdint.h>
-#include <stdbool.h>
-#include <sched.h>
-#include <assert.h>
-#include <debug.h>
-
-#include <nuttx/arch.h>
-#include <nuttx/sched.h>
-
-#include "chip.h"
-#include "sched/sched.h"
-#include "z16_internal.h"
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: up_reprioritize_rtr
- *
- * Description:
- * Called when the priority of a running or
- * ready-to-run task changes and the reprioritization will
- * cause a context switch. Two cases:
- *
- * 1) The priority of the currently running task drops and the next
- * task in the ready to run list has priority.
- * 2) An idle, ready to run task's priority has been raised above the
- * priority of the current, running task and it now has the priority.
- *
- * Input Parameters:
- * tcb: The TCB of the task that has been reprioritized
- * priority: The new task priority
- *
- ****************************************************************************/
-
-void up_reprioritize_rtr(FAR struct tcb_s *tcb, uint8_t priority)
-{
- /* Verify that the caller is sane */
-
- if (tcb->task_state < FIRST_READY_TO_RUN_STATE ||
- tcb->task_state > LAST_READY_TO_RUN_STATE
-#if SCHED_PRIORITY_MIN > 0
- || priority < SCHED_PRIORITY_MIN
-#endif
-#if SCHED_PRIORITY_MAX < UINT8_MAX
- || priority > SCHED_PRIORITY_MAX
-#endif
- )
- {
- DEBUGPANIC();
- }
- else
- {
- FAR struct tcb_s *rtcb = this_task();
- bool switch_needed;
-
- sinfo("TCB=%p PRI=%d\n", tcb, priority);
-
- /* Remove the tcb task from the ready-to-run list.
- * nxsched_remove_readytorun will return true if we just
- * remove the head of the ready to run list.
- */
-
- switch_needed = nxsched_remove_readytorun(tcb, false);
-
- /* Setup up the new task priority */
-
- tcb->sched_priority = (uint8_t)priority;
-
- /* Return the task to the specified blocked task list.
- * nxsched_add_readytorun will return true if the task was
- * added to the new list. We will need to perform a context
- * switch only if the EXCLUSIVE or of the two calls is non-zero
- * (i.e., one and only one the calls changes the head of the
- * ready-to-run list).
- */
-
- switch_needed ^= nxsched_add_readytorun(tcb);
-
- /* Now, perform the context switch if one is needed */
-
- if (switch_needed)
- {
- /* If we are going to do a context switch, then now is the right
- * time to add any pending tasks back into the ready-to-run list.
- */
-
- if (g_pendingtasks.head)
- {
- nxsched_merge_pending();
- }
-
- /* Update scheduler parameters */
-
- nxsched_suspend_scheduler(rtcb);
-
- /* Are we in an interrupt handler? */
-
- if (IN_INTERRUPT)
- {
- /* Yes, then we have to do things differently.
- * Just copy the current context into the OLD rtcb.
- */
-
- SAVE_IRQCONTEXT(rtcb);
-
- /* Restore the exception context of the rtcb at the (new) head
- * of the ready-to-run task list.
- */
-
- rtcb = this_task();
-
- /* Update scheduler parameters */
-
- nxsched_resume_scheduler(rtcb);
-
- /* Then setup so that the context will be performed on exit
- * from the interrupt.
- */
-
- SET_IRQCONTEXT(rtcb);
- }
-
- /* Copy the exception context into the TCB at the (old) head of
- * the ready-to-run Task list. if SAVE_USERCONTEXT returns a non-
- * zero value, then this is really the previously running task
- * restarting!
- */
-
- else if (!SAVE_USERCONTEXT(rtcb))
- {
- /* Restore the exception context of the rtcb at the (new) head
- * of the ready-to-run task list.
- */
-
- rtcb = this_task();
-
- /* Update scheduler parameters */
-
- nxsched_resume_scheduler(rtcb);
-
- /* Then switch contexts */
-
- RESTORE_USERCONTEXT(rtcb);
- }
- }
- }
-}
diff --git a/arch/z16/src/z16f/Make.defs b/arch/z16/src/z16f/Make.defs
index 264be6b4b6..422bdfa75e 100644
--- a/arch/z16/src/z16f/Make.defs
+++ b/arch/z16/src/z16f/Make.defs
@@ -26,7 +26,7 @@ CMN_CSRCS += z16_stackdump.c z16_copystate.c
CMN_CSRCS += z16_mdelay.c z16_udelay.c z16_createstack.c z16_registerdump.c
CMN_CSRCS += z16_unblocktask.c z16_doirq.c z16_releasepending.c z16_usestack.c
CMN_CSRCS += z16_exit.c z16_releasestack.c z16_stackframe.c z16_idle.c
-CMN_CSRCS += z16_reprioritizertr.c z16_nputs.c
+CMN_CSRCS += z16_nputs.c
CHIP_SSRCS = z16f_lowuart.S z16f_saveusercontext.S z16f_restoreusercontext.S
CHIP_CSRCS = z16f_clkinit.c z16f_sysexec.c z16f_irq.c z16f_serial.c
diff --git a/arch/z80/src/common/z80_reprioritizertr.c b/arch/z80/src/common/z80_reprioritizertr.c
deleted file mode 100644
index 9d5f97bdca..0000000000
--- a/arch/z80/src/common/z80_reprioritizertr.c
+++ /dev/null
@@ -1,187 +0,0 @@
-/****************************************************************************
- * arch/z80/src/common/z80_reprioritizertr.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 <stdint.h>
-#include <stdbool.h>
-#include <sched.h>
-#include <assert.h>
-#include <debug.h>
-
-#include <nuttx/arch.h>
-#include <nuttx/sched.h>
-
-#include "chip.h"
-#include "chip/switch.h"
-#include "sched/sched.h"
-#include "group/group.h"
-#include "z80_internal.h"
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: up_reprioritize_rtr
- *
- * Description:
- * Called when the priority of a running or
- * ready-to-run task changes and the reprioritization will
- * cause a context switch. Two cases:
- *
- * 1) The priority of the currently running task drops and the next
- * task in the ready to run list has priority.
- * 2) An idle, ready to run task's priority has been raised above the
- * priority of the current, running task and it now has the priority.
- *
- * Input Parameters:
- * tcb: The TCB of the task that has been reprioritized
- * priority: The new task priority
- *
- ****************************************************************************/
-
-void up_reprioritize_rtr(FAR struct tcb_s *tcb, uint8_t priority)
-{
- /* Verify that the caller is sane */
-
- if (tcb->task_state < FIRST_READY_TO_RUN_STATE ||
- tcb->task_state > LAST_READY_TO_RUN_STATE
-#if SCHED_PRIORITY_MIN > 0
- || priority < SCHED_PRIORITY_MIN
-#endif
-#if SCHED_PRIORITY_MAX < UINT8_MAX
- || priority > SCHED_PRIORITY_MAX
-#endif
- )
- {
- DEBUGPANIC();
- }
- else
- {
- FAR struct tcb_s *rtcb = this_task();
- bool switch_needed;
-
- sinfo("TCB=%p PRI=%d\n", tcb, priority);
-
- /* Remove the tcb task from the ready-to-run list.
- * nxsched_remove_readytorun will return true if we just
- * remove the head of the ready to run list.
- */
-
- switch_needed = nxsched_remove_readytorun(tcb, false);
-
- /* Setup up the new task priority */
-
- tcb->sched_priority = (uint8_t)priority;
-
- /* Return the task to the specified blocked task list.
- * nxsched_add_readytorun will return true if the task was
- * added to the new list. We will need to perform a context
- * switch only if the EXCLUSIVE or of the two calls is non-zero
- * (i.e., one and only one the calls changes the head of the
- * ready-to-run list).
- */
-
- switch_needed ^= nxsched_add_readytorun(tcb);
-
- /* Now, perform the context switch if one is needed */
-
- if (switch_needed)
- {
- /* If we are going to do a context switch, then now is the right
- * time to add any pending tasks back into the ready-to-run list.
- */
-
- if (g_pendingtasks.head)
- {
- nxsched_merge_pending();
- }
-
- /* Update scheduler parameters */
-
- nxsched_suspend_scheduler(rtcb);
-
- /* Are we in an interrupt handler? */
-
- if (IN_INTERRUPT())
- {
- /* Yes, then we have to do things differently.
- * Just copy the current context into the OLD rtcb.
- */
-
- SAVE_IRQCONTEXT(rtcb);
-
- /* Restore the exception context of the rtcb at the (new) head
- * of the ready-to-run task list.
- */
-
- rtcb = this_task();
-
- /* Update scheduler parameters */
-
- nxsched_resume_scheduler(rtcb);
-
- /* Then setup so that the context will be performed on exit
- * from the interrupt. Any necessary address environment
- * changes will be made when the interrupt returns.
- */
-
- SET_IRQCONTEXT(rtcb);
- }
-
- /* Copy the exception context into the TCB at the (old) head of the
- * ready-to-run Task list. if SAVE_USERCONTEXT returns a non-zero
- * value, then this is really the previously running task
- * restarting!
- */
-
- else if (!SAVE_USERCONTEXT(rtcb))
- {
- /* Restore the exception context of the rtcb at the (new) head
- * of the ready-to-run task list.
- */
-
- rtcb = this_task();
-
-#ifdef CONFIG_ARCH_ADDRENV
- /* Make sure that the address environment for the previously
- * running task is closed down gracefully (data caches dump,
- * MMU flushed) and set up the address environment for the new
- * thread at the head of the ready-to-run list.
- */
-
- group_addrenv(rtcb);
-#endif
- /* Update scheduler parameters */
-
- nxsched_resume_scheduler(rtcb);
-
- /* Then switch contexts */
-
- RESTORE_USERCONTEXT(rtcb);
- }
- }
- }
-}
diff --git a/arch/z80/src/ez80/Make.defs b/arch/z80/src/ez80/Make.defs
index b10df0800a..a360cbeb7e 100644
--- a/arch/z80/src/ez80/Make.defs
+++ b/arch/z80/src/ez80/Make.defs
@@ -21,7 +21,7 @@
CMN_CSRCS = z80_initialize.c z80_allocateheap.c z80_createstack.c
CMN_CSRCS += z80_releasestack.c z80_interruptcontext.c z80_blocktask.c
CMN_CSRCS += z80_unblocktask.c z80_exit.c z80_releasepending.c
-CMN_CSRCS += z80_reprioritizertr.c z80_idle.c z80_assert.c z80_doirq.c
+CMN_CSRCS += z80_idle.c z80_assert.c z80_doirq.c
CMN_CSRCS += z80_mdelay.c z80_stackframe.c z80_udelay.c z80_usestack.c
CMN_CSRCS += z80_nputs.c
diff --git a/arch/z80/src/z180/Make.defs b/arch/z80/src/z180/Make.defs
index c48c998073..42a2dc0d79 100644
--- a/arch/z80/src/z180/Make.defs
+++ b/arch/z80/src/z180/Make.defs
@@ -29,7 +29,7 @@ endif
CMN_CSRCS = z80_allocateheap.c z80_assert.c z80_blocktask.c z80_createstack.c
CMN_CSRCS += z80_doirq.c z80_exit.c z80_idle.c z80_initialize.c
CMN_CSRCS += z80_interruptcontext.c z80_mdelay.c z80_releasepending.c
-CMN_CSRCS += z80_releasestack.c z80_stackframe.c z80_reprioritizertr.c
+CMN_CSRCS += z80_releasestack.c z80_stackframe.c
CMN_CSRCS += z80_unblocktask.c z80_udelay.c z80_usestack.c z80_nputs.c
CHIP_ASRCS = z180_restoreusercontext.asm z180_saveusercontext.asm
diff --git a/arch/z80/src/z8/Make.defs b/arch/z80/src/z8/Make.defs
index 92798ecb08..f70dbcfff7 100644
--- a/arch/z80/src/z8/Make.defs
+++ b/arch/z80/src/z8/Make.defs
@@ -23,7 +23,7 @@ HEAD_SSRC = z8_head.S
CMN_CSRCS = z80_initialize.c z80_allocateheap.c z80_createstack.c
CMN_CSRCS += z80_releasestack.c z80_interruptcontext.c z80_blocktask.c
CMN_CSRCS += z80_unblocktask.c z80_exit.c z80_releasepending.c
-CMN_CSRCS += z80_reprioritizertr.c z80_idle.c z80_assert.c z80_doirq.c
+CMN_CSRCS += z80_idle.c z80_assert.c z80_doirq.c
CMN_CSRCS += z80_mdelay.c z80_stackframe.c z80_udelay.c z80_usestack.c
CMN_CSRCS += z80_nputs.c
diff --git a/arch/z80/src/z80/Make.defs b/arch/z80/src/z80/Make.defs
index f6a355c7af..620264a1d4 100644
--- a/arch/z80/src/z80/Make.defs
+++ b/arch/z80/src/z80/Make.defs
@@ -29,7 +29,7 @@ endif
CMN_CSRCS = z80_initialize.c z80_allocateheap.c z80_createstack.c
CMN_CSRCS += z80_releasestack.c z80_interruptcontext.c z80_blocktask.c
CMN_CSRCS += z80_unblocktask.c z80_exit.c z80_releasepending.c
-CMN_CSRCS += z80_reprioritizertr.c z80_idle.c z80_assert.c z80_doirq.c
+CMN_CSRCS += z80_idle.c z80_assert.c z80_doirq.c
CMN_CSRCS += z80_mdelay.c z80_stackframe.c z80_udelay.c z80_usestack.c
CHIP_ASRCS = z80_saveusercontext.asm z80_restoreusercontext.asm
diff --git a/include/nuttx/arch.h b/include/nuttx/arch.h
index dd45c4de5d..24e35a8d80 100644
--- a/include/nuttx/arch.h
+++ b/include/nuttx/arch.h
@@ -441,31 +441,6 @@ void up_block_task(FAR struct tcb_s *rtcb);
void up_release_pending(void);
-/****************************************************************************
- * Name: up_reprioritize_rtr
- *
- * Description:
- * Called when the priority of a running or
- * ready-to-run task changes and the reprioritization will
- * cause a context switch. Two cases:
- *
- * 1) The priority of the currently running task drops and the next
- * task in the ready to run list has priority.
- * 2) An idle, ready to run task's priority has been raised above the
- * priority of the current, running task and it now has the priority.
- *
- * This function is called only from the NuttX scheduling
- * logic. Interrupts will always be disabled when this
- * function is called.
- *
- * Input Parameters:
- * tcb: The TCB of the task that has been reprioritized
- * priority: The new task priority
- *
- ****************************************************************************/
-
-void up_reprioritize_rtr(FAR struct tcb_s *tcb, uint8_t priority);
-
/****************************************************************************
* Name: up_exit
*
diff --git a/sched/sched/Make.defs b/sched/sched/Make.defs
index e2084557a0..9f9fdd4c0c 100644
--- a/sched/sched/Make.defs
+++ b/sched/sched/Make.defs
@@ -29,7 +29,7 @@ CSRCS += sched_setscheduler.c sched_getscheduler.c
CSRCS += sched_yield.c sched_rrgetinterval.c sched_foreach.c
CSRCS += sched_lock.c sched_unlock.c sched_lockcount.c
CSRCS += sched_idletask.c sched_self.c sched_get_stackinfo.c
-CSRCS += sched_sysinfo.c
+CSRCS += sched_sysinfo.c sched_reprioritizertr.c
ifeq ($(CONFIG_PRIORITY_INHERITANCE),y)
CSRCS += sched_reprioritize.c
diff --git a/sched/sched/sched.h b/sched/sched/sched.h
index 1a43f47dd4..607ab430a8 100644
--- a/sched/sched/sched.h
+++ b/sched/sched/sched.h
@@ -322,6 +322,7 @@ bool nxsched_merge_pending(void);
void nxsched_add_blocked(FAR struct tcb_s *btcb, tstate_t task_state);
void nxsched_remove_blocked(FAR struct tcb_s *btcb);
int nxsched_set_priority(FAR struct tcb_s *tcb, int sched_priority);
+bool nxsched_reprioritize_rtr(FAR struct tcb_s *tcb, int priority);
/* Priority inheritance support */
diff --git a/sched/sched/sched_reprioritizertr.c b/sched/sched/sched_reprioritizertr.c
new file mode 100644
index 0000000000..a94cf0e298
--- /dev/null
+++ b/sched/sched/sched_reprioritizertr.c
@@ -0,0 +1,91 @@
+/****************************************************************************
+ * sched/sched/sched_reprioritizertr.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 <stdint.h>
+#include <sched.h>
+#include <errno.h>
+
+#include <nuttx/sched.h>
+
+#include "sched/sched.h"
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: nxsched_reprioritize_rtr
+ *
+ * Description:
+ * This function called when the priority of a running or
+ * ready-to-run task changes.
+ *
+ * Input Parameters:
+ * tcb - the TCB of task to reprioritize.
+ * priority - The new task priority
+ *
+ * Returned Value:
+ * true if the head of the ready-to-run task list has changed indicating
+ * a context switch is needed.
+ *
+ ****************************************************************************/
+
+bool nxsched_reprioritize_rtr(FAR struct tcb_s *tcb, int priority)
+{
+ bool switch_needed;
+
+ /* Remove the tcb task from the ready-to-run list.
+ * nxsched_remove_readytorun will return true if we just
+ * remove the head of the ready to run list.
+ */
+
+ switch_needed = nxsched_remove_readytorun(tcb, false);
+
+ /* Setup up the new task priority */
+
+ tcb->sched_priority = (uint8_t)priority;
+
+ /* Return the task to the specified blocked task list.
+ * nxsched_add_readytorun will return true if the task was
+ * added to the new list. We will need to perform a context
+ * switch only if the EXCLUSIVE or of the two calls is non-zero
+ * (i.e., one and only one the calls changes the head of the
+ * ready-to-run list).
+ */
+
+ switch_needed ^= nxsched_add_readytorun(tcb);
+
+ /* If we are going to do a context switch, then now is the right
+ * time to add any pending tasks back into the ready-to-run list.
+ */
+
+ if (switch_needed && g_pendingtasks.head)
+ {
+ nxsched_merge_pending();
+ }
+
+ return switch_needed;
+}
diff --git a/sched/sched/sched_roundrobin.c b/sched/sched/sched_roundrobin.c
index a078fd95b4..c174dbe78e 100644
--- a/sched/sched/sched_roundrobin.c
+++ b/sched/sched/sched_roundrobin.c
@@ -140,12 +140,17 @@ uint32_t nxsched_process_roundrobin(FAR struct tcb_s *tcb, uint32_t ticks,
if (tcb->flink &&
tcb->flink->sched_priority >= tcb->sched_priority)
{
+ FAR struct tcb_s *rtcb = this_task();
+
/* Just resetting the task priority to its current value.
* This will cause the task to be rescheduled behind any
* other tasks at the same priority.
*/
- up_reprioritize_rtr(tcb, tcb->sched_priority);
+ if (nxsched_reprioritize_rtr(tcb, tcb->sched_priority))
+ {
+ up_block_task(rtcb);
+ }
}
}
}
diff --git a/sched/sched/sched_setpriority.c b/sched/sched/sched_setpriority.c
index 292efca14c..aa68e3eaac 100644
--- a/sched/sched/sched_setpriority.c
+++ b/sched/sched/sched_setpriority.c
@@ -140,9 +140,14 @@ static inline void nxsched_running_setpriority(FAR struct tcb_s *tcb,
if (sched_priority <= nxttcb->sched_priority)
{
+ FAR struct tcb_s *rtcb = this_task();
+
/* A context switch will occur. */
- up_reprioritize_rtr(tcb, (uint8_t)sched_priority);
+ if (nxsched_reprioritize_rtr(tcb, sched_priority))
+ {
+ up_block_task(rtcb);
+ }
}
/* Otherwise, we can just change priority since it has no effect */
@@ -223,7 +228,10 @@ static void nxsched_readytorun_setpriority(FAR struct tcb_s *tcb,
{
/* A context switch will occur. */
- up_reprioritize_rtr(tcb, (uint8_t)sched_priority);
+ if (nxsched_reprioritize_rtr(tcb, sched_priority))
+ {
+ up_block_task(rtcb);
+ }
}
/* Otherwise, we can just change priority and re-schedule (since it have