source: rtems/cpukit/rtems/include/rtems/rtems/message.h @ 993a888

4.115
Last change on this file since 993a888 was 993a888, checked in by Sebastian Huber <sebastian.huber@…>, on 07/18/13 at 13:05:37

rtems: Create message queue implementation header

Move implementation specific parts of message.h and message.inl into new
header file messageimpl.h. The message.h contains now only the
application visible API.

  • Property mode set to 100644
File size: 8.3 KB
Line 
1/**
2 * @file rtems/rtems/message.h
3 *
4 * @defgroup ClassicMessageQueue Message Queues
5 *
6 * @ingroup ClassicRTEMS
7 * @brief Message Queue Manager
8 *
9 * This include file contains all the constants and structures associated
10 * with the Message Queue Manager. This manager provides a mechanism for
11 * communication and synchronization between tasks using messages.
12 *
13 * Directives provided are:
14 *
15 * - create a queue
16 * - get ID of a queue
17 * - delete a queue
18 * - put a message at the rear of a queue
19 * - put a message at the front of a queue
20 * - broadcast N messages to a queue
21 * - receive message from a queue
22 * - flush all messages on a queue
23 */
24
25/* COPYRIGHT (c) 1989-2008.
26 * On-Line Applications Research Corporation (OAR).
27 *
28 * The license and distribution terms for this file may be
29 * found in the file LICENSE in this distribution or at
30 * http://www.rtems.com/license/LICENSE.
31 */
32
33#ifndef _RTEMS_RTEMS_MESSAGE_H
34#define _RTEMS_RTEMS_MESSAGE_H
35
36#include <rtems/rtems/types.h>
37#include <rtems/rtems/status.h>
38#include <rtems/rtems/options.h>
39#include <rtems/rtems/attr.h>
40#include <rtems/score/object.h>
41#include <rtems/score/coremsg.h>
42
43#ifdef __cplusplus
44extern "C" {
45#endif
46
47/**
48 *  @ingroup ClassicMessageQueueImpl
49 *
50 *  The following records define the control block used to manage
51 *  each message queue.
52 */
53typedef struct {
54  /** This field is the inherited object characteristics. */
55  Objects_Control             Object;
56  /** This field is the attribute set as defined by the API. */
57  rtems_attribute             attribute_set;
58  /** This field is the instance of the SuperCore Message Queue. */
59  CORE_message_queue_Control  message_queue;
60}   Message_queue_Control;
61
62/**
63 *  @defgroup ClassicMessageQueue Message Queues
64 *
65 *  @ingroup ClassicRTEMS
66 *
67 *  This encapsulates functionality which XXX
68 */
69/**@{*/
70
71/**
72 * @brief RTEMS Create Message Queue
73 *
74 * This routine implements the rtems_message_queue_create directive. The
75 * message queue will have the @a name. If the @a attribute_set indicates
76 * that the message queue is to be limited in the number of messages
77 * that can be outstanding, then @a count indicates the maximum number of
78 * messages that will be held. It returns the id of the created
79 * message queue in @a id.
80 *
81 * @param[in] name is the user defined queue name
82 * @param[in] count is the maximum message and reserved buffer count
83 * @param[in] max_message_size is the maximum size of each message
84 * @param[in] attribute_set is the process method
85 * @param[in] id is the pointer to queue
86 *
87 * @retval This method returns RTEMS_SUCCESSFUL if there was not an
88 *         error. Otherwise, a status code is returned indicating the
89 *         source of the error. If successful, the @a id will
90 *         be filled in with the queue id.
91 */
92rtems_status_code rtems_message_queue_create(
93  rtems_name       name,
94  uint32_t         count,
95  size_t           max_message_size,
96  rtems_attribute  attribute_set,
97  rtems_id        *id
98);
99
100/**
101 * @brief RTEMS Message Queue Name to Id
102 *
103 * This routine implements the rtems_message_queue_ident directive.
104 * This directive returns the message queue ID associated with NAME.
105 * If more than one message queue is named name, then the message
106 * queue to which the ID belongs is arbitrary. node indicates the
107 * extent of the search for the ID of the message queue named name.
108 * The search can be limited to a particular node or allowed to
109 * encompass all nodes.
110 *
111 * @param[in] name is the user defined message queue name
112 * @param[in] node is the node(s) to be searched
113 * @param[in] id is the pointer to message queue id
114 *
115 * @retval RTEMS_SUCCESSFUL if successful or error code if unsuccessful and
116 * *id filled with the message queue id
117 */
118rtems_status_code rtems_message_queue_ident(
119  rtems_name  name,
120  uint32_t    node,
121  rtems_id   *id
122);
123
124/**
125 * @brief RTEMS Delete Message Queue
126 *
127 * This routine implements the rtems_message_queue_delete directive. The
128 * message queue indicated by ID is deleted.
129 *
130 * @param[in] id is the queue id
131 *
132 * @retval RTEMS_SUCCESSFUL if successful or error code if unsuccessful
133 */
134rtems_status_code rtems_message_queue_delete(
135  rtems_id id
136);
137
138/**
139 *  @brief rtems_message_queue_send
140 *
141 *  Message Queue Manager - rtems_message_queue_send
142 *
143 *  This routine implements the rtems_message_queue_send directive.
144 *  This directive sends the message buffer to the message queue
145 *  indicated by ID.  If one or more tasks is blocked waiting
146 *  to receive a message from this message queue, then one will
147 *  receive the message.  The task selected to receive the
148 *  message is based on the task queue discipline algorithm in
149 *  use by this particular message queue.  If no tasks are waiting,
150 *  then the message buffer will be placed at the REAR of the
151 *  chain of pending messages for this message queue.
152 */
153rtems_status_code rtems_message_queue_send(
154  rtems_id    id,
155  const void *buffer,
156  size_t      size
157);
158
159/**
160 * @brief RTEMS Urgent Message Queue
161 *
162 * This routine implements the rtems_message_queue_urgent directive.
163 * This directive has the same behavior as rtems_message_queue_send
164 * except that if no tasks are waiting, the message buffer will
165 * be placed at the FRONT of the chain of pending messages rather
166 * than at the REAR.
167 *
168 * @param[in] id is the pointer to message queue
169 * @param[in] buffer is the pointer to message buffer
170 * @param[in] size is the size of message to send urgently
171 *
172 * @retval RTEMS_SUCCESSFUL if successful or error code if unsuccessful
173 */
174rtems_status_code rtems_message_queue_urgent(
175  rtems_id    id,
176  const void *buffer,
177  size_t      size
178);
179
180/**
181 * @brief RTEMS Broadcast Message Queue
182 *
183 * This routine implements the rtems_message_queue_broadcast directive.
184 * This directive sends the message buffer to all of the tasks blocked
185 * waiting for a message on the message queue indicated by ID.
186 * If no tasks are waiting, then the message buffer will not be queued.
187 *
188 * @param[in] id is the pointer to message queue
189 * @param[in] buffer is the pointer to message buffer
190 * @param[in] size is the size of message to broadcast
191 * @param[in] count pointer to area to store number of threads made ready
192 *
193 * @retval RTEMS_SUCCESSFUL if successful or error code if unsuccessful and
194 *              *count filled in with number of threads made ready
195 */
196rtems_status_code rtems_message_queue_broadcast(
197  rtems_id    id,
198  const void *buffer,
199  size_t      size,
200  uint32_t   *count
201);
202
203/**
204 * @brief RTEMS Message Queue Receive
205 *
206 * This routine implements the rtems_message_queue_receive directive.
207 * This directive is invoked when the calling task wishes to receive
208 * a message from the message queue indicated by ID. The received
209 * message is to be placed in buffer. If no messages are outstanding
210 * and the option_set indicates that the task is willing to block,
211 * then the task will be blocked until a message arrives or until,
212 * optionally, timeout clock ticks have passed.
213 *
214 * @param[in] id is the queue id
215 * @param[in] buffer is the pointer to message buffer
216 * @param[in] size is the size of message receive
217 * @param[in] option_set is the options on receive
218 * @param[in] timeout is the number of ticks to wait
219 *
220 * @retval This method returns RTEMS_SUCCESSFUL if there was not an
221 *         error. Otherwise, a status code is returned indicating the
222 *         source of the error.
223 */
224rtems_status_code rtems_message_queue_receive(
225  rtems_id        id,
226  void           *buffer,
227  size_t         *size,
228  rtems_option    option_set,
229  rtems_interval  timeout
230);
231
232/**
233 *  @brief rtems_message_queue_flush
234 *
235 *  This routine implements the rtems_message_queue_flush directive.
236 *  This directive takes all outstanding messages for the message
237 *  queue indicated by ID and returns them to the inactive message
238 *  chain.  The number of messages flushed is returned in COUNT.
239 *
240 *  Message Queue Manager
241 */
242rtems_status_code rtems_message_queue_flush(
243  rtems_id  id,
244  uint32_t *count
245);
246
247/**
248 *  @brief RTEMS Message Queue Get Number Pending
249 *
250 *  Message Queue Manager
251 *
252 *  This routine implements the rtems_message_queue_get_number_pending
253 *  directive.  This directive returns the number of pending
254 *  messages for the message queue indicated by ID
255 *  chain.  The number of messages pending is returned in COUNT.
256 */
257rtems_status_code rtems_message_queue_get_number_pending(
258  rtems_id  id,
259  uint32_t *count
260);
261
262/**@}*/
263
264#ifdef __cplusplus
265}
266#endif
267
268#endif
269/* end of include file */
Note: See TracBrowser for help on using the repository browser.