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

4.104.114.84.95
Last change on this file since f4a8ee1 was f4a8ee1, checked in by Joel Sherrill <joel.sherrill@…>, on 03/17/99 at 16:01:03

Unlimited objects patch from Chris Johns <ccj@…>. Email follows:

First, the unlimited patch. I have compiled the unlmited patch for the
Linux posix BSP only and it seems to work cleanly. I would like a really
major application run on this change before commiting as the changes are
very core and significant. I am currently building all the tests to run.

I have no targets suitable to test on at the moment.

I have tested the patch for inline functions and macros.

Turning macros on has found some core bugs. I have fixed these but have
not run all the tests. Please review the patch for these changes. They
are:

1) The conditional compilation for MP support broke the core messages
code. You cannot embed a conditional macro in another macro. The Send
and Urgent Send calls are macros.

2) User extensions handler initialisation now has two parameters. I have
updated the macros to support the extra parameter.

The patch also contains the gcc-target-default.cfg fix required to build
the kernel. More of a by product than a fix for you.

  • 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-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 
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#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 
62RTEMS_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
94RTEMS_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
113RTEMS_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
132RTEMS_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
150RTEMS_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 
169RTEMS_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
186RTEMS_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
204RTEMS_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
224RTEMS_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 
241RTEMS_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 
257RTEMS_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 */
Note: See TracBrowser for help on using the repository browser.