source: rtems/cpukit/score/include/rtems/score/coremsg.h @ 4e89a12

4.104.114.84.95
Last change on this file since 4e89a12 was dd687d97, checked in by Joel Sherrill <joel.sherrill@…>, on 09/04/03 at 18:56:05

2003-09-04 Joel Sherrill <joel@…>

  • include/rtems/debug.h, include/rtems/seterr.h, include/rtems/system.h, include/rtems/score/address.h, include/rtems/score/apiext.h, include/rtems/score/apimutex.h, include/rtems/score/bitfield.h, include/rtems/score/chain.h, include/rtems/score/context.h, include/rtems/score/copyrt.h, include/rtems/score/coremsg.h, include/rtems/score/coremutex.h, include/rtems/score/coresem.h, include/rtems/score/heap.h, include/rtems/score/interr.h, include/rtems/score/isr.h, include/rtems/score/mpci.h, include/rtems/score/mppkt.h, include/rtems/score/object.h, include/rtems/score/objectmp.h, include/rtems/score/priority.h, include/rtems/score/stack.h, include/rtems/score/states.h, include/rtems/score/sysstate.h, include/rtems/score/thread.h, include/rtems/score/threadmp.h, include/rtems/score/threadq.h, include/rtems/score/tod.h, include/rtems/score/tqdata.h, include/rtems/score/userext.h, include/rtems/score/watchdog.h, include/rtems/score/wkspace.h, inline/rtems/score/address.inl, inline/rtems/score/chain.inl, inline/rtems/score/coremsg.inl, inline/rtems/score/coremutex.inl, inline/rtems/score/coresem.inl, inline/rtems/score/heap.inl, inline/rtems/score/isr.inl, inline/rtems/score/mppkt.inl, inline/rtems/score/object.inl, inline/rtems/score/objectmp.inl, inline/rtems/score/priority.inl, inline/rtems/score/stack.inl, inline/rtems/score/states.inl, inline/rtems/score/sysstate.inl, inline/rtems/score/thread.inl, inline/rtems/score/threadmp.inl, inline/rtems/score/tod.inl, inline/rtems/score/tqdata.inl, inline/rtems/score/userext.inl, inline/rtems/score/watchdog.inl, inline/rtems/score/wkspace.inl, macros/rtems/score/address.inl, macros/rtems/score/chain.inl, macros/rtems/score/coremsg.inl, macros/rtems/score/coremutex.inl, macros/rtems/score/coresem.inl, macros/rtems/score/heap.inl, macros/rtems/score/isr.inl, macros/rtems/score/mppkt.inl, macros/rtems/score/object.inl, macros/rtems/score/objectmp.inl, macros/rtems/score/priority.inl, macros/rtems/score/stack.inl, macros/rtems/score/states.inl, macros/rtems/score/sysstate.inl, macros/rtems/score/thread.inl, macros/rtems/score/threadmp.inl, macros/rtems/score/tod.inl, macros/rtems/score/tqdata.inl, macros/rtems/score/userext.inl, macros/rtems/score/watchdog.inl, macros/rtems/score/wkspace.inl, src/apiext.c, src/chain.c, src/coremsg.c, src/coremsgbroadcast.c, src/coremsgclose.c, src/coremsgflush.c, src/coremsgflushsupp.c, src/coremsgflushwait.c, src/coremsginsert.c, src/coremsgseize.c, src/coremsgsubmit.c, src/coremutex.c, src/coremutexflush.c, src/coremutexseize.c, src/coremutexsurrender.c, src/coresem.c, src/coresemflush.c, src/coresemseize.c, src/coresemsurrender.c, src/coretod.c, src/coretodset.c, src/coretodtickle.c, src/coretodtoseconds.c, src/coretodvalidate.c, src/heap.c, src/heapallocate.c, src/heapextend.c, src/heapfree.c, src/heapgetinfo.c, src/heapsizeofuserarea.c, src/heapwalk.c, src/interr.c, src/isr.c, src/iterateoverthreads.c, src/mpci.c, src/object.c, src/objectallocate.c, src/objectallocatebyindex.c, src/objectclearname.c, src/objectcomparenameraw.c, src/objectcomparenamestring.c, src/objectcopynameraw.c, src/objectcopynamestring.c, src/objectextendinformation.c, src/objectfree.c, src/objectget.c, src/objectgetbyindex.c, src/objectgetisr.c, src/objectgetnext.c, src/objectgetnoprotection.c, src/objectidtoname.c, src/objectinitializeinformation.c, src/objectmp.c, src/objectnametoid.c, src/objectshrinkinformation.c, src/thread.c, src/threadchangepriority.c, src/threadclearstate.c, src/threadclose.c, src/threadcreateidle.c, src/threaddelayended.c, src/threaddispatch.c, src/threadevaluatemode.c, src/threadget.c, src/threadhandler.c, src/threadidlebody.c, src/threadinitialize.c, src/threadloadenv.c, src/threadmp.c, src/threadq.c, src/threadqdequeue.c, src/threadqdequeuefifo.c, src/threadqdequeuepriority.c, src/threadqenqueue.c, src/threadqenqueuefifo.c, src/threadqenqueuepriority.c, src/threadqextract.c, src/threadqextractfifo.c, src/threadqextractpriority.c, src/threadqextractwithproxy.c, src/threadqfirst.c, src/threadqfirstfifo.c, src/threadqfirstpriority.c, src/threadqflush.c, src/threadqtimeout.c, src/threadready.c, src/threadreset.c, src/threadresettimeslice.c, src/threadrestart.c, src/threadresume.c, src/threadrotatequeue.c, src/threadsetpriority.c, src/threadsetstate.c, src/threadsettransient.c, src/threadstackallocate.c, src/threadstackfree.c, src/threadstart.c, src/threadstartmultitasking.c, src/threadsuspend.c, src/threadtickletimeslice.c, src/threadyieldprocessor.c, src/userext.c, src/watchdog.c, src/watchdogadjust.c, src/watchdoginsert.c, src/watchdogremove.c, src/watchdogtickle.c, src/wkspace.c: URL for license changed.
  • Property mode set to 100644
