source: rtems/c/src/exec/rtems/include/rtems/rtems/message.h @ c13cd48

4.104.114.84.95
Last change on this file since c13cd48 was 97e2729d, checked in by Joel Sherrill <joel.sherrill@…>, on 11/23/98 at 17:38:09

Added --disable-multiprocessing flag and modified a lot of files to make
it work.

  • Property mode set to 100644
File size: 9.2 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-1998.
20 *  On-Line Applications Research Corporation (OAR).
21 *  Copyright assigned to U.S. Government, 1994.
22 *
23 *  The license and distribution terms for this file may be
24 *  found in the file LICENSE in this distribution or at
25 *  http://www.OARcorp.com/rtems/license.html.
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/score/chain.h>
39#include <rtems/score/object.h>
40#include <rtems/rtems/attr.h>
41#include <rtems/score/threadq.h>
42#include <rtems/score/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
71RTEMS_EXTERN 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 *  rtems_message_queue_get_number_pending
246 *
247 *  DESCRIPTION:
248 *
249 *  This routine implements the rtems_message_queue_get_number_pending
250 *  directive.  This directive returns the number of pending
251 *  messages for the message queue indicated by ID
252 *  chain.  The number of messages pending is returned in COUNT.
253 */
254
255rtems_status_code rtems_message_queue_get_number_pending(
256  Objects_Id  id,
257  unsigned32 *count
258);
259
260
261/*
262 *  _Message_queue_Submit
263 *
264 *  DESCRIPTION:
265 *
266 *  This routine implements the directives rtems_message_queue_send
267 *  and rtems_message_queue_urgent.  It processes a message that is
268 *  to be submitted to the designated message queue.  The message will
269 *  either be processed as a send send message which it will be inserted
270 *  at the rear of the queue or it will be processed as an urgent message
271 *  which will be inserted at the front of the queue.
272 */
273 
274rtems_status_code _Message_queue_Submit(
275  Objects_Id                  id,
276  void                       *buffer,
277  unsigned32                  size,
278  Message_queue_Submit_types  submit_type
279);
280
281/*
282 *  _Message_queue_Allocate
283 *
284 *  DESCRIPTION:
285 *
286 *  This function allocates a message queue control block from
287 *  the inactive chain of free message queue control blocks.
288 */
289
290Message_queue_Control *_Message_queue_Allocate (
291    unsigned32          count,
292    unsigned32          max_message_size
293);
294
295/*
296 *  _Message_queue_Translate_core_message_queue_return_code
297 *
298 *  DESCRIPTION:
299 *
300 *  This function returns a RTEMS status code based on the core message queue
301 *  status code specified.
302 */
303 
304rtems_status_code _Message_queue_Translate_core_message_queue_return_code (
305  unsigned32 the_message_queue_status
306);
307
308/*
309 *
310 *  _Message_queue_Core_message_queue_mp_support
311 *
312 *  Input parameters:
313 *    the_thread - the remote thread the message was submitted to
314 *    id         - id of the message queue
315 *
316 *  Output parameters: NONE
317 */
318 
319#if defined(RTEMS_MULTIPROCESSING)
320void  _Message_queue_Core_message_queue_mp_support (
321  Thread_Control *the_thread,
322  Objects_Id      id
323);
324#endif
325
326#ifndef __RTEMS_APPLICATION__
327#include <rtems/rtems/message.inl>
328#endif
329#if defined(RTEMS_MULTIPROCESSING)
330#include <rtems/rtems/msgmp.h>
331#endif
332
333#ifdef __cplusplus
334}
335#endif
336
337#endif
338/* end of include file */
Note: See TracBrowser for help on using the repository browser.