nuttx/sched: merge up_block_task and up_unblock_task

This commit is contained in:
zhangyuan21 2022-11-15 16:52:40 +08:00 committed by Xiang Xiao
parent 25bfd437fe
commit d8051ba979
91 changed files with 222 additions and 2473 deletions

View file

@ -102,7 +102,7 @@ function will perform the following operations:
with the page fill worker must be "`locked <#MemoryOrg>`__" and
always present in memory.
#. **Block the currently executing task**. This function will call
``up_block_task()`` to block the task at the head of the ready-to-run
``up_switch_context()`` to block the task at the head of the ready-to-run
list. This should cause an interrupt level context switch to the next
highest priority task. The blocked task will be marked with state
``TSTATE_WAIT_PAGEFILL`` and will be retained in the
@ -373,8 +373,8 @@ Most standard, architecture-specific functions are declared in
``include/nuttx/arch.h``. However, for the case of this paging logic,
the architecture specific functions are declared in
``include/nuttx/page.h``. Standard, architecture-specific functions that
should already be provided in the architecture port are :c:func:`up_block_task`
and :c:func:`up_unblock_task`. New, additional functions that must be
should already be provided in the architecture port are
:c:func:`up_switch_context`. New, additional functions that must be
implemented just for on-demand paging support are:
.. c:function:: int up_checkmapping(FAR struct tcb_s *tcb)

View file

@ -174,7 +174,7 @@ APIs Exported by Architecture-Specific Logic to NuttX
and threads must have come from memory that is accessible to
user
.. c:function:: void up_unblock_task(FAR struct tcb_s *tcb, FAR struct tcb_s *rtcb)
.. c:function:: void up_switch_context(FAR struct tcb_s *tcb, FAR struct tcb_s *rtcb)
A task is currently in the ready-to-run list but has been preppe
to execute. Restore its context, and start execution.
@ -186,18 +186,6 @@ APIs Exported by Architecture-Specific Logic to NuttX
which will be executed.
:param rtcb: Refers to the running task which will be blocked.
.. c:function:: void up_block_task(FAR struct tcb_s *rtcb)
The currently executing task has already removed from ready-to-run list.
Save its context and switch to the next running task at the head of the
ready-to-run list.
This function is called only from the NuttX scheduling logic.
Interrupts will always be disabled when this function is called.
:param rtcb: Reference to the running task which is different to the
task (next running task) at the head of the list.
.. c:function:: void up_release_pending(void)
When tasks become ready-to-run but cannot run

View file

@ -20,14 +20,14 @@
# Common ARM files
CMN_CSRCS += arm_allocateheap.c arm_assert.c arm_blocktask.c
CMN_CSRCS += arm_allocateheap.c arm_assert.c
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_saveusercontext.c
CMN_CSRCS += arm_stackframe.c
CMN_CSRCS += arm_vfork.c arm_unblocktask.c arm_usestack.c
CMN_CSRCS += arm_vfork.c arm_switchcontext.c arm_usestack.c
ifneq ($(CONFIG_ALARM_ARCH),y)
ifneq ($(CONFIG_TIMER_ARCH),y)

View file

@ -1,112 +0,0 @@
/****************************************************************************
* arch/arm/src/common/arm_blocktask.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 <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_block_task
*
* Description:
* The currently executing task has already removed from ready-to-run list.
* Save its context and switch to the next running task at the head of the
* ready-to-run list.
*
* Input Parameters:
* rtcb: Reference to the running task which is different to the
* task (next running task) at the head of the list.
*
****************************************************************************/
void up_block_task(struct tcb_s *rtcb)
{
/* 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();
/* Reset 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();
/* Reset 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.
*/
}
}

View file

@ -1,5 +1,5 @@
/****************************************************************************
* arch/arm/src/common/arm_unblocktask.c
* arch/arm/src/common/arm_switchcontext.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@ -40,7 +40,7 @@
****************************************************************************/
/****************************************************************************
* Name: up_unblock_task
* Name: up_switch_context
*
* Description:
* A task is currently in the ready-to-run list but has been prepped
@ -53,7 +53,7 @@
*
****************************************************************************/
void up_unblock_task(struct tcb_s *tcb, struct tcb_s *rtcb)
void up_switch_context(struct tcb_s *tcb, struct tcb_s *rtcb)
{
/* Update scheduler parameters */

View file

@ -46,7 +46,7 @@ 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
CMN_CSRCS += arm64_releasepending.c arm64_unblocktask.c arm64_blocktask.c
CMN_CSRCS += arm64_releasepending.c arm64_switchcontext.c
CMN_CSRCS += arm64_assert.c arm64_schedulesigaction.c arm64_backtrace.c
CMN_CSRCS += arm64_sigdeliver.c

View file

@ -1,112 +0,0 @@
/****************************************************************************
* arch/arm64/src/common/arm64_blocktask.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 <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_block_task
*
* Description:
* The currently executing task has already removed from ready-to-run list.
* Save its context and switch to the next running task at the head of the
* ready-to-run list.
*
* Input Parameters:
* rtcb: Reference to the running task which is different to the
* task (next running task) at the head of the list.
*
****************************************************************************/
void up_block_task(struct tcb_s *rtcb)
{
/* 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();
/* Reset 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();
/* Reset 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.
*/
}
}

View file

@ -1,5 +1,5 @@
/****************************************************************************
* arch/arm64/src/common/arm64_unblocktask.c
* arch/arm64/src/common/arm64_switchcontext.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@ -40,7 +40,7 @@
****************************************************************************/
/****************************************************************************
* Name: up_unblock_task
* Name: up_switch_context
*
* Description:
* A task is currently in the ready-to-run list but has been prepped
@ -53,7 +53,7 @@
*
****************************************************************************/
void up_unblock_task(struct tcb_s *tcb, struct tcb_s *rtcb)
void up_switch_context(struct tcb_s *tcb, struct tcb_s *rtcb)
{
/* Update scheduler parameters */

View file

@ -24,14 +24,14 @@ HEAD_ASRC = avr_nommuhead.S
# Common AVR/AVR32 files
CMN_ASRCS = avr_exceptions.S avr_fullcontextrestore.S avr_switchcontext.S
CMN_CSRCS = avr_assert.c avr_allocateheap.c avr_blocktask.c avr_copystate.c
CMN_ASRCS = avr_exceptions.S avr_fullcontextrestore.S avr_doswitch.S
CMN_CSRCS = avr_assert.c avr_allocateheap.c avr_copystate.c
CMN_CSRCS += avr_createstack.c avr_mdelay.c avr_udelay.c avr_exit.c avr_idle.c
CMN_CSRCS += avr_initialize.c avr_initialstate.c
CMN_CSRCS += avr_modifyreg8.c avr_modifyreg16.c avr_modifyreg32.c
CMN_CSRCS += avr_releasepending.c avr_releasestack.c
CMN_CSRCS += avr_schedulesigaction.c avr_sigdeliver.c avr_stackframe.c
CMN_CSRCS += avr_unblocktask.c avr_usestack.c avr_doirq.c avr_nputs.c
CMN_CSRCS += avr_switchcontext.c avr_usestack.c avr_doirq.c avr_nputs.c
# Configuration-dependent common files

View file

@ -24,14 +24,14 @@ HEAD_ASRC = at90usb_head.S
# Common AVR files
CMN_ASRCS = avr_switchcontext.S
CMN_CSRCS = avr_allocateheap.c avr_assert.c avr_blocktask.c avr_copystate.c
CMN_ASRCS = avr_doswitch.S
CMN_CSRCS = avr_allocateheap.c avr_assert.c avr_copystate.c
CMN_CSRCS += avr_createstack.c avr_doirq.c avr_exit.c avr_idle.c avr_initialize.c
CMN_CSRCS += avr_initialstate.c avr_irq.c avr_lowputs.c
CMN_CSRCS += avr_mdelay.c avr_modifyreg8.c avr_modifyreg16.c avr_modifyreg32.c
CMN_CSRCS += avr_nputs.c avr_releasepending.c avr_releasestack.c
CMN_CSRCS += avr_schedulesigaction.c avr_sigdeliver.c
CMN_CSRCS += avr_stackframe.c avr_udelay.c avr_unblocktask.c avr_usestack.c
CMN_CSRCS += avr_stackframe.c avr_udelay.c avr_switchcontext.c avr_usestack.c
# Configuration-dependent common files

View file

@ -24,14 +24,14 @@ HEAD_ASRC = atmega_head.S
# Common AVR files
CMN_ASRCS = avr_switchcontext.S
CMN_CSRCS = avr_allocateheap.c avr_assert.c avr_blocktask.c avr_copystate.c
CMN_ASRCS = avr_doswitch.S
CMN_CSRCS = avr_allocateheap.c avr_assert.c avr_copystate.c
CMN_CSRCS += avr_createstack.c avr_doirq.c avr_exit.c avr_idle.c avr_initialize.c
CMN_CSRCS += avr_initialstate.c avr_irq.c avr_lowputs.c
CMN_CSRCS += avr_mdelay.c avr_modifyreg8.c avr_modifyreg16.c avr_modifyreg32.c
CMN_CSRCS += avr_nputs.c avr_releasepending.c avr_releasestack.c
CMN_CSRCS += avr_schedulesigaction.c avr_sigdeliver.c
CMN_CSRCS += avr_stackframe.c avr_udelay.c avr_unblocktask.c avr_usestack.c
CMN_CSRCS += avr_stackframe.c avr_udelay.c avr_switchcontext.c avr_usestack.c
# Configuration-dependent common files

View file

@ -1,109 +0,0 @@
/****************************************************************************
* arch/avr/src/avr/avr_blocktask.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 <stdbool.h>
#include <sched.h>
#include <assert.h>
#include <debug.h>
#include <nuttx/arch.h>
#include <nuttx/sched.h>
#include "sched/sched.h"
#include "avr_internal.h"
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: up_block_task
*
* Description:
* The currently executing task has already removed from ready-to-run list.
* Save its context and switch to the next running task at the head of the
* ready-to-run list.
*
* Input Parameters:
* rtcb: Reference to the running task which is different to the
* task (next running task) at the head of the list.
*
****************************************************************************/
void up_block_task(struct tcb_s *rtcb)
{
/* 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.
*/
avr_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();
/* Reset scheduler parameters */
nxsched_resume_scheduler(rtcb);
/* Then switch contexts */
avr_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.
*/
avr_switchcontext(rtcb->xcp.regs, nexttcb->xcp.regs);
/* avr_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.
*/
}
}

