mirror of
https://github.com/apache/nuttx.git
synced 2026-06-04 23:03:27 +08:00
Add scheduler resume/suspend calls in all implementations of up_block_task()
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* arch/arm/src/arm/up_blocktask.c
|
* arch/arm/src/arm/up_blocktask.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
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@@ -121,6 +109,10 @@ void up_block_task(struct tcb_s *tcb, tstate_t task_state)
|
|||||||
|
|
||||||
if (switch_needed)
|
if (switch_needed)
|
||||||
{
|
{
|
||||||
|
/* 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)
|
||||||
@@ -137,6 +129,10 @@ void up_block_task(struct tcb_s *tcb, tstate_t task_state)
|
|||||||
|
|
||||||
rtcb = (struct tcb_s*)g_readytorun.head;
|
rtcb = (struct tcb_s*)g_readytorun.head;
|
||||||
|
|
||||||
|
/* Reset 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.
|
||||||
*/
|
*/
|
||||||
@@ -166,6 +162,10 @@ void up_block_task(struct tcb_s *tcb, tstate_t task_state)
|
|||||||
|
|
||||||
(void)group_addrenv(rtcb);
|
(void)group_addrenv(rtcb);
|
||||||
#endif
|
#endif
|
||||||
|
/* Reset scheduler parameters */
|
||||||
|
|
||||||
|
sched_resume_scheduler(rtcb);
|
||||||
|
|
||||||
/* Then switch contexts */
|
/* Then switch contexts */
|
||||||
|
|
||||||
up_fullcontextrestore(rtcb->xcp.regs);
|
up_fullcontextrestore(rtcb->xcp.regs);
|
||||||
|
|||||||
@@ -48,18 +48,6 @@
|
|||||||
#include "clock/clock.h"
|
#include "clock/clock.h"
|
||||||
#include "up_internal.h"
|
#include "up_internal.h"
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Pre-processor Definitions
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Private Data
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Private Functions
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* arch/arm/src/armv6-m/up_blocktask.c
|
* arch/arm/src/armv6-m/up_blocktask.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
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@@ -119,6 +107,10 @@ void up_block_task(struct tcb_s *tcb, tstate_t task_state)
|
|||||||
|
|
||||||
if (switch_needed)
|
if (switch_needed)
|
||||||
{
|
{
|
||||||
|
/* 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)
|
||||||
@@ -135,6 +127,10 @@ void up_block_task(struct tcb_s *tcb, tstate_t task_state)
|
|||||||
|
|
||||||
rtcb = (struct tcb_s*)g_readytorun.head;
|
rtcb = (struct tcb_s*)g_readytorun.head;
|
||||||
|
|
||||||
|
/* Reset scheduler parameters */
|
||||||
|
|
||||||
|
sched_resume_scheduler(rtcb);
|
||||||
|
|
||||||
/* Then switch contexts */
|
/* Then switch contexts */
|
||||||
|
|
||||||
up_restorestate(rtcb->xcp.regs);
|
up_restorestate(rtcb->xcp.regs);
|
||||||
@@ -144,11 +140,16 @@ void up_block_task(struct tcb_s *tcb, tstate_t task_state)
|
|||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
struct tcb_s *nexttcb = (struct tcb_s*)g_readytorun.head;
|
||||||
|
|
||||||
|
/* Reset 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/up_blocktask.c
|
* arch/arm/src/armv7-a/up_blocktask.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
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@@ -121,6 +109,10 @@ void up_block_task(struct tcb_s *tcb, tstate_t task_state)
|
|||||||
|
|
||||||
if (switch_needed)
|
if (switch_needed)
|
||||||
{
|
{
|
||||||
|
/* 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)
|
||||||
@@ -137,6 +129,10 @@ void up_block_task(struct tcb_s *tcb, tstate_t task_state)
|
|||||||
|
|
||||||
rtcb = (struct tcb_s*)g_readytorun.head;
|
rtcb = (struct tcb_s*)g_readytorun.head;
|
||||||
|
|
||||||
|
/* Reset 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.
|
||||||
*/
|
*/
|
||||||
@@ -166,6 +162,10 @@ void up_block_task(struct tcb_s *tcb, tstate_t task_state)
|
|||||||
|
|
||||||
(void)group_addrenv(rtcb);
|
(void)group_addrenv(rtcb);
|
||||||
#endif
|
#endif
|
||||||
|
/* Reset 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_blocktask.c
|
* arch/arm/src/armv7-m/up_blocktask.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
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@@ -120,6 +108,10 @@ void up_block_task(struct tcb_s *tcb, tstate_t task_state)
|
|||||||
|
|
||||||
if (switch_needed)
|
if (switch_needed)
|
||||||
{
|
{
|
||||||
|
/* 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)
|
||||||
@@ -136,6 +128,10 @@ void up_block_task(struct tcb_s *tcb, tstate_t task_state)
|
|||||||
|
|
||||||
rtcb = (struct tcb_s*)g_readytorun.head;
|
rtcb = (struct tcb_s*)g_readytorun.head;
|
||||||
|
|
||||||
|
/* Reset scheduler parameters */
|
||||||
|
|
||||||
|
sched_resume_scheduler(rtcb);
|
||||||
|
|
||||||
/* Then switch contexts */
|
/* Then switch contexts */
|
||||||
|
|
||||||
up_restorestate(rtcb->xcp.regs);
|
up_restorestate(rtcb->xcp.regs);
|
||||||
@@ -145,11 +141,16 @@ void up_block_task(struct tcb_s *tcb, tstate_t task_state)
|
|||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
struct tcb_s *nexttcb = (struct tcb_s*)g_readytorun.head;
|
||||||
|
|
||||||
|
/* Reset 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_blocktask.c
|
* arch/avr/src/avr/up_blocktask.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
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@@ -120,6 +108,10 @@ void up_block_task(struct tcb_s *tcb, tstate_t task_state)
|
|||||||
|
|
||||||
if (switch_needed)
|
if (switch_needed)
|
||||||
{
|
{
|
||||||
|
/* 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)
|
||||||
@@ -136,6 +128,10 @@ void up_block_task(struct tcb_s *tcb, tstate_t task_state)
|
|||||||
|
|
||||||
rtcb = (struct tcb_s*)g_readytorun.head;
|
rtcb = (struct tcb_s*)g_readytorun.head;
|
||||||
|
|
||||||
|
/* Reset scheduler parameters */
|
||||||
|
|
||||||
|
sched_resume_scheduler(rtcb);
|
||||||
|
|
||||||
/* Then switch contexts */
|
/* Then switch contexts */
|
||||||
|
|
||||||
up_restorestate(rtcb->xcp.regs);
|
up_restorestate(rtcb->xcp.regs);
|
||||||
@@ -145,11 +141,16 @@ void up_block_task(struct tcb_s *tcb, tstate_t task_state)
|
|||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
struct tcb_s *nexttcb = (struct tcb_s*)g_readytorun.head;
|
||||||
|
|
||||||
|
/* Reset 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_blocktask.c
|
* arch/avr/src/avr32/up_blocktask.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
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@@ -121,6 +109,10 @@ void up_block_task(struct tcb_s *tcb, tstate_t task_state)
|
|||||||
|
|
||||||
if (switch_needed)
|
if (switch_needed)
|
||||||
{
|
{
|
||||||
|
/* 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)
|
||||||
@@ -137,6 +129,10 @@ void up_block_task(struct tcb_s *tcb, tstate_t task_state)
|
|||||||
|
|
||||||
rtcb = (struct tcb_s*)g_readytorun.head;
|
rtcb = (struct tcb_s*)g_readytorun.head;
|
||||||
|
|
||||||
|
/* Reset scheduler parameters */
|
||||||
|
|
||||||
|
sched_resume_scheduler(rtcb);
|
||||||
|
|
||||||
/* Then switch contexts. Any new address environment needed by
|
/* Then switch contexts. Any new address environment needed by
|
||||||
* the new thread will be instantiated before the return from
|
* the new thread will be instantiated before the return from
|
||||||
* interrupt.
|
* interrupt.
|
||||||
@@ -164,6 +160,10 @@ void up_block_task(struct tcb_s *tcb, tstate_t task_state)
|
|||||||
|
|
||||||
(void)group_addrenv(nexttcb);
|
(void)group_addrenv(nexttcb);
|
||||||
#endif
|
#endif
|
||||||
|
/* Reset 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_blocktask.c
|
* arch/hc/src/common/up_blocktask.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
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@@ -121,6 +109,10 @@ void up_block_task(struct tcb_s *tcb, tstate_t task_state)
|
|||||||
|
|
||||||
if (switch_needed)
|
if (switch_needed)
|
||||||
{
|
{
|
||||||
|
/* 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)
|
||||||
@@ -137,6 +129,10 @@ void up_block_task(struct tcb_s *tcb, tstate_t task_state)
|
|||||||
|
|
||||||
rtcb = (struct tcb_s*)g_readytorun.head;
|
rtcb = (struct tcb_s*)g_readytorun.head;
|
||||||
|
|
||||||
|
/* Reset 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.
|
||||||
*/
|
*/
|
||||||
@@ -166,6 +162,10 @@ void up_block_task(struct tcb_s *tcb, tstate_t task_state)
|
|||||||
|
|
||||||
(void)group_addrenv(rtcb);
|
(void)group_addrenv(rtcb);
|
||||||
#endif
|
#endif
|
||||||
|
/* Reset 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_blocktask.c
|
* arch/mips/src/mips32/up_blocktask.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
|
||||||
@@ -50,18 +50,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
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@@ -122,6 +110,10 @@ void up_block_task(struct tcb_s *tcb, tstate_t task_state)
|
|||||||
|
|
||||||
if (switch_needed)
|
if (switch_needed)
|
||||||
{
|
{
|
||||||
|
/* 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)
|
||||||
@@ -138,6 +130,10 @@ void up_block_task(struct tcb_s *tcb, tstate_t task_state)
|
|||||||
|
|
||||||
rtcb = (struct tcb_s*)g_readytorun.head;
|
rtcb = (struct tcb_s*)g_readytorun.head;
|
||||||
|
|
||||||
|
/* Reset 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.
|
||||||
*/
|
*/
|
||||||
@@ -164,6 +160,10 @@ void up_block_task(struct tcb_s *tcb, tstate_t task_state)
|
|||||||
|
|
||||||
(void)group_addrenv(nexttcb);
|
(void)group_addrenv(nexttcb);
|
||||||
#endif
|
#endif
|
||||||
|
/* Reset 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);
|
||||||
|
|||||||
+39
-15
@@ -251,12 +251,15 @@ void up_release_stack(struct tcb_s *dtcb, uint8_t ttype)
|
|||||||
void up_block_task(struct tcb_s *tcb, tstate_t task_state)
|
void up_block_task(struct tcb_s *tcb, tstate_t task_state)
|
||||||
{
|
{
|
||||||
/* Verify that the context switch can be performed */
|
/* Verify that the context switch can be performed */
|
||||||
|
|
||||||
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))
|
||||||
|
{
|
||||||
warn("%s: task sched error\n", __func__);
|
warn("%s: task sched error\n", __func__);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
struct tcb_s *rtcb = current_task;
|
struct tcb_s *rtcb = current_task;
|
||||||
bool switch_needed;
|
bool switch_needed;
|
||||||
|
|
||||||
@@ -266,23 +269,38 @@ void up_block_task(struct tcb_s *tcb, tstate_t task_state)
|
|||||||
* ready-to-run task is needed. In this case, it should
|
* ready-to-run task is needed. In this case, it should
|
||||||
* also be true that rtcb == tcb.
|
* also be true that rtcb == tcb.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
switch_needed = sched_removereadytorun(tcb);
|
switch_needed = sched_removereadytorun(tcb);
|
||||||
|
|
||||||
/* Add the task to the specified blocked task list */
|
/* Add the task to the specified blocked task list */
|
||||||
|
|
||||||
sched_addblocked(tcb, (tstate_t)task_state);
|
sched_addblocked(tcb, (tstate_t)task_state);
|
||||||
|
|
||||||
/* Now, perform the context switch if one is needed */
|
/* Now, perform the context switch if one is needed */
|
||||||
if (switch_needed) {
|
|
||||||
|
if (switch_needed)
|
||||||
|
{
|
||||||
struct tcb_s *nexttcb;
|
struct tcb_s *nexttcb;
|
||||||
// this part should not be executed in interrupt context
|
|
||||||
if (up_interrupt_context()) {
|
/* Update scheduler parameters */
|
||||||
|
|
||||||
|
sched_suspend_scheduler(rtcb);
|
||||||
|
|
||||||
|
/* this part should not be executed in interrupt context */
|
||||||
|
|
||||||
|
if (up_interrupt_context())
|
||||||
|
{
|
||||||
panic("%s: %d\n", __func__, __LINE__);
|
panic("%s: %d\n", __func__, __LINE__);
|
||||||
}
|
}
|
||||||
// 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
|
/* If there are any pending tasks, then add them to the g_readytorun
|
||||||
// sched_unlock() to do this for disable preemption. But it block
|
* task list now. It should be the up_realease_pending() called from
|
||||||
// itself, so it's OK.
|
* sched_unlock() to do this for disable preemption. But it block
|
||||||
if (g_pendingtasks.head) {
|
* itself, so it's OK.
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (g_pendingtasks.head)
|
||||||
|
{
|
||||||
warn("Disable preemption failed for task block itself\n");
|
warn("Disable preemption failed for task block itself\n");
|
||||||
sched_mergepending();
|
sched_mergepending();
|
||||||
}
|
}
|
||||||
@@ -290,14 +308,20 @@ void up_block_task(struct tcb_s *tcb, tstate_t task_state)
|
|||||||
nexttcb = (struct tcb_s*)g_readytorun.head;
|
nexttcb = (struct tcb_s*)g_readytorun.head;
|
||||||
|
|
||||||
#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
|
||||||
// running task is closed down gracefully (data caches dump,
|
* running task is closed down gracefully (data caches dump,
|
||||||
// MMU flushed) and set up the address environment for the new
|
* MMU flushed) and set up the address environment for the new
|
||||||
// thread at the head of the ready-to-run list.
|
* thread at the head of the ready-to-run list.
|
||||||
|
*/
|
||||||
|
|
||||||
(void)group_addrenv(nexttcb);
|
(void)group_addrenv(nexttcb);
|
||||||
#endif
|
#endif
|
||||||
// context switch
|
/* Reset scheduler parameters */
|
||||||
|
|
||||||
|
sched_resume_scheduler(nexttcb);
|
||||||
|
|
||||||
|
/* context switch */
|
||||||
|
|
||||||
up_switchcontext(rtcb, nexttcb);
|
up_switchcontext(rtcb, nexttcb);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* arch/sh/src/common/up_blocktask.c
|
* arch/sh/src/common/up_blocktask.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2008-2009, 2013-2014 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
|
||||||
@@ -48,18 +48,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
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@@ -120,6 +108,10 @@ void up_block_task(struct tcb_s *tcb, tstate_t task_state)
|
|||||||
|
|
||||||
if (switch_needed)
|
if (switch_needed)
|
||||||
{
|
{
|
||||||
|
/* 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)
|
||||||
@@ -136,6 +128,10 @@ void up_block_task(struct tcb_s *tcb, tstate_t task_state)
|
|||||||
|
|
||||||
rtcb = (struct tcb_s*)g_readytorun.head;
|
rtcb = (struct tcb_s*)g_readytorun.head;
|
||||||
|
|
||||||
|
/* Reset 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.
|
||||||
*/
|
*/
|
||||||
@@ -165,6 +161,10 @@ void up_block_task(struct tcb_s *tcb, tstate_t task_state)
|
|||||||
|
|
||||||
(void)group_addrenv(rtcb);
|
(void)group_addrenv(rtcb);
|
||||||
#endif
|
#endif
|
||||||
|
/* Reset 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_blocktask.c
|
* arch/sim/src/up_blocktask.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
|
||||||
@@ -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
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@@ -122,6 +110,10 @@ void up_block_task(struct tcb_s *tcb, tstate_t task_state)
|
|||||||
|
|
||||||
if (switch_needed)
|
if (switch_needed)
|
||||||
{
|
{
|
||||||
|
/* 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!
|
||||||
@@ -148,6 +140,10 @@ void up_block_task(struct tcb_s *tcb, tstate_t task_state)
|
|||||||
rtcb->xcp.sigdeliver = NULL;
|
rtcb->xcp.sigdeliver = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Reset 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/x86/src/common/up_blocktask.c
|
* arch/x86/src/common/up_blocktask.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
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@@ -120,6 +108,10 @@ void up_block_task(struct tcb_s *tcb, tstate_t task_state)
|
|||||||
|
|
||||||
if (switch_needed)
|
if (switch_needed)
|
||||||
{
|
{
|
||||||
|
/* 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)
|
||||||
@@ -136,6 +128,10 @@ void up_block_task(struct tcb_s *tcb, tstate_t task_state)
|
|||||||
|
|
||||||
rtcb = (struct tcb_s*)g_readytorun.head;
|
rtcb = (struct tcb_s*)g_readytorun.head;
|
||||||
|
|
||||||
|
/* Reset 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.
|
||||||
*/
|
*/
|
||||||
@@ -165,6 +161,10 @@ void up_block_task(struct tcb_s *tcb, tstate_t task_state)
|
|||||||
|
|
||||||
(void)group_addrenv(rtcb);
|
(void)group_addrenv(rtcb);
|
||||||
#endif
|
#endif
|
||||||
|
/* Reset 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_blocktask.c
|
* common/up_blocktask.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
|
||||||
@@ -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
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@@ -122,6 +110,10 @@ void up_block_task(FAR struct tcb_s *tcb, tstate_t task_state)
|
|||||||
|
|
||||||
if (switch_needed)
|
if (switch_needed)
|
||||||
{
|
{
|
||||||
|
/* 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)
|
||||||
@@ -137,7 +129,10 @@ void up_block_task(FAR struct tcb_s *tcb, tstate_t task_state)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
rtcb = (FAR struct tcb_s*)g_readytorun.head;
|
rtcb = (FAR struct tcb_s*)g_readytorun.head;
|
||||||
/* dbg("New Active Task TCB=%p\n", rtcb); */
|
|
||||||
|
/* Reset 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.
|
||||||
@@ -158,7 +153,10 @@ void up_block_task(FAR struct tcb_s *tcb, tstate_t task_state)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
rtcb = (FAR struct tcb_s*)g_readytorun.head;
|
rtcb = (FAR struct tcb_s*)g_readytorun.head;
|
||||||
/* dbg("New Active Task TCB=%p\n", rtcb); */
|
|
||||||
|
/* Reset scheduler parameters */
|
||||||
|
|
||||||
|
sched_resume_scheduler(rtcb);
|
||||||
|
|
||||||
/* Then switch contexts */
|
/* Then switch contexts */
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* arch/z80/src/common/up_blocktask.c
|
* arch/z80/src/common/up_blocktask.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
|
||||||
@@ -50,18 +50,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
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@@ -124,6 +112,10 @@ void up_block_task(FAR struct tcb_s *tcb, tstate_t task_state)
|
|||||||
|
|
||||||
if (switch_needed)
|
if (switch_needed)
|
||||||
{
|
{
|
||||||
|
/* 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())
|
||||||
@@ -139,7 +131,10 @@ void up_block_task(FAR struct tcb_s *tcb, tstate_t task_state)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
rtcb = (FAR struct tcb_s*)g_readytorun.head;
|
rtcb = (FAR struct tcb_s*)g_readytorun.head;
|
||||||
/* dbg("New Active Task TCB=%p\n", rtcb); */
|
|
||||||
|
/* Reset 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
|
||||||
@@ -171,6 +166,10 @@ void up_block_task(FAR struct tcb_s *tcb, tstate_t task_state)
|
|||||||
|
|
||||||
(void)group_addrenv(rtcb);
|
(void)group_addrenv(rtcb);
|
||||||
#endif
|
#endif
|
||||||
|
/* Reset 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