source: rtems/cpukit/score/inline/rtems/score/coremsg.inl @ d6154c7

4.104.114.84.95
Last change on this file since d6154c7 was d6154c7, checked in by Ralf Corsepius <ralf.corsepius@…>, on Mar 29, 2004 at 4:41:13 PM

2004-03-29 Ralf Corsepius <ralf_corsepius@…>

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