OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [rtos/] [rtems/] [c/] [src/] [exec/] [rtems/] [include/] [rtems/] [rtems/] [message.h] - Blame information for rev 173

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 30 unneback
/*  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-1999.
20
 *  On-Line Applications Research Corporation (OAR).
21
 *
22
 *  The license and distribution terms for this file may be
23
 *  found in the file LICENSE in this distribution or at
24
 *  http://www.OARcorp.com/rtems/license.html.
25
 *
26
 *  $Id: message.h,v 1.2 2001-09-27 11:59:18 chris Exp $
27
 */
28
 
29
#ifndef __RTEMS_MESSAGE_QUEUE_h
30
#define __RTEMS_MESSAGE_QUEUE_h
31
 
32
#ifdef __cplusplus
33
extern "C" {
34
#endif
35
 
36
#include <rtems/rtems/types.h>
37
#include <rtems/score/chain.h>
38
#include <rtems/score/object.h>
39
#include <rtems/rtems/attr.h>
40
#include <rtems/score/threadq.h>
41
#include <rtems/score/coremsg.h>
42
 
43
/*
44
 *  The following enumerated type details the modes in which a message
45
 *  may be submitted to a message queue.  The message may be posted
46
 *  in a send or urgent fashion.
47
 */
48
 
49
typedef enum {
50
  MESSAGE_QUEUE_SEND_REQUEST   = 0,
51
  MESSAGE_QUEUE_URGENT_REQUEST = 1
52
}  Message_queue_Submit_types;
53
 
54
/*
55
 *  The following records define the control block used to manage
56
 *  each message queue.
57
 */
58
 
59
typedef struct {
60
  Objects_Control             Object;
61
  rtems_attribute             attribute_set;
62
  CORE_message_queue_Control  message_queue;
63
}   Message_queue_Control;
64
 
65
/*
66
 *  The following defines the information control block used to
67
 *  manage this class of objects.
68
 */
69
 
70
RTEMS_EXTERN Objects_Information  _Message_queue_Information;
71
 
72
/*
73
 *  _Message_queue_Manager_initialization
74
 *
75
 *  DESCRIPTION:
76
 *
77
 *  This routine performs the initialization necessary for this manager.
78
 */
79
 
80
void _Message_queue_Manager_initialization(
81
  unsigned32 maximum_message_queues
82
);
83
 
84
/*
85
 *  rtems_message_queue_create
86
 *
87
 *  DESCRIPTION:
88
 *
89
 *  This routine implements the rtems_message_queue_create directive.  The
90
 *  message queue will have the name name.  If the attribute_set indicates
91
 *  that the message queue is to be limited in the number of messages
92
 *  that can be outstanding, then count indicates the maximum number of
93
 *  messages that will be held.  It returns the id of the created
94
 *  message queue in ID.
95
 */
96
 
97
rtems_status_code rtems_message_queue_create(
98
  rtems_name       name,
99
  unsigned32       count,
100
  unsigned32       max_message_size,
101
  rtems_attribute  attribute_set,
102
  Objects_Id      *id
103
);
104
 
105
/*
106
 *  rtems_message_queue_ident
107
 *
108
 *  DESCRIPTION:
109
 *
110
 *  This routine implements the rtems_message_queue_ident directive.
111
 *  This directive returns the message queue ID associated with NAME.
112
 *  If more than one message queue is named name, then the message
113
 *  queue to which the ID belongs is arbitrary.  node indicates the
114
 *  extent of the search for the ID of the message queue named name.
115
 *  The search can be limited to a particular node or allowed to
116
 *  encompass all nodes.
117
 */
118
 
119
rtems_status_code rtems_message_queue_ident(
120
  rtems_name    name,
121
  unsigned32    node,
122
  Objects_Id   *id
123
);
124
 
125
/*
126
 *  rtems_message_queue_delete
127
 *
128
 *  DESCRIPTION:
129
 *
130
 *  This routine implements the rtems_message_queue_delete directive.  The
131
 *  message queue indicated by ID is deleted.
132
 */
133
 
134
rtems_status_code rtems_message_queue_delete(
135
  Objects_Id id
136
);
137
 
138
/*
139
 *  rtems_message_queue_send
140
 *
141
 *  DESCRIPTION:
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
 */
153
 
154
rtems_status_code rtems_message_queue_send(
155
  Objects_Id            id,
156
  void                 *buffer,
157
  unsigned32            size
158
);
159
 
160
/*
161
 *  rtems_message_queue_urgent
162
 *
163
 *  DESCRIPTION:
164
 *
165
 *  This routine implements the rtems_message_queue_urgent directive.
166
 *  This directive has the same behavior as rtems_message_queue_send
167
 *  except that if no tasks are waiting, the message buffer will
168
 *  be placed at the FRONT of the chain of pending messages rather
169
 *  than at the REAR.
170
 */
171
 
172
rtems_status_code rtems_message_queue_urgent(
173
  Objects_Id            id,
174
  void                 *buffer,
175
  unsigned32            size
176
);
177
 
178
/*
179
 *  rtems_message_queue_broadcast
180
 *
181
 *  DESCRIPTION:
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
 
189
rtems_status_code rtems_message_queue_broadcast(
190
  Objects_Id            id,
191
  void                 *buffer,
192
  unsigned32            size,
193
  unsigned32           *count
194
);
195
 
196
/*
197
 *  rtems_message_queue_receive
198
 *
199
 *  DESCRIPTION:
200
 *
201
 *  This routine implements the rtems_message_queue_receive directive.
202
 *  This directive is invoked when the calling task wishes to receive
203
 *  a message from the message queue indicated by ID.  The received
204
 *  message is to be placed in buffer.  If no messages are outstanding
205
 *  and the option_set indicates that the task is willing to block,
206
 *  then the task will be blocked until a message arrives or until,
207
 *  optionally, timeout clock ticks have passed.
208
 */
209
 
210
rtems_status_code rtems_message_queue_receive(
211
  Objects_Id            id,
212
  void                 *buffer,
213
  unsigned32           *size,
214
  unsigned32            option_set,
215
  rtems_interval        timeout
216
);
217
 
218
/*
219
 *  rtems_message_queue_flush
220
 *
221
 *  DESCRIPTION:
222
 *
223
 *  This routine implements the rtems_message_queue_flush directive.
224
 *  This directive takes all outstanding messages for the message
225
 *  queue indicated by ID and returns them to the inactive message
226
 *  chain.  The number of messages flushed is returned in COUNT.
227
 */
228
 
229
rtems_status_code rtems_message_queue_flush(
230
  Objects_Id  id,
231
  unsigned32 *count
232
);
233
 
234
/*
235
 *  rtems_message_queue_get_number_pending
236
 *
237
 *  DESCRIPTION:
238
 *
239
 *  This routine implements the rtems_message_queue_get_number_pending
240
 *  directive.  This directive returns the number of pending
241
 *  messages for the message queue indicated by ID
242
 *  chain.  The number of messages pending is returned in COUNT.
243
 */
244
 
245
rtems_status_code rtems_message_queue_get_number_pending(
246
  Objects_Id  id,
247
  unsigned32 *count
248
);
249
 
250
 
251
/*
252
 *  _Message_queue_Submit
253
 *
254
 *  DESCRIPTION:
255
 *
256
 *  This routine implements the directives rtems_message_queue_send
257
 *  and rtems_message_queue_urgent.  It processes a message that is
258
 *  to be submitted to the designated message queue.  The message will
259
 *  either be processed as a send send message which it will be inserted
260
 *  at the rear of the queue or it will be processed as an urgent message
261
 *  which will be inserted at the front of the queue.
262
 */
263
 
264
rtems_status_code _Message_queue_Submit(
265
  Objects_Id                  id,
266
  void                       *buffer,
267
  unsigned32                  size,
268
  Message_queue_Submit_types  submit_type
269
);
270
 
271
/*
272
 *  _Message_queue_Allocate
273
 *
274
 *  DESCRIPTION:
275
 *
276
 *  This function allocates a message queue control block from
277
 *  the inactive chain of free message queue control blocks.
278
 */
279
 
280
Message_queue_Control *_Message_queue_Allocate (
281
    unsigned32          count,
282
    unsigned32          max_message_size
283
);
284
 
285
/*
286
 *  _Message_queue_Translate_core_message_queue_return_code
287
 *
288
 *  DESCRIPTION:
289
 *
290
 *  This function returns a RTEMS status code based on the core message queue
291
 *  status code specified.
292
 */
293
 
294
rtems_status_code _Message_queue_Translate_core_message_queue_return_code (
295
  unsigned32 the_message_queue_status
296
);
297
 
298
/*
299
 *
300
 *  _Message_queue_Core_message_queue_mp_support
301
 *
302
 *  Input parameters:
303
 *    the_thread - the remote thread the message was submitted to
304
 *    id         - id of the message queue
305
 *
306
 *  Output parameters: NONE
307
 */
308
 
309
#if defined(RTEMS_MULTIPROCESSING)
310
void  _Message_queue_Core_message_queue_mp_support (
311
  Thread_Control *the_thread,
312
  Objects_Id      id
313
);
314
#endif
315
 
316
#ifndef __RTEMS_APPLICATION__
317
#include <rtems/rtems/message.inl>
318
#endif
319
#if defined(RTEMS_MULTIPROCESSING)
320
#include <rtems/rtems/msgmp.h>
321
#endif
322
 
323
#ifdef __cplusplus
324
}
325
#endif
326
 
327
#endif
328
/* end of include file */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.