source: rtems/cpukit/rtems/include/rtems/rtems/message.h @ f9293df

4.104.114.95
Last change on this file since f9293df was f9293df, checked in by Joel Sherrill <joel.sherrill@…>, on 04/18/08 at 20:08:08

2008-04-18 Joel Sherrill <joel.sherrill@…>

  • rtems/Doxyfile, rtems/include/rtems/rtems/asr.h, rtems/include/rtems/rtems/attr.h, rtems/include/rtems/rtems/barrier.h, rtems/include/rtems/rtems/barriermp.h, rtems/include/rtems/rtems/cache.h, rtems/include/rtems/rtems/config.h, rtems/include/rtems/rtems/dpmem.h, rtems/include/rtems/rtems/event.h, rtems/include/rtems/rtems/eventmp.h, rtems/include/rtems/rtems/eventset.h, rtems/include/rtems/rtems/intr.h, rtems/include/rtems/rtems/message.h, rtems/include/rtems/rtems/modes.h, rtems/include/rtems/rtems/mp.h, rtems/include/rtems/rtems/msgmp.h, rtems/include/rtems/rtems/options.h, rtems/include/rtems/rtems/part.h, rtems/include/rtems/rtems/partmp.h, rtems/include/rtems/rtems/ratemon.h, rtems/include/rtems/rtems/region.h, rtems/include/rtems/rtems/regionmp.h, rtems/include/rtems/rtems/rtemsapi.h, rtems/include/rtems/rtems/sem.h, rtems/include/rtems/rtems/semmp.h, rtems/include/rtems/rtems/signal.h, rtems/include/rtems/rtems/signalmp.h, rtems/include/rtems/rtems/status.h, rtems/include/rtems/rtems/support.h, rtems/include/rtems/rtems/taskmp.h, rtems/include/rtems/rtems/tasks.h, rtems/include/rtems/rtems/timer.h, rtems/include/rtems/rtems/types.h, rtems/inline/rtems/rtems/asr.inl, rtems/inline/rtems/rtems/attr.inl, rtems/inline/rtems/rtems/barrier.inl, rtems/inline/rtems/rtems/dpmem.inl, rtems/inline/rtems/rtems/event.inl, rtems/inline/rtems/rtems/message.inl, rtems/inline/rtems/rtems/modes.inl, rtems/inline/rtems/rtems/options.inl, rtems/inline/rtems/rtems/part.inl, rtems/inline/rtems/rtems/ratemon.inl, rtems/inline/rtems/rtems/region.inl, rtems/inline/rtems/rtems/sem.inl, rtems/inline/rtems/rtems/status.inl, rtems/inline/rtems/rtems/support.inl, rtems/inline/rtems/rtems/timer.inl: More Doxygen improvements.
  • Property mode set to 100644
