source: rtems/c/src/exec/score/headers/coremsg.h @ 9db72b4

4.104.114.84.95
Last change on this file since 9db72b4 was 03f2154e, checked in by Joel Sherrill <joel.sherrill@…>, on 04/22/97 at 17:20:27

headers updated to reflect new style copyright notice as part
of switching to the modified GNU GPL.

  • Property mode set to 100644
File size: 7.1 KB
Line 
1/*  coremsg.h
2 *
3 *  This include file contains all the constants and structures associated
4 *  with the Message queue Handler.
5 *
6 *  COPYRIGHT (c) 1989-1997.
7 *  On-Line Applications Research Corporation (OAR).
8 *  Copyright assigned to U.S. Government, 1994.
9 *
10 *  The license and distribution terms for this file may in
11 *  the file LICENSE in this distribution or at
12 *  http://www.OARcorp.com/rtems/license.html.
13 *
14 *  $Id$
15 */
16 
17#ifndef __RTEMS_CORE_MESSAGE_QUEUE_h
18#define __RTEMS_CORE_MESSAGE_QUEUE_h
19 
20#ifdef __cplusplus
21extern "C" {
22#endif
23
24#include <rtems/score/thread.h>
25#include <rtems/score/threadq.h>
26#include <rtems/score/priority.h>
27#include <rtems/score/watchdog.h>
28 
29/*
30 *  The following type defines the callout which the API provides
31 *  to support global/multiprocessor operations on message_queues.
32 */
33 
34typedef void ( *CORE_message_queue_API_mp_support_callout )(
35                 Thread_Control *,
36                 Objects_Id
37             );
38
39/*
40 *  The following defines the data types needed to manipulate
41 *  the contents of message buffers.
42 *
43 *  NOTE:  The buffer field is normally longer than a single unsigned32.
44 *         but since messages are variable length we just make a ptr to 1. 
45 */
46 
47typedef struct {
48    unsigned32  size;
49    unsigned32  buffer[1];
50} CORE_message_queue_Buffer;
51 
52/*
53 *  The following records define the organization of a message
54 *  buffer.
55 */
56 
57typedef struct {
58  Chain_Node                 Node;
59  CORE_message_queue_Buffer  Contents;
60}   CORE_message_queue_Buffer_control;
61
62/*
63 *  Blocking disciplines for a message_queue.
64 */
65
66typedef enum {
67  CORE_MESSAGE_QUEUE_DISCIPLINES_FIFO,
68  CORE_MESSAGE_QUEUE_DISCIPLINES_PRIORITY
69}   CORE_message_queue_Disciplines;
70
71/*
72 *  The following enumerated type details the modes in which a message
73 *  may be submitted to a message queue.  The message may be posted
74 *  in a send or urgent fashion.
75 */
76 
77typedef enum {
78  CORE_MESSAGE_QUEUE_SEND_REQUEST   = 0,
79  CORE_MESSAGE_QUEUE_URGENT_REQUEST = 1
80}  CORE_message_queue_Submit_types;
81
82/*
83 *  Core Message queue handler return statuses.
84 */
85 
86typedef enum {
87  CORE_MESSAGE_QUEUE_STATUS_SUCCESSFUL,
88  CORE_MESSAGE_QUEUE_STATUS_INVALID_SIZE,
89  CORE_MESSAGE_QUEUE_STATUS_TOO_MANY,
90  CORE_MESSAGE_QUEUE_STATUS_UNSATISFIED,
91  CORE_MESSAGE_QUEUE_STATUS_UNSATISFIED_NOWAIT,
92  CORE_MESSAGE_QUEUE_STATUS_WAS_DELETED,
93  CORE_MESSAGE_QUEUE_STATUS_TIMEOUT
94}   CORE_message_queue_Status;
95
96/*
97 *  The following defines the control block used to manage the
98 *  attributes of each message queue.
99 */
100
101typedef struct {
102  CORE_message_queue_Disciplines  discipline;
103}   CORE_message_queue_Attributes;
104 
105/*
106 *  The following defines the type for a Notification handler.  A notification
107 *  handler is invoked when the message queue makes a 0->1 transition on
108 *  pending messages.
109 */
110
111typedef void (*CORE_message_queue_Notify_Handler)( void * );
112
113/*
114 *  The following defines the control block used to manage each
115 *  counting message_queue.
116 */
117 
118typedef struct {
119  Thread_queue_Control               Wait_queue;
120  CORE_message_queue_Attributes      Attributes;
121  unsigned32                         maximum_pending_messages;
122  unsigned32                         number_of_pending_messages;
123  unsigned32                         maximum_message_size;
124  Chain_Control                      Pending_messages;
125  CORE_message_queue_Buffer         *message_buffers;
126  CORE_message_queue_Notify_Handler  notify_handler;
127  void                              *notify_argument;
128  Chain_Control                      Inactive_messages;
129}   CORE_message_queue_Control;
130
131/*
132 *  _CORE_message_queue_Initialize
133 *
134 *  DESCRIPTION:
135 *
136 *  This routine initializes the message_queue based on the parameters passed.
137 */
138
139boolean _CORE_message_queue_Initialize(
140  CORE_message_queue_Control    *the_message_queue,
141  Objects_Classes                the_class,
142  CORE_message_queue_Attributes *the_message_queue_attributes,
143  unsigned32                     maximum_pending_messages,
144  unsigned32                     maximum_message_size,
145  Thread_queue_Extract_callout   proxy_extract_callout
146);
147 
148/*
149 *  _CORE_message_queue_Close
150 *
151 *  DESCRIPTION:
152 *
153 *  This function closes a message by returning all allocated space and
154 *  flushing the message_queue's task wait queue.
155 */
156 
157void _CORE_message_queue_Close(
158  CORE_message_queue_Control *the_message_queue,
159  Thread_queue_Flush_callout  remote_extract_callout,
160  unsigned32                  status
161);
162
163/*
164 *
165 *  _CORE_message_queue_Flush
166 *
167 *  DESCRIPTION:
168 *
169 *  This function flushes the message_queue's task wait queue.  The number
170 *  messages flushed from the queue is returned.
171 *
172 */
173
174unsigned32 _CORE_message_queue_Flush(
175  CORE_message_queue_Control *the_message_queue
176);
177
178/*
179 *  _CORE_message_queue_Flush_support
180 *
181 *  DESCRIPTION:
182 *
183 *  This routine flushes all outstanding messages and returns
184 *  them to the inactive message chain.
185 */
186 
187unsigned32 _CORE_message_queue_Flush_support(
188  CORE_message_queue_Control *the_message_queue
189);
190 
191/*
192 *
193 *  _CORE_message_queue_Broadcast
194 *
195 *  DESCRIPTION:
196 *
197 *  This function sends a message for every thread waiting on the queue and
198 *  returns the number of threads made ready by the message.
199 *
200 */
201 
202CORE_message_queue_Status _CORE_message_queue_Broadcast(
203  CORE_message_queue_Control                *the_message_queue,
204  void                                      *buffer,
205  unsigned32                                 size,
206  Objects_Id                                 id,
207  CORE_message_queue_API_mp_support_callout  api_message_queue_mp_support,
208  unsigned32                                *count
209);
210
211/*
212 *
213 *  _CORE_message_queue_Submit
214 *
215 *  DESCRIPTION:
216 *
217 *  This routine implements the send and urgent message functions. It
218 *  processes a message that is to be submitted to the designated
219 *  message queue.  The message will either be processed as a
220 *  send message which it will be inserted at the rear of the queue
221 *  or it will be processed as an urgent message which will be inserted
222 *  at the front of the queue.
223 *
224 */
225 
226CORE_message_queue_Status _CORE_message_queue_Submit(
227  CORE_message_queue_Control                *the_message_queue,
228  void                                      *buffer,
229  unsigned32                                 size,
230  Objects_Id                                 id,
231  CORE_message_queue_API_mp_support_callout  api_message_queue_mp_support,
232  CORE_message_queue_Submit_types            submit_type
233);
234
235/*
236 *
237 *  _CORE_message_queue_Seize
238 *
239 *  DESCRIPTION:
240 *
241 *  This kernel routine dequeues a message, copies the message buffer to
242 *  a given destination buffer, and frees the message buffer to the
243 *  inactive message pool.  The thread will be blocked if wait is TRUE,
244 *  otherwise an error will be given to the thread if no messages are available.
245 *
246 */
247 
248void _CORE_message_queue_Seize(
249  CORE_message_queue_Control *the_message_queue,
250  Objects_Id                  id,
251  void                       *buffer,
252  unsigned32                 *size,
253  boolean                     wait,
254  Watchdog_Interval           timeout
255);
256
257#ifndef __RTEMS_APPLICATION__
258#include <rtems/score/coremsg.inl>
259#endif
260
261#ifdef __cplusplus
262}
263#endif
264 
265#endif
266/*  end of include file */
267
Note: See TracBrowser for help on using the repository browser.