OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [rtems-20020807/] [doc/] [user/] [msg.t] - Blame information for rev 1765

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.