source: rtems/doc/user/msg.t @ 75e22db

4.104.114.84.95
Last change on this file since 75e22db was 75e22db, checked in by Joel Sherrill <joel.sherrill@…>, on 03/27/98 at 16:47:53

Completed sweep adding directive and constant prefixes.

  • Property mode set to 100644
File size: 30.3 KB
Line 
1@c
2@c  COPYRIGHT (c) 1988-1998.
3@c  On-Line Applications Research Corporation (OAR).
4@c  All rights reserved.
5@c
6@c  $Id$
7@c
8
9@ifinfo
10@node Message Manager, Message Manager Introduction, SEMAPHORE_RELEASE - Release a semaphore, Top
11@end ifinfo
12@chapter Message Manager
13@ifinfo
14@menu
15* Message Manager Introduction::
16* Message Manager Background::
17* Message Manager Operations::
18* Message Manager Directives::
19@end menu
20@end ifinfo
21
22@ifinfo
23@node Message Manager Introduction, Message Manager Background, Message Manager, Message Manager
24@end ifinfo
25@section Introduction
26
27The message manager provides communication and
28synchronization capabilities using RTEMS message queues.  The
29directives provided by the message manager are:
30
31@itemize @bullet
32@item @code{@value{DIRPREFIX}message_queue_create} - Create a queue
33@item @code{@value{DIRPREFIX}message_queue_ident} - Get ID of a queue
34@item @code{@value{DIRPREFIX}message_queue_delete} - Delete a queue
35@item @code{@value{DIRPREFIX}message_queue_send} - Put message at rear of a queue
36@item @code{@value{DIRPREFIX}message_queue_urgent} - Put message at front of a queue
37@item @code{@value{DIRPREFIX}message_queue_broadcast} - Broadcast N messages to a queue
38@item @code{@value{DIRPREFIX}message_queue_receive} - Receive message from a queue
39@item @code{@value{DIRPREFIX}message_queue_get_number_pending} - Get number of messages pending on a queue
40@item @code{@value{DIRPREFIX}message_queue_flush} - Flush all messages on a queue
41@end itemize
42
43@ifinfo
44@node Message Manager Background, Messages, Message Manager Introduction, Message Manager
45@end ifinfo
46@section Background
47@ifinfo
48@menu
49* Messages::
50* Message Queues::
51* Building a Message Queue's Attribute Set::
52* Building a MESSAGE_QUEUE_RECEIVE Option Set::
53@end menu
54@end ifinfo
55
56@ifinfo
57@node Messages, Message Queues, Message Manager Background, Message Manager Background
58@end ifinfo
59@subsection Messages
60
61A message is a variable length buffer where
62information can be stored to support communication.  The length
63of the message and the information stored in that message are
64user-defined and can be actual data, pointer(s), or empty.
65
66@ifinfo
67@node Message Queues, Building a Message Queue's Attribute Set, Messages, Message Manager Background
68@end ifinfo
69@subsection Message Queues
70
71A message queue permits the passing of messages among
72tasks and ISRs.  Message queues can contain a variable number of
73messages.  Normally messages are sent to and received from the
74queue in FIFO order using the @code{@value{DIRPREFIX}message_queue_send}
75directive.  However, the @code{@value{DIRPREFIX}message_queue_urgent}
76directive can be used to place
77messages at the head of a queue in LIFO order.
78
79Synchronization can be accomplished when a task can
80wait for a message to arrive at a queue.  Also, a task may poll
81a queue for the arrival of a message.
82
83The maximum length message which can be sent is set
84on a per message queue basis.
85
86@ifinfo
87@node Building a Message Queue's Attribute Set, Building a MESSAGE_QUEUE_RECEIVE Option Set, Message Queues, Message Manager Background
88@end ifinfo
89@subsection Building a Message Queue's Attribute Set
90
91In general, an attribute set is built by a bitwise OR
92of the desired attribute components.  The set of valid message
93queue attributes is provided in the following table:
94
95@itemize @bullet
96@item @code{@value{RPREFIX}FIFO} - tasks wait by FIFO (default)
97@item @code{@value{RPREFIX}PRIORITY} - tasks wait by priority
98@item @code{@value{RPREFIX}LOCAL} - local message queue (default)
99@item @code{@value{RPREFIX}GLOBAL} - global message queue
100@end itemize
101
102
103An attribute listed as a default is not required to
104appear in the attribute list, although it is a good programming
105practice to specify default attributes.  If all defaults are
106desired, the attribute @code{@value{RPREFIX}DEFAULT_ATTRIBUTES}
107should be specified on this call.
108
109This example demonstrates the attribute_set parameter
110needed to create a local message queue with the task priority
111waiting queue discipline.  The attribute_set parameter to the
112@code{@value{DIRPREFIX}message_queue_create} directive could be either
113@code{@value{RPREFIX}PRIORITY} or
114@code{@value{RPREFIX}LOCAL @value{OR} @value{RPREFIX}PRIORITY}. 
115The attribute_set parameter can be set to @code{@value{RPREFIX}PRIORITY}
116because @code{@value{RPREFIX}LOCAL} is the default for all created
117message queues.  If a similar message queue were to be known globally, then the
118attribute_set parameter would be
119@code{@value{RPREFIX}GLOBAL @value{OR} @value{RPREFIX}PRIORITY}.
120
121@ifinfo
122@node Building a MESSAGE_QUEUE_RECEIVE Option Set, Message Manager Operations, Building a Message Queue's Attribute Set, Message Manager Background
123@end ifinfo
124@subsection Building a MESSAGE_QUEUE_RECEIVE Option Set
125
126In general, an option is built by a bitwise OR of the
127desired option components.  The set of valid options for the
128@code{@value{DIRPREFIX}message_queue_receive} directive are
129listed in the following table:
130
131@itemize @bullet
132@item @code{@value{RPREFIX}WAIT} - task will wait for a message (default)
133@item @code{@value{RPREFIX}NO_WAIT} - task should not wait
134@end itemize
135
136An option listed as a default is not required to
137appear in the option OR list, although it is a good programming
138practice to specify default options.  If all defaults are
139desired, the option @code{@value{RPREFIX}DEFAULT_OPTIONS} should
140be specified on this call.
141
142This example demonstrates the option parameter needed
143to poll for a message to arrive.  The option parameter passed to
144the @code{@value{DIRPREFIX}message_queue_receive} directive should
145be @code{@value{RPREFIX}NO_WAIT}.
146
147@ifinfo
148@node Message Manager Operations, Creating a Message Queue, Building a MESSAGE_QUEUE_RECEIVE Option Set, Message Manager
149@end ifinfo
150@section Operations
151@ifinfo
152@menu
153* Creating a Message Queue::
154* Obtaining Message Queue IDs::
155* Receiving a Message::
156* Sending a Message::
157* Broadcasting a Message::
158* Deleting a Message Queue::
159@end menu
160@end ifinfo
161
162@ifinfo
163@node Creating a Message Queue, Obtaining Message Queue IDs, Message Manager Operations, Message Manager Operations
164@end ifinfo
165@subsection Creating a Message Queue
166
167The @code{@value{DIRPREFIX}message_queue_create} directive creates a message
168queue with the user-defined name.  The user specifies the
169maximum message size and maximum number of messages which can be
170placed in the message queue at one time.  The user may select
171FIFO or task priority as the method for placing waiting tasks in
172the task wait queue.  RTEMS allocates a Queue Control Block
173(QCB) from the QCB free list to maintain the newly created queue
174as well as memory for the message buffer pool associated with
175this message queue.  RTEMS also generates a message queue ID
176which is returned to the calling task.
177
178For GLOBAL message queues, the maximum message size
179is effectively limited to the longest message which the MPCI is
180capable of transmitting.
181
182@ifinfo
183@node Obtaining Message Queue IDs, Receiving a Message, Creating a Message Queue, Message Manager Operations
184@end ifinfo
185@subsection Obtaining Message Queue IDs
186
187When a message queue is created, RTEMS generates a
188unique message queue ID.  The message queue ID may be obtained
189by either of two methods.  First, as the result of an invocation
190of the @code{@value{DIRPREFIX}message_queue_create} directive, the
191queue ID is stored in a user provided location.  Second, the queue
192ID may be obtained later using the @code{@value{DIRPREFIX}message_queue_ident}
193directive.  The queue ID is used by other message manager
194directives to access this message queue.
195
196@ifinfo
197@node Receiving a Message, Sending a Message, Obtaining Message Queue IDs, Message Manager Operations
198@end ifinfo
199@subsection Receiving a Message
200
201The @code{@value{DIRPREFIX}message_queue_receive} directive attempts to
202retrieve a message from the specified message queue.  If at
203least one message is in the queue, then the message is removed
204from the queue, copied to the caller's message buffer, and
205returned immediately along with the length of the message.  When
206messages are unavailable, one of the following situations
207applies:
208
209@itemize @bullet
210@item By default, the calling task will wait forever for the
211message to arrive.
212
213@item Specifying the @code{@value{RPREFIX}NO_WAIT} option forces an immediate return
214with an error status code.
215
216@item Specifying a timeout limits the period the task will
217wait before returning with an error status.
218@end itemize
219
220If the task waits for a message, then it is placed in
221the message queue's task wait queue in either FIFO or task
222priority order.  All tasks waiting on a message queue are
223returned an error code when the message queue is deleted.
224
225@ifinfo
226@node Sending a Message, Broadcasting a Message, Receiving a Message, Message Manager Operations
227@end ifinfo
228@subsection Sending a Message
229
230Messages can be sent to a queue with the
231@code{@value{DIRPREFIX}message_queue_send} and
232@code{@value{DIRPREFIX}message_queue_urgent} directives.  These
233directives work identically when tasks are waiting to receive a
234message.  A task is removed from the task waiting queue,
235unblocked,  and the message is copied to a waiting task's
236message buffer.
237
238When no tasks are waiting at the queue,
239@code{@value{DIRPREFIX}message_queue_send} places the
240message at the rear of the message queue, while
241@code{@value{DIRPREFIX}message_queue_urgent} places the message at the
242front of the queue.  The message is copied to a message buffer
243from this message queue's buffer pool and then placed in the
244message queue.  Neither directive can successfully send a
245message to a message queue which has a full queue of pending
246messages.
247
248@ifinfo
249@node Broadcasting a Message, Deleting a Message Queue, Sending a Message, Message Manager Operations
250@end ifinfo
251@subsection Broadcasting a Message
252
253The @code{@value{DIRPREFIX}message_queue_broadcast} directive sends the same
254message to every task waiting on the specified message queue as
255an atomic operation.  The message is copied to each waiting
256task's message buffer and each task is unblocked.  The number of
257tasks which were unblocked is returned to the caller.
258
259@ifinfo
260@node Deleting a Message Queue, Message Manager Directives, Broadcasting a Message, Message Manager Operations
261@end ifinfo
262@subsection Deleting a Message Queue
263
264The @code{@value{DIRPREFIX}message_queue_delete} directive removes a message
265queue from the system and frees its control block as well as the
266memory associated with this message queue's message buffer pool.
267A message queue can be deleted by any local task that knows the
268message queue's ID.  As a result of this directive, all tasks
269blocked waiting to receive a message from the message queue will
270be readied and returned a status code which indicates that the
271message queue was deleted.  Any subsequent references to the
272message queue's name and ID are invalid.  Any messages waiting
273at the message queue are also deleted and deallocated.
274
275@ifinfo
276@node Message Manager Directives, MESSAGE_QUEUE_CREATE - Create a queue, Deleting a Message Queue, Message Manager
277@end ifinfo
278@section Directives
279@ifinfo
280@menu
281* MESSAGE_QUEUE_CREATE - Create a queue::
282* MESSAGE_QUEUE_IDENT - Get ID of a queue::
283* MESSAGE_QUEUE_DELETE - Delete a queue::
284* MESSAGE_QUEUE_SEND - Put message at rear of a queue::
285* MESSAGE_QUEUE_URGENT - Put message at front of a queue::
286* MESSAGE_QUEUE_BROADCAST - Broadcast N messages to a queue::
287* MESSAGE_QUEUE_RECEIVE - Receive message from a queue::
288* MESSAGE_QUEUE_GET_NUMBER_PENDING - Get number of messages pending on a queue::
289* MESSAGE_QUEUE_FLUSH - Flush all messages on a queue::
290@end menu
291@end ifinfo
292
293This section details the message manager's
294directives.  A subsection is dedicated to each of this manager's
295directives and describes the calling sequence, related
296constants, usage, and status codes.
297
298@page
299@ifinfo
300@node MESSAGE_QUEUE_CREATE - Create a queue, MESSAGE_QUEUE_IDENT - Get ID of a queue, Message Manager Directives, Message Manager Directives
301@end ifinfo
302@subsection MESSAGE_QUEUE_CREATE - Create a queue
303
304@subheading CALLING SEQUENCE:
305
306@ifset is-C
307@example
308rtems_status_code rtems_message_queue_create(
309  rtems_name        name,
310  rtems_unsigned32  count,
311  rtems_unsigned32  max_message_size,
312  rtems_attribute   attribute_set,
313  rtems_id         *id
314);
315@end example
316@end ifset
317
318@ifset is-Ada
319@example
320procedure Message_Queue_Create (
321   Name             : in     RTEMS.Name;
322   Count            : in     RTEMS.Unsigned32;
323   Max_Message_Size : in     RTEMS.Unsigned32;
324   Attribute_Set    : in     RTEMS.Attribute;
325   ID               :    out RTEMS.ID;
326   Result           :    out RTEMS.Status_Codes
327);
328@end example
329@end ifset
330
331@subheading DIRECTIVE STATUS CODES:
332@code{@value{RPREFIX}SUCCESSFUL} - queue created successfully@*
333@code{@value{RPREFIX}INVALID_NAME} - invalid task name@*
334@code{@value{RPREFIX}INVALID_NUMBER} - invalid message count@*
335@code{@value{RPREFIX}INVALID_SIZE} - invalid message size@*
336@code{@value{RPREFIX}TOO_MANY} - too many queues created@*
337@code{@value{RPREFIX}MP_NOT_CONFIGURED} - multiprocessing not configured@*
338@code{@value{RPREFIX}TOO_MANY} - too many global objects
339
340@subheading DESCRIPTION:
341
342This directive creates a message queue which resides
343on the local node with the user-defined name specified in name.
344For control and maintenance of the queue, RTEMS allocates and
345initializes a QCB.  Memory is allocated from the RTEMS Workspace
346for the specified count of messages, each of max_message_size
347bytes in length.  The RTEMS-assigned queue id, returned in id,
348is used to access the message queue.
349
350Specifying @code{@value{RPREFIX}PRIORITY} in attribute_set causes tasks
351waiting for a message to be serviced according to task priority.
352When @code{@value{RPREFIX}FIFO} is specified, waiting tasks are serviced in First
353In-First Out order.
354
355@subheading NOTES:
356
357This directive will not cause the calling task to be
358preempted.
359
360The following message queue attribute constants are
361defined by RTEMS:
362
363@itemize @bullet
364@item @code{@value{RPREFIX}FIFO} - tasks wait by FIFO (default)
365@item @code{@value{RPREFIX}PRIORITY} - tasks wait by priority
366@item @code{@value{RPREFIX}LOCAL} - local message queue (default)
367@item @code{@value{RPREFIX}GLOBAL} - global message queue
368@end itemize
369
370Message queues should not be made global unless
371remote tasks must interact with the created message queue.  This
372is to avoid the system overhead incurred by the creation of a
373global message queue.  When a global message queue is created,
374the message queue's name and id must be transmitted to every
375node in the system for insertion in the local copy of the global
376object table.
377
378For GLOBAL message queues, the maximum message size
379is effectively limited to the longest message which the MPCI is
380capable of transmitting.
381
382The total number of global objects, including message
383queues, is limited by the maximum_global_objects field in the
384configuration table.
385
386@page
387@ifinfo
388@node MESSAGE_QUEUE_IDENT - Get ID of a queue, MESSAGE_QUEUE_DELETE - Delete a queue, MESSAGE_QUEUE_CREATE - Create a queue, Message Manager Directives
389@end ifinfo
390@subsection MESSAGE_QUEUE_IDENT - Get ID of a queue
391
392@subheading CALLING SEQUENCE:
393
394@ifset is-C
395@example
396rtems_status_code rtems_message_queue_ident(
397  rtems_name        name,
398  rtems_unsigned32  node,
399  rtems_id         *id
400);
401@end example
402@end ifset
403
404@ifset is-Ada
405@example
406procedure Message_Queue_Ident (
407   Name   : in     RTEMS.Name;
408   Node   : in     RTEMS.Unsigned32;
409   ID     :    out RTEMS.ID;
410   Result :    out RTEMS.Status_Codes
411);
412@end example
413@end ifset
414
415@subheading DIRECTIVE STATUS CODES:
416@code{@value{RPREFIX}SUCCESSFUL} - queue identified successfully@*
417@code{@value{RPREFIX}INVALID_NAME} - queue name not found@*
418@code{@value{RPREFIX}INVALID_NODE} - invalid node id
419
420@subheading DESCRIPTION:
421
422This directive obtains the queue id associated with
423the queue name specified in name.  If the queue name is not
424unique, then the queue id will match one of the queues with that
425name.  However, this queue id is not guaranteed to correspond to
426the desired queue.  The queue id is used with other message
427related directives to access the message queue.
428
429@subheading NOTES:
430
431This directive will not cause the running task to be
432preempted.
433
434If node is @code{@value{RPREFIX}SEARCH_ALL_NODES}, all nodes are searched
435with the local node being searched first.  All other nodes are
436searched with the lowest numbered node searched first.
437
438If node is a valid node number which does not
439represent the local node, then only the message queues exported
440by the designated node are searched.
441
442This directive does not generate activity on remote
443nodes.  It accesses only the local copy of the global object
444table.
445
446@page
447@ifinfo
448@node MESSAGE_QUEUE_DELETE - Delete a queue, MESSAGE_QUEUE_SEND - Put message at rear of a queue, MESSAGE_QUEUE_IDENT - Get ID of a queue, Message Manager Directives
449@end ifinfo
450@subsection MESSAGE_QUEUE_DELETE - Delete a queue
451
452@subheading CALLING SEQUENCE:
453
454@ifset is-C
455@example
456rtems_status_code rtems_message_queue_delete(
457  rtems_id id
458);
459@end example
460@end ifset
461
462@ifset is-Ada
463@example
464procedure Message_Queue_Delete (
465   ID     : in     RTEMS.ID;
466   Result :    out RTEMS.Status_Codes
467);
468@end example
469@end ifset
470
471@subheading DIRECTIVE STATUS CODES:
472@code{@value{RPREFIX}SUCCESSFUL} - queue deleted successfully@*
473@code{@value{RPREFIX}INVALID_ID} - invalid queue id@*
474@code{@value{RPREFIX}ILLEGAL_ON_REMOTE_OBJECT} - cannot delete remote queue
475
476@subheading DESCRIPTION:
477
478This directive deletes the message queue specified by
479id.  As a result of this directive, all tasks blocked waiting to
480receive a message from this queue will be readied and returned a
481status code which indicates that the message queue was deleted.
482If no tasks are waiting, but the queue contains messages, then
483RTEMS returns these message buffers back to the system message
484buffer pool.  The QCB for this queue as well as the memory for
485the message buffers is reclaimed by RTEMS.
486
487@subheading NOTES:
488
489The calling task will be preempted if its preemption
490mode is enabled and one or more local tasks with a higher
491priority than the calling task are waiting on the deleted queue.
492The calling task will NOT be preempted if the tasks that are
493waiting are remote tasks.
494
495The calling task does not have to be the task that
496created the queue, although the task and queue must reside on
497the same node.
498
499When the queue is deleted, any messages in the queue
500are returned to the free message buffer pool.  Any information
501stored in those messages is lost.
502
503When a global message queue is deleted, the message
504queue id must be transmitted to every node in the system for
505deletion from the local copy of the global object table.
506
507Proxies, used to represent remote tasks, are
508reclaimed when the message queue is deleted.
509
510@page
511@ifinfo
512@node MESSAGE_QUEUE_SEND - Put message at rear of a queue, MESSAGE_QUEUE_URGENT - Put message at front of a queue, MESSAGE_QUEUE_DELETE - Delete a queue, Message Manager Directives
513@end ifinfo
514@subsection MESSAGE_QUEUE_SEND - Put message at rear of a queue
515
516@subheading CALLING SEQUENCE:
517
518@ifset is-C
519@example
520rtems_status_code rtems_message_queue_send(
521  rtems_id           id,
522  void              *buffer,
523  rtems_unsigned32   size
524);
525@end example
526@end ifset
527
528@ifset is-Ada
529@example
530procedure Message_Queue_Send (
531   ID     : in     RTEMS.ID;
532   Buffer : in     RTEMS.Address;
533   Size   : in     RTEMS.Unsigned32;
534   Result :    out RTEMS.Status_Codes
535);
536@end example
537@end ifset
538
539@subheading DIRECTIVE STATUS CODES:
540@code{@value{RPREFIX}SUCCESSFUL} - message sent successfully@*
541@code{@value{RPREFIX}INVALID_ID} - invalid queue id@*
542@code{@value{RPREFIX}INVALID_SIZE} - invalid message size@*
543@code{@value{RPREFIX}UNSATISFIED} - out of message buffers@*
544@code{@value{RPREFIX}TOO_MANY} - queue's limit has been reached
545
546@subheading DESCRIPTION:
547
548This directive sends the message buffer of size bytes
549in length to the queue specified by id.  If a task is waiting at
550the queue, then the message is copied to the waiting task's
551buffer and the task is unblocked. If no tasks are waiting at the
552queue, then the message is copied to a message buffer which is
553obtained from this message queue's message buffer pool.  The
554message buffer is then placed at the rear of the queue.
555
556@subheading NOTES:
557
558The calling task will be preempted if it has
559preemption enabled and a higher priority task is unblocked as
560the result of this directive.
561
562Sending a message to a global message queue which
563does not reside on the local node will generate a request to the
564remote node to post the message on the specified message queue.
565
566If the task to be unblocked resides on a different
567node from the message queue, then the message is forwarded to
568the appropriate node, the waiting task is unblocked, and the
569proxy used to represent the task is reclaimed.
570
571@page
572@ifinfo
573@node MESSAGE_QUEUE_URGENT - Put message at front of a queue, MESSAGE_QUEUE_BROADCAST - Broadcast N messages to a queue, MESSAGE_QUEUE_SEND - Put message at rear of a queue, Message Manager Directives
574@end ifinfo
575@subsection MESSAGE_QUEUE_URGENT - Put message at front of a queue
576
577@subheading CALLING SEQUENCE:
578
579@ifset is-C
580@example
581rtems_status_code rtems_message_queue_urgent(
582  rtems_id           id,
583  void              *buffer,
584  rtems_unsigned32   size
585);
586@end example
587@end ifset
588
589@ifset is-Ada
590@example
591procedure Message_Queue_Urgent (
592   ID     : in     RTEMS.ID;
593   Buffer : in     RTEMS.Address;
594   Size   : in     RTEMS.Unsigned32;
595   Result :    out RTEMS.Status_Codes
596);
597@end example
598@end ifset
599
600@subheading DIRECTIVE STATUS CODES:
601@code{@value{RPREFIX}SUCCESSFUL} - message sent successfully@*
602@code{@value{RPREFIX}INVALID_ID} - invalid queue id@*
603@code{@value{RPREFIX}INVALID_SIZE} - invalid message size@*
604@code{@value{RPREFIX}UNSATISFIED} - out of message buffers@*
605@code{@value{RPREFIX}TOO_MANY} - queue's limit has been reached
606
607@subheading DESCRIPTION:
608
609This directive sends the message buffer of size bytes
610in length to the queue specified by id.  If a task is waiting on
611the queue, then the message is copied to the task's buffer and
612the task is unblocked.  If no tasks are waiting on the queue,
613then the message is copied to a message buffer which is obtained
614from this message queue's message buffer pool.  The message
615buffer is then placed at the front of the queue.
616
617@subheading NOTES:
618
619The calling task will be preempted if it has
620preemption enabled and a higher priority task is unblocked as
621the result of this directive.
622
623Sending a message to a global message queue which
624does not reside on the local node will generate a request
625telling the remote node to post the message on the specified
626message queue.
627
628If the task to be unblocked resides on a different
629node from the message queue, then the message is forwarded to
630the appropriate node, the waiting task is unblocked, and the
631proxy used to represent the task is reclaimed.
632
633@page
634@ifinfo
635@node MESSAGE_QUEUE_BROADCAST - Broadcast N messages to a queue, MESSAGE_QUEUE_RECEIVE - Receive message from a queue, MESSAGE_QUEUE_URGENT - Put message at front of a queue, Message Manager Directives
636@end ifinfo
637@subsection MESSAGE_QUEUE_BROADCAST - Broadcast N messages to a queue
638
639@subheading CALLING SEQUENCE:
640
641@ifset is-C
642@example
643rtems_status_code rtems_message_queue_broadcast(
644  rtems_id           id,
645  void              *buffer,
646  rtems_unsigned32   size,
647  rtems_unsigned32  *count
648);
649@end example
650@end ifset
651
652@ifset is-Ada
653@example
654procedure Message_Queue_Broadcast (
655   ID     : in     RTEMS.ID;
656   Buffer : in     RTEMS.Address;
657   Size   : in     RTEMS.Unsigned32;
658   Count  :    out RTEMS.Unsigned32;
659   Result :    out RTEMS.Status_Codes
660);
661@end example
662@end ifset
663
664@subheading DIRECTIVE STATUS CODES:
665@code{@value{RPREFIX}SUCCESSFUL} - message broadcasted successfully@*
666@code{@value{RPREFIX}INVALID_ID} - invalid queue id@*
667@code{@value{RPREFIX}INVALID_SIZE} - invalid message size
668
669@subheading DESCRIPTION:
670
671This directive causes all tasks that are waiting at
672the queue specified by id to be unblocked and sent the message
673contained in buffer.  Before a task is unblocked, the message
674buffer of size byes in length is copied to that task's message
675buffer.  The number of tasks that were unblocked is returned in
676count.
677
678@subheading NOTES:
679
680The calling task will be preempted if it has
681preemption enabled and a higher priority task is unblocked as
682the result of this directive.
683
684The execution time of this directive is directly
685related to the number of tasks waiting on the message queue,
686although it is more efficient than the equivalent number of
687invocations of @code{@value{DIRPREFIX}message_queue_send}.
688
689Broadcasting a message to a global message queue
690which does not reside on the local node will generate a request
691telling the remote node to broadcast the message to the
692specified message queue.
693
694When a task is unblocked which resides on a different
695node from the message queue, a copy of the message is forwarded
696to the appropriate node,  the waiting task is unblocked, and the
697proxy used to represent the task is reclaimed.
698
699@page
700@ifinfo
701@node MESSAGE_QUEUE_RECEIVE - Receive message from a queue, MESSAGE_QUEUE_GET_NUMBER_PENDING - Get number of messages pending on a queue, MESSAGE_QUEUE_BROADCAST - Broadcast N messages to a queue, Message Manager Directives
702@end ifinfo
703@subsection MESSAGE_QUEUE_RECEIVE - Receive message from a queue
704
705@subheading CALLING SEQUENCE:
706
707@ifset is-C
708@example
709rtems_status_code rtems_message_queue_receive(
710  rtems_id           id,
711  void              *buffer,
712  rtems_unsigned32  *size,
713  rtems_unsigned32   option_set,
714  rtems_interval     timeout
715);
716@end example
717@end ifset
718
719@ifset is-Ada
720@example
721procedure Message_Queue_Receive (
722   ID         : in     RTEMS.ID;
723   Buffer     : in     RTEMS.Address;
724   Option_Set : in     RTEMS.Option;
725   Timeout    : in     RTEMS.Interval;
726   Size       :    out RTEMS.Unsigned32;
727   Result     :    out RTEMS.Status_Codes
728);
729@end example
730@end ifset
731
732@subheading DIRECTIVE STATUS CODES:
733@code{@value{RPREFIX}SUCCESSFUL} - message received successfully@*
734@code{@value{RPREFIX}INVALID_ID} - invalid queue id@*
735@code{@value{RPREFIX}UNSATISFIED} - queue is empty@*
736@code{@value{RPREFIX}TIMEOUT} - timed out waiting for message@*
737@code{@value{RPREFIX}OBJECT_WAS_DELETED} - queue deleted while waiting
738
739@subheading DESCRIPTION:
740
741This directive receives a message from the message
742queue specified in id.  The @code{@value{RPREFIX}WAIT} and @code{@value{RPREFIX}NO_WAIT} options of the
743options parameter allow the calling task to specify whether to
744wait for a message to become available or return immediately.
745For either option, if there is at least one message in the
746queue, then it is copied to buffer, size is set to return the
747length of the message in bytes, and this directive returns
748immediately with a successful return code.
749
750If the calling task chooses to return immediately and
751the queue is empty, then a status code indicating this condition
752is returned.  If the calling task chooses to wait at the message
753queue and the queue is empty, then the calling task is placed on
754the message wait queue and blocked.  If the queue was created
755with the @code{@value{RPREFIX}PRIORITY} option specified, then
756the calling task is inserted into the wait queue according to
757its priority.  But, if the queue was created with the
758@code{@value{RPREFIX}FIFO} option specified, then the
759calling task is placed at the rear of the wait queue.
760
761A task choosing to wait at the queue can optionally
762specify a timeout value in the timeout parameter.  The timeout
763parameter specifies the maximum interval to wait before the
764calling task desires to be unblocked.  If it is set to
765@code{@value{RPREFIX}NO_TIMEOUT}, then the calling task will wait forever.
766
767@subheading NOTES:
768
769The following message receive option constants are
770defined by RTEMS:
771
772@itemize @bullet
773@item @code{@value{RPREFIX}WAIT} - task will wait for a message (default)
774@item @code{@value{RPREFIX}NO_WAIT} - task should not wait
775@end itemize
776
777Receiving a message from a global message queue which
778does not reside on the local node will generate a request to the
779remote node to obtain a message from the specified message
780queue.  If no message is available and @code{@value{RPREFIX}WAIT} was specified, then
781the task must be blocked until a message is posted.  A proxy is
782allocated on the remote node to represent the task until the
783message is posted.
784
785A clock tick is required to support the timeout functionality of
786this directive.
787
788@page
789@ifinfo
790@node MESSAGE_QUEUE_GET_NUMBER_PENDING - Get number of messages pending on a queue, MESSAGE_QUEUE_FLUSH - Flush all messages on a queue, MESSAGE_QUEUE_RECEIVE - Receive message from a queue, Message Manager Directives
791@end ifinfo
792@subsection MESSAGE_QUEUE_GET_NUMBER_PENDING - Get number of messages pending on a queue
793
794@subheading CALLING SEQUENCE:
795
796@ifset is-C
797@example
798rtems_status_code rtems_message_queue_get_number_pending(
799  rtems_id          id,
800  rtems_unsigned32 *count
801);
802@end example
803@end ifset
804
805@ifset is-Ada
806@example
807procedure Message_Queue_Get_Number_Pending (
808   ID     : in     RTEMS.ID;
809   Count  :    out RTEMS.Unsigned32;
810   Result :    out RTEMS.Status_Codes
811);
812@end example
813@end ifset
814
815@subheading DIRECTIVE STATUS CODES:
816@code{@value{RPREFIX}SUCCESSFUL} - number of messages pending returned successfully@*
817@code{@value{RPREFIX}INVALID_ID} - invalid queue id
818
819@subheading DESCRIPTION:
820
821This directive returns the number of messages pending on this
822message queue in count.  If no messages are present
823on the queue, count is set to zero.
824
825@subheading NOTES:
826
827Getting the number of pending messages on a global message queue which
828does not reside on the local node will generate a request to the
829remote node to actually obtain the pending message count for
830the specified message queue.
831
832
833@page
834@ifinfo
835@node MESSAGE_QUEUE_FLUSH - Flush all messages on a queue, Event Manager, MESSAGE_QUEUE_GET_NUMBER_PENDING - Get number of messages pending on a queue, Message Manager Directives
836@end ifinfo
837@subsection MESSAGE_QUEUE_FLUSH - Flush all messages on a queue
838
839@subheading CALLING SEQUENCE:
840
841@ifset is-C
842@example
843rtems_status_code rtems_message_queue_flush(
844  rtems_id          id,
845  rtems_unsigned32 *count
846);
847@end example
848@end ifset
849
850@ifset is-Ada
851@example
852procedure Message_Queue_Flush (
853   ID     : in     RTEMS.ID;
854   Count  :    out RTEMS.Unsigned32;
855   Result :    out RTEMS.Status_Codes
856);
857@end example
858@end ifset
859
860@subheading DIRECTIVE STATUS CODES:
861@code{@value{RPREFIX}SUCCESSFUL} - message queue flushed successfully@*
862@code{@value{RPREFIX}INVALID_ID} - invalid queue id
863
864@subheading DESCRIPTION:
865
866This directive removes all pending messages from the
867specified queue id.  The number of messages removed is returned
868in count.  If no messages are present on the queue, count is set
869to zero.
870
871@subheading NOTES:
872
873Flushing all messages on a global message queue which
874does not reside on the local node will generate a request to the
875remote node to actually flush the specified message queue.
876
Note: See TracBrowser for help on using the repository browser.