mirror of
https://github.com/apache/nuttx.git
synced 2026-06-04 23:03:27 +08:00
Add scheduler resume/suspend calls to all implementations of up_reprioritize_rtr()
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* arch/arm/src/arm/up_reprioritizertr.c
|
* arch/arm/src/arm/up_reprioritizertr.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007-2009, 2013-2014 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2007-2009, 2013-2015 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@@ -49,18 +49,6 @@
|
|||||||
#include "group/group.h"
|
#include "group/group.h"
|
||||||
#include "up_internal.h"
|
#include "up_internal.h"
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Pre-processor Definitions
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Private Data
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Private Functions
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@@ -143,7 +131,11 @@ void up_reprioritize_rtr(struct tcb_s *tcb, uint8_t priority)
|
|||||||
sched_mergepending();
|
sched_mergepending();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Are we in an interrupt handler? */
|
/* Update scheduler parameters */
|
||||||
|
|
||||||
|
sched_suspend_scheduler(rtcb);
|
||||||
|
|
||||||
|
/* Are we in an interrupt handler? */
|
||||||
|
|
||||||
if (current_regs)
|
if (current_regs)
|
||||||
{
|
{
|
||||||
@@ -158,7 +150,10 @@ void up_reprioritize_rtr(struct tcb_s *tcb, uint8_t priority)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
rtcb = (struct tcb_s*)g_readytorun.head;
|
rtcb = (struct tcb_s*)g_readytorun.head;
|
||||||
slldbg("New Active Task TCB=%p\n", rtcb);
|
|
||||||
|
/* Update scheduler parameters */
|
||||||
|
|
||||||
|
sched_resume_scheduler(rtcb);
|
||||||
|
|
||||||
/* Then switch contexts. Any necessary address environment
|
/* Then switch contexts. Any necessary address environment
|
||||||
* changes will be made when the interrupt returns.
|
* changes will be made when the interrupt returns.
|
||||||
@@ -179,7 +174,6 @@ void up_reprioritize_rtr(struct tcb_s *tcb, uint8_t priority)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
rtcb = (struct tcb_s*)g_readytorun.head;
|
rtcb = (struct tcb_s*)g_readytorun.head;
|
||||||
slldbg("New Active Task TCB=%p\n", rtcb);
|
|
||||||
|
|
||||||
#ifdef CONFIG_ARCH_ADDRENV
|
#ifdef CONFIG_ARCH_ADDRENV
|
||||||
/* Make sure that the address environment for the previously
|
/* Make sure that the address environment for the previously
|
||||||
@@ -190,6 +184,10 @@ void up_reprioritize_rtr(struct tcb_s *tcb, uint8_t priority)
|
|||||||
|
|
||||||
(void)group_addrenv(rtcb);
|
(void)group_addrenv(rtcb);
|
||||||
#endif
|
#endif
|
||||||
|
/* Update scheduler parameters */
|
||||||
|
|
||||||
|
sched_resume_scheduler(rtcb);
|
||||||
|
|
||||||
/* Then switch contexts */
|
/* Then switch contexts */
|
||||||
|
|
||||||
up_fullcontextrestore(rtcb->xcp.regs);
|
up_fullcontextrestore(rtcb->xcp.regs);
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* arch/arm/src/armv6-m/up_reprioritizertr.c
|
* arch/arm/src/armv6-m/up_reprioritizertr.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2013 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2013, 2015 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@@ -48,18 +48,6 @@
|
|||||||
#include "sched/sched.h"
|
#include "sched/sched.h"
|
||||||
#include "up_internal.h"
|
#include "up_internal.h"
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Pre-processor Definitions
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Private Data
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Private Functions
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@@ -143,6 +131,10 @@ void up_reprioritize_rtr(struct tcb_s *tcb, uint8_t priority)
|
|||||||
sched_mergepending();
|
sched_mergepending();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Update scheduler parameters */
|
||||||
|
|
||||||
|
sched_suspend_scheduler(rtcb);
|
||||||
|
|
||||||
/* Are we in an interrupt handler? */
|
/* Are we in an interrupt handler? */
|
||||||
|
|
||||||
if (current_regs)
|
if (current_regs)
|
||||||
@@ -158,7 +150,10 @@ void up_reprioritize_rtr(struct tcb_s *tcb, uint8_t priority)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
rtcb = (struct tcb_s*)g_readytorun.head;
|
rtcb = (struct tcb_s*)g_readytorun.head;
|
||||||
slldbg("New Active Task TCB=%p\n", rtcb);
|
|
||||||
|
/* Update scheduler parameters */
|
||||||
|
|
||||||
|
sched_resume_scheduler(rtcb);
|
||||||
|
|
||||||
/* Then switch contexts */
|
/* Then switch contexts */
|
||||||
|
|
||||||
@@ -169,11 +164,16 @@ void up_reprioritize_rtr(struct tcb_s *tcb, uint8_t priority)
|
|||||||
|
|
||||||
else
|
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
|
/* Switch context to the context of the task at the head of the
|
||||||
* ready to run list.
|
* ready to run list.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
struct tcb_s *nexttcb = (struct tcb_s*)g_readytorun.head;
|
|
||||||
up_switchcontext(rtcb->xcp.regs, nexttcb->xcp.regs);
|
up_switchcontext(rtcb->xcp.regs, nexttcb->xcp.regs);
|
||||||
|
|
||||||
/* up_switchcontext forces a context switch to the task at the
|
/* up_switchcontext forces a context switch to the task at the
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* arch/arm/src/armv7-a/arm_reprioritizertr.c
|
* arch/arm/src/armv7-a/arm_reprioritizertr.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2013-2014 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2013-2015 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@@ -49,18 +49,6 @@
|
|||||||
#include "group/group.h"
|
#include "group/group.h"
|
||||||
#include "up_internal.h"
|
#include "up_internal.h"
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Pre-processor Definitions
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Private Data
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Private Functions
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@@ -143,6 +131,10 @@ void up_reprioritize_rtr(struct tcb_s *tcb, uint8_t priority)
|
|||||||
sched_mergepending();
|
sched_mergepending();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Update scheduler parameters */
|
||||||
|
|
||||||
|
sched_suspend_scheduler(rtcb);
|
||||||
|
|
||||||
/* Are we in an interrupt handler? */
|
/* Are we in an interrupt handler? */
|
||||||
|
|
||||||
if (current_regs)
|
if (current_regs)
|
||||||
@@ -158,7 +150,10 @@ void up_reprioritize_rtr(struct tcb_s *tcb, uint8_t priority)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
rtcb = (struct tcb_s*)g_readytorun.head;
|
rtcb = (struct tcb_s*)g_readytorun.head;
|
||||||
slldbg("New Active Task TCB=%p\n", rtcb);
|
|
||||||
|
/* Update scheduler parameters */
|
||||||
|
|
||||||
|
sched_resume_scheduler(rtcb);
|
||||||
|
|
||||||
/* Then switch contexts. Any necessary address environment
|
/* Then switch contexts. Any necessary address environment
|
||||||
* changes will be made when the interrupt returns.
|
* changes will be made when the interrupt returns.
|
||||||
@@ -179,7 +174,6 @@ void up_reprioritize_rtr(struct tcb_s *tcb, uint8_t priority)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
rtcb = (struct tcb_s*)g_readytorun.head;
|
rtcb = (struct tcb_s*)g_readytorun.head;
|
||||||
slldbg("New Active Task TCB=%p\n", rtcb);
|
|
||||||
|
|
||||||
#ifdef CONFIG_ARCH_ADDRENV
|
#ifdef CONFIG_ARCH_ADDRENV
|
||||||
/* Make sure that the address environment for the previously
|
/* Make sure that the address environment for the previously
|
||||||
@@ -190,6 +184,10 @@ void up_reprioritize_rtr(struct tcb_s *tcb, uint8_t priority)
|
|||||||
|
|
||||||
(void)group_addrenv(rtcb);
|
(void)group_addrenv(rtcb);
|
||||||
#endif
|
#endif
|
||||||
|
/* Update scheduler parameters */
|
||||||
|
|
||||||
|
sched_resume_scheduler(rtcb);
|
||||||
|
|
||||||
/* Then switch contexts */
|
/* Then switch contexts */
|
||||||
|
|
||||||
up_fullcontextrestore(rtcb->xcp.regs);
|
up_fullcontextrestore(rtcb->xcp.regs);
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* arch/arm/src/armv7-m/up_reprioritizertr.c
|
* arch/arm/src/armv7-m/up_reprioritizertr.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007-2009, 2012-2013 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2007-2009, 2012-2013, 2015 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@@ -48,18 +48,6 @@
|
|||||||
#include "sched/sched.h"
|
#include "sched/sched.h"
|
||||||
#include "up_internal.h"
|
#include "up_internal.h"
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Pre-processor Definitions
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Private Data
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Private Functions
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@@ -143,6 +131,10 @@ void up_reprioritize_rtr(struct tcb_s *tcb, uint8_t priority)
|
|||||||
sched_mergepending();
|
sched_mergepending();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Update scheduler parameters */
|
||||||
|
|
||||||
|
sched_suspend_scheduler(rtcb);
|
||||||
|
|
||||||
/* Are we in an interrupt handler? */
|
/* Are we in an interrupt handler? */
|
||||||
|
|
||||||
if (current_regs)
|
if (current_regs)
|
||||||
@@ -158,7 +150,10 @@ void up_reprioritize_rtr(struct tcb_s *tcb, uint8_t priority)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
rtcb = (struct tcb_s*)g_readytorun.head;
|
rtcb = (struct tcb_s*)g_readytorun.head;
|
||||||
slldbg("New Active Task TCB=%p\n", rtcb);
|
|
||||||
|
/* Update scheduler parameters */
|
||||||
|
|
||||||
|
sched_resume_scheduler(rtcb);
|
||||||
|
|
||||||
/* Then switch contexts */
|
/* Then switch contexts */
|
||||||
|
|
||||||
@@ -169,11 +164,16 @@ void up_reprioritize_rtr(struct tcb_s *tcb, uint8_t priority)
|
|||||||
|
|
||||||
else
|
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
|
/* Switch context to the context of the task at the head of the
|
||||||
* ready to run list.
|
* ready to run list.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
struct tcb_s *nexttcb = (struct tcb_s*)g_readytorun.head;
|
|
||||||
up_switchcontext(rtcb->xcp.regs, nexttcb->xcp.regs);
|
up_switchcontext(rtcb->xcp.regs, nexttcb->xcp.regs);
|
||||||
|
|
||||||
/* up_switchcontext forces a context switch to the task at the
|
/* up_switchcontext forces a context switch to the task at the
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* arch/avr/src/avr/up_reprioritizertr.c
|
* arch/avr/src/avr/up_reprioritizertr.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2011, 2013 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2011, 2013, 2015 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@@ -48,18 +48,6 @@
|
|||||||
#include "sched/sched.h"
|
#include "sched/sched.h"
|
||||||
#include "up_internal.h"
|
#include "up_internal.h"
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Pre-processor Definitions
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Private Data
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Private Functions
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@@ -142,6 +130,10 @@ void up_reprioritize_rtr(struct tcb_s *tcb, uint8_t priority)
|
|||||||
sched_mergepending();
|
sched_mergepending();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Update scheduler parameters */
|
||||||
|
|
||||||
|
sched_suspend_scheduler(rtcb);
|
||||||
|
|
||||||
/* Are we in an interrupt handler? */
|
/* Are we in an interrupt handler? */
|
||||||
|
|
||||||
if (current_regs)
|
if (current_regs)
|
||||||
@@ -157,7 +149,10 @@ void up_reprioritize_rtr(struct tcb_s *tcb, uint8_t priority)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
rtcb = (struct tcb_s*)g_readytorun.head;
|
rtcb = (struct tcb_s*)g_readytorun.head;
|
||||||
slldbg("New Active Task TCB=%p\n", rtcb);
|
|
||||||
|
/* Update scheduler parameters */
|
||||||
|
|
||||||
|
sched_resume_scheduler(rtcb);
|
||||||
|
|
||||||
/* Then switch contexts */
|
/* Then switch contexts */
|
||||||
|
|
||||||
@@ -168,11 +163,16 @@ void up_reprioritize_rtr(struct tcb_s *tcb, uint8_t priority)
|
|||||||
|
|
||||||
else
|
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
|
/* Switch context to the context of the task at the head of the
|
||||||
* ready to run list.
|
* ready to run list.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
struct tcb_s *nexttcb = (struct tcb_s*)g_readytorun.head;
|
|
||||||
up_switchcontext(rtcb->xcp.regs, nexttcb->xcp.regs);
|
up_switchcontext(rtcb->xcp.regs, nexttcb->xcp.regs);
|
||||||
|
|
||||||
/* up_switchcontext forces a context switch to the task at the
|
/* up_switchcontext forces a context switch to the task at the
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* arch/avr/src/avr32/up_reprioritizertr.c
|
* arch/avr/src/avr32/up_reprioritizertr.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2010, 2013-2014 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2010, 2013-2015 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@@ -49,18 +49,6 @@
|
|||||||
#include "group/group.h"
|
#include "group/group.h"
|
||||||
#include "up_internal.h"
|
#include "up_internal.h"
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Pre-processor Definitions
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Private Data
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Private Functions
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@@ -143,7 +131,11 @@ void up_reprioritize_rtr(struct tcb_s *tcb, uint8_t priority)
|
|||||||
sched_mergepending();
|
sched_mergepending();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Are we in an interrupt handler? */
|
/* Update scheduler parameters */
|
||||||
|
|
||||||
|
sched_suspend_scheduler(rtcb);
|
||||||
|
|
||||||
|
/* Are we in an interrupt handler? */
|
||||||
|
|
||||||
if (current_regs)
|
if (current_regs)
|
||||||
{
|
{
|
||||||
@@ -158,7 +150,10 @@ void up_reprioritize_rtr(struct tcb_s *tcb, uint8_t priority)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
rtcb = (struct tcb_s*)g_readytorun.head;
|
rtcb = (struct tcb_s*)g_readytorun.head;
|
||||||
slldbg("New Active Task TCB=%p\n", rtcb);
|
|
||||||
|
/* Update scheduler parameters */
|
||||||
|
|
||||||
|
sched_resume_scheduler(rtcb);
|
||||||
|
|
||||||
/* Then switch contexts. Any necessary address environment
|
/* Then switch contexts. Any necessary address environment
|
||||||
* changes will be made when the interrupt returns.
|
* changes will be made when the interrupt returns.
|
||||||
@@ -186,6 +181,10 @@ void up_reprioritize_rtr(struct tcb_s *tcb, uint8_t priority)
|
|||||||
|
|
||||||
(void)group_addrenv(nexttcb);
|
(void)group_addrenv(nexttcb);
|
||||||
#endif
|
#endif
|
||||||
|
/* Update scheduler parameters */
|
||||||
|
|
||||||
|
sched_resume_scheduler(nexttcb);
|
||||||
|
|
||||||
/* Then switch contexts */
|
/* Then switch contexts */
|
||||||
|
|
||||||
up_switchcontext(rtcb->xcp.regs, nexttcb->xcp.regs);
|
up_switchcontext(rtcb->xcp.regs, nexttcb->xcp.regs);
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* arch/hc/src/common/up_reprioritizertr.c
|
* arch/hc/src/common/up_reprioritizertr.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2010, 2013-2014 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2010, 2013-2015 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@@ -49,18 +49,6 @@
|
|||||||
#include "group/group.h"
|
#include "group/group.h"
|
||||||
#include "up_internal.h"
|
#include "up_internal.h"
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Pre-processor Definitions
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Private Data
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Private Functions
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@@ -143,7 +131,11 @@ void up_reprioritize_rtr(struct tcb_s *tcb, uint8_t priority)
|
|||||||
sched_mergepending();
|
sched_mergepending();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Are we in an interrupt handler? */
|
/* Update scheduler parameters */
|
||||||
|
|
||||||
|
sched_suspend_scheduler(rtcb);
|
||||||
|
|
||||||
|
/* Are we in an interrupt handler? */
|
||||||
|
|
||||||
if (current_regs)
|
if (current_regs)
|
||||||
{
|
{
|
||||||
@@ -158,7 +150,10 @@ void up_reprioritize_rtr(struct tcb_s *tcb, uint8_t priority)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
rtcb = (struct tcb_s*)g_readytorun.head;
|
rtcb = (struct tcb_s*)g_readytorun.head;
|
||||||
slldbg("New Active Task TCB=%p\n", rtcb);
|
|
||||||
|
/* Update scheduler parameters */
|
||||||
|
|
||||||
|
sched_resume_scheduler(rtcb);
|
||||||
|
|
||||||
/* Then switch contexts. Any necessary address environment
|
/* Then switch contexts. Any necessary address environment
|
||||||
* changes will be made when the interrupt returns.
|
* changes will be made when the interrupt returns.
|
||||||
@@ -179,7 +174,6 @@ void up_reprioritize_rtr(struct tcb_s *tcb, uint8_t priority)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
rtcb = (struct tcb_s*)g_readytorun.head;
|
rtcb = (struct tcb_s*)g_readytorun.head;
|
||||||
slldbg("New Active Task TCB=%p\n", rtcb);
|
|
||||||
|
|
||||||
#ifdef CONFIG_ARCH_ADDRENV
|
#ifdef CONFIG_ARCH_ADDRENV
|
||||||
/* Make sure that the address environment for the previously
|
/* Make sure that the address environment for the previously
|
||||||
@@ -190,6 +184,10 @@ void up_reprioritize_rtr(struct tcb_s *tcb, uint8_t priority)
|
|||||||
|
|
||||||
(void)group_addrenv(rtcb);
|
(void)group_addrenv(rtcb);
|
||||||
#endif
|
#endif
|
||||||
|
/* Update scheduler parameters */
|
||||||
|
|
||||||
|
sched_resume_scheduler(rtcb);
|
||||||
|
|
||||||
/* Then switch contexts */
|
/* Then switch contexts */
|
||||||
|
|
||||||
up_fullcontextrestore(rtcb->xcp.regs);
|
up_fullcontextrestore(rtcb->xcp.regs);
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* arch/mips/src/mips32/up_reprioritizertr.c
|
* arch/mips/src/mips32/up_reprioritizertr.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2011, 2013-2014 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2011, 2013-2015 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@@ -51,18 +51,6 @@
|
|||||||
#include "group/group.h"
|
#include "group/group.h"
|
||||||
#include "up_internal.h"
|
#include "up_internal.h"
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Pre-processor Definitions
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Private Data
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Private Functions
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@@ -145,6 +133,10 @@ void up_reprioritize_rtr(struct tcb_s *tcb, uint8_t priority)
|
|||||||
sched_mergepending();
|
sched_mergepending();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Update scheduler parameters */
|
||||||
|
|
||||||
|
sched_suspend_scheduler(rtcb);
|
||||||
|
|
||||||
/* Are we in an interrupt handler? */
|
/* Are we in an interrupt handler? */
|
||||||
|
|
||||||
if (current_regs)
|
if (current_regs)
|
||||||
@@ -160,7 +152,10 @@ void up_reprioritize_rtr(struct tcb_s *tcb, uint8_t priority)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
rtcb = (struct tcb_s*)g_readytorun.head;
|
rtcb = (struct tcb_s*)g_readytorun.head;
|
||||||
slldbg("New Active Task TCB=%p\n", rtcb);
|
|
||||||
|
/* Update scheduler parameters */
|
||||||
|
|
||||||
|
sched_resume_scheduler(rtcb);
|
||||||
|
|
||||||
/* Then switch contexts. Any necessary address environment
|
/* Then switch contexts. Any necessary address environment
|
||||||
* changes will be made when the interrupt returns.
|
* changes will be made when the interrupt returns.
|
||||||
@@ -188,6 +183,10 @@ void up_reprioritize_rtr(struct tcb_s *tcb, uint8_t priority)
|
|||||||
|
|
||||||
(void)group_addrenv(nexttcb);
|
(void)group_addrenv(nexttcb);
|
||||||
#endif
|
#endif
|
||||||
|
/* Update scheduler parameters */
|
||||||
|
|
||||||
|
sched_resume_scheduler(nexttcb);
|
||||||
|
|
||||||
/* Then switch contexts */
|
/* Then switch contexts */
|
||||||
|
|
||||||
up_switchcontext(rtcb->xcp.regs, nexttcb->xcp.regs);
|
up_switchcontext(rtcb->xcp.regs, nexttcb->xcp.regs);
|
||||||
|
|||||||
+84
-58
@@ -59,25 +59,28 @@
|
|||||||
|
|
||||||
struct tcb_s *current_task = NULL;
|
struct tcb_s *current_task = NULL;
|
||||||
|
|
||||||
/**
|
/* This function is called in non-interrupt context
|
||||||
* This function is called in non-interrupt context
|
|
||||||
* to switch tasks.
|
* to switch tasks.
|
||||||
* Assumption: global interrupt is disabled.
|
* Assumption: global interrupt is disabled.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static inline void up_switchcontext(struct tcb_s *ctcb, struct tcb_s *ntcb)
|
static inline void up_switchcontext(struct tcb_s *ctcb, struct tcb_s *ntcb)
|
||||||
{
|
{
|
||||||
// do nothing if two tasks are the same
|
// do nothing if two tasks are the same
|
||||||
if (ctcb == ntcb)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// this function can not be called in interrupt
|
if (ctcb == ntcb)
|
||||||
if (up_interrupt_context()) {
|
return;
|
||||||
panic("%s: try to switch context in interrupt\n", __func__);
|
|
||||||
}
|
|
||||||
|
|
||||||
// start switch
|
// this function can not be called in interrupt
|
||||||
current_task = ntcb;
|
|
||||||
rgmp_context_switch(ctcb ? &ctcb->xcp.ctx : NULL, &ntcb->xcp.ctx);
|
if (up_interrupt_context()) {
|
||||||
|
panic("%s: try to switch context in interrupt\n", __func__);
|
||||||
|
}
|
||||||
|
|
||||||
|
// start switch
|
||||||
|
|
||||||
|
current_task = ntcb;
|
||||||
|
rgmp_context_switch(ctcb ? &ctcb->xcp.ctx : NULL, &ntcb->xcp.ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
void up_initialize(void)
|
void up_initialize(void)
|
||||||
@@ -424,66 +427,89 @@ void up_release_pending(void)
|
|||||||
|
|
||||||
void up_reprioritize_rtr(struct tcb_s *tcb, uint8_t priority)
|
void up_reprioritize_rtr(struct tcb_s *tcb, uint8_t priority)
|
||||||
{
|
{
|
||||||
/* Verify that the caller is sane */
|
/* Verify that the caller is sane */
|
||||||
|
|
||||||
if (tcb->task_state < FIRST_READY_TO_RUN_STATE ||
|
if (tcb->task_state < FIRST_READY_TO_RUN_STATE ||
|
||||||
tcb->task_state > LAST_READY_TO_RUN_STATE
|
tcb->task_state > LAST_READY_TO_RUN_STATE
|
||||||
#if SCHED_PRIORITY_MIN > UINT8_MIN
|
#if SCHED_PRIORITY_MIN > UINT8_MIN
|
||||||
|| priority < SCHED_PRIORITY_MIN
|
|| priority < SCHED_PRIORITY_MIN
|
||||||
#endif
|
#endif
|
||||||
#if SCHED_PRIORITY_MAX < UINT8_MAX
|
#if SCHED_PRIORITY_MAX < UINT8_MAX
|
||||||
|| priority > SCHED_PRIORITY_MAX
|
|| priority > SCHED_PRIORITY_MAX
|
||||||
#endif
|
#endif
|
||||||
) {
|
)
|
||||||
warn("%s: task sched error\n", __func__);
|
{
|
||||||
return;
|
warn("%s: task sched error\n", __func__);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
struct tcb_s *rtcb = current_task;
|
{
|
||||||
bool switch_needed;
|
struct tcb_s *rtcb = current_task;
|
||||||
|
bool switch_needed;
|
||||||
|
|
||||||
/* Remove the tcb task from the ready-to-run list.
|
/* Remove the tcb task from the ready-to-run list.
|
||||||
* sched_removereadytorun will return true if we just
|
* sched_removereadytorun will return true if we just
|
||||||
* remove the head of the ready to run list.
|
* remove the head of the ready to run list.
|
||||||
*/
|
*/
|
||||||
switch_needed = sched_removereadytorun(tcb);
|
|
||||||
|
|
||||||
/* Setup up the new task priority */
|
switch_needed = sched_removereadytorun(tcb);
|
||||||
tcb->sched_priority = (uint8_t)priority;
|
|
||||||
|
|
||||||
/* Return the task to the specified blocked task list.
|
/* Setup up the new task priority */
|
||||||
* sched_addreadytorun will return true if the task was
|
|
||||||
* added to the new list. We will need to perform a context
|
|
||||||
* switch only if the EXCLUSIVE or of the two calls is non-zero
|
|
||||||
* (i.e., one and only one the calls changes the head of the
|
|
||||||
* ready-to-run list).
|
|
||||||
*/
|
|
||||||
switch_needed ^= sched_addreadytorun(tcb);
|
|
||||||
|
|
||||||
/* Now, perform the context switch if one is needed */
|
tcb->sched_priority = (uint8_t)priority;
|
||||||
if (switch_needed && !up_interrupt_context()) {
|
|
||||||
struct tcb_s *nexttcb;
|
/* Return the task to the specified blocked task list.
|
||||||
// If there are any pending tasks, then add them to the g_readytorun
|
* sched_addreadytorun will return true if the task was
|
||||||
// task list now. It should be the up_realease_pending() called from
|
* added to the new list. We will need to perform a context
|
||||||
// sched_unlock() to do this for disable preemption. But it block
|
* switch only if the EXCLUSIVE or of the two calls is non-zero
|
||||||
// itself, so it's OK.
|
* (i.e., one and only one the calls changes the head of the
|
||||||
if (g_pendingtasks.head) {
|
* ready-to-run list).
|
||||||
warn("Disable preemption failed for reprioritize task\n");
|
*/
|
||||||
sched_mergepending();
|
|
||||||
|
switch_needed ^= sched_addreadytorun(tcb);
|
||||||
|
|
||||||
|
/* Now, perform the context switch if one is needed */
|
||||||
|
|
||||||
|
if (switch_needed && !up_interrupt_context())
|
||||||
|
{
|
||||||
|
struct tcb_s *nexttcb;
|
||||||
|
|
||||||
|
/* If there are any pending tasks, then add them to the g_readytorun
|
||||||
|
* task list now. It should be the up_realease_pending() called from
|
||||||
|
* sched_unlock() to do this for disable preemption. But it block
|
||||||
|
* itself, so it's OK.
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (g_pendingtasks.head)
|
||||||
|
{
|
||||||
|
warn("Disable preemption failed for reprioritize task\n");
|
||||||
|
sched_mergepending();
|
||||||
}
|
}
|
||||||
|
|
||||||
nexttcb = (struct tcb_s*)g_readytorun.head;
|
/* Update scheduler parameters */
|
||||||
#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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
(void)group_addrenv(nexttcb);
|
sched_suspend_scheduler(rtcb);
|
||||||
|
|
||||||
|
/* Get the TCB of the new task to run */
|
||||||
|
|
||||||
|
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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
(void)group_addrenv(nexttcb);
|
||||||
#endif
|
#endif
|
||||||
// context switch
|
/* Update scheduler parameters */
|
||||||
up_switchcontext(rtcb, nexttcb);
|
|
||||||
|
sched_resume_scheduler(nexttcb);
|
||||||
|
|
||||||
|
/* context switch */
|
||||||
|
|
||||||
|
up_switchcontext(rtcb, nexttcb);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* arch/sh/src/common/up_reprioritizertr.c
|
* arch/sh/src/common/up_reprioritizertr.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2008-2009, 2011, 2013-2014 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2008-2009, 2011, 2013-2015 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@@ -49,18 +49,6 @@
|
|||||||
#include "group/group.h"
|
#include "group/group.h"
|
||||||
#include "up_internal.h"
|
#include "up_internal.h"
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Pre-processor Definitions
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Private Data
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Private Functions
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@@ -143,6 +131,10 @@ void up_reprioritize_rtr(struct tcb_s *tcb, uint8_t priority)
|
|||||||
sched_mergepending();
|
sched_mergepending();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Update scheduler parameters */
|
||||||
|
|
||||||
|
sched_suspend_scheduler(rtcb);
|
||||||
|
|
||||||
/* Are we in an interrupt handler? */
|
/* Are we in an interrupt handler? */
|
||||||
|
|
||||||
if (current_regs)
|
if (current_regs)
|
||||||
@@ -158,7 +150,10 @@ void up_reprioritize_rtr(struct tcb_s *tcb, uint8_t priority)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
rtcb = (struct tcb_s*)g_readytorun.head;
|
rtcb = (struct tcb_s*)g_readytorun.head;
|
||||||
slldbg("New Active Task TCB=%p\n", rtcb);
|
|
||||||
|
/* Update scheduler parameters */
|
||||||
|
|
||||||
|
sched_resume_scheduler(rtcb);
|
||||||
|
|
||||||
/* Then switch contexts. Any necessary address environment
|
/* Then switch contexts. Any necessary address environment
|
||||||
* changes will be made when the interrupt returns.
|
* changes will be made when the interrupt returns.
|
||||||
@@ -179,7 +174,6 @@ void up_reprioritize_rtr(struct tcb_s *tcb, uint8_t priority)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
rtcb = (struct tcb_s*)g_readytorun.head;
|
rtcb = (struct tcb_s*)g_readytorun.head;
|
||||||
slldbg("New Active Task TCB=%p\n", rtcb);
|
|
||||||
|
|
||||||
#ifdef CONFIG_ARCH_ADDRENV
|
#ifdef CONFIG_ARCH_ADDRENV
|
||||||
/* Make sure that the address environment for the previously
|
/* Make sure that the address environment for the previously
|
||||||
@@ -190,6 +184,10 @@ void up_reprioritize_rtr(struct tcb_s *tcb, uint8_t priority)
|
|||||||
|
|
||||||
(void)group_addrenv(rtcb);
|
(void)group_addrenv(rtcb);
|
||||||
#endif
|
#endif
|
||||||
|
/* Update scheduler parameters */
|
||||||
|
|
||||||
|
sched_resume_scheduler(rtcb);
|
||||||
|
|
||||||
/* Then switch contexts */
|
/* Then switch contexts */
|
||||||
|
|
||||||
up_fullcontextrestore(rtcb->xcp.regs);
|
up_fullcontextrestore(rtcb->xcp.regs);
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* arch/sim/src/up_reprioritizertr.c
|
* arch/sim/src/up_reprioritizertr.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007-2009, 2013 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2007-2009, 2013, 2015 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@@ -49,18 +49,6 @@
|
|||||||
#include "sched/sched.h"
|
#include "sched/sched.h"
|
||||||
#include "up_internal.h"
|
#include "up_internal.h"
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Pre-processor Definitions
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Private Data
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Private Functions
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@@ -143,6 +131,10 @@ void up_reprioritize_rtr(struct tcb_s *tcb, uint8_t priority)
|
|||||||
sched_mergepending();
|
sched_mergepending();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Update scheduler parameters */
|
||||||
|
|
||||||
|
sched_suspend_scheduler(rtcb);
|
||||||
|
|
||||||
/* Copy the exception context into the TCB at the (old) head of the
|
/* Copy the exception context into the TCB at the (old) head of the
|
||||||
* g_readytorun Task list. if up_setjmp returns a non-zero
|
* g_readytorun Task list. if up_setjmp returns a non-zero
|
||||||
* value, then this is really the previously running task restarting!
|
* value, then this is really the previously running task restarting!
|
||||||
@@ -169,6 +161,10 @@ void up_reprioritize_rtr(struct tcb_s *tcb, uint8_t priority)
|
|||||||
rtcb->xcp.sigdeliver = NULL;
|
rtcb->xcp.sigdeliver = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Update scheduler parameters */
|
||||||
|
|
||||||
|
sched_resume_scheduler(rtcb);
|
||||||
|
|
||||||
/* Then switch contexts */
|
/* Then switch contexts */
|
||||||
|
|
||||||
up_longjmp(rtcb->xcp.regs, 1);
|
up_longjmp(rtcb->xcp.regs, 1);
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* arch/arm/src/arm/up_reprioritizertr.c
|
* arch/arm/src/arm/up_reprioritizertr.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2011, 2013-2014 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2011, 2013-2015 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@@ -49,18 +49,6 @@
|
|||||||
#include "group/group.h"
|
#include "group/group.h"
|
||||||
#include "up_internal.h"
|
#include "up_internal.h"
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Pre-processor Definitions
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Private Data
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Private Functions
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@@ -143,6 +131,10 @@ void up_reprioritize_rtr(struct tcb_s *tcb, uint8_t priority)
|
|||||||
sched_mergepending();
|
sched_mergepending();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Update scheduler parameters */
|
||||||
|
|
||||||
|
sched_suspend_scheduler(rtcb);
|
||||||
|
|
||||||
/* Are we in an interrupt handler? */
|
/* Are we in an interrupt handler? */
|
||||||
|
|
||||||
if (current_regs)
|
if (current_regs)
|
||||||
@@ -158,7 +150,10 @@ void up_reprioritize_rtr(struct tcb_s *tcb, uint8_t priority)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
rtcb = (struct tcb_s*)g_readytorun.head;
|
rtcb = (struct tcb_s*)g_readytorun.head;
|
||||||
slldbg("New Active Task TCB=%p\n", rtcb);
|
|
||||||
|
/* Update scheduler parameters */
|
||||||
|
|
||||||
|
sched_resume_scheduler(rtcb);
|
||||||
|
|
||||||
/* Then switch contexts. Any necessary address environment
|
/* Then switch contexts. Any necessary address environment
|
||||||
* changes will be made when the interrupt returns.
|
* changes will be made when the interrupt returns.
|
||||||
@@ -179,7 +174,6 @@ void up_reprioritize_rtr(struct tcb_s *tcb, uint8_t priority)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
rtcb = (struct tcb_s*)g_readytorun.head;
|
rtcb = (struct tcb_s*)g_readytorun.head;
|
||||||
slldbg("New Active Task TCB=%p\n", rtcb);
|
|
||||||
|
|
||||||
#ifdef CONFIG_ARCH_ADDRENV
|
#ifdef CONFIG_ARCH_ADDRENV
|
||||||
/* Make sure that the address environment for the previously
|
/* Make sure that the address environment for the previously
|
||||||
@@ -190,6 +184,10 @@ void up_reprioritize_rtr(struct tcb_s *tcb, uint8_t priority)
|
|||||||
|
|
||||||
(void)group_addrenv(rtcb);
|
(void)group_addrenv(rtcb);
|
||||||
#endif
|
#endif
|
||||||
|
/* Update scheduler parameters */
|
||||||
|
|
||||||
|
sched_resume_scheduler(rtcb);
|
||||||
|
|
||||||
/* Then switch contexts */
|
/* Then switch contexts */
|
||||||
|
|
||||||
up_fullcontextrestore(rtcb->xcp.regs);
|
up_fullcontextrestore(rtcb->xcp.regs);
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* common/up_reprioritizertr.c
|
* common/up_reprioritizertr.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2008-2009, 2013 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2008-2009, 2013, 2015 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@@ -50,18 +50,6 @@
|
|||||||
#include "sched/sched.h"
|
#include "sched/sched.h"
|
||||||
#include "up_internal.h"
|
#include "up_internal.h"
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Pre-processor Definitions
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Private Data
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Private Functions
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@@ -144,6 +132,10 @@ void up_reprioritize_rtr(FAR struct tcb_s *tcb, uint8_t priority)
|
|||||||
sched_mergepending();
|
sched_mergepending();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Update scheduler parameters */
|
||||||
|
|
||||||
|
sched_suspend_scheduler(rtcb);
|
||||||
|
|
||||||
/* Are we in an interrupt handler? */
|
/* Are we in an interrupt handler? */
|
||||||
|
|
||||||
if (IN_INTERRUPT)
|
if (IN_INTERRUPT)
|
||||||
@@ -159,7 +151,10 @@ void up_reprioritize_rtr(FAR struct tcb_s *tcb, uint8_t priority)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
rtcb = (FAR struct tcb_s*)g_readytorun.head;
|
rtcb = (FAR struct tcb_s*)g_readytorun.head;
|
||||||
slldbg("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
|
/* Then setup so that the context will be performed on exit
|
||||||
* from the interrupt.
|
* from the interrupt.
|
||||||
@@ -180,7 +175,10 @@ void up_reprioritize_rtr(FAR struct tcb_s *tcb, uint8_t priority)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
rtcb = (FAR struct tcb_s*)g_readytorun.head;
|
rtcb = (FAR struct tcb_s*)g_readytorun.head;
|
||||||
slldbg("New Active Task TCB=%p\n", rtcb);
|
|
||||||
|
/* Update scheduler parameters */
|
||||||
|
|
||||||
|
sched_resume_scheduler(rtcb);
|
||||||
|
|
||||||
/* Then switch contexts */
|
/* Then switch contexts */
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* arch/z80/src/common/up_reprioritizertr.c
|
* arch/z80/src/common/up_reprioritizertr.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007-2009, 2013-2014 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2007-2009, 2013-2015 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@@ -52,18 +52,6 @@
|
|||||||
#include "group/group.h"
|
#include "group/group.h"
|
||||||
#include "up_internal.h"
|
#include "up_internal.h"
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Pre-processor Definitions
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Private Data
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Private Functions
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@@ -146,6 +134,10 @@ void up_reprioritize_rtr(FAR struct tcb_s *tcb, uint8_t priority)
|
|||||||
sched_mergepending();
|
sched_mergepending();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Update scheduler parameters */
|
||||||
|
|
||||||
|
sched_suspend_scheduler(rtcb);
|
||||||
|
|
||||||
/* Are we in an interrupt handler? */
|
/* Are we in an interrupt handler? */
|
||||||
|
|
||||||
if (IN_INTERRUPT())
|
if (IN_INTERRUPT())
|
||||||
@@ -161,7 +153,10 @@ void up_reprioritize_rtr(FAR struct tcb_s *tcb, uint8_t priority)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
rtcb = (FAR struct tcb_s*)g_readytorun.head;
|
rtcb = (FAR struct tcb_s*)g_readytorun.head;
|
||||||
slldbg("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
|
/* Then setup so that the context will be performed on exit
|
||||||
* from the interrupt. Any necessary address environment
|
* from the interrupt. Any necessary address environment
|
||||||
@@ -183,7 +178,6 @@ void up_reprioritize_rtr(FAR struct tcb_s *tcb, uint8_t priority)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
rtcb = (FAR struct tcb_s*)g_readytorun.head;
|
rtcb = (FAR struct tcb_s*)g_readytorun.head;
|
||||||
slldbg("New Active Task TCB=%p\n", rtcb);
|
|
||||||
|
|
||||||
#ifdef CONFIG_ARCH_ADDRENV
|
#ifdef CONFIG_ARCH_ADDRENV
|
||||||
/* Make sure that the address environment for the previously
|
/* Make sure that the address environment for the previously
|
||||||
@@ -194,6 +188,10 @@ void up_reprioritize_rtr(FAR struct tcb_s *tcb, uint8_t priority)
|
|||||||
|
|
||||||
(void)group_addrenv(rtcb);
|
(void)group_addrenv(rtcb);
|
||||||
#endif
|
#endif
|
||||||
|
/* Update scheduler parameters */
|
||||||
|
|
||||||
|
sched_resume_scheduler(rtcb);
|
||||||
|
|
||||||
/* Then switch contexts */
|
/* Then switch contexts */
|
||||||
|
|
||||||
RESTORE_USERCONTEXT(rtcb);
|
RESTORE_USERCONTEXT(rtcb);
|
||||||
|
|||||||
Reference in New Issue
Block a user