Correct resume scheduler hooks and add suspend scheduler hooks to all implementations of up_unblock_task
This commit is contained in:
parent
a92c0a10ab
commit
838c5355eb
14 changed files with 223 additions and 226 deletions
|
@ -81,10 +81,6 @@ void up_unblock_task(struct tcb_s *tcb)
|
|||
|
||||
sched_removeblocked(tcb);
|
||||
|
||||
/* Reset scheduler parameters */
|
||||
|
||||
sched_resume_scheduler(tcb);
|
||||
|
||||
/* Add the task in the correct location in the prioritized
|
||||
* g_readytorun task list
|
||||
*/
|
||||
|
@ -93,10 +89,14 @@ void up_unblock_task(struct tcb_s *tcb)
|
|||
{
|
||||
/* The currently active task has changed! We need to do
|
||||
* a context switch to the new task.
|
||||
*
|
||||
* Are we in an interrupt handler?
|
||||
*/
|
||||
|
||||
/* Update scheduler parameters */
|
||||
|
||||
sched_suspend_scheduler(rtcb);
|
||||
|
||||
/* Are we in an interrupt handler? */
|
||||
|
||||
if (current_regs)
|
||||
{
|
||||
/* Yes, then we have to do things differently.
|
||||
|
@ -111,6 +111,10 @@ void up_unblock_task(struct tcb_s *tcb)
|
|||
|
||||
rtcb = (struct tcb_s*)g_readytorun.head;
|
||||
|
||||
/* Update scheduler parameters */
|
||||
|
||||
sched_resume_scheduler(rtcb);
|
||||
|
||||
/* Then switch contexts. Any necessary address environment
|
||||
* changes will be made when the interrupt returns.
|
||||
*/
|
||||
|
@ -142,6 +146,10 @@ void up_unblock_task(struct tcb_s *tcb)
|
|||
|
||||
(void)group_addrenv(rtcb);
|
||||
#endif
|
||||
/* Update scheduler parameters */
|
||||
|
||||
sched_resume_scheduler(rtcb);
|
||||
|
||||
/* Then switch contexts */
|
||||
|
||||
up_fullcontextrestore(rtcb->xcp.regs);
|
||||
|
|
|
@ -47,18 +47,6 @@
|
|||
#include "clock/clock.h"
|
||||
#include "up_internal.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
@ -91,10 +79,6 @@ void up_unblock_task(struct tcb_s *tcb)
|
|||
|
||||
sched_removeblocked(tcb);
|
||||
|
||||
/* Reset scheduler parameters */
|
||||
|
||||
sched_resume_scheduler(tcb);
|
||||
|
||||
/* Add the task in the correct location in the prioritized
|
||||
* g_readytorun task list
|
||||
*/
|
||||
|
@ -103,10 +87,14 @@ void up_unblock_task(struct tcb_s *tcb)
|
|||
{
|
||||
/* The currently active task has changed! We need to do
|
||||
* a context switch to the new task.
|
||||
*
|
||||
* Are we in an interrupt handler?
|
||||
*/
|
||||
|
||||
/* Update scheduler parameters */
|
||||
|
||||
sched_suspend_scheduler(rtcb);
|
||||
|
||||
/* Are we in an interrupt handler? */
|
||||
|
||||
if (current_regs)
|
||||
{
|
||||
/* Yes, then we have to do things differently.
|
||||
|
@ -121,6 +109,10 @@ void up_unblock_task(struct tcb_s *tcb)
|
|||
|
||||
rtcb = (struct tcb_s*)g_readytorun.head;
|
||||
|
||||
/* Update scheduler parameters */
|
||||
|
||||
sched_resume_scheduler(rtcb);
|
||||
|
||||
/* Then switch contexts */
|
||||
|
||||
up_restorestate(rtcb->xcp.regs);
|
||||
|
@ -130,11 +122,16 @@ void up_unblock_task(struct tcb_s *tcb)
|
|||
|
||||
else
|
||||
{
|
||||
struct tcb_s *nexttcb = (struct tcb_s*)g_readytorun.head;
|
||||
|
||||
/* Update scheduler parameters */
|
||||
|
||||
sched_resume_scheduler(nexttcb);
|
||||
|
||||
/* Switch context to the context of the task at the head of the
|
||||
* ready to run list.
|
||||
*/
|
||||
|
||||
struct tcb_s *nexttcb = (struct tcb_s*)g_readytorun.head;
|
||||
up_switchcontext(rtcb->xcp.regs, nexttcb->xcp.regs);
|
||||
|
||||
/* up_switchcontext forces a context switch to the task at the
|
||||
|
|
|
@ -93,10 +93,6 @@ void up_unblock_task(struct tcb_s *tcb)
|
|||
|
||||
sched_removeblocked(tcb);
|
||||
|
||||
/* Reset scheduler parameters */
|
||||
|
||||
sched_resume_scheduler(tcb);
|
||||
|
||||
/* Add the task in the correct location in the prioritized
|
||||
* g_readytorun task list
|
||||
*/
|
||||
|
@ -105,10 +101,14 @@ void up_unblock_task(struct tcb_s *tcb)
|
|||
{
|
||||
/* The currently active task has changed! We need to do
|
||||
* a context switch to the new task.
|
||||
*
|
||||
* Are we in an interrupt handler?
|
||||
*/
|
||||
|
||||
/* Update scheduler parameters */
|
||||
|
||||
sched_suspend_scheduler(rtcb);
|
||||
|
||||
/* Are we in an interrupt handler? */
|
||||
|
||||
if (current_regs)
|
||||
{
|
||||
/* Yes, then we have to do things differently.
|
||||
|
@ -123,6 +123,10 @@ void up_unblock_task(struct tcb_s *tcb)
|
|||
|
||||
rtcb = (struct tcb_s*)g_readytorun.head;
|
||||
|
||||
/* Update scheduler parameters */
|
||||
|
||||
sched_resume_scheduler(rtcb);
|
||||
|
||||
/* Then switch contexts. Any necessary address environment
|
||||
* changes will be made when the interrupt returns.
|
||||
*/
|
||||
|
@ -154,6 +158,10 @@ void up_unblock_task(struct tcb_s *tcb)
|
|||
|
||||
(void)group_addrenv(rtcb);
|
||||
#endif
|
||||
/* Update scheduler parameters */
|
||||
|
||||
sched_resume_scheduler(rtcb);
|
||||
|
||||
/* Then switch contexts */
|
||||
|
||||
up_fullcontextrestore(rtcb->xcp.regs);
|
||||
|
|
|
@ -47,18 +47,6 @@
|
|||
#include "clock/clock.h"
|
||||
#include "up_internal.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
@ -92,10 +80,6 @@ void up_unblock_task(struct tcb_s *tcb)
|
|||
|
||||
sched_removeblocked(tcb);
|
||||
|
||||
/* Reset scheduler parameters */
|
||||
|
||||
sched_resume_scheduler(tcb);
|
||||
|
||||
/* Add the task in the correct location in the prioritized
|
||||
* g_readytorun task list
|
||||
*/
|
||||
|
@ -104,10 +88,14 @@ void up_unblock_task(struct tcb_s *tcb)
|
|||
{
|
||||
/* The currently active task has changed! We need to do
|
||||
* a context switch to the new task.
|
||||
*
|
||||
* Are we in an interrupt handler?
|
||||
*/
|
||||
|
||||
/* Update scheduler parameters */
|
||||
|
||||
sched_suspend_scheduler(rtcb);
|
||||
|
||||
/* Are we in an interrupt handler? */
|
||||
|
||||
if (current_regs)
|
||||
{
|
||||
/* Yes, then we have to do things differently.
|
||||
|
@ -122,6 +110,10 @@ void up_unblock_task(struct tcb_s *tcb)
|
|||
|
||||
rtcb = (struct tcb_s*)g_readytorun.head;
|
||||
|
||||
/* Update scheduler parameters */
|
||||
|
||||
sched_resume_scheduler(rtcb);
|
||||
|
||||
/* Then switch contexts */
|
||||
|
||||
up_restorestate(rtcb->xcp.regs);
|
||||
|
@ -131,11 +123,16 @@ void up_unblock_task(struct tcb_s *tcb)
|
|||
|
||||
else
|
||||
{
|
||||
struct tcb_s *nexttcb = (struct tcb_s*)g_readytorun.head;
|
||||
|
||||
/* Update scheduler parameters */
|
||||
|
||||
sched_resume_scheduler(nexttcb);
|
||||
|
||||
/* Switch context to the context of the task at the head of the
|
||||
* ready to run list.
|
||||
*/
|
||||
|
||||
struct tcb_s *nexttcb = (struct tcb_s*)g_readytorun.head;
|
||||
up_switchcontext(rtcb->xcp.regs, nexttcb->xcp.regs);
|
||||
|
||||
/* up_switchcontext forces a context switch to the task at the
|
||||
|
|
|
@ -47,18 +47,6 @@
|
|||
#include "clock/clock.h"
|
||||
#include "up_internal.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
@ -92,10 +80,6 @@ void up_unblock_task(struct tcb_s *tcb)
|
|||
|
||||
sched_removeblocked(tcb);
|
||||
|
||||
/* Reset scheduler parameters */
|
||||
|
||||
sched_resume_scheduler(tcb);
|
||||
|
||||
/* Add the task in the correct location in the prioritized
|
||||
* g_readytorun task list
|
||||
*/
|
||||
|
@ -104,10 +88,14 @@ void up_unblock_task(struct tcb_s *tcb)
|
|||
{
|
||||
/* The currently active task has changed! We need to do
|
||||
* a context switch to the new task.
|
||||
*
|
||||
* Are we in an interrupt handler?
|
||||
*/
|
||||
|
||||
/* Update scheduler parameters */
|
||||
|
||||
sched_suspend_scheduler(rtcb);
|
||||
|
||||
/* Are we in an interrupt handler? */
|
||||
|
||||
if (current_regs)
|
||||
{
|
||||
/* Yes, then we have to do things differently.
|
||||
|
@ -122,6 +110,10 @@ void up_unblock_task(struct tcb_s *tcb)
|
|||
|
||||
rtcb = (struct tcb_s*)g_readytorun.head;
|
||||
|
||||
/* Update scheduler parameters */
|
||||
|
||||
sched_resume_scheduler(rtcb);
|
||||
|
||||
/* Then switch contexts */
|
||||
|
||||
up_restorestate(rtcb->xcp.regs);
|
||||
|
@ -131,11 +123,16 @@ void up_unblock_task(struct tcb_s *tcb)
|
|||
|
||||
else
|
||||
{
|
||||
struct tcb_s *nexttcb = (struct tcb_s*)g_readytorun.head;
|
||||
|
||||
/* Update scheduler parameters */
|
||||
|
||||
sched_resume_scheduler(nexttcb);
|
||||
|
||||
/* Switch context to the context of the task at the head of the
|
||||
* ready to run list.
|
||||
*/
|
||||
|
||||
struct tcb_s *nexttcb = (struct tcb_s*)g_readytorun.head;
|
||||
up_switchcontext(rtcb->xcp.regs, nexttcb->xcp.regs);
|
||||
|
||||
/* up_switchcontext forces a context switch to the task at the
|
||||
|
|
|
@ -48,18 +48,6 @@
|
|||
#include "clock/clock.h"
|
||||
#include "up_internal.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
@ -93,10 +81,6 @@ void up_unblock_task(struct tcb_s *tcb)
|
|||
|
||||
sched_removeblocked(tcb);
|
||||
|
||||
/* Reset scheduler parameters */
|
||||
|
||||
sched_resume_scheduler(tcb);
|
||||
|
||||
/* Add the task in the correct location in the prioritized
|
||||
* g_readytorun task list
|
||||
*/
|
||||
|
@ -105,10 +89,14 @@ void up_unblock_task(struct tcb_s *tcb)
|
|||
{
|
||||
/* The currently active task has changed! We need to do
|
||||
* a context switch to the new task.
|
||||
*
|
||||
* Are we in an interrupt handler?
|
||||
*/
|
||||
|
||||
/* Update scheduler parameters */
|
||||
|
||||
sched_suspend_scheduler(rtcb);
|
||||
|
||||
/* Are we in an interrupt handler? */
|
||||
|
||||
if (current_regs)
|
||||
{
|
||||
/* Yes, then we have to do things differently.
|
||||
|
@ -123,6 +111,10 @@ void up_unblock_task(struct tcb_s *tcb)
|
|||
|
||||
rtcb = (struct tcb_s*)g_readytorun.head;
|
||||
|
||||
/* Update scheduler parameters */
|
||||
|
||||
sched_resume_scheduler(rtcb);
|
||||
|
||||
/* Then switch contexts. Any new address environment needed by
|
||||
* the new thread will be instantiated before the return from
|
||||
* interrupt.
|
||||
|
@ -151,6 +143,10 @@ void up_unblock_task(struct tcb_s *tcb)
|
|||
|
||||
(void)group_addrenv(nexttcb);
|
||||
#endif
|
||||
/* Update scheduler parameters */
|
||||
|
||||
sched_resume_scheduler(nexttcb);
|
||||
|
||||
/* Then switch contexts */
|
||||
|
||||
up_switchcontext(rtcb->xcp.regs, nexttcb->xcp.regs);
|
||||
|
|
|
@ -48,18 +48,6 @@
|
|||
#include "clock/clock.h"
|
||||
#include "up_internal.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
@ -93,10 +81,6 @@ void up_unblock_task(struct tcb_s *tcb)
|
|||
|
||||
sched_removeblocked(tcb);
|
||||
|
||||
/* Reset scheduler parameters */
|
||||
|
||||
sched_resume_scheduler(tcb);
|
||||
|
||||
/* Add the task in the correct location in the prioritized
|
||||
* g_readytorun task list
|
||||
*/
|
||||
|
@ -105,10 +89,14 @@ void up_unblock_task(struct tcb_s *tcb)
|
|||
{
|
||||
/* The currently active task has changed! We need to do
|
||||
* a context switch to the new task.
|
||||
*
|
||||
* Are we in an interrupt handler?
|
||||
*/
|
||||
|
||||
/* Update scheduler parameters */
|
||||
|
||||
sched_suspend_scheduler(rtcb);
|
||||
|
||||
/* Are we in an interrupt handler? */
|
||||
|
||||
if (current_regs)
|
||||
{
|
||||
/* Yes, then we have to do things differently.
|
||||
|
@ -123,6 +111,10 @@ void up_unblock_task(struct tcb_s *tcb)
|
|||
|
||||
rtcb = (struct tcb_s*)g_readytorun.head;
|
||||
|
||||
/* Update scheduler parameters */
|
||||
|
||||
sched_resume_scheduler(rtcb);
|
||||
|
||||
/* Then switch contexts. Any necessary address environment
|
||||
* changes will be made when the interrupt returns.
|
||||
*/
|
||||
|
@ -154,6 +146,10 @@ void up_unblock_task(struct tcb_s *tcb)
|
|||
|
||||
(void)group_addrenv(rtcb);
|
||||
#endif
|
||||
/* Update scheduler parameters */
|
||||
|
||||
sched_resume_scheduler(rtcb);
|
||||
|
||||
/* Then switch contexts */
|
||||
|
||||
up_fullcontextrestore(rtcb->xcp.regs);
|
||||
|
|
|
@ -50,18 +50,6 @@
|
|||
#include "clock/clock.h"
|
||||
#include "up_internal.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
@ -95,10 +83,6 @@ void up_unblock_task(struct tcb_s *tcb)
|
|||
|
||||
sched_removeblocked(tcb);
|
||||
|
||||
/* Reset scheduler parameters */
|
||||
|
||||
sched_resume_scheduler(tcb);
|
||||
|
||||
/* Add the task in the correct location in the prioritized
|
||||
* g_readytorun task list
|
||||
*/
|
||||
|
@ -107,10 +91,14 @@ void up_unblock_task(struct tcb_s *tcb)
|
|||
{
|
||||
/* The currently active task has changed! We need to do
|
||||
* a context switch to the new task.
|
||||
*
|
||||
* Are we in an interrupt handler?
|
||||
*/
|
||||
|
||||
/* Update scheduler parameters */
|
||||
|
||||
sched_suspend_scheduler(rtcb);
|
||||
|
||||
/* Are we in an interrupt handler? */
|
||||
|
||||
if (current_regs)
|
||||
{
|
||||
/* Yes, then we have to do things differently.
|
||||
|
@ -125,6 +113,10 @@ void up_unblock_task(struct tcb_s *tcb)
|
|||
|
||||
rtcb = (struct tcb_s*)g_readytorun.head;
|
||||
|
||||
/* Update scheduler parameters */
|
||||
|
||||
sched_resume_scheduler(rtcb);
|
||||
|
||||
/* Then switch contexts. Any necessary address environment
|
||||
* changes will be made when the interrupt returns.
|
||||
*/
|
||||
|
@ -152,6 +144,10 @@ void up_unblock_task(struct tcb_s *tcb)
|
|||
|
||||
(void)group_addrenv(nexttcb);
|
||||
#endif
|
||||
/* Update scheduler parameters */
|
||||
|
||||
sched_resume_scheduler(nexttcb);
|
||||
|
||||
/* Then switch contexts */
|
||||
|
||||
up_switchcontext(rtcb->xcp.regs, nexttcb->xcp.regs);
|
||||
|
|
|
@ -342,51 +342,63 @@ void up_block_task(struct tcb_s *tcb, tstate_t task_state)
|
|||
* ready to run taks, executed.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void up_unblock_task(struct tcb_s *tcb)
|
||||
{
|
||||
/* Verify that the context switch can be performed */
|
||||
if ((tcb->task_state < FIRST_BLOCKED_STATE) ||
|
||||
(tcb->task_state > LAST_BLOCKED_STATE)) {
|
||||
warn("%s: task sched error\n", __func__);
|
||||
return;
|
||||
/* Verify that the context switch can be performed */
|
||||
|
||||
if ((tcb->task_state < FIRST_BLOCKED_STATE) ||
|
||||
(tcb->task_state > LAST_BLOCKED_STATE))
|
||||
{
|
||||
warn("%s: task sched error\n", __func__);
|
||||
return;
|
||||
}
|
||||
else {
|
||||
struct tcb_s *rtcb = current_task;
|
||||
else
|
||||
{
|
||||
struct tcb_s *rtcb = current_task;
|
||||
|
||||
/* Remove the task from the blocked task list */
|
||||
/* Remove the task from the blocked task list */
|
||||
|
||||
sched_removeblocked(tcb);
|
||||
sched_removeblocked(tcb);
|
||||
|
||||
/* Reset scheduler parameters */
|
||||
/* Add the task in the correct location in the prioritized
|
||||
* g_readytorun task list.
|
||||
*/
|
||||
|
||||
sched_resume_scheduler(tcb);
|
||||
if (sched_addreadytorun(tcb) && !up_interrupt_context())
|
||||
{
|
||||
/* The currently active task has changed! */
|
||||
/* Update scheduler parameters */
|
||||
|
||||
// Add the task in the correct location in the prioritized
|
||||
// g_readytorun task list.
|
||||
if (sched_addreadytorun(tcb) && !up_interrupt_context()) {
|
||||
/* The currently active task has changed! */
|
||||
sched_suspend_scheduler(rtcb);
|
||||
|
||||
struct tcb_s *nexttcb = (struct tcb_s*)g_readytorun.head;
|
||||
/* Are we in an interrupt handler? */
|
||||
|
||||
struct tcb_s *nexttcb = (struct tcb_s*)g_readytorun.head;
|
||||
|
||||
#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.
|
||||
/* 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.
|
||||
|
||||
(void)group_addrenv(nexttcb);
|
||||
(void)group_addrenv(nexttcb);
|
||||
#endif
|
||||
// context switch
|
||||
/* Update scheduler parameters */
|
||||
|
||||
up_switchcontext(rtcb, nexttcb);
|
||||
sched_resume_scheduler(nexttcb);
|
||||
|
||||
/* context switch */
|
||||
|
||||
up_switchcontext(rtcb, nexttcb);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is called from sched_unlock() which will check not
|
||||
/* This function is called from sched_unlock() which will check not
|
||||
* in interrupt context and disable interrupt.
|
||||
*/
|
||||
|
||||
void up_release_pending(void)
|
||||
{
|
||||
struct tcb_s *rtcb = current_task;
|
||||
|
|
|
@ -48,18 +48,6 @@
|
|||
#include "clock/clock.h"
|
||||
#include "up_internal.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
@ -93,10 +81,6 @@ void up_unblock_task(struct tcb_s *tcb)
|
|||
|
||||
sched_removeblocked(tcb);
|
||||
|
||||
/* Reset scheduler parameters */
|
||||
|
||||
sched_resume_scheduler(tcb);
|
||||
|
||||
/* Add the task in the correct location in the prioritized
|
||||
* g_readytorun task list
|
||||
*/
|
||||
|
@ -105,10 +89,14 @@ void up_unblock_task(struct tcb_s *tcb)
|
|||
{
|
||||
/* The currently active task has changed! We need to do
|
||||
* a context switch to the new task.
|
||||
*
|
||||
* Are we in an interrupt handler?
|
||||
*/
|
||||
|
||||
/* Update scheduler parameters */
|
||||
|
||||
sched_suspend_scheduler(rtcb);
|
||||
|
||||
/* Are we in an interrupt handler? */
|
||||
|
||||
if (current_regs)
|
||||
{
|
||||
/* Yes, then we have to do things differently.
|
||||
|
@ -123,6 +111,10 @@ void up_unblock_task(struct tcb_s *tcb)
|
|||
|
||||
rtcb = (struct tcb_s*)g_readytorun.head;
|
||||
|
||||
/* Update scheduler parameters */
|
||||
|
||||
sched_resume_scheduler(rtcb);
|
||||
|
||||
/* Then switch contexts. Any necessary address environment
|
||||
* changes will be made when the interrupt returns.
|
||||
*/
|
||||
|
@ -154,6 +146,10 @@ void up_unblock_task(struct tcb_s *tcb)
|
|||
|
||||
(void)group_addrenv(rtcb);
|
||||
#endif
|
||||
/* Update scheduler parameters */
|
||||
|
||||
sched_resume_scheduler(rtcb);
|
||||
|
||||
/* Then switch contexts */
|
||||
|
||||
up_fullcontextrestore(rtcb->xcp.regs);
|
||||
|
|
|
@ -92,10 +92,14 @@ void up_unblock_task(struct tcb_s *tcb)
|
|||
|
||||
if (sched_addreadytorun(tcb))
|
||||
{
|
||||
/* The currently active task has changed! Copy the exception context
|
||||
* into the TCB of the task that was previously active. if
|
||||
* up_setjmp returns a non-zero value, then this is really the
|
||||
* previously running task restarting!
|
||||
/* The currently active task has changed! */
|
||||
/* Update scheduler parameters */
|
||||
|
||||
sched_suspend_scheduler(rtcb);
|
||||
|
||||
/* Copy the exception context into the TCB of the task that was
|
||||
* previously active. if up_setjmp returns a non-zero value, then
|
||||
* this is really the previously running task restarting!
|
||||
*/
|
||||
|
||||
if (!up_setjmp(rtcb->xcp.regs))
|
||||
|
@ -120,6 +124,10 @@ void up_unblock_task(struct tcb_s *tcb)
|
|||
rtcb->xcp.sigdeliver = NULL;
|
||||
}
|
||||
|
||||
/* Update scheduler parameters */
|
||||
|
||||
sched_resume_scheduler(rtcb);
|
||||
|
||||
/* Then switch contexts */
|
||||
|
||||
up_longjmp(rtcb->xcp.regs, 1);
|
||||
|
|
|
@ -48,18 +48,6 @@
|
|||
#include "clock/clock.h"
|
||||
#include "up_internal.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
@ -92,10 +80,6 @@ void up_unblock_task(struct tcb_s *tcb)
|
|||
|
||||
sched_removeblocked(tcb);
|
||||
|
||||
/* Reset scheduler parameters */
|
||||
|
||||
sched_resume_scheduler(tcb);
|
||||
|
||||
/* Add the task in the correct location in the prioritized
|
||||
* g_readytorun task list
|
||||
*/
|
||||
|
@ -104,10 +88,14 @@ void up_unblock_task(struct tcb_s *tcb)
|
|||
{
|
||||
/* The currently active task has changed! We need to do
|
||||
* a context switch to the new task.
|
||||
*
|
||||
* Are we in an interrupt handler?
|
||||
*/
|
||||
|
||||
/* Update scheduler parameters */
|
||||
|
||||
sched_suspend_scheduler(rtcb);
|
||||
|
||||
/* Are we in an interrupt handler? */
|
||||
|
||||
if (current_regs)
|
||||
{
|
||||
/* Yes, then we have to do things differently.
|
||||
|
@ -122,6 +110,10 @@ void up_unblock_task(struct tcb_s *tcb)
|
|||
|
||||
rtcb = (struct tcb_s*)g_readytorun.head;
|
||||
|
||||
/* Update scheduler parameters */
|
||||
|
||||
sched_resume_scheduler(rtcb);
|
||||
|
||||
/* Then switch contexts. Any necessary address environment
|
||||
* changes will be made when the interrupt returns.
|
||||
*/
|
||||
|
@ -153,6 +145,10 @@ void up_unblock_task(struct tcb_s *tcb)
|
|||
|
||||
(void)group_addrenv(rtcb);
|
||||
#endif
|
||||
/* Update scheduler parameters */
|
||||
|
||||
sched_resume_scheduler(rtcb);
|
||||
|
||||
/* Then switch contexts */
|
||||
|
||||
up_fullcontextrestore(rtcb->xcp.regs);
|
||||
|
|
|
@ -49,18 +49,6 @@
|
|||
#include "clock/clock.h"
|
||||
#include "up_internal.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
@ -96,10 +84,6 @@ void up_unblock_task(FAR struct tcb_s *tcb)
|
|||
|
||||
sched_removeblocked(tcb);
|
||||
|
||||
/* Reset scheduler parameters */
|
||||
|
||||
sched_resume_scheduler(tcb);
|
||||
|
||||
/* Add the task in the correct location in the prioritized
|
||||
* g_readytorun task list
|
||||
*/
|
||||
|
@ -108,10 +92,14 @@ void up_unblock_task(FAR struct tcb_s *tcb)
|
|||
{
|
||||
/* The currently active task has changed! We need to do
|
||||
* a context switch to the new task.
|
||||
*
|
||||
* Are we in an interrupt handler?
|
||||
*/
|
||||
|
||||
/* Update scheduler parameters */
|
||||
|
||||
sched_suspend_scheduler(rtcb);
|
||||
|
||||
/* Are we in an interrupt handler? */
|
||||
|
||||
if (IN_INTERRUPT)
|
||||
{
|
||||
/* Yes, then we have to do things differently.
|
||||
|
@ -125,7 +113,10 @@ void up_unblock_task(FAR struct tcb_s *tcb)
|
|||
*/
|
||||
|
||||
rtcb = (FAR struct tcb_s*)g_readytorun.head;
|
||||
/* dbg("New Active Task TCB=%p\n", rtcb); */
|
||||
|
||||
/* Update scheduler parameters */
|
||||
|
||||
sched_resume_scheduler(rtcb);
|
||||
|
||||
/* Then setup so that the context will be performed on exit
|
||||
* from the interrupt.
|
||||
|
@ -148,7 +139,10 @@ void up_unblock_task(FAR struct tcb_s *tcb)
|
|||
*/
|
||||
|
||||
rtcb = (FAR struct tcb_s*)g_readytorun.head;
|
||||
/* dbg("New Active Task TCB=%p\n", rtcb); */
|
||||
|
||||
/* Update scheduler parameters */
|
||||
|
||||
sched_resume_scheduler(rtcb);
|
||||
|
||||
/* Then switch contexts */
|
||||
|
||||
|
|
|
@ -51,18 +51,6 @@
|
|||
#include "clock/clock.h"
|
||||
#include "up_internal.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
@ -98,10 +86,6 @@ void up_unblock_task(FAR struct tcb_s *tcb)
|
|||
|
||||
sched_removeblocked(tcb);
|
||||
|
||||
/* Reset scheduler parameters */
|
||||
|
||||
sched_resume_scheduler(tcb);
|
||||
|
||||
/* Add the task in the correct location in the prioritized
|
||||
* g_readytorun task list
|
||||
*/
|
||||
|
@ -110,10 +94,14 @@ void up_unblock_task(FAR struct tcb_s *tcb)
|
|||
{
|
||||
/* The currently active task has changed! We need to do
|
||||
* a context switch to the new task.
|
||||
*
|
||||
* Are we in an interrupt handler?
|
||||
*/
|
||||
|
||||
/* Update scheduler parameters */
|
||||
|
||||
sched_suspend_scheduler(rtcb);
|
||||
|
||||
/* Are we in an interrupt handler? */
|
||||
|
||||
if (IN_INTERRUPT())
|
||||
{
|
||||
/* Yes, then we have to do things differently.
|
||||
|
@ -128,6 +116,10 @@ void up_unblock_task(FAR struct tcb_s *tcb)
|
|||
|
||||
rtcb = (FAR struct tcb_s*)g_readytorun.head;
|
||||
|
||||
/* Update scheduler parameters */
|
||||
|
||||
sched_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.
|
||||
|
@ -160,6 +152,10 @@ void up_unblock_task(FAR struct tcb_s *tcb)
|
|||
|
||||
(void)group_addrenv(rtcb);
|
||||
#endif
|
||||
/* Update scheduler parameters */
|
||||
|
||||
sched_resume_scheduler(rtcb);
|
||||
|
||||
/* Then switch contexts */
|
||||
|
||||
RESTORE_USERCONTEXT(rtcb);
|
||||
|
|
Loading…
Reference in a new issue