source: rtems/cpukit/score/inline/rtems/score/coremsg.inl @ 507d382

4.104.115
Last change on this file since 507d382 was 507d382, checked in by Joel Sherrill <joel.sherrill@…>, on Sep 11, 2009 at 8:00:30 PM

2009-09-11 Joel Sherrill <joel.sherrill@…>

  • score/include/rtems/score/coremsg.h, score/inline/rtems/score/coremsg.inl, score/src/coremsg.c, score/src/coremsginsert.c, score/src/coremsgseize.c, score/src/coremsgsubmit.c, score/src/objectnametoidstring.c: Disable the Core Message Queue features of notification, priority messages, and blocking sends when no API requires them.
  • Property mode set to 100644
File size: 5.9 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-2009.
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 */
36RTEMS_INLINE_ROUTINE CORE_message_queue_Status _CORE_message_queue_Send(
37  CORE_message_queue_Control                *the_message_queue,
38  const void                                *buffer,
39  size_t                                     size,
40  Objects_Id                                 id,
41  CORE_message_queue_API_mp_support_callout  api_message_queue_mp_support,
42  bool                                    wait,
43  Watchdog_Interval                          timeout
44)
45{
46  return _CORE_message_queue_Submit(
47    the_message_queue,
48    buffer,
49    size,
50    id,
51#if defined(RTEMS_MULTIPROCESSING)
52    api_message_queue_mp_support,
53#else
54    NULL,
55#endif
56    CORE_MESSAGE_QUEUE_SEND_REQUEST,
57    wait,     /* sender may block */
58    timeout   /* timeout interval */
59  );
60}
61 
62/**
63 *  This routine sends a message to the front of the specified message queue.
64 */
65RTEMS_INLINE_ROUTINE CORE_message_queue_Status _CORE_message_queue_Urgent(
66  CORE_message_queue_Control                *the_message_queue,
67  const void                                *buffer,
68  size_t                                     size,
69  Objects_Id                                 id,
70  CORE_message_queue_API_mp_support_callout  api_message_queue_mp_support,
71  bool                                    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/**
92 *  This routine copies the contents of the source message buffer
93 *  to the destination message buffer.
94 */
95RTEMS_INLINE_ROUTINE void _CORE_message_queue_Copy_buffer (
96  const void *source,
97  void       *destination,
98  size_t      size
99)
100{
101  memcpy(destination, source, size);
102}
103
104/**
105 *  This function allocates a message buffer from the inactive
106 *  message buffer chain.
107 */
108RTEMS_INLINE_ROUTINE CORE_message_queue_Buffer_control *
109_CORE_message_queue_Allocate_message_buffer (
110    CORE_message_queue_Control *the_message_queue
111)
112{
113   return (CORE_message_queue_Buffer_control *)
114     _Chain_Get( &the_message_queue->Inactive_messages );
115}
116
117/**
118 *  This routine frees a message buffer to the inactive
119 *  message buffer chain.
120 */
121RTEMS_INLINE_ROUTINE void _CORE_message_queue_Free_message_buffer (
122    CORE_message_queue_Control        *the_message_queue,
123    CORE_message_queue_Buffer_control *the_message
124)
125{
126  _Chain_Append( &the_message_queue->Inactive_messages, &the_message->Node );
127}
128
129/**
130 *  This function removes the first message from the_message_queue
131 *  and returns a pointer to it.
132 */
133RTEMS_INLINE_ROUTINE
134  CORE_message_queue_Buffer_control *_CORE_message_queue_Get_pending_message (
135  CORE_message_queue_Control *the_message_queue
136)
137{
138  return (CORE_message_queue_Buffer_control *)
139    _Chain_Get_unprotected( &the_message_queue->Pending_messages );
140}
141
142/**
143 *  This function returns true if the priority attribute is
144 *  enabled in the attribute_set and false otherwise.
145 */
146RTEMS_INLINE_ROUTINE bool _CORE_message_queue_Is_priority(
147  CORE_message_queue_Attributes *the_attribute
148)
149{
150  return
151    (the_attribute->discipline == CORE_MESSAGE_QUEUE_DISCIPLINES_PRIORITY);
152}
153
154/**
155 *  This routine places the_message at the rear of the outstanding
156 *  messages on the_message_queue.
157 */
158RTEMS_INLINE_ROUTINE void _CORE_message_queue_Append_unprotected (
159  CORE_message_queue_Control        *the_message_queue,
160  CORE_message_queue_Buffer_control *the_message
161)
162{
163  _Chain_Append_unprotected(
164    &the_message_queue->Pending_messages,
165    &the_message->Node
166  );
167}
168
169/**
170 *  This routine places the_message at the front of the outstanding
171 *  messages on the_message_queue.
172 */
173RTEMS_INLINE_ROUTINE void _CORE_message_queue_Prepend_unprotected (
174  CORE_message_queue_Control        *the_message_queue,
175  CORE_message_queue_Buffer_control *the_message
176)
177{
178  _Chain_Prepend_unprotected(
179    &the_message_queue->Pending_messages,
180    &the_message->Node
181  );
182}
183
184/**
185 *  This function returns true if the_message_queue is true and false otherwise.
186 */
187RTEMS_INLINE_ROUTINE bool _CORE_message_queue_Is_null (
188  CORE_message_queue_Control *the_message_queue
189)
190{
191  return ( the_message_queue == NULL  );
192}
193
194#if defined(RTEMS_SCORE_COREMSG_ENABLE_NOTIFICATION)
195  /**
196   *  This function returns true if notification is enabled on this message
197   *  queue and false otherwise.
198   */
199  RTEMS_INLINE_ROUTINE bool _CORE_message_queue_Is_notify_enabled (
200    CORE_message_queue_Control *the_message_queue
201  )
202  {
203    return (the_message_queue->notify_handler != NULL);
204  }
205 
206  /**
207   *  This routine initializes the notification information for
208   *  @a the_message_queue.
209   */
210 
211  RTEMS_INLINE_ROUTINE void _CORE_message_queue_Set_notify (
212    CORE_message_queue_Control        *the_message_queue,
213    CORE_message_queue_Notify_Handler  the_handler,
214    void                              *the_argument
215  )
216  {
217    the_message_queue->notify_handler  = the_handler;
218    the_message_queue->notify_argument = the_argument;
219  }
220#endif
221
222/**@}*/
223
224#endif
225/* end of include file */
Note: See TracBrowser for help on using the repository browser.