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