View file

@ -1,5 +1,5 @@
/************************************************************************************
* arch/avr/src/avr/avr_switchcontext.S
* arch/avr/src/avr/avr_doswitch.S
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@ -36,7 +36,7 @@
* Public Symbols
************************************************************************************/
.file "avr_switchcontext.S"
.file "avr_doswitch.S"
/************************************************************************************
* Macros

View file

@ -1,5 +1,5 @@
/****************************************************************************
* arch/avr/src/avr/avr_unblocktask.c
* arch/avr/src/avr/avr_switchcontext.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@ -39,7 +39,7 @@
****************************************************************************/
/****************************************************************************
* Name: up_unblock_task
* Name: up_switch_context
*
* Description:
* A task is currently in the ready-to-run list but has been prepped
@ -52,7 +52,7 @@
*
****************************************************************************/
void up_unblock_task(struct tcb_s *tcb, struct tcb_s *rtcb)
void up_switch_context(struct tcb_s *tcb, struct tcb_s *rtcb)
{
/* Update scheduler parameters */

View file

@ -546,7 +546,7 @@
* interrupt_enable - return sequence.
*
* NOTE: since actual returning is handled by this macro it has been
* removed from avr_fullcontextrestore function (avr_switchcontext.S)
* removed from avr_fullcontextrestore function (avr_doswitch.S)
*/
/* If interrupts shall be enabled go to 'restore remaining and reti' code

View file

@ -1,124 +0,0 @@
/****************************************************************************
* arch/avr/src/avr32/avr_blocktask.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 <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 "avr_internal.h"
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: up_block_task
*
* Description:
* The currently executing task has already removed from ready-to-run list.
* Save its context and switch to the next running task at the head of the
* ready-to-run list.
*
* Input Parameters:
* rtcb: Reference to the running task which is different to the
* task (next running task) at the head of the list.
*
****************************************************************************/
void up_block_task(struct tcb_s *rtcb)
{
/* 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.
*/
avr_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();
/* Reset scheduler parameters */
nxsched_resume_scheduler(rtcb);
/* Then switch contexts. Any new address environment needed by
* the new thread will be instantiated before the return from
* interrupt.
*/
avr_restorestate(rtcb->xcp.regs);
}
/* No, then we will need to perform the user context switch */
else
{
/* Get 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
/* Reset scheduler parameters */
nxsched_resume_scheduler(nexttcb);
/* Then switch contexts */
avr_switchcontext(rtcb->xcp.regs, nexttcb->xcp.regs);
/* avr_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.
*/
}
}

View file

@ -1,5 +1,5 @@
/************************************************************************************
* arch/avr/src/avr32/avr_switchcontext.S
* arch/avr/src/avr32/avr_doswitch.S
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@ -34,7 +34,7 @@
* Public Symbols
************************************************************************************/
.file "avr_switchcontext.S"
.file "avr_doswitch.S"
/************************************************************************************
* Macros

View file

@ -1,5 +1,5 @@
/****************************************************************************
* arch/avr/src/avr32/avr_unblocktask.c
* arch/avr/src/avr32/avr_switchcontext.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@ -40,7 +40,7 @@
****************************************************************************/
/****************************************************************************
* Name: up_unblock_task
* Name: up_switch_context
*
* Description:
* A task is currently in the ready-to-run list but has been prepped
@ -53,7 +53,7 @@
*
****************************************************************************/
void up_unblock_task(struct tcb_s *tcb, struct tcb_s *rtcb)
void up_switch_context(struct tcb_s *tcb, struct tcb_s *rtcb)
{
/* Update scheduler parameters */

View file

@ -1,102 +0,0 @@
/****************************************************************************
* arch/ceva/src/common/ceva_blocktask.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <nuttx/arch.h>
#include "sched/sched.h"
#include "ceva_internal.h"
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: up_block_task
*
* Description:
* The currently executing task has already removed from ready-to-run list.
* Save its context and switch to the next running task at the head of the
* ready-to-run list.
*
* Inputs:
* rtcb: Reference to the running task which is different to the
* task (next running task) at the head of the list.
*
****************************************************************************/
void up_block_task(struct tcb_s *rtcb)
{
/* 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();
/* Reset 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();
/* Reset scheduler parameters */
sched_resume_scheduler(nexttcb);
/* Switch context to the context of the task at the head of the
* ready to run list.
*/
ceva_switchcontext(&rtcb->xcp.regs, nexttcb->xcp.regs);
/* ceva_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.
*/
}
}

View file

@ -22,8 +22,10 @@
* Included Files
****************************************************************************/
#include <nuttx/arch.h>
#include <arch/syscall.h>
#include "sched/sched.h"
#include "ceva_internal.h"
/****************************************************************************
@ -50,3 +52,64 @@ void ceva_switchcontext(uint32_t **saveregs, uint32_t *restoreregs)
sys_call2(SYS_switch_context, (uintptr_t)saveregs, (uintptr_t)restoreregs);
}
/****************************************************************************
* Name: up_switch_context
*
* Description:
* A task is currently in the ready-to-run list but has been prepped
* to execute. Restore its context, and start execution.
*
* Input Parameters:
* tcb: Refers to the head task of the ready-to-run list
* which will be executed.
* rtcb: Refers to the running task which will be blocked.
*
****************************************************************************/
void up_switch_context(struct tcb_s *tcb, struct tcb_s *rtcb)
{
/* 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;
/* Update scheduler parameters */
sched_resume_scheduler(tcb);
/* Then switch contexts */
CURRENT_REGS = tcb->xcp.regs;
}
/* No, then we will need to perform the user context switch */
else
{
/* Update scheduler parameters */
sched_resume_scheduler(tcb);
/* Switch context to the context of the task at the head of the
* ready to run list.
*/
ceva_switchcontext(&rtcb->xcp.regs, tcb->xcp.regs);
/* ceva_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.
*/
}
}

View file

@ -1,96 +0,0 @@
/****************************************************************************
* arch/ceva/src/common/ceva_unblocktask.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 "ceva_internal.h"
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: up_unblock_task
*
* Description:
* A task is currently in the ready-to-run list but has been prepped
* to execute. Restore its context, and start execution.
*
* Input Parameters:
* tcb: Refers to the head task of the ready-to-run list
* which will be executed.
* rtcb: Refers to the running task which will be blocked.
*
****************************************************************************/
void up_unblock_task(struct tcb_s *tcb, struct tcb_s *rtcb)
{
/* 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;
/* Update scheduler parameters */
sched_resume_scheduler(tcb);
/* Then switch contexts */
CURRENT_REGS = tcb->xcp.regs;
}
/* No, then we will need to perform the user context switch */
else
{
/* Update scheduler parameters */
sched_resume_scheduler(tcb);
/* Switch context to the context of the task at the head of the
* ready to run list.
*/
ceva_switchcontext(&rtcb->xcp.regs, tcb->xcp.regs);
/* ceva_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.
*/
}
}

