[c18e0ba] | 1 | /** |
---|
| 2 | * @file |
---|
[ac7d5ef0] | 3 | * |
---|
[c18e0ba] | 4 | * @brief Signal MP Support |
---|
| 5 | * @ingroup ClassicSignalMP |
---|
| 6 | */ |
---|
| 7 | |
---|
| 8 | /* |
---|
[6c06288] | 9 | * COPYRIGHT (c) 1989-2008. |
---|
[ac7d5ef0] | 10 | * On-Line Applications Research Corporation (OAR). |
---|
| 11 | * |
---|
[98e4ebf5] | 12 | * The license and distribution terms for this file may be |
---|
| 13 | * found in the file LICENSE in this distribution or at |
---|
[c499856] | 14 | * http://www.rtems.org/license/LICENSE. |
---|
[ac7d5ef0] | 15 | */ |
---|
| 16 | |
---|
[1095ec1] | 17 | #if HAVE_CONFIG_H |
---|
| 18 | #include "config.h" |
---|
| 19 | #endif |
---|
| 20 | |
---|
[6cec745f] | 21 | #include <rtems/rtems/signalimpl.h> |
---|
| 22 | #include <rtems/rtems/optionsimpl.h> |
---|
[dce48791] | 23 | #include <rtems/rtems/statusimpl.h> |
---|
[fe6c170c] | 24 | #include <rtems/score/statesimpl.h> |
---|
[5618c37a] | 25 | #include <rtems/score/threadimpl.h> |
---|
[a112364] | 26 | #include <rtems/score/threadqimpl.h> |
---|
[ac7d5ef0] | 27 | |
---|
[bb2ad039] | 28 | /** |
---|
| 29 | * The following enumerated type defines the list of |
---|
| 30 | * remote signal operations. |
---|
| 31 | */ |
---|
| 32 | typedef enum { |
---|
| 33 | SIGNAL_MP_SEND_REQUEST = 0, |
---|
| 34 | SIGNAL_MP_SEND_RESPONSE = 1 |
---|
| 35 | } Signal_MP_Remote_operations; |
---|
| 36 | |
---|
| 37 | /** |
---|
| 38 | * The following data structure defines the packet used to perform |
---|
| 39 | * remote signal operations. |
---|
| 40 | */ |
---|
| 41 | typedef struct { |
---|
| 42 | rtems_packet_prefix Prefix; |
---|
| 43 | Signal_MP_Remote_operations operation; |
---|
| 44 | rtems_signal_set signal_set; |
---|
| 45 | } Signal_MP_Packet; |
---|
| 46 | |
---|
[d689de0] | 47 | RTEMS_STATIC_ASSERT( |
---|
| 48 | sizeof(Signal_MP_Packet) <= MP_PACKET_MINIMUM_PACKET_SIZE, |
---|
| 49 | Signal_MP_Packet |
---|
| 50 | ); |
---|
| 51 | |
---|
[bb2ad039] | 52 | static Signal_MP_Packet *_Signal_MP_Get_packet( Objects_Id id ) |
---|
[e38a92b] | 53 | { |
---|
[bb2ad039] | 54 | if ( !_Thread_MP_Is_remote( id ) ) { |
---|
| 55 | return NULL; |
---|
| 56 | } |
---|
| 57 | |
---|
[e38a92b] | 58 | return (Signal_MP_Packet *) _MPCI_Get_packet(); |
---|
| 59 | } |
---|
| 60 | |
---|
[64adc13] | 61 | /* |
---|
[ac7d5ef0] | 62 | * _Signal_MP_Send_process_packet |
---|
| 63 | * |
---|
| 64 | * This subprogram is not needed since there are no process |
---|
| 65 | * packets to be sent by this manager. |
---|
| 66 | * |
---|
| 67 | */ |
---|
| 68 | |
---|
[bb2ad039] | 69 | rtems_status_code _Signal_MP_Send( |
---|
| 70 | rtems_id id, |
---|
| 71 | rtems_signal_set signal_set |
---|
[ac7d5ef0] | 72 | ) |
---|
| 73 | { |
---|
| 74 | Signal_MP_Packet *the_packet; |
---|
[dce48791] | 75 | Status_Control status; |
---|
[ac7d5ef0] | 76 | |
---|
[bb2ad039] | 77 | the_packet = _Signal_MP_Get_packet( id ); |
---|
| 78 | if ( the_packet == NULL ) { |
---|
| 79 | return RTEMS_INVALID_ID; |
---|
[ac7d5ef0] | 80 | } |
---|
[bb2ad039] | 81 | |
---|
| 82 | the_packet->Prefix.the_class = MP_PACKET_SIGNAL; |
---|
| 83 | the_packet->Prefix.length = sizeof( *the_packet ); |
---|
| 84 | the_packet->Prefix.to_convert = sizeof( *the_packet ); |
---|
| 85 | the_packet->operation = SIGNAL_MP_SEND_REQUEST; |
---|
| 86 | the_packet->Prefix.id = id; |
---|
| 87 | the_packet->signal_set = signal_set; |
---|
| 88 | |
---|
[dce48791] | 89 | status = _MPCI_Send_request_packet( |
---|
[bb2ad039] | 90 | _Objects_Get_node( id ), |
---|
| 91 | &the_packet->Prefix, |
---|
[dce48791] | 92 | STATES_READY |
---|
[bb2ad039] | 93 | ); |
---|
[dce48791] | 94 | return _Status_Get( status ); |
---|
[ac7d5ef0] | 95 | } |
---|
| 96 | |
---|
[c506158c] | 97 | static void _Signal_MP_Send_response_packet ( |
---|
[ac7d5ef0] | 98 | Signal_MP_Remote_operations operation, |
---|
| 99 | Thread_Control *the_thread |
---|
| 100 | ) |
---|
| 101 | { |
---|
| 102 | Signal_MP_Packet *the_packet; |
---|
| 103 | |
---|
| 104 | switch ( operation ) { |
---|
| 105 | |
---|
| 106 | case SIGNAL_MP_SEND_RESPONSE: |
---|
| 107 | |
---|
| 108 | the_packet = ( Signal_MP_Packet *) the_thread->receive_packet; |
---|
| 109 | |
---|
| 110 | /* |
---|
| 111 | * The packet being returned already contains the class, length, and |
---|
| 112 | * to_convert fields, therefore they are not set in this routine. |
---|
| 113 | */ |
---|
| 114 | the_packet->operation = operation; |
---|
| 115 | the_packet->Prefix.id = the_packet->Prefix.source_tid; |
---|
| 116 | |
---|
| 117 | _MPCI_Send_response_packet( |
---|
[6c06288] | 118 | _Objects_Get_node( the_packet->Prefix.source_tid ), |
---|
[ac7d5ef0] | 119 | &the_packet->Prefix |
---|
| 120 | ); |
---|
| 121 | break; |
---|
| 122 | |
---|
| 123 | case SIGNAL_MP_SEND_REQUEST: |
---|
| 124 | break; |
---|
| 125 | |
---|
| 126 | } |
---|
| 127 | } |
---|
| 128 | |
---|
| 129 | void _Signal_MP_Process_packet ( |
---|
| 130 | rtems_packet_prefix *the_packet_prefix |
---|
| 131 | ) |
---|
| 132 | { |
---|
| 133 | Signal_MP_Packet *the_packet; |
---|
| 134 | |
---|
| 135 | the_packet = (Signal_MP_Packet *) the_packet_prefix; |
---|
| 136 | |
---|
| 137 | switch ( the_packet->operation ) { |
---|
| 138 | |
---|
| 139 | case SIGNAL_MP_SEND_REQUEST: |
---|
| 140 | |
---|
| 141 | the_packet->Prefix.return_code = rtems_signal_send( |
---|
| 142 | the_packet->Prefix.id, |
---|
[bb2ad039] | 143 | the_packet->signal_set |
---|
[ac7d5ef0] | 144 | ); |
---|
| 145 | |
---|
| 146 | _Signal_MP_Send_response_packet( |
---|
| 147 | SIGNAL_MP_SEND_RESPONSE, |
---|
| 148 | _Thread_Executing |
---|
| 149 | ); |
---|
| 150 | break; |
---|
| 151 | |
---|
| 152 | case SIGNAL_MP_SEND_RESPONSE: |
---|
| 153 | |
---|
[06f68a96] | 154 | _MPCI_Process_response( the_packet_prefix ); |
---|
[ac7d5ef0] | 155 | _MPCI_Return_packet( the_packet_prefix ); |
---|
| 156 | break; |
---|
| 157 | |
---|
| 158 | } |
---|
| 159 | } |
---|
| 160 | |
---|
[64adc13] | 161 | /* |
---|
[ac7d5ef0] | 162 | * _Signal_MP_Send_object_was_deleted |
---|
| 163 | * |
---|
| 164 | * This subprogram is not needed since there are no objects |
---|
| 165 | * deleted by this manager. |
---|
| 166 | * |
---|
| 167 | */ |
---|
| 168 | |
---|
[64adc13] | 169 | /* |
---|
[ac7d5ef0] | 170 | * _Signal_MP_Send_extract_proxy |
---|
| 171 | * |
---|
| 172 | * This subprogram is not needed since there are no objects |
---|
| 173 | * deleted by this manager. |
---|
| 174 | * |
---|
| 175 | */ |
---|
| 176 | |
---|
| 177 | /* end of file */ |
---|