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-1998. |
---|
7 | * On-Line Applications Research Corporation (OAR). |
---|
8 | * Copyright assigned to U.S. Government, 1994. |
---|
9 | * |
---|
10 | * The license and distribution terms for this file may be |
---|
11 | * found in the file LICENSE in this distribution or at |
---|
12 | * http://www.OARcorp.com/rtems/license.html. |
---|
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 | |
---|
31 | RTEMS_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 | #if defined(RTEMS_MULTIPROCESSING) |
---|
45 | api_message_queue_mp_support, |
---|
46 | #else |
---|
47 | NULL, |
---|
48 | #endif |
---|
49 | CORE_MESSAGE_QUEUE_SEND_REQUEST |
---|
50 | ); |
---|
51 | } |
---|
52 | |
---|
53 | /*PAGE |
---|
54 | * |
---|
55 | * _CORE_message_queue_Urgent |
---|
56 | * |
---|
57 | * DESCRIPTION: |
---|
58 | * |
---|
59 | * This routine sends a message to the front of the specified message queue. |
---|
60 | */ |
---|
61 | |
---|
62 | RTEMS_INLINE_ROUTINE CORE_message_queue_Status _CORE_message_queue_Urgent( |
---|
63 | CORE_message_queue_Control *the_message_queue, |
---|
64 | void *buffer, |
---|
65 | unsigned32 size, |
---|
66 | Objects_Id id, |
---|
67 | CORE_message_queue_API_mp_support_callout api_message_queue_mp_support |
---|
68 | ) |
---|
69 | { |
---|
70 | return _CORE_message_queue_Submit( |
---|
71 | the_message_queue, |
---|
72 | buffer, |
---|
73 | size, |
---|
74 | id, |
---|
75 | #if defined(RTEMS_MULTIPROCESSING) |
---|
76 | api_message_queue_mp_support, |
---|
77 | #else |
---|
78 | NULL, |
---|
79 | #endif |
---|
80 | CORE_MESSAGE_QUEUE_URGENT_REQUEST |
---|
81 | ); |
---|
82 | } |
---|
83 | |
---|
84 | /*PAGE |
---|
85 | * |
---|
86 | * _CORE_message_queue_Copy_buffer |
---|
87 | * |
---|
88 | * DESCRIPTION: |
---|
89 | * |
---|
90 | * This routine copies the contents of the source message buffer |
---|
91 | * to the destination message buffer. |
---|
92 | */ |
---|
93 | |
---|
94 | RTEMS_INLINE_ROUTINE void _CORE_message_queue_Copy_buffer ( |
---|
95 | void *source, |
---|
96 | void *destination, |
---|
97 | unsigned32 size |
---|
98 | ) |
---|
99 | { |
---|
100 | memcpy(destination, source, size); |
---|
101 | } |
---|
102 | |
---|
103 | /*PAGE |
---|
104 | * |
---|
105 | * _CORE_message_queue_Allocate_message_buffer |
---|
106 | * |
---|
107 | * DESCRIPTION: |
---|
108 | * |
---|
109 | * This function allocates a message buffer from the inactive |
---|
110 | * message buffer chain. |
---|
111 | */ |
---|
112 | |
---|
113 | RTEMS_INLINE_ROUTINE CORE_message_queue_Buffer_control * |
---|
114 | _CORE_message_queue_Allocate_message_buffer ( |
---|
115 | CORE_message_queue_Control *the_message_queue |
---|
116 | ) |
---|
117 | { |
---|
118 | return (CORE_message_queue_Buffer_control *) |
---|
119 | _Chain_Get( &the_message_queue->Inactive_messages ); |
---|
120 | } |
---|
121 | |
---|
122 | /*PAGE |
---|
123 | * |
---|
124 | * _CORE_message_queue_Free_message_buffer |
---|
125 | * |
---|
126 | * DESCRIPTION: |
---|
127 | * |
---|
128 | * This routine frees a message buffer to the inactive |
---|
129 | * message buffer chain. |
---|
130 | */ |
---|
131 | |
---|
132 | RTEMS_INLINE_ROUTINE void _CORE_message_queue_Free_message_buffer ( |
---|
133 | CORE_message_queue_Control *the_message_queue, |
---|
134 | CORE_message_queue_Buffer_control *the_message |
---|
135 | ) |
---|
136 | { |
---|
137 | _Chain_Append( &the_message_queue->Inactive_messages, &the_message->Node ); |
---|
138 | } |
---|
139 | |
---|
140 | /*PAGE |
---|
141 | * |
---|
142 | * _CORE_message_queue_Get_pending_message |
---|
143 | * |
---|
144 | * DESCRIPTION: |
---|
145 | * |
---|
146 | * This function removes the first message from the_message_queue |
---|
147 | * and returns a pointer to it. |
---|
148 | */ |
---|
149 | |
---|
150 | RTEMS_INLINE_ROUTINE |
---|
151 | CORE_message_queue_Buffer_control *_CORE_message_queue_Get_pending_message ( |
---|
152 | CORE_message_queue_Control *the_message_queue |
---|
153 | ) |
---|
154 | { |
---|
155 | return (CORE_message_queue_Buffer_control *) |
---|
156 | _Chain_Get_unprotected( &the_message_queue->Pending_messages ); |
---|
157 | } |
---|
158 | |
---|
159 | /*PAGE |
---|
160 | * |
---|
161 | * _CORE_message_queue_Is_priority |
---|
162 | * |
---|
163 | * DESCRIPTION: |
---|
164 | * |
---|
165 | * This function returns TRUE if the priority attribute is |
---|
166 | * enabled in the attribute_set and FALSE otherwise. |
---|
167 | */ |
---|
168 | |
---|
169 | RTEMS_INLINE_ROUTINE boolean _CORE_message_queue_Is_priority( |
---|
170 | CORE_message_queue_Attributes *the_attribute |
---|
171 | ) |
---|
172 | { |
---|
173 | return (the_attribute->discipline == CORE_MESSAGE_QUEUE_DISCIPLINES_PRIORITY); |
---|
174 | } |
---|
175 | |
---|
176 | /*PAGE |
---|
177 | * |
---|
178 | * _CORE_message_queue_Append |
---|
179 | * |
---|
180 | * DESCRIPTION: |
---|
181 | * |
---|
182 | * This routine places the_message at the rear of the outstanding |
---|
183 | * messages on the_message_queue. |
---|
184 | */ |
---|
185 | |
---|
186 | RTEMS_INLINE_ROUTINE void _CORE_message_queue_Append ( |
---|
187 | CORE_message_queue_Control *the_message_queue, |
---|
188 | CORE_message_queue_Buffer_control *the_message |
---|
189 | ) |
---|
190 | { |
---|
191 | _Chain_Append( &the_message_queue->Pending_messages, &the_message->Node ); |
---|
192 | } |
---|
193 | |
---|
194 | /*PAGE |
---|
195 | * |
---|
196 | * _CORE_message_queue_Prepend |
---|
197 | * |
---|
198 | * DESCRIPTION: |
---|
199 | * |
---|
200 | * This routine places the_message at the front of the outstanding |
---|
201 | * messages on the_message_queue. |
---|
202 | */ |
---|
203 | |
---|
204 | RTEMS_INLINE_ROUTINE void _CORE_message_queue_Prepend ( |
---|
205 | CORE_message_queue_Control *the_message_queue, |
---|
206 | CORE_message_queue_Buffer_control *the_message |
---|
207 | ) |
---|
208 | { |
---|
209 | _Chain_Prepend( |
---|
210 | &the_message_queue->Pending_messages, |
---|
211 | &the_message->Node |
---|
212 | ); |
---|
213 | } |
---|
214 | |
---|
215 | /*PAGE |
---|
216 | * |
---|
217 | * _CORE_message_queue_Is_null |
---|
218 | * |
---|
219 | * DESCRIPTION: |
---|
220 | * |
---|
221 | * This function returns TRUE if the_message_queue is TRUE and FALSE otherwise. |
---|
222 | */ |
---|
223 | |
---|
224 | RTEMS_INLINE_ROUTINE boolean _CORE_message_queue_Is_null ( |
---|
225 | CORE_message_queue_Control *the_message_queue |
---|
226 | ) |
---|
227 | { |
---|
228 | return ( the_message_queue == NULL ); |
---|
229 | } |
---|
230 | |
---|
231 | /*PAGE |
---|
232 | * |
---|
233 | * _CORE_message_queue_Is_notify_enabled |
---|
234 | * |
---|
235 | * DESCRIPTION: |
---|
236 | * |
---|
237 | * This function returns TRUE if notification is enabled on this message |
---|
238 | * queue and FALSE otherwise. |
---|
239 | */ |
---|
240 | |
---|
241 | RTEMS_INLINE_ROUTINE boolean _CORE_message_queue_Is_notify_enabled ( |
---|
242 | CORE_message_queue_Control *the_message_queue |
---|
243 | ) |
---|
244 | { |
---|
245 | return (the_message_queue->notify_handler != NULL); |
---|
246 | } |
---|
247 | |
---|
248 | /*PAGE |
---|
249 | * |
---|
250 | * _CORE_message_queue_Set_notify |
---|
251 | * |
---|
252 | * DESCRIPTION: |
---|
253 | * |
---|
254 | * This routine initializes the notification information for the_message_queue. |
---|
255 | */ |
---|
256 | |
---|
257 | RTEMS_INLINE_ROUTINE void _CORE_message_queue_Set_notify ( |
---|
258 | CORE_message_queue_Control *the_message_queue, |
---|
259 | CORE_message_queue_Notify_Handler the_handler, |
---|
260 | void *the_argument |
---|
261 | ) |
---|
262 | { |
---|
263 | the_message_queue->notify_handler = the_handler; |
---|
264 | the_message_queue->notify_argument = the_argument; |
---|
265 | } |
---|
266 | |
---|
267 | #endif |
---|
268 | /* end of include file */ |
---|