source: rtems/cpukit/score/inline/rtems/score/coremsg.inl @ 503dc058

4.104.114.84.95
Last change on this file since 503dc058 was 503dc058, checked in by Joel Sherrill <joel.sherrill@…>, on 07/03/96 at 14:20:03

switched from "STATIC INLINE" to "RTEMS_INLINE_ROUTINE"

  • Property mode set to 100644
File size: 6.0 KB
Line 
1/*  coremsg.inl
2 *
3 *  This include file contains the static inline implementation of all
4 *  inlined routines in the Core Message 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 __CORE_MESSAGE_QUEUE_inl
18#define __CORE_MESSAGE_QUEUE_inl
19
20#include <string.h>   /* needed for memcpy */
21 
22/*PAGE
23 *
24 *  _CORE_message_queue_Send
25 *
26 *  DESCRIPTION:
27 *
28 *  This routine sends a message to the end of the specified message queue.
29 */
30 
31RTEMS_INLINE_ROUTINE CORE_message_queue_Status _CORE_message_queue_Send(
32  CORE_message_queue_Control                *the_message_queue,
33  void                                      *buffer,
34  unsigned32                                 size,
35  Objects_Id                                 id,
36  CORE_message_queue_API_mp_support_callout  api_message_queue_mp_support
37)
38{
39  return _CORE_message_queue_Submit(
40    the_message_queue,
41    buffer,
42    size,
43    id,
44    api_message_queue_mp_support,
45    CORE_MESSAGE_QUEUE_SEND_REQUEST
46  );
47}
48 
49/*PAGE
50 *
51 *  _CORE_message_queue_Urgent
52 *
53 *  DESCRIPTION:
54 *
55 *  This routine sends a message to the front of the specified message queue.
56 */
57 
58RTEMS_INLINE_ROUTINE CORE_message_queue_Status _CORE_message_queue_Urgent(
59  CORE_message_queue_Control                *the_message_queue,
60  void                                      *buffer,
61  unsigned32                                 size,
62  Objects_Id                                 id,
63  CORE_message_queue_API_mp_support_callout  api_message_queue_mp_support
64)
65{
66  return _CORE_message_queue_Submit(
67    the_message_queue,
68    buffer,
69    size,
70    id,
71    api_message_queue_mp_support,
72    CORE_MESSAGE_QUEUE_URGENT_REQUEST
73 );
74}
75
76/*PAGE
77 *
78 *  _CORE_message_queue_Copy_buffer
79 *
80 *  DESCRIPTION:
81 *
82 *  This routine copies the contents of the source message buffer
83 *  to the destination message buffer.
84 */
85
86RTEMS_INLINE_ROUTINE void _CORE_message_queue_Copy_buffer (
87  void      *source,
88  void      *destination,
89  unsigned32 size
90)
91{
92  memcpy(destination, source, size);
93}
94
95/*PAGE
96 *
97 *  _CORE_message_queue_Allocate_message_buffer
98 *
99 *  DESCRIPTION:
100 *
101 *  This function allocates a message buffer from the inactive
102 *  message buffer chain.
103 */
104
105RTEMS_INLINE_ROUTINE CORE_message_queue_Buffer_control *
106_CORE_message_queue_Allocate_message_buffer (
107    CORE_message_queue_Control *the_message_queue
108)
109{
110   return (CORE_message_queue_Buffer_control *)
111     _Chain_Get( &the_message_queue->Inactive_messages );
112}
113
114/*PAGE
115 *
116 *  _CORE_message_queue_Free_message_buffer
117 *
118 *  DESCRIPTION:
119 *
120 *  This routine frees a message buffer to the inactive
121 *  message buffer chain.
122 */
123
124RTEMS_INLINE_ROUTINE void _CORE_message_queue_Free_message_buffer (
125    CORE_message_queue_Control        *the_message_queue,
126    CORE_message_queue_Buffer_control *the_message
127)
128{
129  _Chain_Append( &the_message_queue->Inactive_messages, &the_message->Node );
130}
131
132/*PAGE
133 *
134 *  _CORE_message_queue_Get_pending_message
135 *
136 *  DESCRIPTION:
137 *
138 *  This function removes the first message from the_message_queue
139 *  and returns a pointer to it.
140 */
141
142RTEMS_INLINE_ROUTINE
143  CORE_message_queue_Buffer_control *_CORE_message_queue_Get_pending_message (
144  CORE_message_queue_Control *the_message_queue
145)
146{
147  return (CORE_message_queue_Buffer_control *)
148    _Chain_Get_unprotected( &the_message_queue->Pending_messages );
149}
150
151/*PAGE
152 *
153 *  _CORE_message_queue_Is_priority
154 *
155 *  DESCRIPTION:
156 *
157 *  This function returns TRUE if the priority attribute is
158 *  enabled in the attribute_set and FALSE otherwise.
159 */
160 
161RTEMS_INLINE_ROUTINE boolean _CORE_message_queue_Is_priority(
162  CORE_message_queue_Attributes *the_attribute
163)
164{
165  return (the_attribute->discipline == CORE_MESSAGE_QUEUE_DISCIPLINES_PRIORITY);
166}
167
168/*PAGE
169 *
170 *  _CORE_message_queue_Append
171 *
172 *  DESCRIPTION:
173 *
174 *  This routine places the_message at the rear of the outstanding
175 *  messages on the_message_queue.
176 */
177
178RTEMS_INLINE_ROUTINE void _CORE_message_queue_Append (
179  CORE_message_queue_Control        *the_message_queue,
180  CORE_message_queue_Buffer_control *the_message
181)
182{
183  _Chain_Append( &the_message_queue->Pending_messages, &the_message->Node );
184}
185
186/*PAGE
187 *
188 *  _CORE_message_queue_Prepend
189 *
190 *  DESCRIPTION:
191 *
192 *  This routine places the_message at the front of the outstanding
193 *  messages on the_message_queue.
194 */
195
196RTEMS_INLINE_ROUTINE void _CORE_message_queue_Prepend (
197  CORE_message_queue_Control        *the_message_queue,
198  CORE_message_queue_Buffer_control *the_message
199)
200{
201  _Chain_Prepend(
202    &the_message_queue->Pending_messages,
203    &the_message->Node
204  );
205}
206
207/*PAGE
208 *
209 *  _CORE_message_queue_Is_null
210 *
211 *  DESCRIPTION:
212 *
213 *  This function returns TRUE if the_message_queue is TRUE and FALSE otherwise.
214 */
215
216RTEMS_INLINE_ROUTINE boolean _CORE_message_queue_Is_null (
217  CORE_message_queue_Control *the_message_queue
218)
219{
220  return ( the_message_queue == NULL  );
221}
222
223/*PAGE
224 *
225 *  _CORE_message_queue_Is_notify_enabled
226 *
227 *  DESCRIPTION:
228 *
229 *  This function returns TRUE if notification is enabled on this message
230 *  queue and FALSE otherwise.
231 */
232 
233RTEMS_INLINE_ROUTINE boolean _CORE_message_queue_Is_notify_enabled (
234  CORE_message_queue_Control *the_message_queue
235)
236{
237  return (the_message_queue->notify_handler != NULL);
238}
239 
240/*PAGE
241 *
242 *  _CORE_message_queue_Set_notify
243 *
244 *  DESCRIPTION:
245 *
246 *  This routine initializes the notification information for the_message_queue.
247 */
248 
249RTEMS_INLINE_ROUTINE void _CORE_message_queue_Set_notify (
250  CORE_message_queue_Control        *the_message_queue,
251  CORE_message_queue_Notify_Handler  the_handler,
252  void                              *the_argument
253)
254{
255  the_message_queue->notify_handler  = the_handler;
256  the_message_queue->notify_argument = the_argument;
257}
258
259#endif
260/* end of include file */
Note: See TracBrowser for help on using the repository browser.