1 | /** |
---|
2 | * @file rtems/itron/msgbuffer.inl |
---|
3 | */ |
---|
4 | |
---|
5 | /* |
---|
6 | * COPYRIGHT (c) 1989-1999. |
---|
7 | * On-Line Applications Research Corporation (OAR). |
---|
8 | * |
---|
9 | * The license and distribution terms for this file may be |
---|
10 | * found in the file LICENSE in this distribution or at |
---|
11 | * http://www.rtems.com/license/LICENSE. |
---|
12 | * |
---|
13 | * $Id$ |
---|
14 | */ |
---|
15 | |
---|
16 | #ifndef _RTEMS_ITRON_MSGBUFFER_H |
---|
17 | # error "Never use <rtems/itron/msgbuffer.inl> directly; include <rtems/itron/msgbuffer.h> instead." |
---|
18 | #endif |
---|
19 | |
---|
20 | #ifndef _RTEMS_ITRON_MSGBUFFER_INL |
---|
21 | #define _RTEMS_ITRON_MSGBUFFER_INL |
---|
22 | |
---|
23 | #ifdef __cplusplus |
---|
24 | extern "C" { |
---|
25 | #endif |
---|
26 | |
---|
27 | /* |
---|
28 | * _ITRON_Message_buffer_Allocate |
---|
29 | * |
---|
30 | * DESCRIPTION: |
---|
31 | * |
---|
32 | * This routine allocates the message buffer associated with the specified |
---|
33 | * message buffer ID from the pool of inactive message buffers. |
---|
34 | * |
---|
35 | * Input parameters: |
---|
36 | * mbfid - id of message buffer to allocate |
---|
37 | * status - pointer to status variable |
---|
38 | * |
---|
39 | * Output parameters: |
---|
40 | * returns - pointer to the message buffer control block |
---|
41 | * *status - status |
---|
42 | */ |
---|
43 | |
---|
44 | RTEMS_INLINE_ROUTINE ITRON_Message_buffer_Control |
---|
45 | *_ITRON_Message_buffer_Allocate( |
---|
46 | ID mbfid |
---|
47 | ) |
---|
48 | { |
---|
49 | return (ITRON_Message_buffer_Control *)_ITRON_Objects_Allocate_by_index( |
---|
50 | &_ITRON_Message_buffer_Information, |
---|
51 | mbfid, |
---|
52 | sizeof(ITRON_Message_buffer_Control) |
---|
53 | ); |
---|
54 | } |
---|
55 | |
---|
56 | /* |
---|
57 | * _ITRON_Message_buffer_Clarify_allocation_id_error |
---|
58 | * |
---|
59 | * This function is invoked when an object allocation ID error |
---|
60 | * occurs to determine the specific ITRON error code to return. |
---|
61 | */ |
---|
62 | |
---|
63 | #define _ITRON_Message_buffer_Clarify_allocation_id_error( _id ) \ |
---|
64 | _ITRON_Objects_Clarify_allocation_id_error( \ |
---|
65 | &_ITRON_Message_buffer_Information, (_id) ) |
---|
66 | |
---|
67 | /* |
---|
68 | * _ITRON_Message_buffer_Clarify_get_id_error |
---|
69 | * |
---|
70 | * This function is invoked when an object get ID error |
---|
71 | * occurs to determine the specific ITRON error code to return. |
---|
72 | */ |
---|
73 | |
---|
74 | #define _ITRON_Message_buffer_Clarify_get_id_error( _id ) \ |
---|
75 | _ITRON_Objects_Clarify_get_id_error( &_ITRON_Message_buffer_Information, (_id) ) |
---|
76 | |
---|
77 | /* |
---|
78 | * _ITRON_Message_buffer_Free |
---|
79 | * |
---|
80 | * DESCRIPTION: |
---|
81 | * |
---|
82 | * This routine frees a message buffer control block to the |
---|
83 | * inactive chain of free message buffer control blocks. |
---|
84 | * |
---|
85 | * Input parameters: |
---|
86 | * the_message_buffer - pointer to message_buffer control block |
---|
87 | * |
---|
88 | * Output parameters: NONE |
---|
89 | */ |
---|
90 | |
---|
91 | RTEMS_INLINE_ROUTINE void _ITRON_Message_buffer_Free ( |
---|
92 | ITRON_Message_buffer_Control *the_message_buffer |
---|
93 | ) |
---|
94 | { |
---|
95 | _ITRON_Objects_Free( |
---|
96 | &_ITRON_Message_buffer_Information, |
---|
97 | &the_message_buffer->Object |
---|
98 | ); |
---|
99 | } |
---|
100 | |
---|
101 | /*PAGE |
---|
102 | * |
---|
103 | * _ITRON_Message_buffer_Get |
---|
104 | * |
---|
105 | * DESCRIPTION: |
---|
106 | * |
---|
107 | * This function maps message buffer IDs to message buffer control blocks. |
---|
108 | * If ID corresponds to a local message buffer, then it returns |
---|
109 | * the message buffer control pointer which maps to ID and location |
---|
110 | * is set to OBJECTS_LOCAL. if the message buffer ID is global and |
---|
111 | * resides on a remote node, then location is set to OBJECTS_REMOTE, |
---|
112 | * and the message buffer is undefined. Otherwise, location is set |
---|
113 | * to OBJECTS_ERROR and the message buffer is undefined. |
---|
114 | * |
---|
115 | * Input parameters: |
---|
116 | * id - ITRON message_buffer ID. |
---|
117 | * the_location - pointer to a location variable |
---|
118 | * |
---|
119 | * Output parameters: |
---|
120 | * *the_location - location of the object |
---|
121 | */ |
---|
122 | |
---|
123 | RTEMS_INLINE_ROUTINE ITRON_Message_buffer_Control *_ITRON_Message_buffer_Get ( |
---|
124 | ID id, |
---|
125 | Objects_Locations *location |
---|
126 | ) |
---|
127 | { |
---|
128 | return (ITRON_Message_buffer_Control *) |
---|
129 | _ITRON_Objects_Get( &_ITRON_Message_buffer_Information, id, location ); |
---|
130 | } |
---|
131 | |
---|
132 | /*PAGE |
---|
133 | * |
---|
134 | * _ITRON_Message_buffer_Is_null |
---|
135 | * |
---|
136 | * This function returns TRUE if the_message_buffer is NULL |
---|
137 | * and FALSE otherwise. |
---|
138 | * |
---|
139 | * Input parameters: |
---|
140 | * the_message_buffer - pointer to message buffer control block |
---|
141 | * |
---|
142 | * Output parameters: |
---|
143 | * TRUE - if the_message_buffer is NULL |
---|
144 | * FALSE - otherwise |
---|
145 | */ |
---|
146 | |
---|
147 | RTEMS_INLINE_ROUTINE boolean _ITRON_Message_buffer_Is_null ( |
---|
148 | ITRON_Message_buffer_Control *the_message_buffer |
---|
149 | ) |
---|
150 | { |
---|
151 | return ( the_message_buffer == NULL ); |
---|
152 | } |
---|
153 | |
---|
154 | /* |
---|
155 | * XXX insert inline routines here |
---|
156 | */ |
---|
157 | |
---|
158 | #ifdef __cplusplus |
---|
159 | } |
---|
160 | #endif |
---|
161 | |
---|
162 | #endif |
---|
163 | /* end of include file */ |
---|
164 | |
---|