source: rtems/cpukit/score/include/rtems/score/coremsg.h @ 1a8fde6c

4.104.114.84.95
Last change on this file since 1a8fde6c was 1a8fde6c, checked in by Joel Sherrill <joel.sherrill@…>, on 03/06/96 at 21:34:57

Removed prototyes for static inline routines and moved the comments into
the inline implementation. The impetus for this was twofold. First,
it is incorrect to have static inline prototypes when using the macro
implementation. Second, this reduced the number of lines in the include
files seen by rtems.h by about 2000 lines.

Next we restricted visibility for the inline routines to inside the
executive itself EXCEPT for a handful of objects. This reduced the
number of include files included by rtems.h by 40 files and reduced
the lines in the include files seen by rtems.h by about 6000 lines.

In total, these reduced the compile time of the entire RTEMS tree by 20%.
This results in about 8 minutes savings on the SparcStation? 10 morgana.

  • Property mode set to 100644
File size: 7.4 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, 1990, 1991, 1992, 1993, 1994.
7 *  On-Line Applications Research Corporation (OAR).
8 *  All rights assigned to U.S. Government, 1994.
9 *
10 *  This material may be reproduced by or for the U.S. Government pursuant
11 *  to the copyright license under the clause at DFARS 252.227-7013.  This
12 *  notice must appear in all copies of this file and its derivatives.
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 *  Since msgs are variable length we just make a ptr to 1.
43 */
44 
45typedef struct {
46    unsigned32  size;
47 
48#ifndef __cplusplus
49                               /* NOTE:   [0] is gcc specific,
50                                *   but specifically disallowed by ANSI STD C++
51                                * g++ warns about it, so we #ifdef it out to
52                                * get rid of warnings when compiled by g++.
53                                */
54    unsigned32  buffer[0];
55#endif
56 
57} CORE_message_queue_Buffer;
58 
59/*
60 *  The following records define the organization of a message
61 *  buffer.
62 */
63 
64typedef struct {
65  Chain_Node                 Node;
66  CORE_message_queue_Buffer  Contents;
67}   CORE_message_queue_Buffer_control;
68
69/*
70 *  Blocking disciplines for a message_queue.
71 */
72
73typedef enum {
74  CORE_MESSAGE_QUEUE_DISCIPLINES_FIFO,
75  CORE_MESSAGE_QUEUE_DISCIPLINES_PRIORITY
76}   CORE_message_queue_Disciplines;
77
78/*
79 *  The following enumerated type details the modes in which a message
80 *  may be submitted to a message queue.  The message may be posted
81 *  in a send or urgent fashion.
82 */
83 
84typedef enum {
85  CORE_MESSAGE_QUEUE_SEND_REQUEST   = 0,
86  CORE_MESSAGE_QUEUE_URGENT_REQUEST = 1
87}  CORE_message_queue_Submit_types;
88
89/*
90 *  Core Message queue handler return statuses.
91 */
92 
93typedef enum {
94  CORE_MESSAGE_QUEUE_STATUS_SUCCESSFUL,
95  CORE_MESSAGE_QUEUE_STATUS_INVALID_SIZE,
96  CORE_MESSAGE_QUEUE_STATUS_TOO_MANY,
97  CORE_MESSAGE_QUEUE_STATUS_UNSATISFIED,
98  CORE_MESSAGE_QUEUE_STATUS_UNSATISFIED_NOWAIT,
99  CORE_MESSAGE_QUEUE_STATUS_WAS_DELETED,
100  CORE_MESSAGE_QUEUE_STATUS_TIMEOUT
101}   CORE_message_queue_Status;
102
103/*
104 *  The following defines the control block used to manage the
105 *  attributes of each message queue.
106 */
107
108typedef struct {
109  CORE_message_queue_Disciplines  discipline;
110}   CORE_message_queue_Attributes;
111 
112/*
113 *  The following defines the type for a Notification handler.  A notification
114 *  handler is invoked when the message queue makes a 0->1 transition on
115 *  pending messages.
116 */
117
118typedef void (*CORE_message_queue_Notify_Handler)( void * );
119
120/*
121 *  The following defines the control block used to manage each
122 *  counting message_queue.
123 */
124 
125typedef struct {
126  Thread_queue_Control               Wait_queue;
127  CORE_message_queue_Attributes      Attributes;
128  unsigned32                         maximum_pending_messages;
129  unsigned32                         number_of_pending_messages;
130  unsigned32                         maximum_message_size;
131  Chain_Control                      Pending_messages;
132  CORE_message_queue_Buffer         *message_buffers;
133  CORE_message_queue_Notify_Handler  notify_handler;
134  void                              *notify_argument;
135  Chain_Control                      Inactive_messages;
136}   CORE_message_queue_Control;
137
138/*
139 *  _CORE_message_queue_Initialize
140 *
141 *  DESCRIPTION:
142 *
143 *  This routine initializes the message_queue based on the parameters passed.
144 */
145
146boolean _CORE_message_queue_Initialize(
147  CORE_message_queue_Control    *the_message_queue,
148  Objects_Classes                the_class,
149  CORE_message_queue_Attributes *the_message_queue_attributes,
150  unsigned32                     maximum_pending_messages,
151  unsigned32                     maximum_message_size,
152  Thread_queue_Extract_callout   proxy_extract_callout
153);
154 
155/*
156 *  _CORE_message_queue_Close
157 *
158 *  DESCRIPTION:
159 *
160 *  This function closes a message by returning all allocated space and
161 *  flushing the message_queue's task wait queue.
162 */
163 
164void _CORE_message_queue_Close(
165  CORE_message_queue_Control *the_message_queue,
166  Thread_queue_Flush_callout  remote_extract_callout,
167  unsigned32                  status
168);
169
170/*
171 *
172 *  _CORE_message_queue_Flush
173 *
174 *  DESCRIPTION:
175 *
176 *  This function flushes the message_queue's task wait queue.  The number
177 *  messages flushed from the queue is returned.
178 *
179 */
180
181unsigned32 _CORE_message_queue_Flush(
182  CORE_message_queue_Control *the_message_queue
183);
184
185/*
186 *  _CORE_message_queue_Flush_support
187 *
188 *  DESCRIPTION:
189 *
190 *  This routine flushes all outstanding messages and returns
191 *  them to the inactive message chain.
192 */
193 
194unsigned32 _CORE_message_queue_Flush_support(
195  CORE_message_queue_Control *the_message_queue
196);
197 
198/*
199 *
200 *  _CORE_message_queue_Broadcast
201 *
202 *  DESCRIPTION:
203 *
204 *  This function sends a message for every thread waiting on the queue and
205 *  returns the number of threads made ready by the message.
206 *
207 */
208 
209CORE_message_queue_Status _CORE_message_queue_Broadcast(
210  CORE_message_queue_Control                *the_message_queue,
211  void                                      *buffer,
212  unsigned32                                 size,
213  Objects_Id                                 id,
214  CORE_message_queue_API_mp_support_callout  api_message_queue_mp_support,
215  unsigned32                                *count
216);
217
218/*
219 *
220 *  _CORE_message_queue_Submit
221 *
222 *  DESCRIPTION:
223 *
224 *  This routine implements the send and urgent message functions. It
225 *  processes a message that is to be submitted to the designated
226 *  message queue.  The message will either be processed as a
227 *  send message which it will be inserted at the rear of the queue
228 *  or it will be processed as an urgent message which will be inserted
229 *  at the front of the queue.
230 *
231 */
232 
233CORE_message_queue_Status _CORE_message_queue_Submit(
234  CORE_message_queue_Control                *the_message_queue,
235  void                                      *buffer,
236  unsigned32                                 size,
237  Objects_Id                                 id,
238  CORE_message_queue_API_mp_support_callout  api_message_queue_mp_support,
239  CORE_message_queue_Submit_types            submit_type
240);
241
242/*
243 *
244 *  _CORE_message_queue_Seize
245 *
246 *  DESCRIPTION:
247 *
248 *  This kernel routine dequeues a message, copies the message buffer to
249 *  a given destination buffer, and frees the message buffer to the
250 *  inactive message pool.  The thread will be blocked if wait is TRUE,
251 *  otherwise an error will be given to the thread if no messages are available.
252 *
253 */
254 
255void _CORE_message_queue_Seize(
256  CORE_message_queue_Control *the_message_queue,
257  Objects_Id                  id,
258  void                       *buffer,
259  unsigned32                 *size,
260  boolean                     wait,
261  Watchdog_Interval           timeout
262);
263
264#ifndef __RTEMS_APPLICATION__
265#include <rtems/score/coremsg.inl>
266#endif
267
268#ifdef __cplusplus
269}
270#endif
271 
272#endif
273/*  end of include file */
274
Note: See TracBrowser for help on using the repository browser.