File size: 8.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-1999.
7 *  On-Line Applications Research Corporation (OAR).
8 *
9 *  The license and distribution terms for this file may be
10 *  found in the file LICENSE in this distribution or at
11 *  http://www.rtems.com/license/LICENSE.
12 *
13 *  $Id$
14 */
15 
16#ifndef __RTEMS_CORE_MESSAGE_QUEUE_h
17#define __RTEMS_CORE_MESSAGE_QUEUE_h
18 
19#ifdef __cplusplus
20extern "C" {
21#endif
22
23#include <limits.h>
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  int                        priority;
60  CORE_message_queue_Buffer  Contents;
61}   CORE_message_queue_Buffer_control;
62
63/*
64 *  Blocking disciplines for a message_queue.
65 */
66
67typedef enum {
68  CORE_MESSAGE_QUEUE_DISCIPLINES_FIFO,
69  CORE_MESSAGE_QUEUE_DISCIPLINES_PRIORITY
70}   CORE_message_queue_Disciplines;
71
72/*
73 *  The following enumerated type details the modes in which a message
74 *  may be submitted to a message queue.  The message may be posted
75 *  in a send or urgent fashion.
76 *
77 *  NOTE:  All other values are message priorities.  Numerically smaller
78 *         priorities indicate higher priority messages.
79 *
80 */
81
82#define  CORE_MESSAGE_QUEUE_SEND_REQUEST   INT_MAX
83#define  CORE_MESSAGE_QUEUE_URGENT_REQUEST INT_MIN
84 
85typedef int CORE_message_queue_Submit_types;
86
87/*
88 *  Core Message queue handler return statuses.
89 */
90 
91typedef enum {
92  CORE_MESSAGE_QUEUE_STATUS_SUCCESSFUL,
93  CORE_MESSAGE_QUEUE_STATUS_INVALID_SIZE,
94  CORE_MESSAGE_QUEUE_STATUS_TOO_MANY,
95  CORE_MESSAGE_QUEUE_STATUS_UNSATISFIED,
96  CORE_MESSAGE_QUEUE_STATUS_UNSATISFIED_NOWAIT,
97  CORE_MESSAGE_QUEUE_STATUS_WAS_DELETED,
98  CORE_MESSAGE_QUEUE_STATUS_TIMEOUT,
99  CORE_MESSAGE_QUEUE_STATUS_UNSATISFIED_WAIT
100}   CORE_message_queue_Status;
101
102/*
103 *  The following defines the control block used to manage the
104 *  attributes of each message queue.
105 */
106
107typedef struct {
108  CORE_message_queue_Disciplines  discipline;
109}   CORE_message_queue_Attributes;
110 
111/*
112 *  The following defines the type for a Notification handler.  A notification
113 *  handler is invoked when the message queue makes a 0->1 transition on
114 *  pending messages.
115 */
116
117typedef void (*CORE_message_queue_Notify_Handler)( void * );
118
119/*
120 *  The following defines the control block used to manage each
121 *  counting message_queue.
122 */
123 
124typedef struct {
125  Thread_queue_Control               Wait_queue;
126  CORE_message_queue_Attributes      Attributes;
127  unsigned32                         maximum_pending_messages;
128  unsigned32                         number_of_pending_messages;
129  unsigned32                         maximum_message_size;
130  Chain_Control                      Pending_messages;
131  CORE_message_queue_Buffer         *message_buffers;
132  CORE_message_queue_Notify_Handler  notify_handler;
133  void                              *notify_argument;
134  Chain_Control                      Inactive_messages;
135}   CORE_message_queue_Control;
136
137/*
138 *  _CORE_message_queue_Initialize
139 *
140 *  DESCRIPTION:
141 *
142 *  This routine initializes the message_queue based on the parameters passed.
143 */
144
145boolean _CORE_message_queue_Initialize(
146  CORE_message_queue_Control    *the_message_queue,
147  CORE_message_queue_Attributes *the_message_queue_attributes,
148  unsigned32                     maximum_pending_messages,
149  unsigned32                     maximum_message_size
150);
151 
152/*
153 *  _CORE_message_queue_Close
154 *
155 *  DESCRIPTION:
156 *
157 *  This function closes a message by returning all allocated space and
158 *  flushing the message_queue's task wait queue.
159 */
160 
161void _CORE_message_queue_Close(
162  CORE_message_queue_Control *the_message_queue,
163  Thread_queue_Flush_callout  remote_extract_callout,
164  unsigned32                  status
165);
166
167/*
168 *  _CORE_message_queue_Flush
169 *
170 *  DESCRIPTION:
171 *
172 *  This function flushes the message_queue's pending message queue.  The
173 *  number of messages flushed from the queue is returned.
174 *
175 */
176
177unsigned32 _CORE_message_queue_Flush(
178  CORE_message_queue_Control *the_message_queue
179);
180
181/*
182 *  _CORE_message_queue_Flush_support
183 *
184 *  DESCRIPTION:
185 *
186 *  This routine flushes all outstanding messages and returns
187 *  them to the inactive message chain.
188 */
189 
190unsigned32 _CORE_message_queue_Flush_support(
191  CORE_message_queue_Control *the_message_queue
192);
193 
194/*
195 *  _CORE_message_queue_Flush_waiting_threads
196 *
197 *  DESCRIPTION:
198 *
199 *  This function flushes the threads which are blocked on this
200 *  message_queue's pending message queue.  They are unblocked whether
201 *  blocked sending or receiving.
202 */
203
204void _CORE_message_queue_Flush_waiting_threads(
205  CORE_message_queue_Control *the_message_queue
206);
207
208/*
209 *  _CORE_message_queue_Broadcast
210 *
211 *  DESCRIPTION:
212 *
213 *  This function sends a message for every thread waiting on the queue and
214 *  returns the number of threads made ready by the message.
215 *
216 */
217 
218CORE_message_queue_Status _CORE_message_queue_Broadcast(
219  CORE_message_queue_Control                *the_message_queue,
220  void                                      *buffer,
221  unsigned32                                 size,
222  Objects_Id                                 id,
223  CORE_message_queue_API_mp_support_callout  api_message_queue_mp_support,
224  unsigned32                                *count
225);
226
227/*
228 *  _CORE_message_queue_Submit
229 *
230 *  DESCRIPTION:
231 *
232 *  This routine implements the send and urgent message functions. It
233 *  processes a message that is to be submitted to the designated
234 *  message queue.  The message will either be processed as a
235 *  send message which it will be inserted at the rear of the queue
236 *  or it will be processed as an urgent message which will be inserted
237 *  at the front of the queue.
238 *
239 */
240 
241CORE_message_queue_Status _CORE_message_queue_Submit(
242  CORE_message_queue_Control                *the_message_queue,
243  void                                      *buffer,
244  unsigned32                                 size,
245  Objects_Id                                 id,
246  CORE_message_queue_API_mp_support_callout  api_message_queue_mp_support,
247  CORE_message_queue_Submit_types            submit_type,
248  boolean                                    wait,
249  Watchdog_Interval                          timeout
250);
251
252/*
253 *  _CORE_message_queue_Seize
254 *
255 *  DESCRIPTION:
256 *
257 *  This kernel routine dequeues a message, copies the message buffer to
258 *  a given destination buffer, and frees the message buffer to the
259 *  inactive message pool.  The thread will be blocked if wait is TRUE,
260 *  otherwise an error will be given to the thread if no messages are available.
261 *
262 *  NOTE: Returns message priority via return are in TCB.
263 */
264 
265void _CORE_message_queue_Seize(
266  CORE_message_queue_Control      *the_message_queue,
267  Objects_Id                       id,
268  void                            *buffer,
269  unsigned32                      *size,
270  boolean                          wait,
271  Watchdog_Interval                timeout
272);
273
274/*
275 *  _CORE_message_queue_Insert_message
276 *
277 *  DESCRIPTION:
278 *
279 *  This kernel routine inserts the specified message into the
280 *  message queue.  It is assumed that the message has been filled
281 *  in before this routine is called.
282 */
283
284void _CORE_message_queue_Insert_message(
285  CORE_message_queue_Control        *the_message_queue,
286  CORE_message_queue_Buffer_control *the_message,
287  CORE_message_queue_Submit_types    submit_type
288);
289
290#ifndef __RTEMS_APPLICATION__
291#include <rtems/score/coremsg.inl>
292#endif
293
294#ifdef __cplusplus
295}
296#endif
297 
298#endif
299/*  end of include file */
300
Note: See TracBrowser for help on using the repository browser.