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

4.104.115
Last change on this file since 6390256 was 6390256, checked in by Ralf Corsepius <ralf.corsepius@…>, on 12/22/08 at 09:22:17

Eliminate TRUE/FALSE.

  • Property mode set to 100644
File size: 5.8 KB
Line 
1/**
2 *  @file  rtems/score/coremsg.inl
3 *
4 *  This include file contains the static inline implementation of all
5 *  inlined routines in the Core Message Handler.
6 */
7
8/*
9 *  COPYRIGHT (c) 1989-2004.
10 *  On-Line Applications Research Corporation (OAR).
11 *
12 *  The license and distribution terms for this file may be
13 *  found in the file LICENSE in this distribution or at
14 *  http://www.rtems.com/license/LICENSE.
15 *
16 *  $Id$
17 */
18
19#ifndef _RTEMS_SCORE_COREMSG_H
20# error "Never use <rtems/score/coremsg.inl> directly; include <rtems/score/coremsg.h> instead."
21#endif
22
23#ifndef _RTEMS_SCORE_COREMSG_INL
24#define _RTEMS_SCORE_COREMSG_INL
25
26/**
27 *  @addtogroup ScoreMessageQueue
28 *  @{
29 */
30
31#include <string.h>   /* needed for memcpy */
32 
33/**
34 *  This routine sends a message to the end of the specified message queue.
35 */
36 
37RTEMS_INLINE_ROUTINE CORE_message_queue_Status _CORE_message_queue_Send(
38  CORE_message_queue_Control                *the_message_queue,
39  const void                                *buffer,
40  size_t                                     size,
41  Objects_Id                                 id,
42  CORE_message_queue_API_mp_support_callout  api_message_queue_mp_support,
43  bool                                    wait,
44  Watchdog_Interval                          timeout
45)
46{
47  return _CORE_message_queue_Submit(
48    the_message_queue,
49    buffer,
50    size,
51    id,
52#if defined(RTEMS_MULTIPROCESSING)
53    api_message_queue_mp_support,
54#else
55    NULL,
56#endif
57    CORE_MESSAGE_QUEUE_SEND_REQUEST,
58    wait,     /* sender may block */
59    timeout   /* timeout interval */
60  );
61}
62 
63/**
64 *  This routine sends a message to the front of the specified message queue.
65 */
66 
67RTEMS_INLINE_ROUTINE CORE_message_queue_Status _CORE_message_queue_Urgent(
68  CORE_message_queue_Control                *the_message_queue,
69  const void                                *buffer,
70  size_t                                     size,
71  Objects_Id                                 id,
72  CORE_message_queue_API_mp_support_callout  api_message_queue_mp_support,
73  bool                                    wait,
74  Watchdog_Interval                          timeout
75)
76{
77  return _CORE_message_queue_Submit(
78    the_message_queue,
79    buffer,
80    size,
81    id,
82#if defined(RTEMS_MULTIPROCESSING)
83    api_message_queue_mp_support,
84#else
85    NULL,
86#endif
87    CORE_MESSAGE_QUEUE_URGENT_REQUEST,
88    wait,     /* sender may block */
89    timeout   /* timeout interval */
90 );
91}
92
93/**
94 *  This routine copies the contents of the source message buffer
95 *  to the destination message buffer.
96 */
97
98RTEMS_INLINE_ROUTINE void _CORE_message_queue_Copy_buffer (
99  const void *source,
100  void       *destination,
101  size_t      size
102)
103{
104  memcpy(destination, source, size);
105}
106
107/**
108 *  This function allocates a message buffer from the inactive
109 *  message buffer chain.
110 */
111
112RTEMS_INLINE_ROUTINE CORE_message_queue_Buffer_control *
113_CORE_message_queue_Allocate_message_buffer (
114    CORE_message_queue_Control *the_message_queue
115)
116{
117   return (CORE_message_queue_Buffer_control *)
118     _Chain_Get( &the_message_queue->Inactive_messages );
119}
120
121/**
122 *  This routine frees a message buffer to the inactive
123 *  message buffer chain.
124 */
125
126RTEMS_INLINE_ROUTINE void _CORE_message_queue_Free_message_buffer (
127    CORE_message_queue_Control        *the_message_queue,
128    CORE_message_queue_Buffer_control *the_message
129)
130{
131  _Chain_Append( &the_message_queue->Inactive_messages, &the_message->Node );
132}
133
134/**
135 *  This function removes the first message from the_message_queue
136 *  and returns a pointer to it.
137 */
138
139RTEMS_INLINE_ROUTINE
140  CORE_message_queue_Buffer_control *_CORE_message_queue_Get_pending_message (
141  CORE_message_queue_Control *the_message_queue
142)
143{
144  return (CORE_message_queue_Buffer_control *)
145    _Chain_Get_unprotected( &the_message_queue->Pending_messages );
146}
147
148/**
149 *  This function returns true if the priority attribute is
150 *  enabled in the attribute_set and false otherwise.
151 */
152 
153RTEMS_INLINE_ROUTINE bool _CORE_message_queue_Is_priority(
154  CORE_message_queue_Attributes *the_attribute
155)
156{
157  return (the_attribute->discipline == CORE_MESSAGE_QUEUE_DISCIPLINES_PRIORITY);
158}
159
160/**
161 *  This routine places the_message at the rear of the outstanding
162 *  messages on the_message_queue.
163 */
164
165RTEMS_INLINE_ROUTINE void _CORE_message_queue_Append_unprotected (
166  CORE_message_queue_Control        *the_message_queue,
167  CORE_message_queue_Buffer_control *the_message
168)
169{
170  _Chain_Append_unprotected(
171    &the_message_queue->Pending_messages,
172    &the_message->Node
173  );
174}
175
176/**
177 *  This routine places the_message at the front of the outstanding
178 *  messages on the_message_queue.
179 */
180
181RTEMS_INLINE_ROUTINE void _CORE_message_queue_Prepend_unprotected (
182  CORE_message_queue_Control        *the_message_queue,
183  CORE_message_queue_Buffer_control *the_message
184)
185{
186  _Chain_Prepend_unprotected(
187    &the_message_queue->Pending_messages,
188    &the_message->Node
189  );
190}
191
192/**
193 *  This function returns true if the_message_queue is true and false otherwise.
194 */
195
196RTEMS_INLINE_ROUTINE bool _CORE_message_queue_Is_null (
197  CORE_message_queue_Control *the_message_queue
198)
199{
200  return ( the_message_queue == NULL  );
201}
202
203/**
204 *  This function returns true if notification is enabled on this message
205 *  queue and false otherwise.
206 */
207 
208RTEMS_INLINE_ROUTINE bool _CORE_message_queue_Is_notify_enabled (
209  CORE_message_queue_Control *the_message_queue
210)
211{
212  return (the_message_queue->notify_handler != NULL);
213}
214 
215/**
216 *  This routine initializes the notification information for the_message_queue.
217 */
218 
219RTEMS_INLINE_ROUTINE void _CORE_message_queue_Set_notify (
220  CORE_message_queue_Control        *the_message_queue,
221  CORE_message_queue_Notify_Handler  the_handler,
222  void                              *the_argument
223)
224{
225  the_message_queue->notify_handler  = the_handler;
226  the_message_queue->notify_argument = the_argument;
227}
228
229/**@}*/
230
231#endif
232/* end of include file */
Note: See TracBrowser for help on using the repository browser.