View file

@ -1,120 +0,0 @@
/****************************************************************************
* arch/hc/src/common/hc_blocktask.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 <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 "hc_internal.h"
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: up_block_task
*
* Description:
* The currently executing task has already removed from ready-to-run list.
* Save its context and switch to the next running task at the head of the
* ready-to-run list.
*
* Input Parameters:
* rtcb: Reference to the running task which is different to the
* task (next running task) at the head of the list.
*
****************************************************************************/
void up_block_task(struct tcb_s *rtcb)
{
/* 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.
*/
hc_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();
/* Reset scheduler parameters */
nxsched_resume_scheduler(rtcb);
/* Then switch contexts. Any necessary address environment
* changes will be made when the interrupt returns.
*/
hc_restorestate(rtcb->xcp.regs);
}
/* Copy the user C 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
/* Reset scheduler parameters */
nxsched_resume_scheduler(rtcb);
/* Then switch contexts */
hc_fullcontextrestore(rtcb->xcp.regs);
}
}

View file

@ -1,5 +1,5 @@
/****************************************************************************
* arch/hc/src/common/hc_unblocktask.c
* arch/hc/src/common/hc_switchcontext.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@ -40,7 +40,7 @@
****************************************************************************/
/****************************************************************************
* Name: up_unblock_task
* Name: up_switch_context
*
* Description:
* A task is currently in the ready-to-run list but has been prepped
@ -53,7 +53,7 @@
*
****************************************************************************/
void up_unblock_task(struct tcb_s *tcb, struct tcb_s *rtcb)
void up_switch_context(struct tcb_s *tcb, struct tcb_s *rtcb)
{
/* Update scheduler parameters */

View file

@ -20,11 +20,11 @@
HEAD_ASRC = m9s12_vectors.S
CMN_CSRCS = hc_allocateheap.c hc_blocktask.c hc_copystate.c hc_createstack.c
CMN_CSRCS = hc_allocateheap.c hc_copystate.c hc_createstack.c
CMN_CSRCS += hc_doirq.c hc_exit.c hc_idle.c hc_initialize.c
CMN_CSRCS += hc_mdelay.c hc_modifyreg16.c hc_modifyreg32.c hc_modifyreg8.c
CMN_CSRCS += hc_nputs.c hc_releasepending.c hc_releasestack.c
CMN_CSRCS += hc_stackframe.c hc_udelay.c hc_unblocktask.c hc_usestack.c
CMN_CSRCS += hc_stackframe.c hc_udelay.c hc_switchcontext.c hc_usestack.c
CHIP_ASRCS = m9s12_start.S m9s12_lowputc.S m9s12_saveusercontext.S
CHIP_CSRCS = m9s12_assert.c m9s12_gpio.c m9s12_gpioirq.c m9s12_initialstate.c

View file

@ -1,115 +0,0 @@
/****************************************************************************
* arch/mips/src/mips32/mips_blocktask.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 <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_block_task
*
* Description:
* The currently executing task has already removed from ready-to-run list.
* Save its context and switch to the next running task at the head of the
* ready-to-run list.
*
* Input Parameters:
* rtcb: Reference to the running task which is different to the
* task (next running task) at the head of the list.
*
****************************************************************************/
void up_block_task(struct tcb_s *rtcb)
{
/* 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.
*/
mips_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();
/* Reset scheduler parameters */
nxsched_resume_scheduler(rtcb);
/* Then switch contexts. Any necessary address environment
* changes will be made when the interrupt returns.
*/
mips_restorestate(rtcb->xcp.regs);
}
/* No, then we will need to perform the user context switch */
else
{
/* Get the context of the task at the head of the ready to
* run list.
*/
struct tcb_s *nexttcb = this_task();
/* Reset scheduler parameters */
nxsched_resume_scheduler(nexttcb);
/* Then switch contexts */
mips_switchcontext(rtcb->xcp.regs, nexttcb->xcp.regs);
/* mips_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.
*/
}
}

View file

@ -1,5 +1,5 @@
/****************************************************************************
* arch/mips/src/mips32/mips_unblocktask.c
* arch/mips/src/mips32/mips_switchcontext.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@ -42,7 +42,7 @@
****************************************************************************/
/****************************************************************************
* Name: up_unblock_task
* Name: up_switch_context
*
* Description:
* A task is currently in the ready-to-run list but has been prepped
@ -55,7 +55,7 @@
*
****************************************************************************/
void up_unblock_task(struct tcb_s *tcb, struct tcb_s *rtcb)
void up_switch_context(struct tcb_s *tcb, struct tcb_s *rtcb)
{
/* Update scheduler parameters */

View file

@ -25,13 +25,13 @@ HEAD_ASRC = pic32mx_head.S
# Common MIPS files
CMN_ASRCS = mips_syscall0.S vfork.S
CMN_CSRCS = mips_allocateheap.c mips_assert.c mips_blocktask.c mips_copystate.c
CMN_CSRCS = mips_allocateheap.c mips_assert.c mips_copystate.c
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_schedulesigaction.c mips_sigdeliver.c
CMN_CSRCS += mips_stackframe.c mips_swint0.c mips_udelay.c mips_unblocktask.c
CMN_CSRCS += mips_stackframe.c mips_swint0.c mips_udelay.c mips_switchcontext.c
CMN_CSRCS += mips_usestack.c mips_vfork.c
# Configuration dependent common files

View file

@ -25,13 +25,13 @@ HEAD_ASRC = pic32mz_head.S
# Common MIPS files
CMN_ASRCS = mips_syscall0.S vfork.S mips_cache.S
CMN_CSRCS = mips_allocateheap.c mips_assert.c mips_blocktask.c mips_copystate.c
CMN_CSRCS = mips_allocateheap.c mips_assert.c mips_copystate.c
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_schedulesigaction.c mips_sigdeliver.c
CMN_CSRCS += mips_stackframe.c mips_swint0.c mips_udelay.c mips_unblocktask.c
CMN_CSRCS += mips_stackframe.c mips_swint0.c mips_udelay.c mips_switchcontext.c
CMN_CSRCS += mips_usestack.c mips_vfork.c
# Configuration dependent common files

View file

@ -27,11 +27,11 @@ CMN_CSRCS += misoc_timerisr.c misoc_net.c misoc_flushcache.c
CHIP_ASRCS = lm32_syscall.S
CHIP_CSRCS = lm32_allocateheap.c lm32_assert.c lm32_blocktask.c
CHIP_CSRCS = lm32_allocateheap.c lm32_assert.c
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
CHIP_CSRCS += lm32_switchcontext.c
CHIP_CSRCS += lm32_schedulesigaction.c lm32_sigdeliver.c
CHIP_CSRCS += lm32_flushcache.c lm32_usetack.c

View file

@ -1,115 +0,0 @@
/****************************************************************************
* arch/misoc/src/lm32/lm32_blocktask.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 <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_block_task
*
* Description:
* The currently executing task has already removed from ready-to-run list.
* Save its context and switch to the next running task at the head of the
* ready-to-run list.
*
* Input Parameters:
* rtcb: Reference to the running task which is different to the
* task (next running task) at the head of the list.
*
****************************************************************************/
void up_block_task(struct tcb_s *rtcb)
{
/* 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.
*/
misoc_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();
/* Reset scheduler parameters */
nxsched_resume_scheduler(rtcb);
/* Then switch contexts. Any necessary address environment
* changes will be made when the interrupt returns.
*/
misoc_restorestate(rtcb->xcp.regs);
}
/* No, then we will need to perform the user context switch */
else
{
/* Get the context of the task at the head of the ready to
* run list.
*/
struct tcb_s *nexttcb = this_task();
/* Reset scheduler parameters */
nxsched_resume_scheduler(nexttcb);
/* Then switch contexts */
misoc_switchcontext(rtcb->xcp.regs, nexttcb->xcp.regs);
/* misoc_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.
*/
}
}

View file

