[ac7d5ef0] | 1 | /* |
---|
| 2 | * Multiprocessing Support for the Message Queue Manager |
---|
| 3 | * |
---|
| 4 | * |
---|
[6c06288] | 5 | * COPYRIGHT (c) 1989-2008. |
---|
[ac7d5ef0] | 6 | * On-Line Applications Research Corporation (OAR). |
---|
| 7 | * |
---|
[98e4ebf5] | 8 | * The license and distribution terms for this file may be |
---|
| 9 | * found in the file LICENSE in this distribution or at |
---|
[277cc95] | 10 | * http://www.rtems.com/license/LICENSE. |
---|
[ac7d5ef0] | 11 | * |
---|
| 12 | * $Id$ |
---|
| 13 | */ |
---|
| 14 | |
---|
[1095ec1] | 15 | #if HAVE_CONFIG_H |
---|
| 16 | #include "config.h" |
---|
| 17 | #endif |
---|
| 18 | |
---|
[ac7d5ef0] | 19 | #include <rtems/system.h> |
---|
[3a4ae6c] | 20 | #include <rtems/rtems/status.h> |
---|
| 21 | #include <rtems/rtems/message.h> |
---|
[5e9b32b] | 22 | #include <rtems/score/mpci.h> |
---|
[3a4ae6c] | 23 | #include <rtems/rtems/msgmp.h> |
---|
[5e9b32b] | 24 | #include <rtems/score/object.h> |
---|
[3a4ae6c] | 25 | #include <rtems/rtems/options.h> |
---|
[5e9b32b] | 26 | #include <rtems/score/thread.h> |
---|
| 27 | #include <rtems/score/watchdog.h> |
---|
[3a4ae6c] | 28 | #include <rtems/rtems/support.h> |
---|
[ac7d5ef0] | 29 | |
---|
| 30 | /*PAGE |
---|
| 31 | * |
---|
| 32 | * _Message_queue_MP_Send_process_packet |
---|
| 33 | * |
---|
| 34 | */ |
---|
| 35 | |
---|
| 36 | void _Message_queue_MP_Send_process_packet ( |
---|
| 37 | Message_queue_MP_Remote_operations operation, |
---|
| 38 | Objects_Id message_queue_id, |
---|
[3235ad9] | 39 | rtems_name name, |
---|
[ac7d5ef0] | 40 | Objects_Id proxy_id |
---|
| 41 | ) |
---|
| 42 | { |
---|
| 43 | Message_queue_MP_Packet *the_packet; |
---|
[1d496f6] | 44 | uint32_t node; |
---|
[ac7d5ef0] | 45 | |
---|
| 46 | switch ( operation ) { |
---|
| 47 | |
---|
| 48 | case MESSAGE_QUEUE_MP_ANNOUNCE_CREATE: |
---|
| 49 | case MESSAGE_QUEUE_MP_ANNOUNCE_DELETE: |
---|
| 50 | case MESSAGE_QUEUE_MP_EXTRACT_PROXY: |
---|
| 51 | |
---|
| 52 | the_packet = _Message_queue_MP_Get_packet(); |
---|
[3a4ae6c] | 53 | the_packet->Prefix.the_class = MP_PACKET_MESSAGE_QUEUE; |
---|
[ac7d5ef0] | 54 | the_packet->Prefix.length = sizeof ( Message_queue_MP_Packet ); |
---|
| 55 | the_packet->Prefix.to_convert = sizeof ( Message_queue_MP_Packet ); |
---|
| 56 | the_packet->operation = operation; |
---|
| 57 | the_packet->Prefix.id = message_queue_id; |
---|
| 58 | the_packet->name = name; |
---|
| 59 | the_packet->proxy_id = proxy_id; |
---|
| 60 | |
---|
| 61 | if ( operation == MESSAGE_QUEUE_MP_EXTRACT_PROXY ) |
---|
[6c06288] | 62 | node = _Objects_Get_node( message_queue_id ); |
---|
[ac7d5ef0] | 63 | else |
---|
| 64 | node = MPCI_ALL_NODES; |
---|
| 65 | |
---|
| 66 | _MPCI_Send_process_packet( node, &the_packet->Prefix ); |
---|
| 67 | break; |
---|
| 68 | |
---|
| 69 | case MESSAGE_QUEUE_MP_RECEIVE_REQUEST: |
---|
| 70 | case MESSAGE_QUEUE_MP_RECEIVE_RESPONSE: |
---|
| 71 | case MESSAGE_QUEUE_MP_SEND_REQUEST: |
---|
| 72 | case MESSAGE_QUEUE_MP_SEND_RESPONSE: |
---|
| 73 | case MESSAGE_QUEUE_MP_URGENT_REQUEST: |
---|
| 74 | case MESSAGE_QUEUE_MP_URGENT_RESPONSE: |
---|
| 75 | case MESSAGE_QUEUE_MP_BROADCAST_REQUEST: |
---|
| 76 | case MESSAGE_QUEUE_MP_BROADCAST_RESPONSE: |
---|
| 77 | case MESSAGE_QUEUE_MP_FLUSH_REQUEST: |
---|
| 78 | case MESSAGE_QUEUE_MP_FLUSH_RESPONSE: |
---|
[e7d8b58] | 79 | case MESSAGE_QUEUE_MP_GET_NUMBER_PENDING_REQUEST: |
---|
| 80 | case MESSAGE_QUEUE_MP_GET_NUMBER_PENDING_RESPONSE: |
---|
[ac7d5ef0] | 81 | break; |
---|
| 82 | |
---|
| 83 | } |
---|
| 84 | } |
---|
| 85 | |
---|
| 86 | /*PAGE |
---|
| 87 | * |
---|
| 88 | * _Message_queue_MP_Send_request_packet |
---|
| 89 | * |
---|
| 90 | */ |
---|
| 91 | |
---|
| 92 | rtems_status_code _Message_queue_MP_Send_request_packet ( |
---|
| 93 | Message_queue_MP_Remote_operations operation, |
---|
| 94 | Objects_Id message_queue_id, |
---|
[f773c012] | 95 | const void *buffer, |
---|
[6703e491] | 96 | size_t *size_p, |
---|
[3b438fa] | 97 | rtems_option option_set, |
---|
| 98 | rtems_interval timeout |
---|
[ac7d5ef0] | 99 | ) |
---|
| 100 | { |
---|
| 101 | Message_queue_MP_Packet *the_packet; |
---|
| 102 | |
---|
| 103 | switch ( operation ) { |
---|
| 104 | |
---|
| 105 | case MESSAGE_QUEUE_MP_SEND_REQUEST: |
---|
| 106 | case MESSAGE_QUEUE_MP_URGENT_REQUEST: |
---|
| 107 | case MESSAGE_QUEUE_MP_BROADCAST_REQUEST: |
---|
| 108 | case MESSAGE_QUEUE_MP_FLUSH_REQUEST: |
---|
[e7d8b58] | 109 | case MESSAGE_QUEUE_MP_GET_NUMBER_PENDING_REQUEST: |
---|
[ac7d5ef0] | 110 | |
---|
| 111 | the_packet = _Message_queue_MP_Get_packet(); |
---|
[3a4ae6c] | 112 | the_packet->Prefix.the_class = MP_PACKET_MESSAGE_QUEUE; |
---|
[3b438fa] | 113 | the_packet->Prefix.length = sizeof(Message_queue_MP_Packet); |
---|
| 114 | if ( size_p ) |
---|
[3a4ae6c] | 115 | the_packet->Prefix.length += *size_p; |
---|
[3b438fa] | 116 | the_packet->Prefix.to_convert = sizeof(Message_queue_MP_Packet); |
---|
| 117 | |
---|
| 118 | /* |
---|
| 119 | * make sure message is not too big for our MPCI driver |
---|
| 120 | * We have to check it here instead of waiting for MPCI because |
---|
| 121 | * we are about to slam in the payload |
---|
| 122 | */ |
---|
| 123 | |
---|
[3a4ae6c] | 124 | if (the_packet->Prefix.length > _MPCI_table->maximum_packet_size) { |
---|
[3b438fa] | 125 | _Thread_Enable_dispatch(); |
---|
| 126 | return RTEMS_INVALID_SIZE; |
---|
| 127 | } |
---|
| 128 | |
---|
[e7d8b58] | 129 | if (! _Options_Is_no_wait(option_set)) |
---|
[ac7d5ef0] | 130 | the_packet->Prefix.timeout = timeout; |
---|
| 131 | |
---|
[3b438fa] | 132 | the_packet->operation = operation; |
---|
| 133 | the_packet->Prefix.id = message_queue_id; |
---|
| 134 | the_packet->option_set = option_set; |
---|
| 135 | |
---|
| 136 | /* |
---|
| 137 | * Copy the data into place if needed |
---|
| 138 | */ |
---|
[50f32b11] | 139 | |
---|
[3a4ae6c] | 140 | if (buffer) { |
---|
[3b438fa] | 141 | the_packet->Buffer.size = *size_p; |
---|
[3652ad35] | 142 | _CORE_message_queue_Copy_buffer( |
---|
| 143 | buffer, |
---|
| 144 | the_packet->Buffer.buffer, |
---|
| 145 | *size_p |
---|
| 146 | ); |
---|
[3b438fa] | 147 | } |
---|
| 148 | |
---|
[ffe316d] | 149 | return (rtems_status_code) _MPCI_Send_request_packet( |
---|
[6c06288] | 150 | _Objects_Get_node(message_queue_id), |
---|
[ffe316d] | 151 | &the_packet->Prefix, |
---|
| 152 | STATES_WAITING_FOR_MESSAGE |
---|
| 153 | ); |
---|
[3b438fa] | 154 | break; |
---|
[ac7d5ef0] | 155 | |
---|
[3b438fa] | 156 | case MESSAGE_QUEUE_MP_RECEIVE_REQUEST: |
---|
[ac7d5ef0] | 157 | |
---|
[3b438fa] | 158 | the_packet = _Message_queue_MP_Get_packet(); |
---|
[3a4ae6c] | 159 | the_packet->Prefix.the_class = MP_PACKET_MESSAGE_QUEUE; |
---|
[3b438fa] | 160 | the_packet->Prefix.length = sizeof(Message_queue_MP_Packet); |
---|
| 161 | the_packet->Prefix.to_convert = sizeof(Message_queue_MP_Packet); |
---|
| 162 | |
---|
[e7d8b58] | 163 | if (! _Options_Is_no_wait(option_set)) |
---|
[3b438fa] | 164 | the_packet->Prefix.timeout = timeout; |
---|
| 165 | |
---|
| 166 | the_packet->operation = MESSAGE_QUEUE_MP_RECEIVE_REQUEST; |
---|
| 167 | the_packet->Prefix.id = message_queue_id; |
---|
| 168 | the_packet->option_set = option_set; |
---|
| 169 | the_packet->size = 0; /* just in case of an error */ |
---|
| 170 | |
---|
[f773c012] | 171 | _Thread_Executing->Wait.return_argument_second.immutable_object = buffer; |
---|
| 172 | _Thread_Executing->Wait.return_argument = size_p; |
---|
[50f32b11] | 173 | |
---|
[ffe316d] | 174 | return (rtems_status_code) _MPCI_Send_request_packet( |
---|
[6c06288] | 175 | _Objects_Get_node(message_queue_id), |
---|
[ffe316d] | 176 | &the_packet->Prefix, |
---|
| 177 | STATES_WAITING_FOR_MESSAGE |
---|
| 178 | ); |
---|
[ac7d5ef0] | 179 | break; |
---|
| 180 | |
---|
| 181 | case MESSAGE_QUEUE_MP_ANNOUNCE_CREATE: |
---|
| 182 | case MESSAGE_QUEUE_MP_ANNOUNCE_DELETE: |
---|
| 183 | case MESSAGE_QUEUE_MP_EXTRACT_PROXY: |
---|
| 184 | case MESSAGE_QUEUE_MP_RECEIVE_RESPONSE: |
---|
| 185 | case MESSAGE_QUEUE_MP_SEND_RESPONSE: |
---|
| 186 | case MESSAGE_QUEUE_MP_URGENT_RESPONSE: |
---|
| 187 | case MESSAGE_QUEUE_MP_BROADCAST_RESPONSE: |
---|
| 188 | case MESSAGE_QUEUE_MP_FLUSH_RESPONSE: |
---|
[e7d8b58] | 189 | case MESSAGE_QUEUE_MP_GET_NUMBER_PENDING_RESPONSE: |
---|
[ac7d5ef0] | 190 | break; |
---|
| 191 | } |
---|
[3b438fa] | 192 | |
---|
[ac7d5ef0] | 193 | return RTEMS_SUCCESSFUL; |
---|
| 194 | } |
---|
| 195 | |
---|
| 196 | /*PAGE |
---|
| 197 | * |
---|
| 198 | * _Message_queue_MP_Send_response_packet |
---|
| 199 | * |
---|
| 200 | */ |
---|
| 201 | |
---|
| 202 | void _Message_queue_MP_Send_response_packet ( |
---|
| 203 | Message_queue_MP_Remote_operations operation, |
---|
| 204 | Objects_Id message_queue_id, |
---|
| 205 | Thread_Control *the_thread |
---|
| 206 | ) |
---|
| 207 | { |
---|
| 208 | Message_queue_MP_Packet *the_packet; |
---|
| 209 | |
---|
| 210 | switch ( operation ) { |
---|
| 211 | |
---|
| 212 | case MESSAGE_QUEUE_MP_RECEIVE_RESPONSE: |
---|
| 213 | case MESSAGE_QUEUE_MP_SEND_RESPONSE: |
---|
| 214 | case MESSAGE_QUEUE_MP_URGENT_RESPONSE: |
---|
| 215 | case MESSAGE_QUEUE_MP_BROADCAST_RESPONSE: |
---|
| 216 | case MESSAGE_QUEUE_MP_FLUSH_RESPONSE: |
---|
[e7d8b58] | 217 | case MESSAGE_QUEUE_MP_GET_NUMBER_PENDING_RESPONSE: |
---|
[ac7d5ef0] | 218 | |
---|
| 219 | the_packet = ( Message_queue_MP_Packet *) the_thread->receive_packet; |
---|
| 220 | |
---|
| 221 | /* |
---|
| 222 | * The packet being returned already contains the class, length, and |
---|
| 223 | * to_convert fields, therefore they are not set in this routine. |
---|
[3b438fa] | 224 | * |
---|
| 225 | * Exception: MESSAGE_QUEUE_MP_RECEIVE_RESPONSE needs payload length |
---|
| 226 | * added to 'length' |
---|
[ac7d5ef0] | 227 | */ |
---|
| 228 | the_packet->operation = operation; |
---|
| 229 | the_packet->Prefix.id = the_packet->Prefix.source_tid; |
---|
| 230 | |
---|
[3b438fa] | 231 | if (operation == MESSAGE_QUEUE_MP_RECEIVE_RESPONSE) |
---|
| 232 | the_packet->Prefix.length += the_packet->size; |
---|
[50f32b11] | 233 | |
---|
[ac7d5ef0] | 234 | _MPCI_Send_response_packet( |
---|
[6c06288] | 235 | _Objects_Get_node( the_packet->Prefix.source_tid ), |
---|
[ac7d5ef0] | 236 | &the_packet->Prefix |
---|
| 237 | ); |
---|
| 238 | break; |
---|
| 239 | |
---|
| 240 | case MESSAGE_QUEUE_MP_ANNOUNCE_CREATE: |
---|
| 241 | case MESSAGE_QUEUE_MP_ANNOUNCE_DELETE: |
---|
| 242 | case MESSAGE_QUEUE_MP_EXTRACT_PROXY: |
---|
| 243 | case MESSAGE_QUEUE_MP_RECEIVE_REQUEST: |
---|
| 244 | case MESSAGE_QUEUE_MP_SEND_REQUEST: |
---|
| 245 | case MESSAGE_QUEUE_MP_URGENT_REQUEST: |
---|
| 246 | case MESSAGE_QUEUE_MP_BROADCAST_REQUEST: |
---|
| 247 | case MESSAGE_QUEUE_MP_FLUSH_REQUEST: |
---|
[e7d8b58] | 248 | case MESSAGE_QUEUE_MP_GET_NUMBER_PENDING_REQUEST: |
---|
[ac7d5ef0] | 249 | break; |
---|
| 250 | |
---|
| 251 | } |
---|
| 252 | } |
---|
| 253 | |
---|
| 254 | /*PAGE |
---|
| 255 | * |
---|
| 256 | * |
---|
| 257 | * _Message_queue_MP_Process_packet |
---|
| 258 | * |
---|
| 259 | */ |
---|
| 260 | |
---|
| 261 | void _Message_queue_MP_Process_packet ( |
---|
| 262 | rtems_packet_prefix *the_packet_prefix |
---|
| 263 | ) |
---|
| 264 | { |
---|
| 265 | Message_queue_MP_Packet *the_packet; |
---|
| 266 | Thread_Control *the_thread; |
---|
[484a769] | 267 | bool ignored; |
---|
[ac7d5ef0] | 268 | |
---|
| 269 | the_packet = (Message_queue_MP_Packet *) the_packet_prefix; |
---|
| 270 | |
---|
| 271 | switch ( the_packet->operation ) { |
---|
| 272 | |
---|
| 273 | case MESSAGE_QUEUE_MP_ANNOUNCE_CREATE: |
---|
| 274 | |
---|
[7f6a24ab] | 275 | ignored = _Objects_MP_Allocate_and_open( |
---|
[ac7d5ef0] | 276 | &_Message_queue_Information, |
---|
| 277 | the_packet->name, |
---|
| 278 | the_packet->Prefix.id, |
---|
[eaef4657] | 279 | true |
---|
[ac7d5ef0] | 280 | ); |
---|
| 281 | |
---|
| 282 | _MPCI_Return_packet( the_packet_prefix ); |
---|
| 283 | break; |
---|
| 284 | |
---|
| 285 | case MESSAGE_QUEUE_MP_ANNOUNCE_DELETE: |
---|
| 286 | |
---|
| 287 | _Objects_MP_Close( &_Message_queue_Information, the_packet->Prefix.id ); |
---|
| 288 | |
---|
| 289 | _MPCI_Return_packet( the_packet_prefix ); |
---|
| 290 | break; |
---|
| 291 | |
---|
| 292 | case MESSAGE_QUEUE_MP_EXTRACT_PROXY: |
---|
| 293 | |
---|
| 294 | the_thread = _Thread_MP_Find_proxy( the_packet->proxy_id ); |
---|
| 295 | |
---|
[e7d8b58] | 296 | if (! _Thread_Is_null( the_thread ) ) |
---|
[ac7d5ef0] | 297 | _Thread_queue_Extract( the_thread->Wait.queue, the_thread ); |
---|
| 298 | |
---|
| 299 | _MPCI_Return_packet( the_packet_prefix ); |
---|
| 300 | break; |
---|
| 301 | |
---|
| 302 | case MESSAGE_QUEUE_MP_RECEIVE_REQUEST: |
---|
| 303 | |
---|
| 304 | the_packet->Prefix.return_code = rtems_message_queue_receive( |
---|
| 305 | the_packet->Prefix.id, |
---|
[3b438fa] | 306 | the_packet->Buffer.buffer, |
---|
| 307 | &the_packet->size, |
---|
[ac7d5ef0] | 308 | the_packet->option_set, |
---|
| 309 | the_packet->Prefix.timeout |
---|
| 310 | ); |
---|
| 311 | |
---|
[dd1a460e] | 312 | if ( the_packet->Prefix.return_code != RTEMS_PROXY_BLOCKING ) |
---|
[ac7d5ef0] | 313 | _Message_queue_MP_Send_response_packet( |
---|
| 314 | MESSAGE_QUEUE_MP_RECEIVE_RESPONSE, |
---|
| 315 | the_packet->Prefix.id, |
---|
| 316 | _Thread_Executing |
---|
| 317 | ); |
---|
| 318 | break; |
---|
| 319 | |
---|
| 320 | case MESSAGE_QUEUE_MP_RECEIVE_RESPONSE: |
---|
| 321 | |
---|
| 322 | the_thread = _MPCI_Process_response( the_packet_prefix ); |
---|
| 323 | |
---|
[3b438fa] | 324 | if (the_packet->Prefix.return_code == RTEMS_SUCCESSFUL) { |
---|
[f773c012] | 325 | *(size_t *) the_thread->Wait.return_argument = |
---|
[3a4ae6c] | 326 | the_packet->size; |
---|
[3b438fa] | 327 | |
---|
[3652ad35] | 328 | _CORE_message_queue_Copy_buffer( |
---|
[3b438fa] | 329 | the_packet->Buffer.buffer, |
---|
[f773c012] | 330 | the_thread->Wait.return_argument_second.mutable_object, |
---|
[3b438fa] | 331 | the_packet->size |
---|
| 332 | ); |
---|
| 333 | } |
---|
[ac7d5ef0] | 334 | |
---|
| 335 | _MPCI_Return_packet( the_packet_prefix ); |
---|
| 336 | break; |
---|
| 337 | |
---|
| 338 | case MESSAGE_QUEUE_MP_SEND_REQUEST: |
---|
| 339 | |
---|
| 340 | the_packet->Prefix.return_code = rtems_message_queue_send( |
---|
| 341 | the_packet->Prefix.id, |
---|
[3b438fa] | 342 | the_packet->Buffer.buffer, |
---|
| 343 | the_packet->Buffer.size |
---|
[ac7d5ef0] | 344 | ); |
---|
| 345 | |
---|
| 346 | _Message_queue_MP_Send_response_packet( |
---|
| 347 | MESSAGE_QUEUE_MP_SEND_RESPONSE, |
---|
| 348 | the_packet->Prefix.id, |
---|
| 349 | _Thread_Executing |
---|
| 350 | ); |
---|
| 351 | break; |
---|
| 352 | |
---|
| 353 | case MESSAGE_QUEUE_MP_SEND_RESPONSE: |
---|
| 354 | case MESSAGE_QUEUE_MP_URGENT_RESPONSE: |
---|
| 355 | |
---|
| 356 | the_thread = _MPCI_Process_response( the_packet_prefix ); |
---|
| 357 | |
---|
| 358 | _MPCI_Return_packet( the_packet_prefix ); |
---|
| 359 | break; |
---|
| 360 | |
---|
| 361 | case MESSAGE_QUEUE_MP_URGENT_REQUEST: |
---|
| 362 | |
---|
| 363 | the_packet->Prefix.return_code = rtems_message_queue_urgent( |
---|
| 364 | the_packet->Prefix.id, |
---|
[3b438fa] | 365 | the_packet->Buffer.buffer, |
---|
| 366 | the_packet->Buffer.size |
---|
[ac7d5ef0] | 367 | ); |
---|
| 368 | |
---|
| 369 | _Message_queue_MP_Send_response_packet( |
---|
| 370 | MESSAGE_QUEUE_MP_URGENT_RESPONSE, |
---|
| 371 | the_packet->Prefix.id, |
---|
| 372 | _Thread_Executing |
---|
| 373 | ); |
---|
| 374 | break; |
---|
| 375 | |
---|
| 376 | case MESSAGE_QUEUE_MP_BROADCAST_REQUEST: |
---|
| 377 | |
---|
| 378 | the_packet->Prefix.return_code = rtems_message_queue_broadcast( |
---|
| 379 | the_packet->Prefix.id, |
---|
[3b438fa] | 380 | the_packet->Buffer.buffer, |
---|
| 381 | the_packet->Buffer.size, |
---|
[ac7d5ef0] | 382 | &the_packet->count |
---|
| 383 | ); |
---|
| 384 | |
---|
| 385 | _Message_queue_MP_Send_response_packet( |
---|
| 386 | MESSAGE_QUEUE_MP_BROADCAST_RESPONSE, |
---|
| 387 | the_packet->Prefix.id, |
---|
| 388 | _Thread_Executing |
---|
| 389 | ); |
---|
| 390 | break; |
---|
| 391 | |
---|
| 392 | case MESSAGE_QUEUE_MP_BROADCAST_RESPONSE: |
---|
| 393 | case MESSAGE_QUEUE_MP_FLUSH_RESPONSE: |
---|
[e7d8b58] | 394 | case MESSAGE_QUEUE_MP_GET_NUMBER_PENDING_RESPONSE: |
---|
[ac7d5ef0] | 395 | |
---|
| 396 | the_thread = _MPCI_Process_response( the_packet_prefix ); |
---|
| 397 | |
---|
[f773c012] | 398 | *(uint32_t *) the_thread->Wait.return_argument = the_packet->count; |
---|
[ac7d5ef0] | 399 | |
---|
| 400 | _MPCI_Return_packet( the_packet_prefix ); |
---|
| 401 | break; |
---|
| 402 | |
---|
| 403 | case MESSAGE_QUEUE_MP_FLUSH_REQUEST: |
---|
| 404 | |
---|
| 405 | the_packet->Prefix.return_code = rtems_message_queue_flush( |
---|
| 406 | the_packet->Prefix.id, |
---|
| 407 | &the_packet->count |
---|
| 408 | ); |
---|
| 409 | |
---|
| 410 | _Message_queue_MP_Send_response_packet( |
---|
| 411 | MESSAGE_QUEUE_MP_FLUSH_RESPONSE, |
---|
| 412 | the_packet->Prefix.id, |
---|
| 413 | _Thread_Executing |
---|
| 414 | ); |
---|
| 415 | break; |
---|
| 416 | |
---|
[e7d8b58] | 417 | case MESSAGE_QUEUE_MP_GET_NUMBER_PENDING_REQUEST: |
---|
| 418 | |
---|
| 419 | the_packet->Prefix.return_code = rtems_message_queue_get_number_pending( |
---|
| 420 | the_packet->Prefix.id, |
---|
| 421 | &the_packet->count |
---|
| 422 | ); |
---|
| 423 | |
---|
| 424 | _Message_queue_MP_Send_response_packet( |
---|
| 425 | MESSAGE_QUEUE_MP_GET_NUMBER_PENDING_RESPONSE, |
---|
| 426 | the_packet->Prefix.id, |
---|
| 427 | _Thread_Executing |
---|
| 428 | ); |
---|
| 429 | break; |
---|
| 430 | |
---|
[ac7d5ef0] | 431 | } |
---|
| 432 | } |
---|
| 433 | |
---|
| 434 | /*PAGE |
---|
| 435 | * |
---|
| 436 | * _Message_queue_MP_Send_object_was_deleted |
---|
| 437 | * |
---|
| 438 | */ |
---|
| 439 | |
---|
| 440 | void _Message_queue_MP_Send_object_was_deleted ( |
---|
| 441 | Thread_Control *the_proxy |
---|
| 442 | ) |
---|
| 443 | { |
---|
| 444 | the_proxy->receive_packet->return_code = RTEMS_OBJECT_WAS_DELETED; |
---|
| 445 | |
---|
| 446 | _Message_queue_MP_Send_response_packet( |
---|
| 447 | MESSAGE_QUEUE_MP_RECEIVE_RESPONSE, |
---|
| 448 | the_proxy->Wait.id, |
---|
| 449 | the_proxy |
---|
| 450 | ); |
---|
| 451 | } |
---|
| 452 | |
---|
| 453 | /*PAGE |
---|
| 454 | * |
---|
| 455 | * _Message_queue_MP_Send_extract_proxy |
---|
| 456 | * |
---|
| 457 | */ |
---|
| 458 | |
---|
| 459 | void _Message_queue_MP_Send_extract_proxy ( |
---|
[6381642a] | 460 | void *argument |
---|
[ac7d5ef0] | 461 | ) |
---|
| 462 | { |
---|
[6381642a] | 463 | Thread_Control *the_thread = (Thread_Control *)argument; |
---|
| 464 | |
---|
[ac7d5ef0] | 465 | _Message_queue_MP_Send_process_packet( |
---|
| 466 | MESSAGE_QUEUE_MP_EXTRACT_PROXY, |
---|
| 467 | the_thread->Wait.id, |
---|
[3235ad9] | 468 | (rtems_name) 0, |
---|
[ac7d5ef0] | 469 | the_thread->Object.id |
---|
| 470 | ); |
---|
| 471 | } |
---|
| 472 | |
---|
| 473 | /*PAGE |
---|
| 474 | * |
---|
| 475 | * _Message_queue_MP_Get_packet |
---|
| 476 | * |
---|
| 477 | */ |
---|
| 478 | |
---|
| 479 | Message_queue_MP_Packet *_Message_queue_MP_Get_packet ( void ) |
---|
| 480 | { |
---|
| 481 | return ( (Message_queue_MP_Packet *) _MPCI_Get_packet() ); |
---|
| 482 | } |
---|
| 483 | |
---|
[ef22ab2] | 484 | |
---|
| 485 | /*PAGE |
---|
| 486 | * |
---|
| 487 | * _Message_queue_Core_message_queue_mp_support |
---|
| 488 | * |
---|
| 489 | * Input parameters: |
---|
| 490 | * the_thread - the remote thread the message was submitted to |
---|
| 491 | * id - id of the message queue |
---|
| 492 | * |
---|
| 493 | * Output parameters: NONE |
---|
| 494 | */ |
---|
| 495 | |
---|
| 496 | void _Message_queue_Core_message_queue_mp_support ( |
---|
| 497 | Thread_Control *the_thread, |
---|
| 498 | Objects_Id id |
---|
| 499 | ) |
---|
| 500 | { |
---|
| 501 | the_thread->receive_packet->return_code = RTEMS_SUCCESSFUL; |
---|
| 502 | |
---|
| 503 | _Message_queue_MP_Send_response_packet( |
---|
| 504 | MESSAGE_QUEUE_MP_RECEIVE_RESPONSE, |
---|
| 505 | id, |
---|
| 506 | the_thread |
---|
| 507 | ); |
---|
| 508 | } |
---|
| 509 | |
---|
[ac7d5ef0] | 510 | /* end of file */ |
---|