Pumpkin, Inc.

Pumpkin User Forums

OSCreateMsg() behaviour

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

OSCreateMsg() behaviour

Postby luben » Tue Feb 06, 2001 2:18 am

Hello,

from what I read in the manual I don't understand after creating the message will this signal a message or not.

On the page 221 in the manual is the description of the OSCreateMsg(). There is some initial value. Does that mea that with creating the message it is signalled - I mean, if no other task signals Message the waiting task will receive the initial value.

And if the creating don't signal the message - then the question is - what is the sense of this initial value? Messages has to "parameters" - <value> and <if there is message or not>. The signaling of the new message will erase this initial value.

Maybe to be more exactly in the question - what is the purpose of initial value of the messages if creating the message will not signal it.

Regards
Luben

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

Re: OSCreateMsg() behaviour

Postby luben » Tue Feb 06, 2001 2:23 am

Hello,

on page 222 in the manual (the example) row 11 - it's example with creating message. They put value 0 in the pointer to the message. Does that mean that if the value is =0 the message will be not signalled with the process of creating and if I put some other value (pointing some message in ROM) with the creating the message will be signalled?

I meant - there is no one word about this initial value and its meaning.

Regards
Luben

[This message has been edited by luben (edited February 06, 2001).]

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

Re: OSCreateMsg() behaviour

Postby Salvo Tech Support » Wed Feb 07, 2001 9:04 am

Hi Luben.

A value of (OStypeMsgP ) 0 for a message pointer is a lot like a value of 0 for a binSem. Any other value for a message pointer means that a message is available.

When a task waits a message, it will be blocked (i.e. its state will go from eligible to waiting) if the message pointer has a value of (OStypeMsgP) 0. If the message pointer has any other value, it will proceed.

If a task is waiting a message, and you call OSSignalMsg() with a (OStypeMsgP) 0 argument, even if you call it multiple times, the task will continue waiting. Only when you call OSSignalMsg with a non-zero argument will the task get the message.

So your understanding is correct.

--------
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: OSCreateMsg() behaviour

Postby luben » Sun Feb 11, 2001 9:06 am

Hello,

If your manual for SALVO 2.2 is not finished, it's good idea to add information about this feature. FIFO stacks are very useful when receiving/transmitting serial data. You have the working structure with message queue, so it's up to you to point the users how can use it in the best way. I think that in message queues you should add - "you can send messages between tasks and binary data directly" (excuse me for my english - it's not my native language, so I hope you'll correct the sentance). Because from your manual becomes that message queues are only for exchange pointers to the real messages. In fact you can exchange directly binary data.

And you should avoid users to use OSSignalMsg for exchanging binary data (zero couldn't be sent), but for ASCII is OK.

This is one of the "hidden" treasures of SALVO.

Regards
Luben

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

Re: OSCreateMsg() behaviour

Postby aek » Sun Feb 11, 2001 10:11 am

Re:

quote:
If your manual for SALVO 2.2 is not finished ...

That got a good chuckle out of me ... the v2.2 manual is being edited right now -- it's getting bigger and bigger ... OS_WaitEFlag() took four pages (!) in the Reference section.

Anyway, I think we'll add a mention of this, but in the FAQ, as this is more a byproduct of the way the code works, and not an intentional feature ...

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

Re: OSCreateMsg() behaviour

Postby luben » Sun Feb 11, 2001 10:26 am

Hello,

From what you wrote about the messages I understand that's it's impossible to send directly binary values via messages (if you load not the address to the variable that holds the data, but the pure data). The message pointer can't have value 0, or if it has this value it's equal that the event is not signalled, right?

How about message queues? If I signal a message queue with value 0 is it equal that I didn't signaled it? This will answer one of my old questions - could I use message queues like FIFO stack, directly to transfere data (not using the *pointer value, but the value of the pointer). If value of 0 is equal to "no signalled" then the answer to my question should be - yes, it's possible to make FIFO stack, but only with non zero values.

Regards
Luben

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

Re: OSCreateMsg() behaviour

Postby aek » Sun Feb 11, 2001 11:39 am

You've discovered something very interesting ... with messages, a message is considered to "not exist" if the message pointer is 0. But with message queues, a message does not exist only if there are no messages in the queue. If there is a message, and its value is 0, that's OK.

So yes, you should be able to use message queues to pass binary data of any value (including zero) between two tasks, FIFO of course.

-------
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