source: rtems/cpukit/rtems/include/rtems/rtems/message.h @ 9b4422a2

4.115
Last change on this file since 9b4422a2 was 9b4422a2, checked in by Joel Sherrill <joel.sherrill@…>, on 05/03/12 at 15:09:24

Remove All CVS Id Strings Possible Using a Script

Script does what is expected and tries to do it as
smartly as possible.

+ remove occurrences of two blank comment lines

next to each other after Id string line removed.

+ remove entire comment blocks which only exited to

contain CVS Ids

+ If the processing left a blank line at the top of

a file, it was removed.

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