source: rtems/cpukit/include/rtems/rtems/message.h @ dbb7c956

Last change on this file since dbb7c956 was dbb7c956, checked in by Sebastian Huber <sebastian.huber@…>, on 09/15/21 at 09:44:40

rtems: Fix message manager documentation

Correct the description of the count parameter of
rtems_message_queue_flush().

Update #4508.

  • Property mode set to 100644
File size: 33.5 KB
Line 
1/* SPDX-License-Identifier: BSD-2-Clause */
2
3/**
4 * @file
5 *
6 * @ingroup RTEMSImplClassicMessage
7 *
8 * @brief This header file defines the Message Manager API.
9 */
10
11/*
12 * Copyright (C) 2020, 2021 embedded brains GmbH (http://www.embedded-brains.de)
13 * Copyright (C) 1988, 2008 On-Line Applications Research Corporation (OAR)
14 *
15 * Redistribution and use in source and binary forms, with or without
16 * modification, are permitted provided that the following conditions
17 * are met:
18 * 1. Redistributions of source code must retain the above copyright
19 *    notice, this list of conditions and the following disclaimer.
20 * 2. Redistributions in binary form must reproduce the above copyright
21 *    notice, this list of conditions and the following disclaimer in the
22 *    documentation and/or other materials provided with the distribution.
23 *
24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
28 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
32 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34 * POSSIBILITY OF SUCH DAMAGE.
35 */
36
37/*
38 * This file is part of the RTEMS quality process and was automatically
39 * generated.  If you find something that needs to be fixed or
40 * worded better please post a report or patch to an RTEMS mailing list
41 * or raise a bug report:
42 *
43 * https://www.rtems.org/bugs.html
44 *
45 * For information on updating and regenerating please refer to the How-To
46 * section in the Software Requirements Engineering chapter of the
47 * RTEMS Software Engineering manual.  The manual is provided as a part of
48 * a release.  For development sources please refer to the online
49 * documentation at:
50 *
51 * https://docs.rtems.org
52 */
53
54/* Generated from spec:/rtems/message/if/header */
55
56#ifndef _RTEMS_RTEMS_MESSAGE_H
57#define _RTEMS_RTEMS_MESSAGE_H
58
59#include <stddef.h>
60#include <stdint.h>
61#include <rtems/rtems/attr.h>
62#include <rtems/rtems/options.h>
63#include <rtems/rtems/status.h>
64#include <rtems/rtems/types.h>
65#include <rtems/score/coremsgbuffer.h>
66
67#ifdef __cplusplus
68extern "C" {
69#endif
70
71/* Generated from spec:/rtems/message/if/group */
72
73/**
74 * @defgroup RTEMSAPIClassicMessage Message Manager
75 *
76 * @ingroup RTEMSAPIClassic
77 *
78 * @brief The Message Manager provides communication and synchronization
79 *   capabilities using RTEMS message queues.
80 */
81
82/* Generated from spec:/rtems/message/if/config */
83
84/**
85 * @ingroup RTEMSAPIClassicMessage
86 *
87 * @brief This structure defines the configuration of a message queue
88 *   constructed by rtems_message_queue_construct().
89 */
90typedef struct {
91  /**
92   * @brief This member defines the name of the message queue.
93   */
94  rtems_name name;
95
96  /**
97   * @brief This member defines the maximum number of pending messages supported
98   *   by the message queue.
99   */
100  uint32_t maximum_pending_messages;
101
102  /**
103   * @brief This member defines the maximum message size supported by the message
104   *   queue.
105   */
106  size_t maximum_message_size;
107
108  /**
109   * @brief This member shall point to the message buffer storage area begin.
110   *
111   * The message buffer storage area for the message queue shall be an array of
112   * the type defined by RTEMS_MESSAGE_QUEUE_BUFFER() with a maximum message size
113   * equal to the maximum message size of this configuration.
114   */
115  void *storage_area;
116
117  /**
118   * @brief This member defines size of the message buffer storage area in bytes.
119   */
120  size_t storage_size;
121
122  /**
123   * @brief This member defines the optional handler to free the message buffer
124   *   storage area.
125   *
126   * It is called when the message queue is deleted.  It is called from task
127   * context under protection of the object allocator lock.  It is allowed to
128   * call free() in this handler.  If handler is NULL, then no action will be
129   * performed.
130   */
131  void ( *storage_free )( void * );
132
133  /**
134   * @brief This member defines the attributes of the message queue.
135   */
136  rtems_attribute attributes;
137} rtems_message_queue_config;
138
139/* Generated from spec:/rtems/message/if/create */
140
141/**
142 * @ingroup RTEMSAPIClassicMessage
143 *
144 * @brief Creates a message queue.
145 *
146 * @param name is the object name of the message queue.
147 *
148 * @param count is the maximum count of pending messages supported by the
149 *   message queue.
150 *
151 * @param max_message_size is the maximum size in bytes of a message supported
152 *   by the message queue.
153 *
154 * @param attribute_set is the attribute set of the message queue.
155 *
156 * @param[out] id is the pointer to an ::rtems_id object.  When the directive
157 *   call is successful, the identifier of the created message queue will be
158 *   stored in this object.
159 *
160 * This directive creates a message queue which resides on the local node.  The
161 * message queue has the user-defined object name specified in ``name``.
162 * Memory is allocated from the RTEMS Workspace for the count of messages
163 * specified in ``count``, each of ``max_message_size`` bytes in length.  The
164 * assigned object identifier is returned in ``id``.  This identifier is used
165 * to access the message queue with other message queue related directives.
166 *
167 * The **attribute set** specified in ``attribute_set`` is built through a
168 * *bitwise or* of the attribute constants described below.  Not all
169 * combinations of attributes are allowed.  Some attributes are mutually
170 * exclusive.  If mutually exclusive attributes are combined, the behaviour is
171 * undefined.  Attributes not mentioned below are not evaluated by this
172 * directive and have no effect.  Default attributes can be selected by using
173 * the #RTEMS_DEFAULT_ATTRIBUTES constant.  The attribute set defines
174 *
175 * * the scope of the message queue: #RTEMS_LOCAL (default) or #RTEMS_GLOBAL
176 *   and
177 *
178 * * the task wait queue discipline used by the message queue: #RTEMS_FIFO
179 *   (default) or #RTEMS_PRIORITY.
180 *
181 * The message queue has a local or global **scope** in a multiprocessing
182 * network (this attribute does not refer to SMP systems).  The scope is
183 * selected by the mutually exclusive #RTEMS_LOCAL and #RTEMS_GLOBAL
184 * attributes.
185 *
186 * * A **local scope** is the default and can be emphasized through the use of
187 *   the #RTEMS_LOCAL attribute.  A local message queue can be only used by the
188 *   node which created it.
189 *
190 * * A **global scope** is established if the #RTEMS_GLOBAL attribute is set.
191 *   Setting the global attribute in a single node system has no effect.
192 *
193 * The **task wait queue discipline** is selected by the mutually exclusive
194 * #RTEMS_FIFO and #RTEMS_PRIORITY attributes. The discipline defines the order
195 * in which tasks wait for a message to receive on a currently empty message
196 * queue.
197 *
198 * * The **FIFO discipline** is the default and can be emphasized through use
199 *   of the #RTEMS_FIFO attribute.
200 *
201 * * The **priority discipline** is selected by the #RTEMS_PRIORITY attribute.
202 *
203 * @retval ::RTEMS_SUCCESSFUL The requested operation was successful.
204 *
205 * @retval ::RTEMS_INVALID_NAME The ``name`` parameter was invalid.
206 *
207 * @retval ::RTEMS_INVALID_ADDRESS The ``id`` parameter was NULL.
208 *
209 * @retval ::RTEMS_INVALID_NUMBER The ``count`` parameter was invalid.
210 *
211 * @retval ::RTEMS_INVALID_SIZE The ``max_message_size`` parameter was invalid.
212 *
213 * @retval ::RTEMS_TOO_MANY There was no inactive object available to create a
214 *   message queue.  The number of message queue available to the application
215 *   is configured through the #CONFIGURE_MAXIMUM_MESSAGE_QUEUES application
216 *   configuration option.
217 *
218 * @retval ::RTEMS_TOO_MANY In multiprocessing configurations, there was no
219 *   inactive global object available to create a global message queue.  The
220 *   number of global objects available to the application is configured
221 *   through the #CONFIGURE_MP_MAXIMUM_GLOBAL_OBJECTS application configuration
222 *   option.
223 *
224 * @retval ::RTEMS_INVALID_NUMBER The product of ``count`` and
225 *   ``max_message_size`` is greater than the maximum storage size.
226 *
227 * @retval ::RTEMS_UNSATISFIED There was not enough memory available in the
228 *   RTEMS Workspace to allocate the message buffers for the message queue.
229 *
230 * @par Notes
231 * @parblock
232 * For message queues with a global scope, the maximum message size is
233 * effectively limited to the longest message which the MPCI is capable of
234 * transmitting.
235 *
236 * For control and maintenance of the message queue, RTEMS allocates a QCB from
237 * the local QCB free pool and initializes it.
238 *
239 * The QCB for a global message queue is allocated on the local node.  Message
240 * queues should not be made global unless remote tasks must interact with the
241 * message queue.  This is to avoid the system overhead incurred by the
242 * creation of a global message queue.  When a global message queue is created,
243 * the message queue's name and identifier must be transmitted to every node in
244 * the system for insertion in the local copy of the global object table.
245 * @endparblock
246 *
247 * @par Constraints
248 * @parblock
249 * The following constraints apply to this directive:
250 *
251 * * The directive may be called from within device driver initialization
252 *   context.
253 *
254 * * The directive may be called from within task context.
255 *
256 * * The directive may obtain and release the object allocator mutex.  This may
257 *   cause the calling task to be preempted.
258 *
259 * * When the directive operates on a global object, the directive sends a
260 *   message to remote nodes.  This may preempt the calling task.
261 *
262 * * The number of message queues available to the application is configured
263 *   through the #CONFIGURE_MAXIMUM_MESSAGE_QUEUES application configuration
264 *   option.
265 *
266 * * Where the object class corresponding to the directive is configured to use
267 *   unlimited objects, the directive may allocate memory from the RTEMS
268 *   Workspace.
269 *
270 * * The number of global objects available to the application is configured
271 *   through the #CONFIGURE_MP_MAXIMUM_GLOBAL_OBJECTS application configuration
272 *   option.
273 * @endparblock
274 */
275rtems_status_code rtems_message_queue_create(
276  rtems_name      name,
277  uint32_t        count,
278  size_t          max_message_size,
279  rtems_attribute attribute_set,
280  rtems_id       *id
281);
282
283/* Generated from spec:/rtems/message/if/construct */
284
285/**
286 * @ingroup RTEMSAPIClassicMessage
287 *
288 * @brief Constructs a message queue from the specified the message queue
289 *   configuration.
290 *
291 * @param config is the message queue configuration.
292 *
293 * @param[out] id is the pointer to an ::rtems_id object.  When the directive
294 *   call is successful, the identifier of the constructed message queue will
295 *   be stored in this object.
296 *
297 * @retval ::RTEMS_SUCCESSFUL The requested operation was successful.
298 *
299 * @retval ::RTEMS_INVALID_ADDRESS The ``config`` parameter was NULL.
300 *
301 * @retval ::RTEMS_INVALID_NAME The message queue name in the configuration was
302 *   invalid.
303 *
304 * @retval ::RTEMS_INVALID_ADDRESS The ``id`` parameter was NULL.
305 *
306 * @retval ::RTEMS_INVALID_NUMBER The maximum number of pending messages in the
307 *   configuration was zero.
308 *
309 * @retval ::RTEMS_INVALID_SIZE The maximum message size in the configuration
310 *   was zero.
311 *
312 * @retval ::RTEMS_TOO_MANY There was no inactive message queue object
313 *   available to construct a message queue.
314 *
315 * @retval ::RTEMS_TOO_MANY In multiprocessing configurations, there was no
316 *   inactive global object available to construct a global message queue.
317 *
318 * @retval ::RTEMS_INVALID_SIZE The maximum message size in the configuration
319 *   was too big and resulted in integer overflows in calculations carried out
320 *   to determine the size of the message buffer area.
321 *
322 * @retval ::RTEMS_INVALID_NUMBER The maximum number of pending messages in the
323 *   configuration was too big and resulted in integer overflows in
324 *   calculations carried out to determine the size of the message buffer area.
325 *
326 * @retval ::RTEMS_UNSATISFIED The message queue storage area begin pointer in
327 *   the configuration was NULL.
328 *
329 * @retval ::RTEMS_UNSATISFIED The message queue storage area size in the
330 *   configuration was not equal to the size calculated from the maximum number
331 *   of pending messages and the maximum message size.
332 *
333 * @par Notes
334 * @parblock
335 * In contrast to message queues created by rtems_message_queue_create(), the
336 * message queues constructed by this directive use a user-provided message
337 * buffer storage area.
338 *
339 * This directive is intended for applications which do not want to use the
340 * RTEMS Workspace and instead statically allocate all operating system
341 * resources.  An application based solely on static allocation can avoid any
342 * runtime memory allocators.  This can simplify the application architecture
343 * as well as any analysis that may be required.
344 *
345 * The value for #CONFIGURE_MESSAGE_BUFFER_MEMORY should not include memory for
346 * message queues constructed by rtems_message_queue_construct().
347 * @endparblock
348 *
349 * @par Constraints
350 * @parblock
351 * The following constraints apply to this directive:
352 *
353 * * The directive may be called from within device driver initialization
354 *   context.
355 *
356 * * The directive may be called from within task context.
357 *
358 * * The directive may obtain and release the object allocator mutex.  This may
359 *   cause the calling task to be preempted.
360 *
361 * * When the directive operates on a global object, the directive sends a
362 *   message to remote nodes.  This may preempt the calling task.
363 *
364 * * The number of message queues available to the application is configured
365 *   through the #CONFIGURE_MAXIMUM_MESSAGE_QUEUES application configuration
366 *   option.
367 *
368 * * Where the object class corresponding to the directive is configured to use
369 *   unlimited objects, the directive may allocate memory from the RTEMS
370 *   Workspace.
371 *
372 * * The number of global objects available to the application is configured
373 *   through the #CONFIGURE_MP_MAXIMUM_GLOBAL_OBJECTS application configuration
374 *   option.
375 * @endparblock
376 */
377rtems_status_code rtems_message_queue_construct(
378  const rtems_message_queue_config *config,
379  rtems_id                         *id
380);
381
382/* Generated from spec:/rtems/message/if/ident */
383
384/**
385 * @ingroup RTEMSAPIClassicMessage
386 *
387 * @brief Identifies a message queue by the object name.
388 *
389 * @param name is the object name to look up.
390 *
391 * @param node is the node or node set to search for a matching object.
392 *
393 * @param[out] id is the pointer to an ::rtems_id object.  When the directive
394 *   call is successful, the object identifier of an object with the specified
395 *   name will be stored in this object.
396 *
397 * This directive obtains a message queue identifier associated with the
398 * message queue name specified in ``name``.
399 *
400 * The node to search is specified in ``node``.  It shall be
401 *
402 * * a valid node number,
403 *
404 * * the constant #RTEMS_SEARCH_ALL_NODES to search in all nodes,
405 *
406 * * the constant #RTEMS_SEARCH_LOCAL_NODE to search in the local node only, or
407 *
408 * * the constant #RTEMS_SEARCH_OTHER_NODES to search in all nodes except the
409 *   local node.
410 *
411 * @retval ::RTEMS_SUCCESSFUL The requested operation was successful.
412 *
413 * @retval ::RTEMS_INVALID_ADDRESS The ``id`` parameter was NULL.
414 *
415 * @retval ::RTEMS_INVALID_NAME The ``name`` parameter was 0.
416 *
417 * @retval ::RTEMS_INVALID_NAME There was no object with the specified name on
418 *   the specified nodes.
419 *
420 * @retval ::RTEMS_INVALID_NODE In multiprocessing configurations, the
421 *   specified node was invalid.
422 *
423 * @par Notes
424 * @parblock
425 * If the message queue name is not unique, then the message queue identifier
426 * will match the first message queue with that name in the search order.
427 * However, this message queue identifier is not guaranteed to correspond to
428 * the desired message queue.
429 *
430 * The objects are searched from lowest to the highest index.  If ``node`` is
431 * #RTEMS_SEARCH_ALL_NODES, all nodes are searched with the local node being
432 * searched first.  All other nodes are searched from lowest to the highest
433 * node number.
434 *
435 * If node is a valid node number which does not represent the local node, then
436 * only the message queues exported by the designated node are searched.
437 *
438 * This directive does not generate activity on remote nodes.  It accesses only
439 * the local copy of the global object table.
440 *
441 * The message queue identifier is used with other message related directives
442 * to access the message queue.
443 * @endparblock
444 *
445 * @par Constraints
446 * @parblock
447 * The following constraints apply to this directive:
448 *
449 * * The directive may be called from within any runtime context.
450 *
451 * * The directive will not cause the calling task to be preempted.
452 * @endparblock
453 */
454rtems_status_code rtems_message_queue_ident(
455  rtems_name name,
456  uint32_t   node,
457  rtems_id  *id
458);
459
460/* Generated from spec:/rtems/message/if/delete */
461
462/**
463 * @ingroup RTEMSAPIClassicMessage
464 *
465 * @brief Deletes the message queue.
466 *
467 * @param id is the message queue identifier.
468 *
469 * This directive deletes the message queue specified by ``id``. As a result of
470 * this directive, all tasks blocked waiting to receive a message from this
471 * queue will be readied and returned a status code which indicates that the
472 * message queue was deleted.
473 *
474 * @retval ::RTEMS_SUCCESSFUL The requested operation was successful.
475 *
476 * @retval ::RTEMS_INVALID_ID There was no message queue associated with the
477 *   identifier specified by ``id``.
478 *
479 * @retval ::RTEMS_ILLEGAL_ON_REMOTE_OBJECT The message queue resided on a
480 *   remote node.
481 *
482 * @par Notes
483 * @parblock
484 * When the message queue is deleted, any messages in the queue are returned to
485 * the free message buffer pool.  Any information stored in those messages is
486 * lost.  The message buffers allocated for the message queue are reclaimed.
487 *
488 * The QCB for the deleted message queue is reclaimed by RTEMS.
489 *
490 * When a global message queue is deleted, the message queue identifier must be
491 * transmitted to every node in the system for deletion from the local copy of
492 * the global object table.
493 *
494 * The message queue must reside on the local node, even if the message queue
495 * was created with the #RTEMS_GLOBAL attribute.
496 *
497 * Proxies, used to represent remote tasks, are reclaimed when the message
498 * queue is deleted.
499 * @endparblock
500 *
501 * @par Constraints
502 * @parblock
503 * The following constraints apply to this directive:
504 *
505 * * The directive may be called from within device driver initialization
506 *   context.
507 *
508 * * The directive may be called from within task context.
509 *
510 * * The directive may obtain and release the object allocator mutex.  This may
511 *   cause the calling task to be preempted.
512 *
513 * * When the directive operates on a global object, the directive sends a
514 *   message to remote nodes.  This may preempt the calling task.
515 *
516 * * The calling task does not have to be the task that created the object.
517 *   Any local task that knows the object identifier can delete the object.
518 *
519 * * Where the object class corresponding to the directive is configured to use
520 *   unlimited objects, the directive may free memory to the RTEMS Workspace.
521 * @endparblock
522 */
523rtems_status_code rtems_message_queue_delete( rtems_id id );
524
525/* Generated from spec:/rtems/message/if/send */
526
527/**
528 * @ingroup RTEMSAPIClassicMessage
529 *
530 * @brief Puts the message at the rear of the queue.
531 *
532 * @param id is the queue identifier.
533 *
534 * @param buffer is the begin address of the message buffer to send.
535 *
536 * @param size is the size in bytes of the message buffer to send.
537 *
538 * This directive sends the message ``buffer`` of ``size`` bytes in length to
539 * the queue specified by ``id``.  If a task is waiting at the queue, then the
540 * message is copied to the waiting task's buffer and the task is unblocked. If
541 * no tasks are waiting at the queue, then the message is copied to a message
542 * buffer which is obtained from this message queue's message buffer pool.  The
543 * message buffer is then placed at the rear of the queue.
544 *
545 * @retval ::RTEMS_SUCCESSFUL The requested operation was successful.
546 *
547 * @retval ::RTEMS_INVALID_ID There was no queue associated with the identifier
548 *   specified by ``id``.
549 *
550 * @retval ::RTEMS_INVALID_ADDRESS The ``buffer`` parameter was NULL.
551 *
552 * @retval ::RTEMS_INVALID_SIZE The size of the message exceeded the maximum
553 *   message size of the queue as defined by rtems_message_queue_create() or
554 *   rtems_message_queue_construct().
555 *
556 * @retval ::RTEMS_TOO_MANY The maximum number of pending messages supported by
557 *   the queue as defined by rtems_message_queue_create() or
558 *   rtems_message_queue_construct() has been reached.
559 *
560 * @par Constraints
561 * @parblock
562 * The following constraints apply to this directive:
563 *
564 * * The directive may be called from within task context.
565 *
566 * * The directive may be called from within interrupt context.
567 *
568 * * The directive may unblock a task.  This may cause the calling task to be
569 *   preempted.
570 *
571 * * When the directive operates on a remote object, the directive sends a
572 *   message to the remote node and waits for a reply.  This will preempt the
573 *   calling task.
574 * @endparblock
575 */
576rtems_status_code rtems_message_queue_send(
577  rtems_id    id,
578  const void *buffer,
579  size_t      size
580);
581
582/* Generated from spec:/rtems/message/if/urgent */
583
584/**
585 * @ingroup RTEMSAPIClassicMessage
586 *
587 * @brief Puts the message at the front of the queue.
588 *
589 * @param id is the queue identifier.
590 *
591 * @param buffer is the begin address of the message buffer to send urgently.
592 *
593 * @param size is the size in bytes of the message buffer to send urgently.
594 *
595 * This directive sends the message ``buffer`` of ``size`` bytes in length to
596 * the queue specified by ``id``.  If a task is waiting at the queue, then the
597 * message is copied to the waiting task's buffer and the task is unblocked. If
598 * no tasks are waiting at the queue, then the message is copied to a message
599 * buffer which is obtained from this message queue's message buffer pool.  The
600 * message buffer is then placed at the front of the queue.
601 *
602 * @retval ::RTEMS_SUCCESSFUL The requested operation was successful.
603 *
604 * @retval ::RTEMS_INVALID_ID There was no queue associated with the identifier
605 *   specified by ``id``.
606 *
607 * @retval ::RTEMS_INVALID_ADDRESS The ``buffer`` parameter was NULL.
608 *
609 * @retval ::RTEMS_INVALID_SIZE The size of the message exceeded the maximum
610 *   message size of the queue as defined by rtems_message_queue_create() or
611 *   rtems_message_queue_construct().
612 *
613 * @retval ::RTEMS_TOO_MANY The maximum number of pending messages supported by
614 *   the queue as defined by rtems_message_queue_create() or
615 *   rtems_message_queue_construct() has been reached.
616 *
617 * @par Constraints
618 * @parblock
619 * The following constraints apply to this directive:
620 *
621 * * The directive may be called from within task context.
622 *
623 * * The directive may be called from within interrupt context.
624 *
625 * * The directive may unblock a task.  This may cause the calling task to be
626 *   preempted.
627 *
628 * * When the directive operates on a remote object, the directive sends a
629 *   message to the remote node and waits for a reply.  This will preempt the
630 *   calling task.
631 * @endparblock
632 */
633rtems_status_code rtems_message_queue_urgent(
634  rtems_id    id,
635  const void *buffer,
636  size_t      size
637);
638
639/* Generated from spec:/rtems/message/if/broadcast */
640
641/**
642 * @ingroup RTEMSAPIClassicMessage
643 *
644 * @brief Broadcasts the messages to the tasks waiting at the queue.
645 *
646 * @param id is the queue identifier.
647 *
648 * @param buffer is the begin address of the message buffer to broadcast.
649 *
650 * @param size is the size in bytes of the message buffer to broadcast.
651 *
652 * @param[out] count is the pointer to an uint32_t object.  When the directive
653 *   call is successful, the number of unblocked tasks will be stored in this
654 *   object.
655 *
656 * This directive causes all tasks that are waiting at the queue specified by
657 * ``id`` to be unblocked and sent the message contained in ``buffer``.  Before
658 * a task is unblocked, the message ``buffer`` of ``size`` byes in length is
659 * copied to that task's message buffer.  The number of tasks that were
660 * unblocked is returned in ``count``.
661 *
662 * @retval ::RTEMS_SUCCESSFUL The requested operation was successful.
663 *
664 * @retval ::RTEMS_INVALID_ID There was no queue associated with the identifier
665 *   specified by ``id``.
666 *
667 * @retval ::RTEMS_INVALID_ADDRESS The ``buffer`` parameter was NULL.
668 *
669 * @retval ::RTEMS_INVALID_ADDRESS The ``count`` parameter was NULL.
670 *
671 * @retval ::RTEMS_INVALID_SIZE The size of the message exceeded the maximum
672 *   message size of the queue as defined by rtems_message_queue_create() or
673 *   rtems_message_queue_construct().
674 *
675 * @par Notes
676 * The execution time of this directive is directly related to the number of
677 * tasks waiting on the message queue, although it is more efficient than the
678 * equivalent number of invocations of rtems_message_queue_send().
679 *
680 * @par Constraints
681 * @parblock
682 * The following constraints apply to this directive:
683 *
684 * * The directive may be called from within task context.
685 *
686 * * The directive may be called from within interrupt context.
687 *
688 * * The directive may unblock a task.  This may cause the calling task to be
689 *   preempted.
690 *
691 * * When the directive operates on a remote object, the directive sends a
692 *   message to the remote node and waits for a reply.  This will preempt the
693 *   calling task.
694 * @endparblock
695 */
696rtems_status_code rtems_message_queue_broadcast(
697  rtems_id    id,
698  const void *buffer,
699  size_t      size,
700  uint32_t   *count
701);
702
703/* Generated from spec:/rtems/message/if/receive */
704
705/**
706 * @ingroup RTEMSAPIClassicMessage
707 *
708 * @brief Receives a message from the queue.
709 *
710 * @param id is the queue identifier.
711 *
712 * @param buffer is the begin address of the buffer to receive the message.
713 *   The buffer shall be large enough to receive a message of the maximum
714 *   length of the queue as defined by rtems_message_queue_create() or
715 *   rtems_message_queue_construct().  The ``size`` parameter cannot be used to
716 *   specify the size of the buffer.
717 *
718 * @param[out] size is the pointer to a size_t object.  When the directive call
719 *   is successful, the size in bytes of the received messages will be stored
720 *   in this object.  This parameter cannot be used to specify the size of the
721 *   buffer.
722 *
723 * @param option_set is the option set.
724 *
725 * @param timeout is the timeout in clock ticks if the #RTEMS_WAIT option is
726 *   set.  Use #RTEMS_NO_TIMEOUT to wait potentially forever.
727 *
728 * This directive receives a message from the queue specified by ``id``.
729 *
730 * The **option set** specified in ``option_set`` is built through a *bitwise
731 * or* of the option constants described below.  Not all combinations of
732 * options are allowed.  Some options are mutually exclusive.  If mutually
733 * exclusive options are combined, the behaviour is undefined.  Options not
734 * mentioned below are not evaluated by this directive and have no effect.
735 * Default options can be selected by using the #RTEMS_DEFAULT_OPTIONS
736 * constant.
737 *
738 * The calling task can **wait** or **try to receive** a message from the queue
739 * according to the mutually exclusive #RTEMS_WAIT and #RTEMS_NO_WAIT options.
740 *
741 * * **Waiting to receive** a message from the queue is the default and can be
742 *   emphasized through the use of the #RTEMS_WAIT option. The ``timeout``
743 *   parameter defines how long the calling task is willing to wait.  Use
744 *   #RTEMS_NO_TIMEOUT to wait potentially forever, otherwise set a timeout
745 *   interval in clock ticks.
746 *
747 * * **Trying to receive** a message from the queue is selected by the
748 *   #RTEMS_NO_WAIT option.  If this option is defined, then the ``timeout``
749 *   parameter is ignored.  When a message from the queue cannot be immediately
750 *   received, then the ::RTEMS_UNSATISFIED status is returned.
751 *
752 * With either #RTEMS_WAIT or #RTEMS_NO_WAIT if there is at least one message
753 * in the queue, then it is copied to the buffer, the size is set to return the
754 * length of the message in bytes, and this directive returns immediately with
755 * the ::RTEMS_SUCCESSFUL status code.  The buffer has to be big enough to
756 * receive a message of the maximum length with respect to this message queue.
757 *
758 * If the calling task chooses to return immediately and the queue is empty,
759 * then the directive returns immediately with the ::RTEMS_UNSATISFIED status
760 * code.  If the calling task chooses to wait at the message queue and the
761 * queue is empty, then the calling task is placed on the message wait queue
762 * and blocked.  If the queue was created with the #RTEMS_PRIORITY option
763 * specified, then the calling task is inserted into the wait queue according
764 * to its priority.  But, if the queue was created with the #RTEMS_FIFO option
765 * specified, then the calling task is placed at the rear of the wait queue.
766 *
767 * @retval ::RTEMS_SUCCESSFUL The requested operation was successful.
768 *
769 * @retval ::RTEMS_INVALID_ID There was no queue associated with the identifier
770 *   specified by ``id``.
771 *
772 * @retval ::RTEMS_INVALID_ADDRESS The ``buffer`` parameter was NULL.
773 *
774 * @retval ::RTEMS_INVALID_ADDRESS The ``size`` parameter was NULL.
775 *
776 * @retval ::RTEMS_UNSATISFIED The queue was empty.
777 *
778 * @retval ::RTEMS_TIMEOUT The timeout happened while the calling task was
779 *   waiting to receive a message
780 *
781 * @retval ::RTEMS_OBJECT_WAS_DELETED The queue was deleted while the calling
782 *   task was waiting to receive a message.
783 *
784 * @par Constraints
785 * @parblock
786 * The following constraints apply to this directive:
787 *
788 * * When a local queue is accessed and the #RTEMS_NO_WAIT option is set, the
789 *   directive may be called from within interrupt context.
790 *
791 * * The directive may be called from within task context.
792 *
793 * * When the request cannot be immediately satisfied and the #RTEMS_WAIT
794 *   option is set, the calling task blocks at some point during the directive
795 *   call.
796 *
797 * * The timeout functionality of the directive requires a clock tick.
798 *
799 * * When the directive operates on a remote object, the directive sends a
800 *   message to the remote node and waits for a reply.  This will preempt the
801 *   calling task.
802 * @endparblock
803 */
804rtems_status_code rtems_message_queue_receive(
805  rtems_id       id,
806  void          *buffer,
807  size_t        *size,
808  rtems_option   option_set,
809  rtems_interval timeout
810);
811
812/* Generated from spec:/rtems/message/if/get-number-pending */
813
814/**
815 * @ingroup RTEMSAPIClassicMessage
816 *
817 * @brief Gets the number of messages pending on the queue.
818 *
819 * @param id is the queue identifier.
820 *
821 * @param[out] count is the pointer to an uint32_t object.  When the directive
822 *   call is successful, the number of pending messages will be stored in this
823 *   object.
824 *
825 * This directive returns the number of messages pending on the queue specified
826 * by ``id`` in ``count``.  If no messages are present on the queue, count is
827 * set to zero.
828 *
829 * @retval ::RTEMS_SUCCESSFUL The requested operation was successful.
830 *
831 * @retval ::RTEMS_INVALID_ID There was no queue associated with the identifier
832 *   specified by ``id``.
833 *
834 * @retval ::RTEMS_INVALID_ADDRESS The ``count`` parameter was NULL.
835 *
836 * @par Constraints
837 * @parblock
838 * The following constraints apply to this directive:
839 *
840 * * The directive may be called from within task context.
841 *
842 * * The directive may be called from within interrupt context.
843 *
844 * * When the directive operates on a remote object, the directive sends a
845 *   message to the remote node and waits for a reply.  This will preempt the
846 *   calling task.
847 * @endparblock
848 */
849rtems_status_code rtems_message_queue_get_number_pending(
850  rtems_id  id,
851  uint32_t *count
852);
853
854/* Generated from spec:/rtems/message/if/flush */
855
856/**
857 * @ingroup RTEMSAPIClassicMessage
858 *
859 * @brief Flushes all messages on the queue.
860 *
861 * @param id is the queue identifier.
862 *
863 * @param[out] count is the pointer to an uint32_t object.  When the directive
864 *   call is successful, the number of pending messages removed from the queue
865 *   will be stored in this object.
866 *
867 * This directive removes all pending messages from the queue specified by
868 * ``id``.  The number of messages removed is returned in ``count``.  If no
869 * messages are present on the queue, count is set to zero.
870 *
871 * @retval ::RTEMS_SUCCESSFUL The requested operation was successful.
872 *
873 * @retval ::RTEMS_INVALID_ID There was no queue associated with the identifier
874 *   specified by ``id``.
875 *
876 * @retval ::RTEMS_INVALID_ADDRESS The ``count`` parameter was NULL.
877 *
878 * @par Notes
879 * The directive does not flush tasks waiting to receive a message from the
880 * wait queue of the message queue.
881 *
882 * @par Constraints
883 * @parblock
884 * The following constraints apply to this directive:
885 *
886 * * The directive may be called from within interrupt context.
887 *
888 * * The directive may be called from within device driver initialization
889 *   context.
890 *
891 * * The directive may be called from within task context.
892 *
893 * * The directive will not cause the calling task to be preempted.
894 * @endparblock
895 */
896rtems_status_code rtems_message_queue_flush( rtems_id id, uint32_t *count );
897
898/* Generated from spec:/rtems/message/if/buffer */
899
900/**
901 * @ingroup RTEMSAPIClassicMessage
902 *
903 * @brief Defines a structure which can be used as a message queue buffer for
904 *   messages of the specified maximum size.
905 *
906 * @param _maximum_message_size is the maximum message size in bytes.
907 *
908 * @par Notes
909 * Use this macro to define the message buffer storage area for
910 * rtems_message_queue_construct().
911 */
912#define RTEMS_MESSAGE_QUEUE_BUFFER( _maximum_message_size ) \
913  struct { \
914    CORE_message_queue_Buffer _buffer; \
915    char _message[ _maximum_message_size ]; \
916  }
917
918#ifdef __cplusplus
919}
920#endif
921
922#endif /* _RTEMS_RTEMS_MESSAGE_H */
Note: See TracBrowser for help on using the repository browser.