[ac7d5ef0] | 1 | /* |
---|
| 2 | * Multiprocessing Support for the Event Manager |
---|
| 3 | * |
---|
[03f2154e] | 4 | * COPYRIGHT (c) 1989-1997. |
---|
[ac7d5ef0] | 5 | * On-Line Applications Research Corporation (OAR). |
---|
[03f2154e] | 6 | * Copyright assigned to U.S. Government, 1994. |
---|
[ac7d5ef0] | 7 | * |
---|
[98e4ebf5] | 8 | * The license and distribution terms for this file may be |
---|
| 9 | * found in the file LICENSE in this distribution or at |
---|
[03f2154e] | 10 | * http://www.OARcorp.com/rtems/license.html. |
---|
[ac7d5ef0] | 11 | * |
---|
| 12 | * $Id$ |
---|
| 13 | */ |
---|
| 14 | |
---|
| 15 | #include <rtems/system.h> |
---|
[3a4ae6c] | 16 | #include <rtems/rtems/status.h> |
---|
| 17 | #include <rtems/rtems/event.h> |
---|
[5e9b32b] | 18 | #include <rtems/score/mpci.h> |
---|
| 19 | #include <rtems/score/mppkt.h> |
---|
| 20 | #include <rtems/score/object.h> |
---|
[3a4ae6c] | 21 | #include <rtems/rtems/options.h> |
---|
[5e9b32b] | 22 | #include <rtems/score/states.h> |
---|
| 23 | #include <rtems/score/thread.h> |
---|
[3a4ae6c] | 24 | #include <rtems/rtems/support.h> |
---|
[ac7d5ef0] | 25 | |
---|
| 26 | /*PAGE |
---|
| 27 | * |
---|
| 28 | * _Event_MP_Send_process_packet |
---|
| 29 | * |
---|
| 30 | * This subprogram is not needed since there are no process |
---|
| 31 | * packets to be sent by this manager. |
---|
| 32 | * |
---|
| 33 | */ |
---|
| 34 | |
---|
| 35 | /*PAGE |
---|
| 36 | * |
---|
| 37 | * _Event_MP_Send_request_packet |
---|
| 38 | * |
---|
| 39 | */ |
---|
| 40 | |
---|
| 41 | rtems_status_code _Event_MP_Send_request_packet ( |
---|
| 42 | Event_MP_Remote_operations operation, |
---|
| 43 | Objects_Id event_id, |
---|
| 44 | rtems_event_set event_in |
---|
| 45 | ) |
---|
| 46 | { |
---|
| 47 | Event_MP_Packet *the_packet; |
---|
| 48 | |
---|
| 49 | switch ( operation ) { |
---|
| 50 | |
---|
| 51 | case EVENT_MP_SEND_REQUEST: |
---|
| 52 | |
---|
| 53 | the_packet = _Event_MP_Get_packet(); |
---|
[3a4ae6c] | 54 | the_packet->Prefix.the_class = MP_PACKET_EVENT; |
---|
[ac7d5ef0] | 55 | the_packet->Prefix.length = sizeof ( Event_MP_Packet ); |
---|
| 56 | the_packet->Prefix.to_convert = sizeof ( Event_MP_Packet ); |
---|
| 57 | the_packet->operation = operation; |
---|
| 58 | the_packet->Prefix.id = event_id; |
---|
| 59 | the_packet->event_in = event_in; |
---|
| 60 | |
---|
[ffe316d] | 61 | return (rtems_status_code) |
---|
[ac7d5ef0] | 62 | _MPCI_Send_request_packet( |
---|
| 63 | rtems_get_node( event_id ), |
---|
| 64 | &the_packet->Prefix, |
---|
| 65 | STATES_READY |
---|
| 66 | ); |
---|
| 67 | |
---|
| 68 | break; |
---|
| 69 | |
---|
| 70 | case EVENT_MP_SEND_RESPONSE: |
---|
| 71 | break; |
---|
| 72 | |
---|
| 73 | } |
---|
| 74 | /* |
---|
| 75 | * The following line is included to satisfy compilers which |
---|
| 76 | * produce warnings when a function does not end with a return. |
---|
| 77 | */ |
---|
| 78 | return RTEMS_SUCCESSFUL; |
---|
| 79 | } |
---|
| 80 | |
---|
| 81 | /*PAGE |
---|
| 82 | * |
---|
| 83 | * _Event_MP_Send_response_packet |
---|
| 84 | * |
---|
| 85 | */ |
---|
| 86 | |
---|
| 87 | void _Event_MP_Send_response_packet ( |
---|
| 88 | Event_MP_Remote_operations operation, |
---|
| 89 | Thread_Control *the_thread |
---|
| 90 | ) |
---|
| 91 | { |
---|
| 92 | Event_MP_Packet *the_packet; |
---|
| 93 | |
---|
| 94 | switch ( operation ) { |
---|
| 95 | |
---|
| 96 | case EVENT_MP_SEND_RESPONSE: |
---|
| 97 | |
---|
| 98 | the_packet = ( Event_MP_Packet *) the_thread->receive_packet; |
---|
| 99 | |
---|
| 100 | /* |
---|
| 101 | * The packet being returned already contains the class, length, and |
---|
| 102 | * to_convert fields, therefore they are not set in this routine. |
---|
| 103 | */ |
---|
| 104 | the_packet->operation = operation; |
---|
| 105 | the_packet->Prefix.id = the_packet->Prefix.source_tid; |
---|
| 106 | |
---|
| 107 | _MPCI_Send_response_packet( |
---|
| 108 | rtems_get_node( the_packet->Prefix.source_tid ), |
---|
| 109 | &the_packet->Prefix |
---|
| 110 | ); |
---|
| 111 | break; |
---|
| 112 | |
---|
| 113 | case EVENT_MP_SEND_REQUEST: |
---|
| 114 | break; |
---|
| 115 | |
---|
| 116 | } |
---|
| 117 | } |
---|
| 118 | |
---|
| 119 | /*PAGE |
---|
| 120 | * |
---|
| 121 | * |
---|
| 122 | * _Event_MP_Process_packet |
---|
| 123 | * |
---|
| 124 | */ |
---|
| 125 | |
---|
| 126 | void _Event_MP_Process_packet ( |
---|
| 127 | rtems_packet_prefix *the_packet_prefix |
---|
| 128 | ) |
---|
| 129 | { |
---|
| 130 | Event_MP_Packet *the_packet; |
---|
| 131 | Thread_Control *the_thread; |
---|
| 132 | |
---|
| 133 | the_packet = (Event_MP_Packet *) the_packet_prefix; |
---|
| 134 | |
---|
| 135 | switch ( the_packet->operation ) { |
---|
| 136 | |
---|
| 137 | case EVENT_MP_SEND_REQUEST: |
---|
| 138 | |
---|
| 139 | the_packet->Prefix.return_code = rtems_event_send( |
---|
| 140 | the_packet->Prefix.id, |
---|
| 141 | the_packet->event_in |
---|
| 142 | ); |
---|
| 143 | |
---|
| 144 | _Event_MP_Send_response_packet( |
---|
| 145 | EVENT_MP_SEND_RESPONSE, |
---|
| 146 | _Thread_Executing |
---|
| 147 | ); |
---|
| 148 | break; |
---|
| 149 | |
---|
| 150 | case EVENT_MP_SEND_RESPONSE: |
---|
| 151 | |
---|
| 152 | the_thread = _MPCI_Process_response( the_packet_prefix ); |
---|
| 153 | |
---|
| 154 | _MPCI_Return_packet( the_packet_prefix ); |
---|
| 155 | |
---|
| 156 | break; |
---|
| 157 | |
---|
| 158 | } |
---|
| 159 | } |
---|
| 160 | |
---|
| 161 | /*PAGE |
---|
| 162 | * |
---|
| 163 | * _Event_MP_Send_object_was_deleted |
---|
| 164 | * |
---|
| 165 | * This subprogram is not needed since there are no objects |
---|
| 166 | * deleted by this manager. |
---|
| 167 | * |
---|
| 168 | */ |
---|
| 169 | |
---|
| 170 | /*PAGE |
---|
| 171 | * |
---|
| 172 | * _Event_MP_Send_extract_proxy |
---|
| 173 | * |
---|
| 174 | * This subprogram is not needed since there are no objects |
---|
| 175 | * deleted by this manager. |
---|
| 176 | * |
---|
| 177 | */ |
---|
| 178 | |
---|
| 179 | /*PAGE |
---|
| 180 | * |
---|
| 181 | * _Event_MP_Get_packet |
---|
| 182 | * |
---|
| 183 | */ |
---|
| 184 | |
---|
| 185 | Event_MP_Packet *_Event_MP_Get_packet ( void ) |
---|
| 186 | { |
---|
| 187 | return ( (Event_MP_Packet *) _MPCI_Get_packet() ); |
---|
| 188 | } |
---|
| 189 | |
---|
| 190 | /* end of file */ |
---|