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

4.104.114.84.95
Last change on this file since c627b2a3 was c627b2a3, checked in by Joel Sherrill <joel.sherrill@…>, on 05/28/96 at 21:40:52

split the inclusion of "EXTERN" data based on whether it was sapi,
score, rtems api, or posix api related.

  • Property mode set to 100644
File size: 8.8 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/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 *  _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_Allocate
266 *
267 *  DESCRIPTION:
268 *
269 *  This function allocates a message queue control block from
270 *  the inactive chain of free message queue control blocks.
271 */
272
273Message_queue_Control *_Message_queue_Allocate (
274    unsigned32          count,
275    unsigned32          max_message_size
276);
277
278/*
279 *  _Message_queue_Translate_core_message_queue_return_code
280 *
281 *  DESCRIPTION:
282 *
283 *  This function returns a RTEMS status code based on the core message queue
284 *  status code specified.
285 */
286 
287rtems_status_code _Message_queue_Translate_core_message_queue_return_code (
288  unsigned32 the_message_queue_status
289);
290
291/*
292 *
293 *  _Message_queue_Core_message_queue_mp_support
294 *
295 *  Input parameters:
296 *    the_thread - the remote thread the message was submitted to
297 *    id         - id of the message queue
298 *
299 *  Output parameters: NONE
300 */
301 
302void  _Message_queue_Core_message_queue_mp_support (
303  Thread_Control *the_thread,
304  Objects_Id      id
305);
306
307#ifndef __RTEMS_APPLICATION__
308#include <rtems/rtems/message.inl>
309#endif
310#include <rtems/rtems/msgmp.h>
311
312#ifdef __cplusplus
313}
314#endif
315
316#endif
317/* end of include file */
Note: See TracBrowser for help on using the repository browser.