@ -1,5 +1,5 @@
/****************************************************************************
* arch/misoc/src/lm32/lm32_unblocktask.c
* arch/misoc/src/lm32/lm32_switchcontext.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@ -42,7 +42,7 @@
****************************************************************************/
/****************************************************************************
* Name: up_unblock_task
* Name: up_switch_context
*
* Description:
* A task is currently in the ready-to-run list but has been prepped
@ -55,7 +55,7 @@
*
****************************************************************************/
void up_unblock_task(struct tcb_s *tcb, struct tcb_s *rtcb)
void up_switch_context(struct tcb_s *tcb, struct tcb_s *rtcb)
{
/* Update scheduler parameters */

View file

@ -27,11 +27,11 @@ CMN_CSRCS += misoc_timerisr.c misoc_net.c misoc_flushcache.c
CHIP_ASRCS = minerva_syscall.S
CHIP_CSRCS = minerva_allocateheap.c minerva_assert.c minerva_blocktask.c
CHIP_CSRCS = minerva_allocateheap.c minerva_assert.c
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
CHIP_CSRCS += minerva_switchcontext.c
CHIP_CSRCS += minerva_schedulesigaction.c minerva_sigdeliver.c
CHIP_CSRCS += minerva_flushcache.c minerva_doexceptions.c minerva_usetack.c

View file

@ -1,115 +0,0 @@
/****************************************************************************
* arch/misoc/src/minerva/minerva_blocktask.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 <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_block_task
*
* Description:
* The currently executing task has already removed from ready-to-run list.
* Save its context and switch to the next running task at the head of the
* ready-to-run list.
*
* Input Parameters:
* rtcb: Reference to the running task which is different to the
* task (next running task) at the head of the list.
*
****************************************************************************/
void up_block_task(struct tcb_s *rtcb)
{
/* 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.
*/
misoc_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();
/* Reset scheduler parameters */
nxsched_resume_scheduler(rtcb);
/* Then switch contexts. Any necessary address environment changes
* will be made when the interrupt returns.
*/
misoc_restorestate(rtcb->xcp.regs);
}
/* No, then we will need to perform the user context switch */
else
{
/* Get the context of the task at the head of the ready to run
* list.
*/
struct tcb_s *nexttcb = this_task();
/* Reset scheduler parameters */
nxsched_resume_scheduler(nexttcb);
/* Then switch contexts */
misoc_switchcontext(rtcb->xcp.regs, nexttcb->xcp.regs);
/* misoc_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.
*/
}
}

View file

@ -1,5 +1,5 @@
/****************************************************************************
* arch/misoc/src/minerva/minerva_unblocktask.c
* arch/misoc/src/minerva/minerva_switchcontext.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@ -42,7 +42,7 @@
****************************************************************************/
/****************************************************************************
* Name: up_unblock_task
* Name: up_switch_context
*
* Description:
* A task is currently in the ready-to-run list but has been prepped
@ -55,7 +55,7 @@
*
****************************************************************************/
void up_unblock_task(struct tcb_s *tcb, struct tcb_s *rtcb)
void up_switch_context(struct tcb_s *tcb, struct tcb_s *rtcb)
{
/* Update scheduler parameters */

View file

@ -1,120 +0,0 @@
/****************************************************************************
* arch/or1k/src/common/or1k_blocktask.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 <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 "or1k_internal.h"
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: up_block_task
*
* Description:
* The currently executing task has already removed from ready-to-run list.
* Save its context and switch to the next running task at the head of the
* ready-to-run list.
*
* Input Parameters:
* rtcb: Reference to the running task which is different to the
* task (next running task) at the head of the list.
*
****************************************************************************/
void up_block_task(struct tcb_s *rtcb)
{
/* 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.
*/
or1k_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();
/* Reset scheduler parameters */
nxsched_resume_scheduler(rtcb);
/* Then switch contexts. Any necessary address environment
* changes will be made when the interrupt returns.
*/
or1k_restorestate(rtcb->xcp.regs);
}
/* Copy the user C 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
/* Reset scheduler parameters */
nxsched_resume_scheduler(rtcb);
/* Then switch contexts */
or1k_fullcontextrestore(rtcb->xcp.regs);
}
}

View file

@ -1,5 +1,5 @@
/****************************************************************************
* arch/or1k/src/common/or1k_unblocktask.c
* arch/or1k/src/common/or1k_switchcontext.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@ -40,7 +40,7 @@
****************************************************************************/
/****************************************************************************
* Name: up_unblock_task
* Name: up_switch_context
*
* Description:
* A task is currently in the ready-to-run list but has been prepped
@ -53,7 +53,7 @@
*
****************************************************************************/
void up_unblock_task(struct tcb_s *tcb, struct tcb_s *rtcb)
void up_switch_context(struct tcb_s *tcb, struct tcb_s *rtcb)
{
/* Update scheduler parameters */

View file

@ -29,8 +29,7 @@ CMN_CSRCS = or1k_initialize.c \
or1k_releasestack.c \
or1k_stackframe.c \
or1k_initialstate.c \
or1k_blocktask.c \
or1k_unblocktask.c \
or1k_switchcontext.c \
or1k_releasepending.c \
or1k_schedulesigaction.c \
or1k_copyfullstate.c \

View file

@ -1,120 +0,0 @@
/****************************************************************************
* arch/renesas/src/common/renesas_blocktask.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 <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 "renesas_internal.h"
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: up_block_task
*
* Description:
* The currently executing task has already removed from ready-to-run list.
* Save its context and switch to the next running task at the head of the
* ready-to-run list.
*
* Input Parameters:
* rtcb: Reference to the running task which is different to the
* task (next running task) at the head of the list.
*
****************************************************************************/
void up_block_task(struct tcb_s *rtcb)
{
/* 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.
*/
renesas_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();
/* Reset 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 user C 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
/* Reset scheduler parameters */
nxsched_resume_scheduler(rtcb);
/* Then switch contexts */
renesas_fullcontextrestore(rtcb->xcp.regs);
}
}

View file

@ -1,5 +1,5 @@
/****************************************************************************
* arch/renesas/src/common/renesas_unblocktask.c
* arch/renesas/src/common/renesas_switchcontext.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@ -40,7 +40,7 @@
****************************************************************************/
/****************************************************************************
* Name: up_unblock_task
* Name: up_switch_context
*
* Description:
* A task is currently in the ready-to-run list but has been prepped
@ -53,7 +53,7 @@
*
****************************************************************************/
void up_unblock_task(struct tcb_s *tcb, struct tcb_s *rtcb)
void up_switch_context(struct tcb_s *tcb, struct tcb_s *rtcb)
{
/* Update scheduler parameters */

View file

@ -20,11 +20,11 @@
HEAD_ASRC = m16c_head.S
CMN_CSRCS = renesas_allocateheap.c renesas_assert.c renesas_blocktask.c
CMN_CSRCS = renesas_allocateheap.c renesas_assert.c
CMN_CSRCS += renesas_createstack.c renesas_doirq.c renesas_exit.c renesas_idle.c renesas_initialize.c
CMN_CSRCS += renesas_lowputs.c renesas_mdelay.c renesas_nputs.c
CMN_CSRCS += renesas_releasepending.c renesas_releasestack.c
CMN_CSRCS += renesas_stackframe.c renesas_udelay.c renesas_unblocktask.c renesas_usestack.c
CMN_CSRCS += renesas_stackframe.c renesas_udelay.c renesas_switchcontext.c renesas_usestack.c
CHIP_ASRCS = m16c_vectors.S
CHIP_CSRCS = m16c_initialstate.c m16c_copystate.c m16c_lowputc.c m16c_irq.c

View file

@ -20,11 +20,11 @@
HEAD_ASRC = rx65n_head.S
CMN_CSRCS = renesas_allocateheap.c renesas_assert.c renesas_blocktask.c
CMN_CSRCS = renesas_allocateheap.c renesas_assert.c
CMN_CSRCS += renesas_createstack.c renesas_doirq.c renesas_exit.c renesas_idle.c renesas_initialize.c
CMN_CSRCS += renesas_lowputs.c renesas_mdelay.c renesas_nputs.c
CMN_CSRCS += renesas_releasepending.c renesas_releasestack.c
CMN_CSRCS += renesas_stackframe.c renesas_udelay.c renesas_unblocktask.c renesas_usestack.c
CMN_CSRCS += renesas_stackframe.c renesas_udelay.c renesas_switchcontext.c renesas_usestack.c
CHIP_ASRCS = rx65n_vector.S
CHIP_CSRCS = rx65n_lowputc.c rx65n_serial.c rx65n_copystate.c rx65n_irq.c

View file

@ -20,13 +20,13 @@
HEAD_ASRC = sh1_head.S
CMN_CSRCS = renesas_allocateheap.c renesas_assert.c renesas_blocktask.c
CMN_CSRCS = renesas_allocateheap.c renesas_assert.c
CMN_CSRCS += renesas_createstack.c renesas_doirq.c renesas_exit.c renesas_idle.c renesas_initialize.c
CMN_CSRCS += renesas_initialstate.c renesas_lowputs.c
CMN_CSRCS += renesas_mdelay.c renesas_nputs.c renesas_releasepending.c renesas_releasestack.c
CMN_CSRCS += renesas_stackframe.c renesas_udelay.c
CMN_CSRCS += sh1_schedulesigaction.c sh1_sigdeliver.c
CMN_CSRCS += renesas_unblocktask.c renesas_usestack.c
CMN_CSRCS += renesas_switchcontext.c renesas_usestack.c
CHIP_ASRCS = sh1_vector.S sh1_saveusercontext.S
CHIP_CSRCS = sh1_lowputc.c sh1_irq.c sh1_serial.c sh1_initialstate.c

View file

@ -28,11 +28,11 @@ CMN_ASRCS += riscv_vectors.S riscv_exception_common.S riscv_mhartid.S
# Specify C code within the common directory to be included
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_assert.c riscv_copystate.c riscv_initialstate.c
CMN_CSRCS += riscv_modifyreg32.c riscv_nputs.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_sigdeliver.c riscv_switchcontext.c riscv_usestack.c
CMN_CSRCS += riscv_idle.c riscv_tcbinfo.c riscv_cpuidlestack.c
CMN_CSRCS += riscv_exception.c riscv_getnewintctx.c riscv_doirq.c
CMN_CSRCS += riscv_saveusercontext.c

View file

@ -1,115 +0,0 @@
/****************************************************************************
* arch/risc-v/src/common/riscv_blocktask.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 <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_block_task
*
* Description:
* The currently executing task has already removed from ready-to-run list.
* Save its context and switch to the next running task at the head of the
* ready-to-run list.
*
* Input Parameters:
* rtcb: Reference to the running task which is different to the
* task (next running task) at the head of the list.
*
****************************************************************************/
void up_block_task(struct tcb_s *rtcb)
{
/* 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();
/* Reset 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
{
/* Get the context of the task at the head of the ready to
* run list.
*/
struct tcb_s *nexttcb = this_task();
/* Reset 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.
*/
}
}

