source: rtems/c/src/exec/rtems/inline/message.inl @ b2c491a0

4.104.114.84.95
Last change on this file since b2c491a0 was b2c491a0, checked in by Joel Sherrill <joel.sherrill@…>, on 08/22/95 at 14:52:08

make inline and macro implementations match

  • Property mode set to 100644
File size: 3.0 KB
Line 
1/*  message.inl
2 *
3 *  This include file contains the static inline implementation of all
4 *  inlined routines in the Message Manager.
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 __MESSAGE_QUEUE_inl
18#define __MESSAGE_QUEUE_inl
19
20#include <rtems/wkspace.h>
21
22/*PAGE
23 *
24 *  _Message_queue_Copy_buffer
25 *
26 */
27
28STATIC INLINE void _Message_queue_Copy_buffer (
29  void      *source,
30  void      *destination,
31  unsigned32 size
32)
33{
34  memcpy(destination, source, size);
35}
36
37/*PAGE
38 *
39 *  _Message_queue_Allocate_message_buffer
40 *
41 */
42
43STATIC INLINE Message_queue_Buffer_control *
44_Message_queue_Allocate_message_buffer (
45    Message_queue_Control *the_message_queue
46)
47{
48   return (Message_queue_Buffer_control *)
49     _Chain_Get( &the_message_queue->Inactive_messages );
50}
51
52/*PAGE
53 *
54 *  _Message_queue_Free_message_buffer
55 *
56 */
57
58STATIC INLINE void _Message_queue_Free_message_buffer (
59    Message_queue_Control        *the_message_queue,
60    Message_queue_Buffer_control *the_message
61)
62{
63  _Chain_Append( &the_message_queue->Inactive_messages, &the_message->Node );
64}
65
66/*PAGE
67 *
68 *  _Message_queue_Get_pending_message
69 *
70 */
71
72STATIC INLINE
73  Message_queue_Buffer_control *_Message_queue_Get_pending_message (
74  Message_queue_Control *the_message_queue
75)
76{
77  return (Message_queue_Buffer_control *)
78    _Chain_Get_unprotected( &the_message_queue->Pending_messages );
79}
80
81/*PAGE
82 *
83 *  _Message_queue_Append
84 *
85 */
86
87STATIC INLINE void _Message_queue_Append (
88  Message_queue_Control        *the_message_queue,
89  Message_queue_Buffer_control *the_message
90)
91{
92  _Chain_Append( &the_message_queue->Pending_messages, &the_message->Node );
93}
94
95/*PAGE
96 *
97 *  _Message_queue_Prepend
98 *
99 */
100
101STATIC INLINE void _Message_queue_Prepend (
102  Message_queue_Control        *the_message_queue,
103  Message_queue_Buffer_control *the_message
104)
105{
106  _Chain_Prepend(
107    &the_message_queue->Pending_messages,
108    &the_message->Node
109  );
110}
111
112/*PAGE
113 *
114 *  _Message_queue_Is_null
115 *
116 */
117
118STATIC INLINE boolean _Message_queue_Is_null (
119  Message_queue_Control *the_message_queue
120)
121{
122  return ( the_message_queue == NULL  );
123}
124
125
126/*PAGE
127 *
128 *  _Message_queue_Free
129 *
130 */
131
132STATIC INLINE void _Message_queue_Free (
133  Message_queue_Control *the_message_queue
134)
135{
136  if (the_message_queue->message_buffers) {
137    _Workspace_Free((void *) the_message_queue->message_buffers);
138    the_message_queue->message_buffers = 0;
139  }
140 
141  _Objects_Free( &_Message_queue_Information, &the_message_queue->Object );
142}
143
144/*PAGE
145 *
146 *  _Message_queue_Get
147 *
148 */
149
150STATIC INLINE Message_queue_Control *_Message_queue_Get (
151  Objects_Id         id,
152  Objects_Locations *location
153)
154{
155  return (Message_queue_Control *)
156     _Objects_Get( &_Message_queue_Information, id, location );
157}
158
159#endif
160/* end of include file */
Note: See TracBrowser for help on using the repository browser.