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