View file

@ -1,5 +1,5 @@
/****************************************************************************
* arch/risc-v/src/common/riscv_unblocktask.c
* arch/risc-v/src/common/riscv_switchcontext.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@ -42,7 +42,7 @@
****************************************************************************/
/****************************************************************************
* Name: up_unblock_task
* Name: up_switch_context
*
* Description:
* A task is currently in the ready-to-run list but has been prepped
@ -55,7 +55,7 @@
*
****************************************************************************/
void up_unblock_task(struct tcb_s *tcb, struct tcb_s *rtcb)
void up_switch_context(struct tcb_s *tcb, struct tcb_s *rtcb)
{
/* Update scheduler parameters */

View file

@ -59,7 +59,7 @@ AOBJS = $(ASRCS:.S=$(OBJEXT))
CSRCS = sim_initialize.c sim_idle.c sim_interruptcontext.c sim_initialstate.c
CSRCS += sim_createstack.c sim_usestack.c sim_releasestack.c sim_stackframe.c
CSRCS += sim_unblocktask.c sim_blocktask.c sim_releasepending.c
CSRCS += sim_switchcontext.c sim_releasepending.c
CSRCS += sim_exit.c sim_schedulesigaction.c
CSRCS += sim_heap.c sim_uart.c sim_assert.c sim_nputs.c
CSRCS += sim_copyfullstate.c

View file

@ -1,104 +0,0 @@
/****************************************************************************
* arch/sim/src/sim/sim_blocktask.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 <stdbool.h>
#include <sched.h>
#include <assert.h>
#include <debug.h>
#include <nuttx/arch.h>
#include <nuttx/sched.h>
#include "sched/sched.h"
#include "sim_internal.h"
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: up_block_task
*
* Description:
* The currently executing task has already removed from ready-to-run list.
* Save its context and switch to the next running task at the head of the
* ready-to-run list.
*
* Input Parameters:
* rtcb: Reference to the running task which is different to the
* task (next running task) at the head of the list.
*
****************************************************************************/
void up_block_task(struct tcb_s *rtcb)
{
/* Update scheduler parameters */
nxsched_suspend_scheduler(rtcb);
/* TODO */
if (CURRENT_REGS)
{
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);
/* Reset 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();
}
}

View file

@ -1,5 +1,5 @@
/****************************************************************************
* arch/sim/src/sim/sim_unblocktask.c
* arch/sim/src/sim/sim_switchcontext.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@ -39,7 +39,7 @@
****************************************************************************/
/****************************************************************************
* Name: up_unblock_task
* Name: up_switch_context
*
* Description:
* A task is currently in the ready-to-run list but has been prepped
@ -52,7 +52,7 @@
*
****************************************************************************/
void up_unblock_task(struct tcb_s *tcb, struct tcb_s *rtcb)
void up_switch_context(struct tcb_s *tcb, struct tcb_s *rtcb)
{
sinfo("Unblocking TCB=%p\n", tcb);

View file

@ -23,11 +23,11 @@
include common/Make.defs
CMN_ASRCS += sparc_v8_syscall.S
CMN_CSRCS += sparc_v8_blocktask.c sparc_v8_copystate.c sparc_v8_doirq.c
CMN_CSRCS += sparc_v8_copystate.c sparc_v8_doirq.c
CMN_CSRCS += sparc_v8_initialstate.c sparc_v8_irq.c
CMN_CSRCS += sparc_v8_releasepending.c sparc_v8_schedulesigaction.c
CMN_CSRCS += sparc_v8_sigdeliver.c sparc_v8_swint1.c sparc_v8_systemreset.c
CMN_CSRCS += sparc_v8_unblocktask.c
CMN_CSRCS += sparc_v8_switchcontext.c
# Configuration-dependent common files

View file

@ -1,115 +0,0 @@
/****************************************************************************
* arch/sparc/src/sparc_v8/sparc_v8_blocktask.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 <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 "sparc_internal.h"
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: up_block_task
*
* Description:
* The currently executing task has already removed from ready-to-run list.
* Save its context and switch to the next running task at the head of the
* ready-to-run list.
*
* Input Parameters:
* rtcb: Reference to the running task which is different to the
* task (next running task) at the head of the list.
*
****************************************************************************/
void up_block_task(struct tcb_s *rtcb)
{
/* 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.
*/
sparc_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();
/* Reset scheduler parameters */
nxsched_resume_scheduler(rtcb);
/* Then switch contexts. Any necessary address environment
* changes will be made when the interrupt returns.
*/
sparc_restorestate(rtcb->xcp.regs);
}
/* No, then we will need to perform the user context switch */
else
{
/* Get the context of the task at the head of the ready to
* run list.
*/
struct tcb_s *nexttcb = this_task();
/* Reset scheduler parameters */
nxsched_resume_scheduler(nexttcb);
/* Then switch contexts */
sparc_switchcontext(rtcb->xcp.regs, nexttcb->xcp.regs);
/* sparc_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.
*/
}
}

View file

@ -1,5 +1,5 @@
/****************************************************************************
* arch/sparc/src/sparc_v8/sparc_v8_unblocktask.c
* arch/sparc/src/sparc_v8/sparc_v8_switchcontext.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@ -42,7 +42,7 @@
****************************************************************************/
/****************************************************************************
* Name: up_unblock_task
* Name: up_switch_context
*
* Description:
* A task is currently in the ready-to-run list but has been prepped
@ -55,7 +55,7 @@
*
****************************************************************************/
void up_unblock_task(struct tcb_s *tcb, struct tcb_s *rtcb)
void up_switch_context(struct tcb_s *tcb, struct tcb_s *rtcb)
{
/* Update scheduler parameters */

View file

@ -1,121 +0,0 @@
/****************************************************************************
* arch/x86/src/common/x86_blocktask.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 <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 "x86_internal.h"
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: up_block_task
*
* Description:
* The currently executing task has already removed from ready-to-run list.
* Save its context and switch to the next running task at the head of the
* ready-to-run list.
*
* Input Parameters:
* rtcb: Reference to the running task which is different to the
* task (next running task) at the head of the list.
*
****************************************************************************/
void up_block_task(struct tcb_s *rtcb)
{
/* 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.
*/
x86_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();
/* Reset scheduler parameters */
nxsched_resume_scheduler(rtcb);
/* Then switch contexts. Any necessary address environment
* changes will be made when the interrupt returns.
*/
x86_restorestate(rtcb->xcp.regs);
}
/* Copy the user C 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
/* Reset scheduler parameters */
nxsched_resume_scheduler(rtcb);
/* Then switch contexts */
x86_fullcontextrestore(rtcb->xcp.regs);
}
}

View file

@ -1,5 +1,5 @@
/****************************************************************************
* arch/x86/src/common/x86_unblocktask.c
* arch/x86/src/common/x86_switchcontext.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@ -40,7 +40,7 @@
****************************************************************************/
/****************************************************************************
* Name: up_unblock_task
* Name: up_switch_context
*
* Description:
* A task is currently in the ready-to-run list but has been prepped
@ -53,7 +53,7 @@
*
****************************************************************************/
void up_unblock_task(struct tcb_s *tcb, struct tcb_s *rtcb)
void up_switch_context(struct tcb_s *tcb, struct tcb_s *rtcb)
{
/* Update scheduler parameters */

View file

@ -27,10 +27,10 @@ HEAD_ASRC = qemu_head.S
CMN_ASRCS = i486_utils.S i486_syscall6.S
CMN_CSRCS += i486_createstack.c i486_initialstate.c
CMN_CSRCS += x86_allocateheap.c x86_assert.c x86_blocktask.c x86_copystate.c
CMN_CSRCS += x86_allocateheap.c x86_assert.c x86_copystate.c
CMN_CSRCS += x86_exit.c x86_initialize.c x86_mdelay.c x86_udelay.c
CMN_CSRCS += x86_modifyreg8.c x86_modifyreg16.c x86_modifyreg32.c
CMN_CSRCS += x86_nputs.c x86_releasepending.c x86_unblocktask.c
CMN_CSRCS += x86_nputs.c x86_releasepending.c x86_switchcontext.c
CMN_CSRCS += i486_irq.c i486_regdump.c i486_releasestack.c
CMN_CSRCS += i486_savestate.c i486_sigdeliver.c
CMN_CSRCS += i486_schedulesigaction.c i486_stackframe.c

View file

@ -1,122 +0,0 @@
/****************************************************************************
* arch/x86_64/src/common/x86_64_blocktask.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 <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 "x86_64_internal.h"
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: up_block_task
*
* Description:
* The currently executing task has already removed from ready-to-run list.
* Save its context and switch to the next running task at the head of the
* ready-to-run list.
*
* Input Parameters:
* rtcb: Reference to the running task which is different to the
* task (next running task) at the head of the list.
*
****************************************************************************/
void up_block_task(struct tcb_s *rtcb)
{
/* 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.
*/
x86_64_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();
x86_64_restore_auxstate(rtcb);
/* Reset scheduler parameters */
nxsched_resume_scheduler(rtcb);
/* Then switch contexts. Any necessary address environment
* changes will be made when the interrupt returns.
*/
x86_64_restorestate(rtcb->xcp.regs);
}
/* Copy the user C 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();
x86_64_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
/* Reset scheduler parameters */
nxsched_resume_scheduler(rtcb);
/* Then switch contexts */
x86_64_fullcontextrestore(rtcb->xcp.regs);
}
}

