Page 1 of 1

OSCreateTask

PostPosted: Mon May 13, 2002 9:03 am
by dfleck
OSCreateTask sets GIE to 1 before it returns, even if GIE was 0 when this function was called. How can I prevent OSCreateTask from modifying GIE?

------------------
Donald A. Fleck


Re: OSCreateTask

PostPosted: Tue May 14, 2002 7:44 am
by aek
Hi Donald.

Currently, with Salvo for PICmicro(R) MCUs, you can't. That's because there's no stack to push the current interrupt status onto and then restore from. Other Salvo ports (e.g. TI's MSP430) don't have this problem.

For now, I suggest:

1) Create your task(s) very late in the game, after all your interrupts are in place, or

2) Keep the particular interrupt(s) disabled via its own IE flag, and then enable it(them) after OSCreateTask() has been called, just before the infinite loop that calls OSSched(), or

3) IIRC, you have Salvo Pro. If you're not already doing a source-code build for your particular project, you could switch to a source-code build now (see salvo ut u6sysa u6.pjt for an example). Then, you can define your own OSEi() in your project's salvocfg.h, and it will override those in portpicc.h for this particular project only, i.e. don't modify portpicc.h directly. You could do something like

code:
#define OSEi() do { if (flagReady) GIE = 1; } while(0)

. You initialize flagReady to FALSE, and then, after the calls to OSCreateTask(), etc., you set it to TRUE.

Solution 3) is best way to go. I have an idea brewing for how to save and restore PIC GIE status with minimal code and RAM, but it's not ready for release yet.

Regards,

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

[This message has been edited by aek (edited May 14, 2002).]


Re: OSCreateTask

PostPosted: Tue May 14, 2002 7:51 am
by dfleck
Thanks. I'm doing 2) since it is simple and it works. Perhaps when I become more familiar with Salvo I will try 3).

------------------
Donald A. Fleck