Pumpkin, Inc.

Pumpkin User Forums

Behaviour of OSCreateTask()

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

Behaviour of OSCreateTask()

Postby luben » Sun Dec 31, 2000 10:35 am

Hello,

On page 251 of the manual you explain how to start stopped task and there is
OSCreatetask(task,5,OSDONT_START_TASK | 14);

Does that mean that is I create task with priority bigger then some value it will be stopped? Because (14 | value) is just setting the variable to some bigger value, right?

Regards
Luben

luben
 
Posts: 324
Joined: Sun Nov 19, 2000 12:00 am
Location: Sofia, Bulgaria

Re: Behaviour of OSCreateTask()

Postby aek » Mon Jan 01, 2001 8:36 am

No. Please re-read the Reference section on OSCreateTask().

Explanation: There is an optional switch for OSCreateTask() that is passed in the prio parameter. It's done this way because Salvo supports 16 distinct priorities in queue (normal) mode, and therefore the upper 4 bits of the priority parameter are unused. Instead of creating another parameter for OSCreateTask(), which would unnecessarily take up extra RAM and ROM, this extra information (don't start the task) is passed to OSCreateTask() in one of the upper bits of the prio parameter.

If you simply specify a priority that's greater than 15 and does not conflict with this extra bit, then OSCreateTask() will change the priority you specify to 15.

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

Re: Behaviour of OSCreateTask()

Postby luben » Mon Jan 01, 2001 9:55 am

Hello,

Thank you for your reply. I understand that you pass only bits to the kernel, but as I know before passing tha parameters the compiler calculates the value and after then it passes to the function. So, if I do:
- 0x40 | 0x08
- 0x48

in both cases it will return the same value.

So, if I set a number of priority that is not legal, but will imitate operation <| val> the kernel will not understand and will take it just like I tried to create a stopped task.

But talking about good style, this should be forgotten, right?

Regards
Luben

luben
 
Posts: 324
Joined: Sun Nov 19, 2000 12:00 am
Location: Sofia, Bulgaria

Re: Behaviour of OSCreateTask()

Postby aek » Wed Jan 03, 2001 8:19 am

quote:
So, if I set a number of priority that is not legal, but will imitate operation <| val> the kernel will not understand and will take it just like I tried to create a stopped task.

Again, No. Once you obtain the full version, I suggest you view the source code for OSCreateTask(). Hint:The value of OSDONT_START_TASK is critical

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


Return to Coding

Who is online

Users browsing this forum: No registered users and 2 guests

cron