File size: 9.4 KB
Line 
1/**
2 * @file rtems/rtems/message.h
3 *
4 *  This include file contains all the constants and structures associated
5 *  with the Message Queue Manager.  This manager provides a mechanism for
6 *  communication and synchronization between tasks using messages.
7 *
8 *  Directives provided are:
9 *
10 *     - create a queue
11 *     - get ID of a queue
12 *     - delete a queue
13 *     - put a message at the rear of a queue
14 *     - put a message at the front of a queue
15 *     - broadcast N messages to a queue
16 *     - receive message from a queue
17 *     - flush all messages on a queue
18 */
19
20/*  COPYRIGHT (c) 1989-2008.
21 *  On-Line Applications Research Corporation (OAR).
22 *
23 *  The license and distribution terms for this file may be
24 *  found in the file LICENSE in this distribution or at
25 *  http://www.rtems.com/license/LICENSE.
26 *
27 *  $Id$
28 */
29
30#ifndef _RTEMS_RTEMS_MESSAGE_H
31#define _RTEMS_RTEMS_MESSAGE_H
32
33/**
34 *  This constant is defined to extern most of the time when using
35 *  this header file.  However by defining it to nothing, the data
36 *  declared in this header file can be instantiated.  This is done
37 *  in a single per manager file.
38 */
39#ifndef RTEMS_MESSAGE_EXTERN
40#define RTEMS_MESSAGE_EXTERN extern
41#endif
42
43#ifdef __cplusplus
44extern "C" {
45#endif
46
47#include <rtems/rtems/types.h>
48#include <rtems/rtems/status.h>
49#include <rtems/score/chain.h>
50#include <rtems/score/object.h>
51#include <rtems/rtems/attr.h>
52#include <rtems/score/coremsg.h>
53
54/**
55 *  @defgroup ClassicMessageQueue Classic API Message Queue
56 *
57 *  This encapsulates functionality which XXX
58 */
59/**@{*/
60
61/**
62 *  The following enumerated type details the modes in which a message
63 *  may be submitted to a message queue.  The message may be posted
64 *  in a send or urgent fashion.
65 */
66typedef enum {
67  /**
68   *  This value indicates the user wants to send the message using the
69   *  normal message insertion protocol (FIFO or priority).
70   */
71  MESSAGE_QUEUE_SEND_REQUEST   = 0,
72  /**
73   *  This value indicates the user considers the message to be urgent
74   *  and wants it inserted at the head of the pending message queue.
75   */
76  MESSAGE_QUEUE_URGENT_REQUEST = 1
77}  Message_queue_Submit_types;
78
79/**
80 *  The following records define the control block used to manage
81 *  each message queue.
82 */
83typedef struct {
84  /** This field is the inherited obejct characteristics. */
85  Objects_Control             Object;
86  /** This field is the attribute set as defined by the API. */
87  rtems_attribute             attribute_set;
88  /** This field is the instance of the SuperCore Message Queue. */
89  CORE_message_queue_Control  message_queue;
90}   Message_queue_Control;
91
92/**
93 *  The following defines the information control block used to
94 *  manage this class of objects.
95 */
96RTEMS_MESSAGE_EXTERN Objects_Information  _Message_queue_Information;
97
98/**
99 *  @brief Message_queue_Manager_initialization
100 *
101 *  This routine performs the initialization necessary for this manager.
102 */
103void _Message_queue_Manager_initialization(
104  uint32_t   maximum_message_queues
105);
106
107/**
108 *  @brief rtems_message_queue_create
109 *
110 *  This routine implements the rtems_message_queue_create directive.  The
111 *  message queue will have the name name.  If the attribute_set indicates
112 *  that the message queue is to be limited in the number of messages
113 *  that can be outstanding, then count indicates the maximum number of
114 *  messages that will be held.  It returns the id of the created
115 *  message queue in ID.
116 */
117rtems_status_code rtems_message_queue_create(
118  rtems_name       name,
119  uint32_t         count,
120  uint32_t         max_message_size,
121  rtems_attribute  attribute_set,
122  Objects_Id      *id
123);
124
125/**
126 *  @brief rtems_message_queue_ident
127 *
128 *  This routine implements the rtems_message_queue_ident directive.
129 *  This directive returns the message queue ID associated with NAME.
130 *  If more than one message queue is named name, then the message
131 *  queue to which the ID belongs is arbitrary.  node indicates the
132 *  extent of the search for the ID of the message queue named name.
133 *  The search can be limited to a particular node or allowed to
134 *  encompass all nodes.
135 */
136rtems_status_code rtems_message_queue_ident(
137  rtems_name    name,
138  uint32_t      node,
139  Objects_Id   *id
140);
141
142/**
143 *  @brief rtems_message_queue_delete
144 *
145 *  This routine implements the rtems_message_queue_delete directive.  The
146 *  message queue indicated by ID is deleted.
147 */
148rtems_status_code rtems_message_queue_delete(
149  Objects_Id id
150);
151
152/**
153 *  @brief rtems_message_queue_send
154 *
155 *  This routine implements the rtems_message_queue_send directive.
156 *  This directive sends the message buffer to the message queue
157 *  indicated by ID.  If one or more tasks is blocked waiting
158 *  to receive a message from this message queue, then one will
159 *  receive the message.  The task selected to receive the
160 *  message is based on the task queue discipline algorithm in
161 *  use by this particular message queue.  If no tasks are waiting,
162 *  then the message buffer will be placed at the REAR of the
163 *  chain of pending messages for this message queue.
164 */
165rtems_status_code rtems_message_queue_send(
166  Objects_Id            id,
167  void                 *buffer,
168  size_t                size
169);
170
171/**
172 *  @brief rtems_message_queue_urgent
173 *
174 *  This routine implements the rtems_message_queue_urgent directive.
175 *  This directive has the same behavior as rtems_message_queue_send
176 *  except that if no tasks are waiting, the message buffer will
177 *  be placed at the FRONT of the chain of pending messages rather
178 *  than at the REAR.
179 */
180rtems_status_code rtems_message_queue_urgent(
181  Objects_Id            id,
182  void                 *buffer,
183  size_t                size
184);
185
186/**
187 *  @brief rtems_message_queue_broadcast
188 *
189 *  This routine implements the rtems_message_queue_broadcast directive.
190 *  This directive sends the message buffer to all of the tasks blocked
191 *  waiting for a message on the message queue indicated by ID.
192 *  If no tasks are waiting, then the message buffer will not be queued.
193 */
194rtems_status_code rtems_message_queue_broadcast(
195  Objects_Id            id,
196  void                 *buffer,
197  size_t                size,
198  uint32_t             *count
199);
200
201/**
202 *  @brief rtems_message_queue_receive
203 *
204 *  This routine implements the rtems_message_queue_receive directive.
205 *  This directive is invoked when the calling task wishes to receive
206 *  a message from the message queue indicated by ID.  The received
207 *  message is to be placed in buffer.  If no messages are outstanding
208 *  and the option_set indicates that the task is willing to block,
209 *  then the task will be blocked until a message arrives or until,
210 *  optionally, timeout clock ticks have passed.
211 */
212rtems_status_code rtems_message_queue_receive(
213  Objects_Id            id,
214  void                 *buffer,
215  size_t               *size,
216  uint32_t              option_set,
217  rtems_interval        timeout
218);
219
220/**
221 *  @brief rtems_message_queue_flush
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 */
228rtems_status_code rtems_message_queue_flush(
229  Objects_Id  id,
230  uint32_t   *count
231);
232
233/**
234 *  @brief rtems_message_queue_get_number_pending
235 *
236 *  This routine implements the rtems_message_queue_get_number_pending
237 *  directive.  This directive returns the number of pending
238 *  messages for the message queue indicated by ID
239 *  chain.  The number of messages pending is returned in COUNT.
240 */
241rtems_status_code rtems_message_queue_get_number_pending(
242  Objects_Id  id,
243  uint32_t   *count
244);
245
246
247/**
248 *  @brief Message_queue_Submit
249 *
250 *  This routine implements the directives rtems_message_queue_send
251 *  and rtems_message_queue_urgent.  It processes a message that is
252 *  to be submitted to the designated message queue.  The message will
253 *  either be processed as a send send message which it will be inserted
254 *  at the rear of the queue or it will be processed as an urgent message
255 *  which will be inserted at the front of the queue.
256 */
257rtems_status_code _Message_queue_Submit(
258  Objects_Id                  id,
259  void                       *buffer,
260  size_t                      size,
261  Message_queue_Submit_types  submit_type
262);
263
264/**
265 *  @brief Message_queue_Allocate
266 *
267 *  This function allocates a message queue control block from
268 *  the inactive chain of free message queue control blocks.
269 */
270Message_queue_Control *_Message_queue_Allocate (
271    uint32_t            count,
272    uint32_t            max_message_size
273);
274
275/**
276 *  @brief Message_queue_Translate_core_message_queue_return_code
277 *
278 *  This function returns a RTEMS status code based on the core message queue
279 *  status code specified.
280 */
281rtems_status_code _Message_queue_Translate_core_message_queue_return_code (
282  uint32_t   the_message_queue_status
283);
284
285#if defined(RTEMS_MULTIPROCESSING)
286/**
287 *  @brief Message_queue_Core_message_queue_mp_support
288 *
289 *  Input parameters:
290 *    the_thread - the remote thread the message was submitted to
291 *    id         - id of the message queue
292 *
293 *  Output parameters: NONE
294 */
295void  _Message_queue_Core_message_queue_mp_support (
296  Thread_Control *the_thread,
297  Objects_Id      id
298);
299#endif
300
301#ifndef __RTEMS_APPLICATION__
302#include <rtems/rtems/message.inl>
303#endif
304#if defined(RTEMS_MULTIPROCESSING)
305#include <rtems/rtems/msgmp.h>
306#endif
307
308#ifdef __cplusplus
309}
310#endif
311
312/**@}*/
313
314#endif
315/* end of include file */
Note: See TracBrowser for help on using the repository browser.