Thread_Control *_Thread_MP_Allocate_proxy ( States_Control the_state ) { Thread_Control *the_thread; Thread_Proxy_control *the_proxy; the_thread = (Thread_Control *)_Chain_Get( &_Thread_MP_Inactive_proxies ); if ( !_Thread_Is_null( the_thread ) ) { the_proxy = (Thread_Proxy_control *) the_thread; _Thread_Executing->Wait.return_code = THREAD_STATUS_PROXY_BLOCKING; the_proxy->receive_packet = _MPCI_Receive_server_tcb->receive_packet; the_proxy->Object.id = _MPCI_Receive_server_tcb->receive_packet->source_tid; the_proxy->current_priority = _MPCI_Receive_server_tcb->receive_packet->source_priority; the_proxy->current_state = _States_Set( STATES_DORMANT, the_state ); the_proxy->Wait = _Thread_Executing->Wait; _Chain_Append( &_Thread_MP_Active_proxies, &the_proxy->Active ); return the_thread; } _Internal_error_Occurred( INTERNAL_ERROR_CORE, true, INTERNAL_ERROR_OUT_OF_PROXIES ); /* * NOTE: The following return ensures that the compiler will * think that all paths return a value. */ return NULL; }
void _Message_queue_MP_Process_packet ( rtems_packet_prefix *the_packet_prefix ) { Message_queue_MP_Packet *the_packet; Thread_Control *the_thread; bool ignored; the_packet = (Message_queue_MP_Packet *) the_packet_prefix; switch ( the_packet->operation ) { case MESSAGE_QUEUE_MP_ANNOUNCE_CREATE: ignored = _Objects_MP_Allocate_and_open( &_Message_queue_Information, the_packet->name, the_packet->Prefix.id, true ); _MPCI_Return_packet( the_packet_prefix ); break; case MESSAGE_QUEUE_MP_ANNOUNCE_DELETE: _Objects_MP_Close( &_Message_queue_Information, the_packet->Prefix.id ); _MPCI_Return_packet( the_packet_prefix ); break; case MESSAGE_QUEUE_MP_EXTRACT_PROXY: the_thread = _Thread_MP_Find_proxy( the_packet->proxy_id ); if (! _Thread_Is_null( the_thread ) ) _Thread_queue_Extract( the_thread ); _MPCI_Return_packet( the_packet_prefix ); break; case MESSAGE_QUEUE_MP_RECEIVE_REQUEST: the_packet->Prefix.return_code = rtems_message_queue_receive( the_packet->Prefix.id, the_packet->Buffer.buffer, &the_packet->size, the_packet->option_set, the_packet->Prefix.timeout ); if ( the_packet->Prefix.return_code != RTEMS_PROXY_BLOCKING ) _Message_queue_MP_Send_response_packet( MESSAGE_QUEUE_MP_RECEIVE_RESPONSE, the_packet->Prefix.id, _Thread_Executing ); break; case MESSAGE_QUEUE_MP_RECEIVE_RESPONSE: the_thread = _MPCI_Process_response( the_packet_prefix ); if (the_packet->Prefix.return_code == RTEMS_SUCCESSFUL) { *(size_t *) the_thread->Wait.return_argument = the_packet->size; _CORE_message_queue_Copy_buffer( the_packet->Buffer.buffer, the_thread->Wait.return_argument_second.mutable_object, the_packet->size ); } _MPCI_Return_packet( the_packet_prefix ); break; case MESSAGE_QUEUE_MP_SEND_REQUEST: the_packet->Prefix.return_code = rtems_message_queue_send( the_packet->Prefix.id, the_packet->Buffer.buffer, the_packet->Buffer.size ); _Message_queue_MP_Send_response_packet( MESSAGE_QUEUE_MP_SEND_RESPONSE, the_packet->Prefix.id, _Thread_Executing ); break; case MESSAGE_QUEUE_MP_SEND_RESPONSE: case MESSAGE_QUEUE_MP_URGENT_RESPONSE: the_thread = _MPCI_Process_response( the_packet_prefix ); _MPCI_Return_packet( the_packet_prefix ); break; case MESSAGE_QUEUE_MP_URGENT_REQUEST: the_packet->Prefix.return_code = rtems_message_queue_urgent( the_packet->Prefix.id, the_packet->Buffer.buffer, the_packet->Buffer.size ); _Message_queue_MP_Send_response_packet( MESSAGE_QUEUE_MP_URGENT_RESPONSE, the_packet->Prefix.id, _Thread_Executing ); break; case MESSAGE_QUEUE_MP_BROADCAST_REQUEST: the_packet->Prefix.return_code = rtems_message_queue_broadcast( the_packet->Prefix.id, the_packet->Buffer.buffer, the_packet->Buffer.size, &the_packet->count ); _Message_queue_MP_Send_response_packet( MESSAGE_QUEUE_MP_BROADCAST_RESPONSE, the_packet->Prefix.id, _Thread_Executing ); break; case MESSAGE_QUEUE_MP_BROADCAST_RESPONSE: case MESSAGE_QUEUE_MP_FLUSH_RESPONSE: case MESSAGE_QUEUE_MP_GET_NUMBER_PENDING_RESPONSE: the_thread = _MPCI_Process_response( the_packet_prefix ); *(uint32_t *) the_thread->Wait.return_argument = the_packet->count; _MPCI_Return_packet( the_packet_prefix ); break; case MESSAGE_QUEUE_MP_FLUSH_REQUEST: the_packet->Prefix.return_code = rtems_message_queue_flush( the_packet->Prefix.id, &the_packet->count ); _Message_queue_MP_Send_response_packet( MESSAGE_QUEUE_MP_FLUSH_RESPONSE, the_packet->Prefix.id, _Thread_Executing ); break; case MESSAGE_QUEUE_MP_GET_NUMBER_PENDING_REQUEST: the_packet->Prefix.return_code = rtems_message_queue_get_number_pending( the_packet->Prefix.id, &the_packet->count ); _Message_queue_MP_Send_response_packet( MESSAGE_QUEUE_MP_GET_NUMBER_PENDING_RESPONSE, the_packet->Prefix.id, _Thread_Executing ); break; } }
void _Partition_MP_Process_packet ( rtems_packet_prefix *the_packet_prefix ) { Partition_MP_Packet *the_packet; Thread_Control *the_thread; the_packet = (Partition_MP_Packet *) the_packet_prefix; switch ( the_packet->operation ) { case PARTITION_MP_ANNOUNCE_CREATE: _Objects_MP_Allocate_and_open( &_Partition_Information, the_packet->name, the_packet->Prefix.id, true ); _MPCI_Return_packet( the_packet_prefix ); break; case PARTITION_MP_ANNOUNCE_DELETE: _Objects_MP_Close( &_Partition_Information, the_packet->Prefix.id ); _MPCI_Return_packet( the_packet_prefix ); break; case PARTITION_MP_EXTRACT_PROXY: the_thread = _Thread_MP_Find_proxy( the_packet->proxy_id ); if ( ! _Thread_Is_null( the_thread ) ) _Thread_queue_Extract( the_thread ); _MPCI_Return_packet( the_packet_prefix ); break; case PARTITION_MP_GET_BUFFER_REQUEST: the_packet->Prefix.return_code = rtems_partition_get_buffer( the_packet->Prefix.id, &the_packet->buffer ); _Partition_MP_Send_response_packet( PARTITION_MP_GET_BUFFER_RESPONSE, the_packet->Prefix.id, _Thread_Executing ); break; case PARTITION_MP_GET_BUFFER_RESPONSE: the_thread = _MPCI_Process_response( the_packet_prefix ); *(void **)the_thread->Wait.return_argument = the_packet->buffer; _MPCI_Return_packet( the_packet_prefix ); break; case PARTITION_MP_RETURN_BUFFER_REQUEST: the_packet->Prefix.return_code = rtems_partition_return_buffer( the_packet->Prefix.id, the_packet->buffer ); _Partition_MP_Send_response_packet( PARTITION_MP_RETURN_BUFFER_RESPONSE, the_packet->Prefix.id, _Thread_Executing ); break; case PARTITION_MP_RETURN_BUFFER_RESPONSE: the_thread = _MPCI_Process_response( the_packet_prefix ); _MPCI_Return_packet( the_packet_prefix ); break; } }