source: rtems/cpukit/rtems/include/rtems/rtems/messageimpl.h @ ed8b00e6

5
Last change on this file since ed8b00e6 was ed8b00e6, checked in by Sebastian Huber <sebastian.huber@…>, on 12/14/15 at 14:02:45

Optional Classic Message Queue initialization

Update #2408.

  • Property mode set to 100644
File size: 4.3 KB
Line 
1/**
2 * @file rtems/rtems/message.inl
3 *
4 *  This include file contains the static inline implementation of all
5 *  inlined routines in the Message Manager.
6 */
7
8/*  COPYRIGHT (c) 1989-2008.
9 *  On-Line Applications Research Corporation (OAR).
10 *
11 *  The license and distribution terms for this file may be
12 *  found in the file LICENSE in this distribution or at
13 *  http://www.rtems.org/license/LICENSE.
14 */
15
16#ifndef _RTEMS_RTEMS_MESSAGEIMPL_H
17#define _RTEMS_RTEMS_MESSAGEIMPL_H
18
19#include <rtems/rtems/message.h>
20#include <rtems/score/objectimpl.h>
21#include <rtems/score/coremsgimpl.h>
22
23#ifdef __cplusplus
24extern "C" {
25#endif
26
27/**
28 *  @defgroup ClassicMessageQueueImpl Classic Message Queue Implementation
29 *
30 *  @ingroup ClassicMessageQueue
31 *
32 *  @{
33 */
34
35/**
36 *  The following enumerated type details the modes in which a message
37 *  may be submitted to a message queue.  The message may be posted
38 *  in a send or urgent fashion.
39 */
40typedef enum {
41  /**
42   *  This value indicates the user wants to send the message using the
43   *  normal message insertion protocol (FIFO or priority).
44   */
45  MESSAGE_QUEUE_SEND_REQUEST   = 0,
46  /**
47   *  This value indicates the user considers the message to be urgent
48   *  and wants it inserted at the head of the pending message queue.
49   */
50  MESSAGE_QUEUE_URGENT_REQUEST = 1
51}  Message_queue_Submit_types;
52
53/**
54 *  The following defines the information control block used to
55 *  manage this class of objects.
56 */
57extern Objects_Information _Message_queue_Information;
58
59/**
60 *  @brief Message_queue_Submit
61 *
62 *  This routine implements the directives rtems_message_queue_send
63 *  and rtems_message_queue_urgent.  It processes a message that is
64 *  to be submitted to the designated message queue.  The message will
65 *  either be processed as a send send message which it will be inserted
66 *  at the rear of the queue or it will be processed as an urgent message
67 *  which will be inserted at the front of the queue.
68 */
69rtems_status_code _Message_queue_Submit(
70  rtems_id                    id,
71  const void                 *buffer,
72  size_t                      size,
73  Message_queue_Submit_types  submit_type
74);
75
76/**
77 * @brief Message queue Translate Core Message Queue Return Code
78 *
79 * This function returns a RTEMS status code based on
80 * @a the_message_queue_status.
81 *
82 * @param[in] the_message_queue_status is the status code to translate
83 *
84 * @retval translated RTEMS status code
85 */
86rtems_status_code _Message_queue_Translate_core_message_queue_return_code (
87  uint32_t   the_message_queue_status
88);
89
90/**
91 *  @brief Deallocates a message queue control block into
92 *  the inactive chain of free message queue control blocks.
93 *
94 *  This routine deallocates a message queue control block into
95 *  the inactive chain of free message queue control blocks.
96 */
97RTEMS_INLINE_ROUTINE void _Message_queue_Free (
98  Message_queue_Control *the_message_queue
99)
100{
101  _Objects_Free( &_Message_queue_Information, &the_message_queue->Object );
102}
103
104/**
105 *  @brief Maps message queue IDs to message queue control blocks.
106 *
107 *  This function maps message queue IDs to message queue control
108 *  blocks.  If ID corresponds to a local message queue, then it
109 *  returns the_message_queue control pointer which maps to ID
110 *  and location is set to OBJECTS_LOCAL.  If the message queue ID is
111 *  global and resides on a remote node, then location is set
112 *  to OBJECTS_REMOTE, and the_message_queue is undefined.
113 *  Otherwise, location is set to OBJECTS_ERROR and
114 *  the_message_queue is undefined.
115 */
116RTEMS_INLINE_ROUTINE Message_queue_Control *_Message_queue_Get (
117  Objects_Id         id,
118  Objects_Locations *location
119)
120{
121  return (Message_queue_Control *)
122     _Objects_Get( &_Message_queue_Information, id, location );
123}
124
125RTEMS_INLINE_ROUTINE Message_queue_Control *
126_Message_queue_Get_interrupt_disable(
127  Objects_Id         id,
128  Objects_Locations *location,
129  ISR_lock_Context  *lock_context
130)
131{
132  return (Message_queue_Control *) _Objects_Get_isr_disable(
133    &_Message_queue_Information,
134    id,
135    location,
136    lock_context
137  );
138}
139
140RTEMS_INLINE_ROUTINE Message_queue_Control *_Message_queue_Allocate( void )
141{
142  return (Message_queue_Control *)
143    _Objects_Allocate( &_Message_queue_Information );
144}
145
146/**@}*/
147
148#ifdef __cplusplus
149}
150#endif
151
152#if defined(RTEMS_MULTIPROCESSING)
153#include <rtems/rtems/msgmp.h>
154#endif
155
156#endif
157/* end of include file */
Note: See TracBrowser for help on using the repository browser.