source: rtems/c/src/exec/rtems/src/taskmp.c @ b3ac6a8d

4.104.114.84.95
Last change on this file since b3ac6a8d was 3a4ae6c, checked in by Joel Sherrill <joel.sherrill@…>, on 09/11/95 at 19:35:39

The word "RTEMS" almost completely removed from the core.

Configuration Table Template file added and all tests
modified to use this. All gvar.h and conftbl.h files
removed from test directories.

Configuration parameter maximum_devices added.

Core semaphore and mutex handlers added and RTEMS API Semaphore
Manager updated to reflect this.

Initialization sequence changed to invoke API specific initialization
routines. Initialization tasks table now owned by RTEMS Tasks Manager.

Added user extension for post-switch.

Utilized user extensions to implement API specific functionality
like signal dispatching.

Added extensions to the System Initialization Thread so that an
API can register a function to be invoked while the system
is being initialized. These are largely equivalent to the
pre-driver and post-driver hooks.

Added the Modules file oar-go32_p5, modified oar-go32, and modified
the file make/custom/go32.cfg to look at an environment varable which
determines what CPU model is being used.

All BSPs updated to reflect named devices and clock driver's IOCTL
used by the Shared Memory Driver. Also merged clock isr into
main file and removed ckisr.c where possible.

Updated spsize to reflect new and moved variables.

Makefiles for the executive source and include files updated to show
break down of files into Core, RTEMS API, and Neither.

Header and inline files installed into subdirectory based on whether
logically in the Core or a part of the RTEMS API.

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