source: rtems/c/src/exec/rtems/headers/message.h @ 3652ad35

4.104.114.84.95
Last change on this file since 3652ad35 was 3652ad35, checked in by Joel Sherrill <joel.sherrill@…>, on 09/19/95 at 14:53:29

Minor bug fixes to get all targets compilable and running. The
single biggest changes were the expansion of the workspace size
macro to include other types of objects and the increase in the
minimum stack size for most CPUs.

  • Property mode set to 100644
File size: 9.9 KB
Line 
1/*  message.h
2 *
3 *  This include file contains all the constants and structures associated
4 *  with the Message Queue Manager.  This manager provides a mechanism for
5 *  communication and synchronization between tasks using messages.
6 *
7 *  Directives provided are:
8 *
9 *     + create a queue
10 *     + get ID of a queue
11 *     + delete a queue
12 *     + put a message at the rear of a queue
13 *     + put a message at the front of a queue
14 *     + broadcast N messages to a queue
15 *     + receive message from a queue
16 *     + flush all messages on a queue
17 *
18 *
19 *  COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
20 *  On-Line Applications Research Corporation (OAR).
21 *  All rights assigned to U.S. Government, 1994.
22 *
23 *  This material may be reproduced by or for the U.S. Government pursuant
24 *  to the copyright license under the clause at DFARS 252.227-7013.  This
25 *  notice must appear in all copies of this file and its derivatives.
26 *
27 *  $Id$
28 */
29
30#ifndef __RTEMS_MESSAGE_QUEUE_h
31#define __RTEMS_MESSAGE_QUEUE_h
32
33#ifdef __cplusplus
34extern "C" {
35#endif
36
37#include <rtems/rtems/types.h>
38#include <rtems/core/chain.h>
39#include <rtems/core/object.h>
40#include <rtems/rtems/attr.h>
41#include <rtems/core/threadq.h>
42#include <rtems/core/coremsg.h>
43
44/*
45 *  The following enumerated type details the modes in which a message
46 *  may be submitted to a message queue.  The message may be posted
47 *  in a send or urgent fashion.
48 */
49 
50typedef enum {
51  MESSAGE_QUEUE_SEND_REQUEST   = 0,
52  MESSAGE_QUEUE_URGENT_REQUEST = 1
53}  Message_queue_Submit_types;
54
55/*
56 *  The following records define the control block used to manage
57 *  each message queue.
58 */
59
60typedef struct {
61  Objects_Control             Object;
62  rtems_attribute             attribute_set;
63  CORE_message_queue_Control  message_queue;
64}   Message_queue_Control;
65
66/*
67 *  The following defines the information control block used to
68 *  manage this class of objects.
69 */
70
71EXTERN Objects_Information  _Message_queue_Information;
72
73/*
74 *  _Message_queue_Manager_initialization
75 *
76 *  DESCRIPTION:
77 *
78 *  This routine performs the initialization necessary for this manager.
79 */
80
81void _Message_queue_Manager_initialization(
82  unsigned32 maximum_message_queues
83);
84
85/*
86 *  rtems_message_queue_create
87 *
88 *  DESCRIPTION:
89 *
90 *  This routine implements the rtems_message_queue_create directive.  The
91 *  message queue will have the name name.  If the attribute_set indicates
92 *  that the message queue is to be limited in the number of messages
93 *  that can be outstanding, then count indicates the maximum number of
94 *  messages that will be held.  It returns the id of the created
95 *  message queue in ID.
96 */
97
98rtems_status_code rtems_message_queue_create(
99  rtems_name       name,
100  unsigned32       count,
101  unsigned32       max_message_size,
102  rtems_attribute  attribute_set,
103  Objects_Id      *id
104);
105
106/*
107 *  rtems_message_queue_ident
108 *
109 *  DESCRIPTION:
110 *
111 *  This routine implements the rtems_message_queue_ident directive.
112 *  This directive returns the message queue ID associated with NAME.
113 *  If more than one message queue is named name, then the message
114 *  queue to which the ID belongs is arbitrary.  node indicates the
115 *  extent of the search for the ID of the message queue named name.
116 *  The search can be limited to a particular node or allowed to
117 *  encompass all nodes.
118 */
119
120rtems_status_code rtems_message_queue_ident(
121  rtems_name    name,
122  unsigned32    node,
123  Objects_Id   *id
124);
125
126/*
127 *  rtems_message_queue_delete
128 *
129 *  DESCRIPTION:
130 *
131 *  This routine implements the rtems_message_queue_delete directive.  The
132 *  message queue indicated by ID is deleted.
133 */
134
135rtems_status_code rtems_message_queue_delete(
136  Objects_Id id
137);
138
139/*
140 *  rtems_message_queue_send
141 *
142 *  DESCRIPTION:
143 *
144 *  This routine implements the rtems_message_queue_send directive.
145 *  This directive sends the message buffer to the message queue
146 *  indicated by ID.  If one or more tasks is blocked waiting
147 *  to receive a message from this message queue, then one will
148 *  receive the message.  The task selected to receive the
149 *  message is based on the task queue discipline algorithm in
150 *  use by this particular message queue.  If no tasks are waiting,
151 *  then the message buffer will be placed at the rear of the
152 *  chain of pending messages for this message queue.
153 */
154
155rtems_status_code rtems_message_queue_send(
156  Objects_Id            id,
157  void                 *buffer,
158  unsigned32            size
159);
160
161/*
162 *  rtems_message_queue_urgent
163 *
164 *  DESCRIPTION:
165 *
166 *  This routine implements the rtems_message_queue_send directive.
167 *  This directive sends the message buffer to the message queue
168 *  indicated by ID.  If one or more tasks is blocked waiting
169 *  to receive a message from this message queue, then one will
170 *  receive the message.  The task selected to receive the
171 *  message is based on the task queue discipline algorithm in
172 *  use by this particular message queue.  If no tasks are waiting,
173 *  then the message buffer will be placed at the rear of the
174 *  chain of pending messages for this message queue.
175 */
176
177rtems_status_code rtems_message_queue_urgent(
178  Objects_Id            id,
179  void                 *buffer,
180  unsigned32            size
181);
182
183/*
184 *  rtems_message_queue_broadcast
185 *
186 *  DESCRIPTION:
187 *
188 *  This routine implements the rtems_message_queue_send directive.
189 *  This directive sends the message buffer to the message queue
190 *  indicated by ID.  If one or more tasks is blocked waiting
191 *  to receive a message from this message queue, then one will
192 *  receive the message.  The task selected to receive the
193 *  message is based on the task queue discipline algorithm in
194 *  use by this particular message queue.  If no tasks are waiting,
195 *  then the message buffer will be placed at the rear of the
196 *  chain of pending messages for this message queue.
197 */
198
199rtems_status_code rtems_message_queue_broadcast(
200  Objects_Id            id,
201  void                 *buffer,
202  unsigned32            size,
203  unsigned32           *count
204);
205
206/*
207 *  rtems_message_queue_receive
208 *
209 *  DESCRIPTION:
210 *
211 *  This routine implements the rtems_message_queue_receive directive.
212 *  This directive is invoked when the calling task wishes to receive
213 *  a message from the message queue indicated by ID.  The received
214 *  message is to be placed in buffer.  If no messages are outstanding
215 *  and the option_set indicates that the task is willing to block,
216 *  then the task will be blocked until a message arrives or until,
217 *  optionally, timeout clock ticks have passed.
218 */
219
220rtems_status_code rtems_message_queue_receive(
221  Objects_Id            id,
222  void                 *buffer,
223  unsigned32           *size,
224  unsigned32            option_set,
225  rtems_interval        timeout
226);
227
228/*
229 *  rtems_message_queue_flush
230 *
231 *  DESCRIPTION:
232 *
233 *  This routine implements the rtems_message_queue_flush directive.
234 *  This directive takes all outstanding messages for the message
235 *  queue indicated by ID and returns them to the inactive message
236 *  chain.  The number of messages flushed is returned in COUNT.
237 */
238
239rtems_status_code rtems_message_queue_flush(
240  Objects_Id  id,
241  unsigned32 *count
242);
243
244/*
245 *  _Message_queue_Submit
246 *
247 *  DESCRIPTION:
248 *
249 *  This routine implements the directives rtems_message_queue_send
250 *  and rtems_message_queue_urgent.  It processes a message that is
251 *  to be submitted to the designated message queue.  The message will
252 *  either be processed as a send send message which it will be inserted
253 *  at the rear of the queue or it will be processed as an urgent message
254 *  which will be inserted at the front of the queue.
255 */
256 
257rtems_status_code _Message_queue_Submit(
258  Objects_Id                  id,
259  void                       *buffer,
260  unsigned32                  size,
261  Message_queue_Submit_types  submit_type
262);
263
264/*
265 *  _Message_queue_Is_null
266 *
267 *  DESCRIPTION:
268 *
269 *  This function places the_message at the rear of the outstanding
270 *  messages on the_message_queue.
271 */
272
273STATIC INLINE boolean _Message_queue_Is_null (
274  Message_queue_Control *the_message_queue
275);
276
277/*
278 *  _Message_queue_Allocate
279 *
280 *  DESCRIPTION:
281 *
282 *  This function allocates a message queue control block from
283 *  the inactive chain of free message queue control blocks.
284 */
285
286Message_queue_Control *_Message_queue_Allocate (
287    unsigned32          count,
288    unsigned32          max_message_size
289);
290
291/*
292 *  _Message_queue_Free
293 *
294 *  DESCRIPTION:
295 *
296 *  This routine deallocates a message queue control block into
297 *  the inactive chain of free message queue control blocks.
298 */
299
300STATIC INLINE void _Message_queue_Free (
301  Message_queue_Control *the_message_queue
302);
303
304/*
305 *  _Message_queue_Get
306 *
307 *  DESCRIPTION:
308 *
309 *  This function maps message queue IDs to message queue control
310 *  blocks.  If ID corresponds to a local message queue, then it
311 *  returns the_message_queue control pointer which maps to ID
312 *  and location is set to OBJECTS_LOCAL.  If the message queue ID is
313 *  global and resides on a remote node, then location is set
314 *  to OBJECTS_REMOTE, and the_message_queue is undefined.
315 *  Otherwise, location is set to OBJECTS_ERROR and
316 *  the_message_queue is undefined.
317 */
318
319STATIC INLINE Message_queue_Control *_Message_queue_Get (
320  Objects_Id         id,
321  Objects_Locations *location
322);
323
324/*
325 *  _Message_queue_Translate_core_message_queue_return_code
326 *
327 *  DESCRIPTION:
328 *
329 *  This function returns a RTEMS status code based on the core message queue
330 *  status code specified.
331 */
332 
333rtems_status_code _Message_queue_Translate_core_message_queue_return_code (
334  unsigned32 the_message_queue_status
335);
336
337/*
338 *
339 *  _Message_queue_Core_message_queue_mp_support
340 *
341 *  Input parameters:
342 *    the_thread - the remote thread the message was submitted to
343 *    id         - id of the message queue
344 *
345 *  Output parameters: NONE
346 */
347 
348void  _Message_queue_Core_message_queue_mp_support (
349  Thread_Control *the_thread,
350  Objects_Id      id
351);
352
353#include <rtems/rtems/message.inl>
354#include <rtems/rtems/msgmp.h>
355
356#ifdef __cplusplus
357}
358#endif
359
360#endif
361/* end of include file */
Note: See TracBrowser for help on using the repository browser.