1 | /* |
---|
2 | * Multiprocessing 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/config.h> |
---|
18 | #include <rtems/cpu.h> |
---|
19 | #include <rtems/event.h> |
---|
20 | #include <rtems/fatal.h> |
---|
21 | #include <rtems/intthrd.h> |
---|
22 | #include <rtems/message.h> |
---|
23 | #include <rtems/mp.h> |
---|
24 | #include <rtems/mpci.h> |
---|
25 | #include <rtems/mppkt.h> |
---|
26 | #include <rtems/part.h> |
---|
27 | #include <rtems/sem.h> |
---|
28 | #include <rtems/signal.h> |
---|
29 | #include <rtems/states.h> |
---|
30 | #include <rtems/tasks.h> |
---|
31 | #include <rtems/thread.h> |
---|
32 | #include <rtems/threadq.h> |
---|
33 | #include <rtems/watchdog.h> |
---|
34 | |
---|
35 | /*PAGE |
---|
36 | * |
---|
37 | * _Multiprocessing_Manager_initialization |
---|
38 | * |
---|
39 | */ |
---|
40 | |
---|
41 | void _Multiprocessing_Manager_initialization ( void ) |
---|
42 | { |
---|
43 | if ( _Configuration_MP_table->node < 1 || |
---|
44 | _Configuration_MP_table->node > _Configuration_MP_table->maximum_nodes ) |
---|
45 | rtems_fatal_error_occurred( RTEMS_INVALID_NODE ); |
---|
46 | |
---|
47 | _Internal_threads_Set_MP_receive_server( _Multiprocessing_Receive_server ); |
---|
48 | } |
---|
49 | |
---|
50 | /*PAGE |
---|
51 | * |
---|
52 | * rtems_multiprocessing_announce |
---|
53 | * |
---|
54 | */ |
---|
55 | |
---|
56 | void rtems_multiprocessing_announce ( void ) |
---|
57 | { |
---|
58 | _Thread_MP_Ready(); |
---|
59 | } |
---|
60 | |
---|
61 | /*PAGE |
---|
62 | * |
---|
63 | * _Multiprocessing_Receive_server |
---|
64 | * |
---|
65 | */ |
---|
66 | |
---|
67 | Thread _Multiprocessing_Receive_server ( |
---|
68 | Thread_Argument ignored |
---|
69 | ) |
---|
70 | { |
---|
71 | |
---|
72 | rtems_packet_prefix *the_packet; |
---|
73 | |
---|
74 | _Thread_Dispatch_disable_level = 1; |
---|
75 | |
---|
76 | for ( ; ; ) { |
---|
77 | |
---|
78 | _Internal_threads_System_initialization_thread->Notepads[ 0 ] = 1; |
---|
79 | |
---|
80 | the_packet = _MPCI_Receive_packet(); |
---|
81 | |
---|
82 | if ( ! the_packet ) { |
---|
83 | _Thread_MP_Block(); |
---|
84 | _Thread_Dispatch_disable_level = 1; |
---|
85 | } |
---|
86 | else { |
---|
87 | |
---|
88 | _Thread_Executing->receive_packet = the_packet; |
---|
89 | |
---|
90 | switch ( the_packet->the_class ) { |
---|
91 | |
---|
92 | case RTEMS_MP_PACKET_INTERNAL_THREADS: |
---|
93 | _Internal_threads_MP_Process_packet( the_packet ); |
---|
94 | break; |
---|
95 | |
---|
96 | case RTEMS_MP_PACKET_TASKS: |
---|
97 | _RTEMS_tasks_MP_Process_packet( the_packet ); |
---|
98 | break; |
---|
99 | |
---|
100 | case RTEMS_MP_PACKET_MESSAGE_QUEUE: |
---|
101 | _Message_queue_MP_Process_packet( the_packet ); |
---|
102 | break; |
---|
103 | |
---|
104 | case RTEMS_MP_PACKET_SEMAPHORE: |
---|
105 | _Semaphore_MP_Process_packet( the_packet ); |
---|
106 | break; |
---|
107 | |
---|
108 | case RTEMS_MP_PACKET_PARTITION: |
---|
109 | _Partition_MP_Process_packet( the_packet ); |
---|
110 | break; |
---|
111 | |
---|
112 | case RTEMS_MP_PACKET_REGION: |
---|
113 | /* Global regions are unsupported at this time */ |
---|
114 | break; |
---|
115 | |
---|
116 | case RTEMS_MP_PACKET_EVENT: |
---|
117 | _Event_MP_Process_packet( the_packet ); |
---|
118 | break; |
---|
119 | |
---|
120 | case RTEMS_MP_PACKET_SIGNAL: |
---|
121 | _Signal_MP_Process_packet( the_packet ); |
---|
122 | break; |
---|
123 | } |
---|
124 | } |
---|
125 | } |
---|
126 | } |
---|
127 | |
---|
128 | /* end of file */ |
---|