View file

@ -1,5 +1,5 @@
/****************************************************************************
* arch/x86_64/src/common/x86_64_unblocktask.c
* arch/x86_64/src/common/x86_64_switchcontext.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@ -42,7 +42,7 @@
****************************************************************************/
/****************************************************************************
* Name: up_unblock_task
* Name: up_switch_context
*
* Description:
* A task is currently in the ready-to-run list but has been prepped
@ -55,7 +55,7 @@
*
****************************************************************************/
void up_unblock_task(struct tcb_s *tcb, struct tcb_s *rtcb)
void up_switch_context(struct tcb_s *tcb, struct tcb_s *rtcb)
{
/* Update scheduler parameters */

View file

@ -20,10 +20,10 @@
# Common x86_64 and intel64 files
CMN_CSRCS += x86_64_allocateheap.c x86_64_assert.c x86_64_blocktask.c x86_64_copystate.c
CMN_CSRCS += x86_64_allocateheap.c x86_64_assert.c x86_64_copystate.c
CMN_CSRCS += x86_64_mdelay.c x86_64_udelay.c x86_64_exit.c x86_64_initialize.c
CMN_CSRCS += x86_64_modifyreg8.c x86_64_modifyreg16.c x86_64_modifyreg32.c x86_64_nputs.c
CMN_CSRCS += x86_64_releasepending.c x86_64_unblocktask.c
CMN_CSRCS += x86_64_releasepending.c x86_64_switchcontext.c
CMN_CSRCS += intel64_restore_auxstate.c intel64_createstack.c intel64_initialstate.c
CMN_CSRCS += intel64_regdump.c intel64_releasestack.c intel64_map_region.c
CMN_CSRCS += intel64_savestate.c intel64_sigdeliver.c

View file

@ -27,7 +27,7 @@ HEAD_ASRC += xtensa_int_handlers.S xtensa_user_handler.S
CMN_ASRCS = xtensa_context.S xtensa_cpuint.S xtensa_panic.S
CMN_CSRCS = xtensa_assert.c xtensa_blocktask.c
CMN_CSRCS = xtensa_assert.c
CMN_CSRCS += xtensa_cpenable.c xtensa_createstack.c xtensa_exit.c
CMN_CSRCS += xtensa_initialize.c xtensa_initialstate.c
CMN_CSRCS += xtensa_irqdispatch.c xtensa_lowputs.c xtensa_mdelay.c
@ -35,7 +35,7 @@ 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_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_switchcontext.c xtensa_usestack.c xtensa_swint.c
CMN_CSRCS += xtensa_saveusercontext.c
# Configuration-dependent common Xtensa files

View file

@ -1,113 +0,0 @@
/****************************************************************************
* arch/xtensa/src/common/xtensa_blocktask.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 <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_block_task
*
* Description:
* The currently executing task has already removed from ready-to-run list.
* Save its context and switch to the next running task at the head of the
* ready-to-run list.
*
* Input Parameters:
* rtcb: Reference to the running task which is different to the
* task (next running task) at the head of the list.
*
****************************************************************************/
void up_block_task(struct tcb_s *rtcb)
{
/* 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();
/* Reset 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();
/* Switch context to the context of the task at the head of the
* ready to run list.
*/
nxsched_resume_scheduler(nexttcb);
/* Then switch contexts */
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.
*/
}
}

View file

@ -1,5 +1,5 @@
/****************************************************************************
* arch/xtensa/src/common/xtensa_unblocktask.c
* arch/xtensa/src/common/xtensa_switchcontext.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@ -42,7 +42,7 @@
****************************************************************************/
/****************************************************************************
* Name: up_unblock_task
* Name: up_switch_context
*
* Description:
* A task is currently in the ready-to-run list but has been prepped
@ -55,7 +55,7 @@
*
****************************************************************************/
void up_unblock_task(struct tcb_s *tcb, struct tcb_s *rtcb)
void up_switch_context(struct tcb_s *tcb, struct tcb_s *rtcb)
{
/* Update scheduler parameters */

View file

@ -1,110 +0,0 @@
/****************************************************************************
* arch/z16/src/common/z16_blocktask.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 <stdbool.h>
#include <sched.h>
#include <assert.h>
#include <debug.h>
#include <nuttx/arch.h>
#include <nuttx/sched.h>
#include "sched/sched.h"
#include "z16_internal.h"
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: up_block_task
*
* Description:
* The currently executing task has already removed from ready-to-run list.
* Save its context and switch to the next running task at the head of the
* ready-to-run list.
*
* Input Parameters:
* rtcb: Reference to the running task which is different to the
* task (next running task) at the head of the list.
*
****************************************************************************/
void up_block_task(FAR struct tcb_s *rtcb)
{
/* 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 registers 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();
/* Reset 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 user C 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();
/* Reset scheduler parameters */
nxsched_resume_scheduler(rtcb);
/* Then switch contexts */
RESTORE_USERCONTEXT(rtcb);
}
}

View file

