File indexing completed on 2025-05-11 08:24:22
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038 #ifdef HAVE_CONFIG_H
0039 #include "config.h"
0040 #endif
0041
0042 #include <rtems/rtems/signalimpl.h>
0043 #include <rtems/rtems/optionsimpl.h>
0044 #include <rtems/rtems/statusimpl.h>
0045 #include <rtems/score/statesimpl.h>
0046 #include <rtems/score/threadimpl.h>
0047 #include <rtems/score/threadqimpl.h>
0048
0049
0050
0051
0052
0053 typedef enum {
0054 SIGNAL_MP_SEND_REQUEST = 0,
0055 SIGNAL_MP_SEND_RESPONSE = 1
0056 } Signal_MP_Remote_operations;
0057
0058
0059
0060
0061
0062 typedef struct {
0063 rtems_packet_prefix Prefix;
0064 Signal_MP_Remote_operations operation;
0065 rtems_signal_set signal_set;
0066 } Signal_MP_Packet;
0067
0068 RTEMS_STATIC_ASSERT(
0069 sizeof(Signal_MP_Packet) <= MP_PACKET_MINIMUM_PACKET_SIZE,
0070 Signal_MP_Packet
0071 );
0072
0073 static Signal_MP_Packet *_Signal_MP_Get_packet( Objects_Id id )
0074 {
0075 if ( !_Thread_MP_Is_remote( id ) ) {
0076 return NULL;
0077 }
0078
0079 return (Signal_MP_Packet *) _MPCI_Get_packet();
0080 }
0081
0082
0083
0084
0085
0086
0087
0088
0089
0090 rtems_status_code _Signal_MP_Send(
0091 rtems_id id,
0092 rtems_signal_set signal_set
0093 )
0094 {
0095 Signal_MP_Packet *the_packet;
0096 Status_Control status;
0097
0098 the_packet = _Signal_MP_Get_packet( id );
0099 if ( the_packet == NULL ) {
0100 return RTEMS_INVALID_ID;
0101 }
0102
0103 the_packet->Prefix.the_class = MP_PACKET_SIGNAL;
0104 the_packet->Prefix.length = sizeof( *the_packet );
0105 the_packet->Prefix.to_convert = sizeof( *the_packet );
0106 the_packet->operation = SIGNAL_MP_SEND_REQUEST;
0107 the_packet->Prefix.id = id;
0108 the_packet->signal_set = signal_set;
0109
0110 status = _MPCI_Send_request_packet(
0111 _Objects_Get_node( id ),
0112 &the_packet->Prefix,
0113 STATES_READY
0114 );
0115 return _Status_Get( status );
0116 }
0117
0118 static void _Signal_MP_Send_response_packet (
0119 Signal_MP_Remote_operations operation,
0120 Thread_Control *the_thread
0121 )
0122 {
0123 Signal_MP_Packet *the_packet;
0124
0125 switch ( operation ) {
0126
0127 case SIGNAL_MP_SEND_RESPONSE:
0128
0129 the_packet = ( Signal_MP_Packet *) the_thread->receive_packet;
0130
0131
0132
0133
0134
0135 the_packet->operation = operation;
0136 the_packet->Prefix.id = the_packet->Prefix.source_tid;
0137
0138 _MPCI_Send_response_packet(
0139 _Objects_Get_node( the_packet->Prefix.source_tid ),
0140 &the_packet->Prefix
0141 );
0142 break;
0143
0144 case SIGNAL_MP_SEND_REQUEST:
0145 break;
0146
0147 }
0148 }
0149
0150 void _Signal_MP_Process_packet (
0151 rtems_packet_prefix *the_packet_prefix
0152 )
0153 {
0154 Signal_MP_Packet *the_packet;
0155
0156 the_packet = (Signal_MP_Packet *) the_packet_prefix;
0157
0158 switch ( the_packet->operation ) {
0159
0160 case SIGNAL_MP_SEND_REQUEST:
0161
0162 the_packet->Prefix.return_code = rtems_signal_send(
0163 the_packet->Prefix.id,
0164 the_packet->signal_set
0165 );
0166
0167 _Signal_MP_Send_response_packet(
0168 SIGNAL_MP_SEND_RESPONSE,
0169 _Thread_Executing
0170 );
0171 break;
0172
0173 case SIGNAL_MP_SEND_RESPONSE:
0174
0175 _MPCI_Process_response( the_packet_prefix );
0176 _MPCI_Return_packet( the_packet_prefix );
0177 break;
0178
0179 }
0180 }
0181
0182
0183
0184
0185
0186
0187
0188
0189
0190
0191
0192
0193
0194
0195
0196
0197
0198