1 | /** |
---|
2 | * @file |
---|
3 | * |
---|
4 | * @ingroup ClassicMessageQueue |
---|
5 | * |
---|
6 | * @brief Classic Message Queue Manager API |
---|
7 | */ |
---|
8 | |
---|
9 | /* COPYRIGHT (c) 1989-2013. |
---|
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.org/license/LICENSE. |
---|
15 | */ |
---|
16 | |
---|
17 | #ifndef _RTEMS_RTEMS_MESSAGE_H |
---|
18 | #define _RTEMS_RTEMS_MESSAGE_H |
---|
19 | |
---|
20 | #include <rtems/rtems/attr.h> |
---|
21 | #include <rtems/rtems/options.h> |
---|
22 | #include <rtems/rtems/status.h> |
---|
23 | #include <rtems/rtems/types.h> |
---|
24 | |
---|
25 | #ifdef __cplusplus |
---|
26 | extern "C" { |
---|
27 | #endif |
---|
28 | |
---|
29 | /** |
---|
30 | * @defgroup ClassicMessageQueue Message Queues |
---|
31 | * |
---|
32 | * @ingroup RTEMSAPIClassic |
---|
33 | * |
---|
34 | * This encapsulates functionality related to the Classic API Message Queue |
---|
35 | * Manager. |
---|
36 | */ |
---|
37 | /**@{*/ |
---|
38 | |
---|
39 | /** |
---|
40 | * @brief RTEMS Create Message Queue |
---|
41 | * |
---|
42 | * This routine implements the rtems_message_queue_create directive. The |
---|
43 | * message queue will have the @a name. If the @a attribute_set indicates |
---|
44 | * that the message queue is to be limited in the number of messages |
---|
45 | * that can be outstanding, then @a count indicates the maximum number of |
---|
46 | * messages that will be held. It returns the id of the created |
---|
47 | * message queue in @a id. |
---|
48 | * |
---|
49 | * @param[in] name is the user defined queue name |
---|
50 | * @param[in] count is the maximum message and reserved buffer count |
---|
51 | * @param[in] max_message_size is the maximum size of each message |
---|
52 | * @param[in] attribute_set is the process method |
---|
53 | * @param[in] id is the pointer to queue |
---|
54 | * |
---|
55 | * @retval This method returns RTEMS_SUCCESSFUL if there was not an |
---|
56 | * error. Otherwise, a status code is returned indicating the |
---|
57 | * source of the error. If successful, the @a id will |
---|
58 | * be filled in with the queue id. |
---|
59 | */ |
---|
60 | rtems_status_code rtems_message_queue_create( |
---|
61 | rtems_name name, |
---|
62 | uint32_t count, |
---|
63 | size_t max_message_size, |
---|
64 | rtems_attribute attribute_set, |
---|
65 | rtems_id *id |
---|
66 | ); |
---|
67 | |
---|
68 | /** |
---|
69 | * @brief RTEMS Message Queue Name to Id |
---|
70 | * |
---|
71 | * This routine implements the rtems_message_queue_ident directive. |
---|
72 | * This directive returns the message queue ID associated with NAME. |
---|
73 | * If more than one message queue is named name, then the message |
---|
74 | * queue to which the ID belongs is arbitrary. node indicates the |
---|
75 | * extent of the search for the ID of the message queue named name. |
---|
76 | * The search can be limited to a particular node or allowed to |
---|
77 | * encompass all nodes. |
---|
78 | * |
---|
79 | * @param[in] name is the user defined message queue name |
---|
80 | * @param[in] node is the node(s) to be searched |
---|
81 | * @param[in] id is the pointer to message queue id |
---|
82 | * |
---|
83 | * @retval RTEMS_SUCCESSFUL if successful or error code if unsuccessful and |
---|
84 | * *id filled with the message queue id |
---|
85 | */ |
---|
86 | rtems_status_code rtems_message_queue_ident( |
---|
87 | rtems_name name, |
---|
88 | uint32_t node, |
---|
89 | rtems_id *id |
---|
90 | ); |
---|
91 | |
---|
92 | /** |
---|
93 | * @brief RTEMS Delete Message Queue |
---|
94 | * |
---|
95 | * This routine implements the rtems_message_queue_delete directive. The |
---|
96 | * message queue indicated by ID is deleted. |
---|
97 | * |
---|
98 | * @param[in] id is the queue id |
---|
99 | * |
---|
100 | * @retval RTEMS_SUCCESSFUL if successful or error code if unsuccessful |
---|
101 | */ |
---|
102 | rtems_status_code rtems_message_queue_delete( |
---|
103 | rtems_id id |
---|
104 | ); |
---|
105 | |
---|
106 | /** |
---|
107 | * @brief rtems_message_queue_send |
---|
108 | * |
---|
109 | * Message Queue Manager - rtems_message_queue_send |
---|
110 | * |
---|
111 | * This routine implements the rtems_message_queue_send directive. |
---|
112 | * This directive sends the message buffer to the message queue |
---|
113 | * indicated by ID. If one or more tasks is blocked waiting |
---|
114 | * to receive a message from this message queue, then one will |
---|
115 | * receive the message. The task selected to receive the |
---|
116 | * message is based on the task queue discipline algorithm in |
---|
117 | * use by this particular message queue. If no tasks are waiting, |
---|
118 | * then the message buffer will be placed at the REAR of the |
---|
119 | * chain of pending messages for this message queue. |
---|
120 | */ |
---|
121 | rtems_status_code rtems_message_queue_send( |
---|
122 | rtems_id id, |
---|
123 | const void *buffer, |
---|
124 | size_t size |
---|
125 | ); |
---|
126 | |
---|
127 | /** |
---|
128 | * @brief RTEMS Urgent Message Queue |
---|
129 | * |
---|
130 | * This routine implements the rtems_message_queue_urgent directive. |
---|
131 | * This directive has the same behavior as rtems_message_queue_send |
---|
132 | * except that if no tasks are waiting, the message buffer will |
---|
133 | * be placed at the FRONT of the chain of pending messages rather |
---|
134 | * than at the REAR. |
---|
135 | * |
---|
136 | * @param[in] id is the pointer to message queue |
---|
137 | * @param[in] buffer is the pointer to message buffer |
---|
138 | * @param[in] size is the size of message to send urgently |
---|
139 | * |
---|
140 | * @retval RTEMS_SUCCESSFUL if successful or error code if unsuccessful |
---|
141 | */ |
---|
142 | rtems_status_code rtems_message_queue_urgent( |
---|
143 | rtems_id id, |
---|
144 | const void *buffer, |
---|
145 | size_t size |
---|
146 | ); |
---|
147 | |
---|
148 | /** |
---|
149 | * @brief RTEMS Broadcast Message Queue |
---|
150 | * |
---|
151 | * This routine implements the rtems_message_queue_broadcast directive. |
---|
152 | * This directive sends the message buffer to all of the tasks blocked |
---|
153 | * waiting for a message on the message queue indicated by ID. |
---|
154 | * If no tasks are waiting, then the message buffer will not be queued. |
---|
155 | * |
---|
156 | * @param[in] id is the pointer to message queue |
---|
157 | * @param[in] buffer is the pointer to message buffer |
---|
158 | * @param[in] size is the size of message to broadcast |
---|
159 | * @param[in] count pointer to area to store number of threads made ready |
---|
160 | * |
---|
161 | * @retval RTEMS_SUCCESSFUL if successful or error code if unsuccessful and |
---|
162 | * *count filled in with number of threads made ready |
---|
163 | */ |
---|
164 | rtems_status_code rtems_message_queue_broadcast( |
---|
165 | rtems_id id, |
---|
166 | const void *buffer, |
---|
167 | size_t size, |
---|
168 | uint32_t *count |
---|
169 | ); |
---|
170 | |
---|
171 | /** |
---|
172 | * @brief RTEMS Message Queue Receive |
---|
173 | * |
---|
174 | * This routine implements the rtems_message_queue_receive directive. |
---|
175 | * This directive is invoked when the calling task wishes to receive |
---|
176 | * a message from the message queue indicated by ID. The received |
---|
177 | * message is to be placed in buffer. If no messages are outstanding |
---|
178 | * and the option_set indicates that the task is willing to block, |
---|
179 | * then the task will be blocked until a message arrives or until, |
---|
180 | * optionally, timeout clock ticks have passed. |
---|
181 | * |
---|
182 | * @param[in] id is the queue id |
---|
183 | * @param[in] buffer is the pointer to message buffer |
---|
184 | * @param[in] size is the size of message receive |
---|
185 | * @param[in] option_set is the options on receive |
---|
186 | * @param[in] timeout is the number of ticks to wait |
---|
187 | * |
---|
188 | * @retval This method returns RTEMS_SUCCESSFUL if there was not an |
---|
189 | * error. Otherwise, a status code is returned indicating the |
---|
190 | * source of the error. |
---|
191 | */ |
---|
192 | rtems_status_code rtems_message_queue_receive( |
---|
193 | rtems_id id, |
---|
194 | void *buffer, |
---|
195 | size_t *size, |
---|
196 | rtems_option option_set, |
---|
197 | rtems_interval timeout |
---|
198 | ); |
---|
199 | |
---|
200 | /** |
---|
201 | * @brief rtems_message_queue_flush |
---|
202 | * |
---|
203 | * This routine implements the rtems_message_queue_flush directive. |
---|
204 | * This directive takes all outstanding messages for the message |
---|
205 | * queue indicated by ID and returns them to the inactive message |
---|
206 | * chain. The number of messages flushed is returned in COUNT. |
---|
207 | * |
---|
208 | * Message Queue Manager |
---|
209 | */ |
---|
210 | rtems_status_code rtems_message_queue_flush( |
---|
211 | rtems_id id, |
---|
212 | uint32_t *count |
---|
213 | ); |
---|
214 | |
---|
215 | /** |
---|
216 | * @brief RTEMS Message Queue Get Number Pending |
---|
217 | * |
---|
218 | * Message Queue Manager |
---|
219 | * |
---|
220 | * This routine implements the rtems_message_queue_get_number_pending |
---|
221 | * directive. This directive returns the number of pending |
---|
222 | * messages for the message queue indicated by ID |
---|
223 | * chain. The number of messages pending is returned in COUNT. |
---|
224 | */ |
---|
225 | rtems_status_code rtems_message_queue_get_number_pending( |
---|
226 | rtems_id id, |
---|
227 | uint32_t *count |
---|
228 | ); |
---|
229 | |
---|
230 | /**@}*/ |
---|
231 | |
---|
232 | #ifdef __cplusplus |
---|
233 | } |
---|
234 | #endif |
---|
235 | |
---|
236 | #endif |
---|
237 | /* end of include file */ |
---|