From 0924f81f32294abaae83d0fd9f4ff7a6257065ac Mon Sep 17 00:00:00 2001 From: patacongo Date: Mon, 19 Feb 2007 22:51:18 +0000 Subject: Fix ARM IRQ handling problem + ARM context restore problem git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@9 42af7a65-404d-4744-a932-0658087f49c3 --- nuttx/sched/task_create.c | 41 ++++++++++++++++++++++++----------------- 1 file changed, 24 insertions(+), 17 deletions(-) (limited to 'nuttx/sched/task_create.c') diff --git a/nuttx/sched/task_create.c b/nuttx/sched/task_create.c index ecfd68056..dd7da112e 100644 --- a/nuttx/sched/task_create.c +++ b/nuttx/sched/task_create.c @@ -41,6 +41,7 @@ #include #include #include +#include #include #include #include "os_internal.h" @@ -225,6 +226,8 @@ STATUS _task_init(_TCB *tcb, char *name, int priority, { STATUS ret; + vdbg("%s: Entry\n", __FUNCTION__); + /* Assign a unique task ID to the task. */ ret = task_assignpid(tcb); @@ -376,33 +379,35 @@ STATUS task_init(_TCB *tcb, char *name, int priority, STATUS task_activate(_TCB *tcb) { #ifdef CONFIG_SCHED_INSTRUMENTATION - uint32 savedState; + uint32 flags; #endif + vdbg("%s: Entry\n", __FUNCTION__); + #ifdef CONFIG_SCHED_INSTRUMENTATION - savedState = irqsave(); + flags = irqsave(); - /* Check if this is really a re-start */ + /* Check if this is really a re-start */ - if (tcb->task_state != TSTATE_TASK_INACTIVE) - { - /* Inform the instrumentation layer that the task - * has stopped - */ + if (tcb->task_state != TSTATE_TASK_INACTIVE) + { + /* Inform the instrumentation layer that the task + * has stopped + */ - sched_note_stop(tcb); - } + sched_note_stop(tcb); + } - /* Inform the instrumentation layer that the task - * has started - */ + /* Inform the instrumentation layer that the task + * has started + */ - sched_note_start(tcb); - irqrestore(savedState); + sched_note_start(tcb); + irqrestore(flags); #endif - up_unblock_task(tcb); - return OK; + up_unblock_task(tcb); + return OK; } /************************************************************ @@ -444,6 +449,8 @@ int task_create(char *name, int priority, STATUS status; pid_t pid; + vdbg("%s: Entry\n", __FUNCTION__); + /* Allocate a TCB for the new task. */ tcb = (_TCB*)kzmalloc(sizeof(_TCB)); -- cgit v1.2.3