• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1819
  • Last Modified:

message Q on VXWORKS operating system

Dear Experts,

I need to know the principle of a message q with the VXWORKS operating system.

also i'll be delighted for any links on the subject, as well as on semaphore and tasks handling with the VXWORKS operating system

Thanks.
0
ronyjosf
Asked:
ronyjosf
  • 2
  • 2
  • 2
  • +1
1 Solution
 
WakeupSpecialist 1Commented:
I dont know anything about VXWorks, but you can check some of these sites out for information:

http://www.windriver.com/products/html/vxwks54.html
http://www.xs4all.nl/~borkhuis/vxworks/vxworks.html
http://www.faqs.org/faqs/vxworks-faq/part1/
http://www.xs4all.nl/~borkhuis/vxworks/vxfaq.html


Hope those may be able to answer your questions!
0
 
dimitryCommented:
Actually VxWorks programmer's Guide has all the nesessary
information. The chapter is too big and EE doesn't allow to paste pictures. Do you have some specific problem ?
--------------------------------------------------------
2.4.4   Message Queues
Modern real-time applications are constructed as a set of independent but cooperating tasks. While semaphores provide a high-speed mechanism for the synchronization and interlocking of tasks, often a higher-level mechanism is necessary to allow cooperating tasks to communicate with each other. In VxWorks, the primary intertask communication mechanism within a single CPU is message queues. The optional product, VxMP, provides global message queues that can be used across processors; for more information, see 6. Shared-Memory Objects.

Message queues allow a variable number of messages, each of variable length, to be queued. Any task or ISR can send messages to a message queue. Any task can receive messages from a message queue. Multiple tasks can send to and receive from the same message queue. Full-duplex communication between two tasks generally requires two message queues, one for each direction; see Figure 2-14.

Figure 2-14:  Full Duplex Communication Using Message Queues
 
There are two message-queue subroutine libraries in VxWorks. The first of these, msgQLib, provides Wind message queues, designed expressly for VxWorks; the second, mqPxLib, is compatible with the POSIX standard (1003.1b) for real-time extensions. See Comparison of POSIX and Wind Message Queues for a discussion of the differences between the two message-queue designs.

0
 
ITsheresomewhereCommented:
Hello ronyjosf,

It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. If there is no objection or further activity, I will suggest to:

    Split points between: Wakeup and dimitry

ronyjosf, if you think your question was not answered at all, you can post a request in Community Support and ask them to delete this question and refund your points (please include a link to this
Question: http:Q.20311252.html in any posts to Community Support).
If you want to post to Community Support, click here:
      http://www.experts-exchange.com/jsp/qAskQuestion.jsp?ta=commspt

Please do not accept this comment as an answer!

EXPERTS: Your input for closing recommendations is appreciated.
==========
ITsheresomewhere
EE Database Cleanup Volunteer
0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
ronyjosfAuthor Commented:
Dimitry hi,

Sorry it took me that long... but could you be more specific on the way messageQ works ?
in terms on send, recieve, waitforsingleobject, and so long...

Thanks, Rony.
0
 
dimitryCommented:
As I wrote there are two libraries for messages in VxWorks:
Wind and Posix. Let's consider Wind functions:

Wind message queues are created and deleted with the routines shown in Table 2-17. This library provides messages that are queued in FIFO order, with a single exception: there are two priority levels, and messages marked as high priority are attached to the head of the queue.

Table 2-17:  Wind Message Queue Control

-----------------------------------------------------------
Call Description  
-----------------------------------------------------------
msgQCreate( )   Allocate and initialize a message queue.  
msgQDelete( )   Terminate and free a message queue.  
msgQSend( )   Send a message to a message queue.  
msgQReceive( )   Receive a message from a message queue.  
-----------------------------------------------------------

A message queue is created with msgQCreate( ). Its parameters specify the maximum number of messages that can be queued in the message queue and the maximum length in bytes of each message. Enough buffer space is preallocated for the specified number and length of messages.

A task or ISR sends a message to a message queue with msgQSend( ). If no tasks are waiting for messages on that queue, the message is added to the queue's buffer of messages. If any tasks are already waiting for a message from that message queue, the message is immediately delivered to the first waiting task.

A task receives a message from a message queue with msgQReceive( ). If messages are already available in the message queue's buffer, the first message is immediately dequeued and returned to the caller. If no messages are available, then the calling task blocks and is added to a queue of tasks waiting for messages. This queue of waiting tasks can be ordered either by task priority or FIFO, as specified in an option parameter when the queue is created.

Example 2-8:  Wind Message Queues
/* In this example, task t1 creates the message queue and sends a message
 * to task t2. Task t2 receives the message from the queue and simply
 * displays the message.
 */
 
/* includes */
#include "vxWorks.h"
#include "msgQLib.h"
 
/* defines */
#define MAX_MSGS (10)
#define MAX_MSG_LEN (100)
 
MSG_Q_ID myMsgQId;
 
task2 (void)
    {
    char msgBuf[MAX_MSG_LEN];
 
    /* get message from queue; if necessary wait until msg is available */
    if (msgQReceive(myMsgQId, msgBuf, MAX_MSG_LEN, WAIT_FOREVER) == ERROR)
        return (ERROR);
 
    /* display message */
    printf ("Message from task 1:\n%s\n", msgBuf);
    }
 
#define MESSAGE "Greetings from Task 1"
task1 (void)
    {
    /* create message queue */
    if ((myMsgQId = msgQCreate (MAX_MSGS, MAX_MSG_LEN, MSG_Q_PRIORITY))  
        == NULL)
        return (ERROR);
 
    /* send a normal priority message, blocking if queue is full */
    if (msgQSend (myMsgQId, MESSAGE, sizeof (MESSAGE), WAIT_FOREVER,
                  MSG_PRI_NORMAL) == ERROR)
        return (ERROR);
    }
0
 
ITsheresomewhereCommented:
Thank you both for responding.
I have suspended the recommendation pending the thread
remaining active.

ITsheresomewhere
0
 
ronyjosfAuthor Commented:
You've been very helpfull !
Thank you.
Rony.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

  • 2
  • 2
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now