VxWorks Reference Manual : Libraries

msgQSmLib

NAME

msgQSmLib - shared memory message queue library (VxMP Option)

ROUTINES

msgQSmCreate( ) - create and initialize a shared memory message queue (VxMP Option)

DESCRIPTION

This library provides the interface to shared memory message queues. Shared memory message queues allow a variable number of messages (varying in length) to be queued in first-in-first-out order. Any task running on any CPU in the system can send messages to or receive messages from a shared message queue. Tasks can also send to and receive from the same shared message queue. Full-duplex communication between two tasks generally requires two shared message queues, one for each direction.

Shared memory message queues are created with msgQSmCreate( ). Once created, they can be manipulated using the generic routines for local message queues; for more information on the use of these routines, see the manual entry for msgQLib.

MEMORY REQUIREMENTS

The shared memory message queue structure is allocated from a dedicated shared memory partition. This shared memory partition is initialized by the shared memory objects master CPU. The size of this partition is defined by the maximum number of shared message queues, SM_OBJ_MAX_MSG_Q.

The message queue buffers are allocated from the shared memory system partition.

RESTRICTIONS

Shared memory message queues differ from local message queues in the following ways:

Interrupt Use:
Shared memory message queues may not be used (sent to or received from) at interrupt level.

Deletion:
There is no way to delete a shared memory message queue and free its associated shared memory. Attempts to delete a shared message queue return ERROR and set errno to S_smObjLib_NO_OBJECT_DESTROY.

Queuing Style:
The shared message queue task queueing order specified when a message queue is created must be FIFO.

CONFIGURATION

Before routines in this library can be called, the shared memory objects facility must be initialized by calling usrSmObjInit( ), which is found in src/config/usrSmObj.c. This is done automatically from the root task, usrRoot( ), in usrConfig.c if the configuration macro INCLUDE_SM_OBJ is defined.

AVAILABILITY

This module is distributed as a component of the unbundled shared objects memory support option, VxMP.

INCLUDE FILES

msgQSmLib.h, msgQLib.h, smMemLib.h, smObjLib.h

SEE ALSO

msgQSmLib, msgQLib, smObjLib, msgQShow, usrSmObjInit( ), VxWorks Programmer's Guide: Shared Memory Objects


Libraries : Routines

msgQSmCreate( )

NAME

msgQSmCreate( ) - create and initialize a shared memory message queue (VxMP Option)

SYNOPSIS

MSG_Q_ID msgQSmCreate
    (
    int maxMsgs,      /* max messages that can be queued */
    int maxMsgLength, /* max bytes in a message */
    int options       /* message queue options */
    )

DESCRIPTION

This routine creates a shared memory message queue capable of holding up to maxMsgs messages, each up to maxMsgLength bytes long. It returns a message queue ID used to identify the created message queue. The queue can only be created with the option MSG_Q_FIFO (0), thus queuing pended tasks in FIFO order.

The global message queue identifier returned can be used directly by generic message queue handling routines in msgQLib -- msgQSend( ), msgQReceive( ), and msgQNumMsgs( ) -- and by the show routines show( ) and msgQShow( ).

If there is insufficient memory to store the message queue structure in the shared memory message queue partition or if the shared memory system pool cannot handle the requested message queue size, shared memory message queue creation will fail with errno set to S_memLib_NOT_ENOUGH_MEMORY. This problem can be solved by incrementing the value of SM_OBJ_MAX_MSG_Q and/or the shared memory objects dedicated memory size SM_OBJ_MEM_SIZE.

Before this routine can be called, the shared memory objects facility must be initialized (see msgQSmLib).

AVAILABILITY

This routine is distributed as a component of the unbundled shared memory objects support option, VxMP.

RETURNS

MSG_Q_ID, or NULL if error.

ERRNO

S_memLib_NOT_ENOUGH_MEMORY, S_intLib_NOT_ISR_CALLABLE, S_msgQLib_INVALID_QUEUE_TYPE, S_smObjLib_LOCK_TIMEOUT

SEE ALSO

msgQSmLib, smObjLib, msgQLib, msgQShow