@ -1,5 +1,5 @@
/****************************************************************************
* arch/z16/src/common/z16_unblocktask.c
* arch/z16/src/common/z16_switchcontext.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@ -41,7 +41,7 @@
****************************************************************************/
/****************************************************************************
* Name: up_unblock_task
* Name: up_switch_context
*
* Description:
* A task is currently in the ready-to-run list but has been prepped
@ -54,7 +54,7 @@
*
****************************************************************************/
void up_unblock_task(FAR struct tcb_s *tcb, FAR struct tcb_s *rtcb)
void up_switch_context(FAR struct tcb_s *tcb, FAR struct tcb_s *rtcb)
{
/* Update scheduler parameters */

View file

@ -21,10 +21,10 @@
HEAD_SSRC = z16f_head.S
CMN_CSRCS = z16_allocateheap.c z16_initialize.c z16_schedulesigaction.c
CMN_CSRCS += z16_assert.c z16_initialstate.c z16_sigdeliver.c z16_blocktask.c
CMN_CSRCS += z16_assert.c z16_initialstate.c z16_sigdeliver.c
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_switchcontext.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_nputs.c

View file

@ -1,122 +0,0 @@
/****************************************************************************
* arch/z80/src/common/z80_blocktask.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 <stdbool.h>
#include <sched.h>
#include <assert.h>
#include <debug.h>
#include <nuttx/arch.h>
#include <nuttx/sched.h>
#include "chip/switch.h"
#include "sched/sched.h"
#include "group/group.h"
#include "z80_internal.h"
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: up_block_task
*
* Description:
* The currently executing task has already removed from ready-to-run list.
* Save its context and switch to the next running task at the head of the
* ready-to-run list.
*
* Input Parameters:
* rtcb: Reference to the running task which is different to the
* task (next running task) at the head of the list.
*
****************************************************************************/
void up_block_task(FAR struct tcb_s *rtcb)
{
/* 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 registers 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();
/* Reset 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 user C 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
/* Reset scheduler parameters */
nxsched_resume_scheduler(rtcb);
/* Then switch contexts */
RESTORE_USERCONTEXT(rtcb);
}
}

View file

@ -1,5 +1,5 @@
/****************************************************************************
* arch/z80/src/common/z80_unblocktask.c
* arch/z80/src/common/z80_switchcontext.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@ -43,7 +43,7 @@
****************************************************************************/
/****************************************************************************
* Name: up_unblock_task
* Name: up_switch_context
*
* Description:
* A task is currently in the ready-to-run list but has been prepped
@ -56,7 +56,7 @@
*
****************************************************************************/
void up_unblock_task(FAR struct tcb_s *tcb, FAR struct tcb_s *rtcb)
void up_switch_context(FAR struct tcb_s *tcb, FAR struct tcb_s *rtcb)
{
/* Update scheduler parameters */

View file

@ -19,8 +19,8 @@
############################################################################
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_releasestack.c z80_interruptcontext.c
CMN_CSRCS += z80_switchcontext.c z80_exit.c z80_releasepending.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

View file

@ -26,11 +26,11 @@ HEAD_ASRC = z180_head.asm
endif
endif
CMN_CSRCS = z80_allocateheap.c z80_assert.c z80_blocktask.c z80_createstack.c
CMN_CSRCS = z80_allocateheap.c z80_assert.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
CMN_CSRCS += z80_unblocktask.c z80_udelay.c z80_usestack.c z80_nputs.c
CMN_CSRCS += z80_switchcontext.c z80_udelay.c z80_usestack.c z80_nputs.c
CHIP_ASRCS = z180_restoreusercontext.asm z180_saveusercontext.asm
CHIP_ASRCS += z180_vectcommon.asm

View file

@ -21,8 +21,8 @@
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_releasestack.c z80_interruptcontext.c
CMN_CSRCS += z80_switchcontext.c z80_exit.c z80_releasepending.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

View file

@ -27,8 +27,8 @@ endif
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_releasestack.c z80_interruptcontext.c
CMN_CSRCS += z80_switchcontext.c z80_exit.c z80_releasepending.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

View file

@ -139,7 +139,7 @@ SECTIONS
*libarch.a:phy62xx_ble_hcitl.o(.text.phy62xx_ble_init)
*libarch.a:phy62xx_ble_hcitl.o(.text.HCI_ProcessEvent1)
*libarch.a:up_idle.o(.text .text.*)
*libarch.a:up_idle.o(.text.up_block_task)
*libarch.a:up_idle.o(.text.up_switch_context)
*libarch.a:arm_switchcontext.o(.text .text.*)
*libarch.a:arm_fullcontextrestore.o(.text .text.*)
*libarch.a:arm_fullcontextrestore.o(.text .text.*)

View file

@ -384,7 +384,7 @@ FAR void *up_stack_frame(FAR struct tcb_s *tcb, size_t frame_size);
void up_release_stack(FAR struct tcb_s *dtcb, uint8_t ttype);
/****************************************************************************
* Name: up_unblock_task
* Name: up_switch_context
*
* Description:
* A task is currently in the ready-to-run list but has been prepped
@ -401,26 +401,7 @@ void up_release_stack(FAR struct tcb_s *dtcb, uint8_t ttype);
*
****************************************************************************/
void up_unblock_task(FAR struct tcb_s *tcb, FAR struct tcb_s *rtcb);
/****************************************************************************
* Name: up_block_task
*
* Description:
* The currently executing task has already removed from ready-to-run list.
* Save its context and switch to the next running task at the head of the
* ready-to-run list.
*
* This function is called only from the NuttX scheduling logic.
* Interrupts will always be disabled when this function is called.
*
* Input Parameters:
* rtcb: Reference to the running task which is different to the
* task (next running task) at the head of the list.
*
****************************************************************************/
void up_block_task(FAR struct tcb_s *rtcb);
void up_switch_context(FAR struct tcb_s *tcb, FAR struct tcb_s *rtcb);
/****************************************************************************
* Name: up_release_pending

View file

@ -243,9 +243,9 @@ extern "C"
* is resolved and all logic associated with the page fill worker
* must be "locked" and always present in memory.
* 2) Block the currently executing task.
* - Call up_block_task() to block the task at the head of the ready-
* to-run list. This should cause an interrupt level context switch
* to the next highest priority task.
* - Call up_switch_context() to block the task at the head of the
* ready-to-run list. This should cause an interrupt level context
* switch to the next highest priority task.
* - The blocked task will be marked with state TSTATE_WAIT_PAGEFILL
* and will be retained in the g_waitingforfill prioritized task
* list.

View file

@ -75,7 +75,7 @@ static int group_continue_handler(pid_t pid, FAR void *arg)
if (nxsched_add_readytorun(rtcb))
{
up_unblock_task(rtcb, tcb);
up_switch_context(rtcb, tcb);
}
}

View file

@ -197,7 +197,7 @@ int nxmq_wait_receive(FAR struct mqueue_inode_s *msgq,
if (switch_needed)
{
up_block_task(rtcb);
up_switch_context(this_task(), rtcb);
}
/* When we resume at this point, either (1) the message queue
@ -330,7 +330,7 @@ ssize_t nxmq_do_receive(FAR struct mqueue_inode_s *msgq,
if (nxsched_add_readytorun(btcb))
{
up_unblock_task(btcb, rtcb);
up_switch_context(btcb, rtcb);
}
}

View file

@ -282,7 +282,7 @@ int nxmq_wait_send(FAR struct mqueue_inode_s *msgq, int oflags)
if (switch_needed)
{
up_block_task(rtcb);
up_switch_context(this_task(), rtcb);
}
/* When we resume at this point, either (1) the message queue
@ -436,7 +436,7 @@ int nxmq_do_send(FAR struct mqueue_inode_s *msgq,
if (nxsched_add_readytorun(btcb))
{
up_unblock_task(btcb, rtcb);
up_switch_context(btcb, rtcb);
}
}

View file

@ -105,6 +105,6 @@ void nxmq_wait_irq(FAR struct tcb_s *wtcb, int errcode)
if (nxsched_add_readytorun(wtcb))
{
up_unblock_task(wtcb, rtcb);
up_switch_context(wtcb, rtcb);
}
}

View file

@ -140,7 +140,7 @@ static int msgrcv_wait(FAR struct msgq_s *msgq, FAR struct msgbuf_s **rcvmsg,
if (switch_needed)
{
up_block_task(rtcb);
up_switch_context(this_task(), rtcb);
}
/* When we resume at this point, either (1) the message queue
@ -271,7 +271,7 @@ ssize_t msgrcv(int msqid, FAR void *msgp, size_t msgsz, long msgtyp,
if (nxsched_add_readytorun(btcb))
{
up_unblock_task(btcb, rtcb);
up_switch_context(btcb, rtcb);
}
}

View file

@ -106,7 +106,7 @@ static int msgsnd_wait(FAR struct msgq_s *msgq, int msgflg)
if (switch_needed)
{
up_block_task(rtcb);
up_switch_context(this_task(), rtcb);
}
/* When we resume at this point, either (1) the message queue
@ -264,7 +264,7 @@ int msgsnd(int msqid, FAR const void *msgp, size_t msgsz, int msgflg)
if (nxsched_add_readytorun(btcb))
{
up_unblock_task(btcb, rtcb);
up_switch_context(btcb, rtcb);
}
}
}

View file

@ -57,9 +57,9 @@
* must be "locked" and always present in memory.
* - ASSERT if an interrupt was executing at the time of the exception.
* 2) Block the currently executing task.
* - Call up_block_task() to block the task at the head of the ready-
* to-run list. This should cause an interrupt level context switch
* to the next highest priority task.
* - Call up_switch_context() to block the task at the head of the
* ready-to-run list. This should cause an interrupt level context
* switch to the next highest priority task.
* - The blocked task will be marked with state TSTATE_WAIT_PAGEFILL
* and will be retained in the g_waitingforfill prioritized task
* list.
@ -124,9 +124,9 @@ void pg_miss(void)
DEBUGASSERT(g_pgworker != ftcb->pid);
/* Block the currently executing task
* - Call up_block_task() to block the task at the head of the ready-
* to-run list. This should cause an interrupt level context switch
* to the next highest priority task.
* - Call up_switch_context() to block the task at the head of the
* ready-to-run list. This should cause an interrupt level context
* switch to the next highest priority task.
* - The blocked task will be marked with state TSTATE_WAIT_PAGEFILL
* and will be retained in the g_waitingforfill prioritized task list.
*
@ -149,7 +149,7 @@ void pg_miss(void)
if (switch_needed)
{
up_block_task(ftcb);
up_switch_context(this_task(), ftcb);
}
/* Boost the page fill worker thread priority.

View file

@ -295,7 +295,7 @@ static inline bool pg_dequeue(void)
if (nxsched_add_readytorun(g_pftcb))
{
up_unblock_task(g_pftcb, wtcb);
up_switch_context(g_pftcb, wtcb);
}
}
}
@ -492,7 +492,7 @@ static inline void pg_fillcomplete(void)
if (nxsched_add_readytorun(g_pftcb))
{
up_unblock_task(g_pftcb, wtcb);
up_switch_context(g_pftcb, wtcb);
}
}
@ -595,7 +595,7 @@ int pg_worker(int argc, char *argv[])
if (nxsched_add_readytorun(g_pftcb))
{
up_unblock_task(g_pftcb, wtcb);
up_switch_context(g_pftcb, wtcb);
}
/* Yes .. Start the next asynchronous fill. Check the return
@ -680,7 +680,7 @@ int pg_worker(int argc, char *argv[])
if (nxsched_add_readytorun(g_pftcb))
{
up_unblock_task(g_pftcb, wtcb);
up_switch_context(g_pftcb, wtcb);
}
}

View file

@ -149,7 +149,7 @@ uint32_t nxsched_process_roundrobin(FAR struct tcb_s *tcb, uint32_t ticks,
if (nxsched_reprioritize_rtr(tcb, tcb->sched_priority))
{
up_block_task(rtcb);
up_switch_context(this_task(), rtcb);
}
}
}

View file

@ -146,7 +146,7 @@ static inline void nxsched_running_setpriority(FAR struct tcb_s *tcb,
if (nxsched_reprioritize_rtr(tcb, sched_priority))
{
up_block_task(rtcb);
up_switch_context(this_task(), rtcb);
}
}
@ -230,7 +230,7 @@ static void nxsched_readytorun_setpriority(FAR struct tcb_s *tcb,
if (nxsched_reprioritize_rtr(tcb, sched_priority))
{
up_block_task(rtcb);
up_switch_context(this_task(), rtcb);
}
}

View file

@ -103,7 +103,7 @@ void nxsched_suspend(FAR struct tcb_s *tcb)
if (switch_needed)
{
up_block_task(rtcb);
up_switch_context(this_task(), rtcb);
}
}

View file

@ -335,7 +335,7 @@ static int nxsem_boostholderprio(FAR struct semholder_s *pholder,
/* Raise the priority of the holder of the semaphore. This
* cannot cause a context switch because we have preemption
* disabled. The task will be marked "pending" and the switch
* will occur during up_block_task() processing.
* will occur during up_contex_switch() processing.
*/
nxsched_set_priority(htcb, rtcb->sched_priority);

View file

@ -161,7 +161,7 @@ int nxsem_post(FAR sem_t *sem)
if (nxsched_add_readytorun(stcb))
{
up_unblock_task(stcb, rtcb);
up_switch_context(stcb, rtcb);
}
}
#if 0 /* REVISIT: This can fire on IOB throttle semaphore */

