Pumpkin, Inc.

Pumpkin User Forums

OSStopTask()

If you can't make Salvo do what you want it to do, post it here.

OSStopTask()

Postby Salvo Tech Support » Thu Nov 08, 2001 4:01 am

Hi James.

Can you post a snippet of the code you're running? Specifically, where you call OS_Delay() and where you call OSStopTask().

Thanks,

------------------
-----------------------
Salvo Technical Support
Please request all tech support through the Forums.

--------
Salvo Technical Support
Please request all tech support through the Forums.
Salvo Tech Support
 
Posts: 173
Joined: Sun Nov 19, 2000 12:00 am

Re: OSStopTask()

Postby James » Thu Nov 08, 2001 4:32 am

Here is a snippet:

code:
test = OSStopTask( TASK_PWRMGR_P );
printf("
pwrmgr= %2d
",(int)test);

the above was called from another task (other than TaskPwrMgr) and printed out "pwrmgr= 1" (which I take is OSERR). pwrmgr seemed to continue to run. The only os related calls in pwrmgr is OS_Delay(), so I don't understand why it did not stop. If I perform a test and call OS_Stop() from INSIDE pwrmgr, it does seem to stop as expected.

[This message has been edited by Salvo Tech Support (edited November 08, 2001).]

James
 
Posts: 12
Joined: Thu Oct 04, 2001 11:00 pm
Location: San Diego, CA, USA

Re: OSStopTask()

Postby aek » Thu Nov 08, 2001 9:54 am

Hi James.

You're using the return code correctly -- a return code of OSERR does in fact mean that OSStopTask() failed to stop the task.

Frankly, I don't know the reason for your problem -- I wrote a quick piece of test code by modifying tu6main.c to look like this:

code:
...
OSCreateMsg(MSG_UPDATE_PORT_P, (OStypeMsgP) 0);

OSSched();
OSSched();
OSSched();

if ( OSStopTask( TASK_BLINK ) == OSERR ) {
do {
;
} while (1);
}

for (;;)
OSSched();

...


After the three calls to OSSched(), TaskCount() is eligible, TaskShow() is waiting and TaskBlink() is delayed. And sure enough, after the call to OSStopTask(), TaskBlink() is stopped, and the other tasks go on running.

Probably the best way to figure out why it's returning that error code is to do a source code build, and trace your way through OSStopTask() (if you want to trace at the C level). Or, you can do a library build and trace at the assembly level. The things to check for are:

1) In OSStopTask(), does the call to OSTaskUsed() return TRUE (0x01)?

2) In OSStopTask(), does the call to OSDelTaskQ() return OSNOERR (0x00)?

All of Salvo's return codes are unsigned chars, so on the PIC that means that they're returned in the W register. Any easy way to test/trace this sort of thing is to have the Program Memory Window open in MPLAB, and do a "Run to Here" immediately after the function call of interest. Then look at the bottom of the MPLAB window, where there are all those boxed fields, and check what the w:0x?? field is set to ...

------------------

[This message has been edited by aek (edited November 08, 2001).]

-------
aek
aek
 
Posts: 1888
Joined: Sat Aug 26, 2000 11:00 pm

Re: OSStopTask()

Postby James » Thu Nov 08, 2001 11:03 am

When I call OSStopTask to stop a task the return is OSERR and the task does not stop. I do not understand because the task I am trying to stop is waiting in a simple OS_Delay(). What could I be doing wrong?
James
 
Posts: 12
Joined: Thu Oct 04, 2001 11:00 pm
Location: San Diego, CA, USA


Return to Coding

Who is online

Users browsing this forum: Google [Bot] and 1 guest

cron