source: rtems/c/src/exec/rtems/src/mp.c @ 7f6a24ab

4.104.114.84.95
Last change on this file since 7f6a24ab was 7f6a24ab, checked in by Joel Sherrill <joel.sherrill@…>, on 08/28/95 at 15:30:29

Added unused priority ceiling parameter to rtems_semaphore_create.

Rearranged code to created thread handler routines to initialize,
start, restart, and "close/delete" a thread.

Made internal threads their own object class. This now uses the
thread support routines for starting and initializing a thread.

Insured deleted tasks are freed to the Inactive pool associated with the
correct Information block.

Added an RTEMS API specific data area to the thread control block.

Beginnings of removing the word "rtems" from the core.

  • Property mode set to 100644
File size: 3.0 KB
Line 
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
41void _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
56void rtems_multiprocessing_announce ( void )
57{
58  _Thread_Disable_dispatch();
59  _Event_sets_Post(
60    RTEMS_EVENT_0,
61    &_Internal_threads_System_initialization_thread->RTEMS_API->pending_events
62  );
63  _Event_Surrender( _Internal_threads_System_initialization_thread );
64  _Thread_Enable_dispatch();
65}
66
67/*PAGE
68 *
69 *  _Multiprocessing_Receive_server
70 *
71 */
72
73typedef void (*packet_processor)( rtems_packet_prefix * );
74
75packet_processor _Multiprocessor_Packet_processors[] = {
76  _Internal_threads_MP_Process_packet, /* RTEMS_MP_PACKET_INTERNAL_THREADS */
77  _RTEMS_tasks_MP_Process_packet,      /* RTEMS_MP_PACKET_TASKS */
78  _Message_queue_MP_Process_packet,    /* RTEMS_MP_PACKET_MESSAGE_QUEUE */
79  _Semaphore_MP_Process_packet,        /* RTEMS_MP_PACKET_SEMAPHORE */
80  _Partition_MP_Process_packet,        /* RTEMS_MP_PACKET_PARTITION */
81  0,                                   /* RTEMS_MP_PACKET_REGION */
82  _Event_MP_Process_packet,            /* RTEMS_MP_PACKET_EVENT */
83  _Signal_MP_Process_packet            /* RTEMS_MP_PACKET_SIGNAL */
84};
85
86Thread _Multiprocessing_Receive_server (
87  Thread_Argument ignored
88)
89{
90
91  rtems_packet_prefix *the_packet;
92  packet_processor     the_function;
93
94  for ( ; ; ) {
95
96    _Thread_Disable_dispatch();
97    _Event_Seize( RTEMS_EVENT_0, RTEMS_DEFAULT_OPTIONS, RTEMS_NO_TIMEOUT );
98    _Thread_Enable_dispatch();
99
100    for ( ; ; ) {
101      the_packet = _MPCI_Receive_packet();
102
103      if ( !the_packet )
104        break;
105
106      _Thread_Executing->receive_packet = the_packet;
107
108      if ( !_Mp_packet_Is_valid_packet_class ( the_packet->the_class ) )
109        break;
110
111      the_function = _Multiprocessor_Packet_processors[ the_packet->the_class ];
112   
113      if ( !the_function )
114        break;
115
116      (*the_function)( the_packet );
117    }
118  }
119}
120
121/* end of file */
Note: See TracBrowser for help on using the repository browser.