View file

@ -165,7 +165,7 @@ int nxsem_wait(FAR sem_t *sem)
if (switch_needed)
{
up_block_task(rtcb);
up_switch_context(this_task(), rtcb);
}
/* When we resume at this point, either (1) the semaphore has been

View file

@ -109,6 +109,6 @@ void nxsem_wait_irq(FAR struct tcb_s *wtcb, int errcode)
if (nxsched_add_readytorun(wtcb))
{
up_unblock_task(wtcb, rtcb);
up_switch_context(wtcb, rtcb);
}
}

View file

@ -381,7 +381,7 @@ int nxsig_tcbdispatch(FAR struct tcb_s *stcb, siginfo_t *info)
if (nxsched_add_readytorun(stcb))
{
up_unblock_task(stcb, rtcb);
up_switch_context(stcb, rtcb);
}
leave_critical_section(flags);
@ -435,7 +435,7 @@ int nxsig_tcbdispatch(FAR struct tcb_s *stcb, siginfo_t *info)
if (nxsched_add_readytorun(stcb))
{
up_unblock_task(stcb, rtcb);
up_switch_context(stcb, rtcb);
}
}
@ -499,7 +499,7 @@ int nxsig_tcbdispatch(FAR struct tcb_s *stcb, siginfo_t *info)
if (nxsched_add_readytorun(stcb))
{
up_unblock_task(stcb, rtcb);
up_switch_context(stcb, rtcb);
}
#endif
}

View file

@ -138,7 +138,7 @@ int sigsuspend(FAR const sigset_t *set)
if (switch_needed)
{
up_block_task(rtcb);
up_switch_context(this_task(), rtcb);
}
/* We are running again, restore the original sigprocmask */

View file

@ -79,7 +79,7 @@ static void nxsig_timeout(wdparm_t arg)
#ifdef CONFIG_SMP
irqstate_t flags;
/* We must be in a critical section in order to call up_unblock_task()
/* We must be in a critical section in order to call up_switch_context()
* below. If we are running on a single CPU architecture, then we know
* interrupts a disabled an there is no need to explicitly call
* enter_critical_section(). However, in the SMP case,
@ -118,7 +118,7 @@ static void nxsig_timeout(wdparm_t arg)
if (nxsched_add_readytorun(wtcb))
{
up_unblock_task(wtcb, rtcb);
up_switch_context(wtcb, rtcb);
}
}
@ -146,7 +146,7 @@ void nxsig_wait_irq(FAR struct tcb_s *wtcb, int errcode)
#ifdef CONFIG_SMP
irqstate_t flags;
/* We must be in a critical section in order to call up_unblock_task()
/* We must be in a critical section in order to call up_switch_context()
* below. If we are running on a single CPU architecture, then we know
* interrupts a disabled an there is no need to explicitly call
* enter_critical_section(). However, in the SMP case,
@ -185,7 +185,7 @@ void nxsig_wait_irq(FAR struct tcb_s *wtcb, int errcode)
if (nxsched_add_readytorun(wtcb))
{
up_unblock_task(wtcb, rtcb);
up_switch_context(wtcb, rtcb);
}
}
@ -366,7 +366,7 @@ int nxsig_timedwait(FAR const sigset_t *set, FAR struct siginfo *info,
if (switch_needed)
{
up_block_task(rtcb);
up_switch_context(this_task(), rtcb);
}
/* We no longer need the watchdog */
@ -408,7 +408,7 @@ int nxsig_timedwait(FAR const sigset_t *set, FAR struct siginfo *info,
if (switch_needed)
{
up_block_task(rtcb);
up_switch_context(this_task(), rtcb);
}
}

View file

@ -90,7 +90,7 @@ void nxtask_activate(FAR struct tcb_s *tcb)
if (nxsched_add_readytorun(tcb))
{
up_unblock_task(tcb, rtcb);
up_switch_context(tcb, rtcb);
}
leave_critical_section(flags);