source: rtems/cpukit/rtems/src/taskmp.c @ 5250ff39

4.104.114.84.95
Last change on this file since 5250ff39 was 5250ff39, checked in by Joel Sherrill <joel.sherrill@…>, on 08/23/95 at 21:06:31

Moved _Thread_Information -> _RTEMS_tasks_Information.

Added a table of object information control blocks.

Modified _Thread_Get so it looks up a thread regardless of which
thread management "entity" (manager, internal, etc) actually "owns" it.

  • Property mode set to 100644
File size: 8.6 KB
Line 
1/*
2 *  Multiprocessing Support for the RTEMS Task Manager
3 *
4 *
5 *  COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
6 *  On-Line Applications Research Corporation (OAR).
7 *  All rights assigned to U.S. Government, 1994.
8 *
9 *  This material may be reproduced by or for the U.S. Government pursuant
10 *  to the copyright license under the clause at DFARS 252.227-7013.  This
11 *  notice must appear in all copies of this file and its derivatives.
12 *
13 *  $Id$
14 */
15
16#include <rtems/system.h>
17#include <rtems/mpci.h>
18#include <rtems/mppkt.h>
19#include <rtems/object.h>
20#include <rtems/options.h>
21#include <rtems/tasks.h>
22#include <rtems/thread.h>
23#include <rtems/watchdog.h>
24
25/*PAGE
26 *
27 *  _RTEMS_tasks_MP_Send_process_packet
28 *
29 */
30
31void _RTEMS_tasks_MP_Send_process_packet (
32  RTEMS_tasks_MP_Remote_operations operation,
33  Objects_Id                       task_id,
34  rtems_name                       name
35)
36{
37  RTEMS_tasks_MP_Packet *the_packet;
38
39  switch ( operation ) {
40
41    case RTEMS_TASKS_MP_ANNOUNCE_CREATE:
42    case RTEMS_TASKS_MP_ANNOUNCE_DELETE:
43
44      the_packet                    = _RTEMS_tasks_MP_Get_packet();
45      the_packet->Prefix.the_class  = RTEMS_MP_PACKET_TASKS;
46      the_packet->Prefix.length     = sizeof ( RTEMS_tasks_MP_Packet );
47      the_packet->Prefix.to_convert = sizeof ( RTEMS_tasks_MP_Packet );
48      the_packet->operation         = operation;
49      the_packet->Prefix.id         = task_id;
50      the_packet->name              = name;
51
52      _MPCI_Send_process_packet( MPCI_ALL_NODES, &the_packet->Prefix );
53      break;
54
55    case RTEMS_TASKS_MP_SUSPEND_REQUEST:
56    case RTEMS_TASKS_MP_SUSPEND_RESPONSE:
57    case RTEMS_TASKS_MP_RESUME_REQUEST:
58    case RTEMS_TASKS_MP_RESUME_RESPONSE:
59    case RTEMS_TASKS_MP_SET_PRIORITY_REQUEST:
60    case RTEMS_TASKS_MP_SET_PRIORITY_RESPONSE:
61    case RTEMS_TASKS_MP_GET_NOTE_REQUEST:
62    case RTEMS_TASKS_MP_GET_NOTE_RESPONSE:
63    case RTEMS_TASKS_MP_SET_NOTE_REQUEST:
64    case RTEMS_TASKS_MP_SET_NOTE_RESPONSE:
65      break;
66  }
67}
68
69/*PAGE
70 *
71 *  _RTEMS_tasks_MP_Send_request_packet
72 *
73 */
74
75rtems_status_code _RTEMS_tasks_MP_Send_request_packet (
76  RTEMS_tasks_MP_Remote_operations operation,
77  Objects_Id                       task_id,
78  rtems_task_priority                 new_priority,
79  unsigned32                       notepad,
80  unsigned32                       note
81)
82{
83  RTEMS_tasks_MP_Packet *the_packet;
84
85  switch ( operation ) {
86
87    case RTEMS_TASKS_MP_SUSPEND_REQUEST:
88    case RTEMS_TASKS_MP_RESUME_REQUEST:
89    case RTEMS_TASKS_MP_SET_PRIORITY_REQUEST:
90    case RTEMS_TASKS_MP_GET_NOTE_REQUEST:
91    case RTEMS_TASKS_MP_SET_NOTE_REQUEST:
92
93      the_packet                    = _RTEMS_tasks_MP_Get_packet();
94      the_packet->Prefix.the_class  = RTEMS_MP_PACKET_TASKS;
95      the_packet->Prefix.length     = sizeof ( RTEMS_tasks_MP_Packet );
96      the_packet->Prefix.to_convert = sizeof ( RTEMS_tasks_MP_Packet );
97      the_packet->operation         = operation;
98      the_packet->Prefix.id         = task_id;
99      the_packet->the_priority      = new_priority;
100      the_packet->notepad           = notepad;
101      the_packet->note              = note;
102
103      return _MPCI_Send_request_packet(
104        rtems_get_node( task_id ),
105        &the_packet->Prefix,
106        STATES_READY     /* Not used */
107      );
108      break;
109
110    case RTEMS_TASKS_MP_ANNOUNCE_CREATE:
111    case RTEMS_TASKS_MP_ANNOUNCE_DELETE:
112    case RTEMS_TASKS_MP_SUSPEND_RESPONSE:
113    case RTEMS_TASKS_MP_RESUME_RESPONSE:
114    case RTEMS_TASKS_MP_SET_PRIORITY_RESPONSE:
115    case RTEMS_TASKS_MP_GET_NOTE_RESPONSE:
116    case RTEMS_TASKS_MP_SET_NOTE_RESPONSE:
117      break;
118
119  }
120  /*
121   *  The following line is included to satisfy compilers which
122   *  produce warnings when a function does not end with a return.
123   */
124  return RTEMS_SUCCESSFUL;
125}
126
127/*PAGE
128 *
129 *  _RTEMS_tasks_MP_Send_response_packet
130 *
131 */
132
133void _RTEMS_tasks_MP_Send_response_packet (
134  RTEMS_tasks_MP_Remote_operations  operation,
135  Thread_Control                   *the_thread
136)
137{
138  RTEMS_tasks_MP_Packet *the_packet;
139
140  switch ( operation ) {
141
142    case RTEMS_TASKS_MP_SUSPEND_RESPONSE:
143    case RTEMS_TASKS_MP_RESUME_RESPONSE:
144    case RTEMS_TASKS_MP_SET_PRIORITY_RESPONSE:
145    case RTEMS_TASKS_MP_GET_NOTE_RESPONSE:
146    case RTEMS_TASKS_MP_SET_NOTE_RESPONSE:
147
148      the_packet = (RTEMS_tasks_MP_Packet *) the_thread->receive_packet;
149
150/*
151 *  The packet being returned already contains the class, length, and
152 *  to_convert fields, therefore they are not set in this routine.
153 */
154      the_packet->operation    = operation;
155      the_packet->Prefix.id    = the_packet->Prefix.source_tid;
156
157      _MPCI_Send_response_packet(
158        rtems_get_node( the_packet->Prefix.source_tid ),
159        &the_packet->Prefix
160      );
161      break;
162
163    case RTEMS_TASKS_MP_ANNOUNCE_CREATE:
164    case RTEMS_TASKS_MP_ANNOUNCE_DELETE:
165    case RTEMS_TASKS_MP_SUSPEND_REQUEST:
166    case RTEMS_TASKS_MP_RESUME_REQUEST:
167    case RTEMS_TASKS_MP_SET_PRIORITY_REQUEST:
168    case RTEMS_TASKS_MP_GET_NOTE_REQUEST:
169    case RTEMS_TASKS_MP_SET_NOTE_REQUEST:
170      break;
171
172  }
173}
174
175/*PAGE
176 *
177 *
178 *  _RTEMS_tasks_MP_Process_packet
179 *
180 */
181
182void _RTEMS_tasks_MP_Process_packet (
183  rtems_packet_prefix  *the_packet_prefix
184)
185{
186  RTEMS_tasks_MP_Packet *the_packet;
187  Thread_Control   *the_thread;
188  boolean           ignored;
189
190  the_packet = (RTEMS_tasks_MP_Packet *) the_packet_prefix;
191
192  switch ( the_packet->operation ) {
193
194    case RTEMS_TASKS_MP_ANNOUNCE_CREATE:
195
196      ignored = _Objects_MP_Open(
197                  &_RTEMS_tasks_Information,
198                  the_packet->name,
199                  the_packet->Prefix.id,
200                  TRUE
201                );
202
203      _MPCI_Return_packet( the_packet_prefix );
204      break;
205
206    case RTEMS_TASKS_MP_ANNOUNCE_DELETE:
207
208      _Objects_MP_Close( &_RTEMS_tasks_Information, the_packet->Prefix.id );
209
210      _MPCI_Return_packet( the_packet_prefix );
211      break;
212
213    case RTEMS_TASKS_MP_SUSPEND_REQUEST:
214
215      the_packet->Prefix.return_code = rtems_task_suspend(
216        the_packet->Prefix.id
217      );
218
219      _RTEMS_tasks_MP_Send_response_packet(
220        RTEMS_TASKS_MP_SUSPEND_RESPONSE,
221        _Thread_Executing
222      );
223      break;
224
225    case RTEMS_TASKS_MP_SUSPEND_RESPONSE:
226    case RTEMS_TASKS_MP_RESUME_RESPONSE:
227    case RTEMS_TASKS_MP_SET_NOTE_RESPONSE:
228
229      the_thread = _MPCI_Process_response( the_packet_prefix );
230
231      _MPCI_Return_packet( the_packet_prefix );
232      break;
233
234    case RTEMS_TASKS_MP_RESUME_REQUEST:
235
236      the_packet->Prefix.return_code = rtems_task_resume(
237        the_packet->Prefix.id
238      );
239
240      _RTEMS_tasks_MP_Send_response_packet(
241        RTEMS_TASKS_MP_RESUME_RESPONSE,
242        _Thread_Executing
243      );
244      break;
245
246    case RTEMS_TASKS_MP_SET_PRIORITY_REQUEST:
247
248      the_packet->Prefix.return_code = rtems_task_set_priority(
249        the_packet->Prefix.id,
250        the_packet->the_priority,
251        &the_packet->the_priority
252      );
253
254      _RTEMS_tasks_MP_Send_response_packet(
255        RTEMS_TASKS_MP_SET_PRIORITY_RESPONSE,
256        _Thread_Executing
257      );
258      break;
259
260    case RTEMS_TASKS_MP_SET_PRIORITY_RESPONSE:
261
262      the_thread = _MPCI_Process_response( the_packet_prefix );
263
264      *(rtems_task_priority *)the_thread->Wait.return_argument =
265                                               the_packet->the_priority;
266
267      _MPCI_Return_packet( the_packet_prefix );
268      break;
269
270    case RTEMS_TASKS_MP_GET_NOTE_REQUEST:
271
272      the_packet->Prefix.return_code = rtems_task_get_note(
273        the_packet->Prefix.id,
274        the_packet->notepad,
275        &the_packet->note
276      );
277
278      _RTEMS_tasks_MP_Send_response_packet(
279        RTEMS_TASKS_MP_GET_NOTE_RESPONSE,
280        _Thread_Executing
281      );
282      break;
283
284    case RTEMS_TASKS_MP_GET_NOTE_RESPONSE:
285
286      the_thread = _MPCI_Process_response( the_packet_prefix );
287
288      *(unsigned32 *)the_thread->Wait.return_argument = the_packet->note;
289
290      _MPCI_Return_packet( the_packet_prefix );
291      break;
292
293    case RTEMS_TASKS_MP_SET_NOTE_REQUEST:
294
295      the_packet->Prefix.return_code = rtems_task_set_note(
296        the_packet->Prefix.id,
297        the_packet->notepad,
298        the_packet->note
299      );
300
301      _RTEMS_tasks_MP_Send_response_packet(
302        RTEMS_TASKS_MP_SET_NOTE_RESPONSE,
303        _Thread_Executing
304      );
305      break;
306  }
307}
308
309/*PAGE
310 *
311 *  _RTEMS_tasks_MP_Send_object_was_deleted
312 *
313 *  This routine is not neededby the Tasks since a task
314 *  cannot be globally deleted.
315 *
316 */
317
318/*PAGE
319 *
320 *  _RTEMS_tasks_MP_Send_extract_proxy
321 *
322 *  This routine is not neededby the Tasks since a task
323 *  cannot be globally deleted.
324 *
325 */
326
327/*PAGE
328 *
329 *  _RTEMS_tasks_MP_Get_packet
330 *
331 */
332
333RTEMS_tasks_MP_Packet *_RTEMS_tasks_MP_Get_packet ( void )
334{
335  return ( (RTEMS_tasks_MP_Packet *) _MPCI_Get_packet() );
336}
337
338/* end of file */
Note: See TracBrowser for help on using the repository browser.