Changeset 3a4ae6c in rtems for cpukit/score/src/mpci.c


Ignore:
Timestamp:
Sep 11, 1995, 7:35:39 PM (26 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, 5, master
Children:
ced11f99
Parents:
5072b07
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpukit/score/src/mpci.c

    r5072b07 r3a4ae6c  
    1515
    1616#include <rtems/system.h>
    17 #include <rtems/config.h>
    18 #include <rtems/cpu.h>
    19 #include <rtems/fatal.h>
    20 #include <rtems/mpci.h>
    21 #include <rtems/mppkt.h>
    22 #include <rtems/states.h>
    23 #include <rtems/thread.h>
    24 #include <rtems/threadq.h>
    25 #include <rtems/tqdata.h>
    26 #include <rtems/watchdog.h>
     17#include <rtems/core/cpu.h>
     18#include <rtems/core/interr.h>
     19#include <rtems/core/mpci.h>
     20#include <rtems/core/mppkt.h>
     21#include <rtems/core/states.h>
     22#include <rtems/core/thread.h>
     23#include <rtems/core/threadq.h>
     24#include <rtems/core/tqdata.h>
     25#include <rtems/core/watchdog.h>
     26#include <rtems/sysstate.h>
     27
     28#include <rtems/core/coresem.h>
     29
     30#include <rtems/rtems/status.h> /* XXX for TIMEOUT */
    2731
    2832/*PAGE
     
    3337 */
    3438
    35 void _MPCI_Handler_initialization ( void )
    36 {
     39void _MPCI_Handler_initialization(
     40  MPCI_Control            *users_mpci_table
     41)
     42{
     43  CORE_semaphore_Attributes    attributes;
     44
     45  if ( _System_state_Is_multiprocessing && !users_mpci_table )
     46    _Internal_error_Occurred(
     47      INTERNAL_ERROR_CORE,
     48      TRUE,
     49      INTERNAL_ERROR_NO_MPCI
     50    );
     51
     52  _MPCI_table = users_mpci_table;
     53
     54  attributes.discipline = CORE_SEMAPHORE_DISCIPLINES_FIFO;
     55
     56  _CORE_semaphore_Initialize(
     57    &_MPCI_Semaphore,
     58    OBJECTS_NO_CLASS,         /* free floating semaphore */
     59    &attributes,              /* the_semaphore_attributes */
     60    0,                        /* initial_value */
     61    NULL                      /* proxy_extract_callout */
     62  );
     63
    3764  _Thread_queue_Initialize(
    3865    &_MPCI_Remote_blocked_threads,
     
    4067    THREAD_QUEUE_DISCIPLINE_FIFO,
    4168    STATES_WAITING_FOR_RPC_REPLY,
    42     NULL
     69    NULL,
     70    RTEMS_TIMEOUT
    4371  );
    4472}
     
    5482void _MPCI_Initialization ( void )
    5583{
    56   (*_Configuration_MPCI_table->initialization)(
    57     _Configuration_Table,
    58     &_CPU_Table,
    59     _Configuration_MP_table
    60   );
     84  (*_MPCI_table->initialization)();
     85}
     86
     87/*PAGE
     88 *
     89 *  _MPCI_Register_packet_processor
     90 *
     91 *  This routine registers the MPCI packet processor for the
     92 *  designated object class.
     93 */
     94 
     95void _MPCI_Register_packet_processor(
     96  Objects_Classes        the_class,
     97  MPCI_Packet_processor  the_packet_processor
     98 
     99)
     100{
     101  _MPCI_Packet_processors[ the_class ] = the_packet_processor;
    61102}
    62103
     
    69110 */
    70111
    71 rtems_packet_prefix *_MPCI_Get_packet ( void )
    72 {
    73   rtems_packet_prefix  *the_packet;
    74 
    75   (*_Configuration_MPCI_table->get_packet)( &the_packet );
     112MP_packet_Prefix *_MPCI_Get_packet ( void )
     113{
     114  MP_packet_Prefix  *the_packet;
     115
     116  (*_MPCI_table->get_packet)( &the_packet );
    76117
    77118  if ( the_packet == NULL )
    78     rtems_fatal_error_occurred( RTEMS_UNSATISFIED );
     119    _Internal_error_Occurred(
     120      INTERNAL_ERROR_CORE,
     121      TRUE,
     122      INTERNAL_ERROR_OUT_OF_PACKETS
     123    );
    79124
    80125  /*
     
    97142
    98143void _MPCI_Return_packet (
    99   rtems_packet_prefix   *the_packet
    100 )
    101 {
    102   (*_Configuration_MPCI_table->return_packet)( the_packet );
     144  MP_packet_Prefix   *the_packet
     145)
     146{
     147  (*_MPCI_table->return_packet)( the_packet );
    103148}
    104149
     
    113158void _MPCI_Send_process_packet (
    114159  unsigned32          destination,
    115   rtems_packet_prefix   *the_packet
     160  MP_packet_Prefix   *the_packet
    116161)
    117162{
    118163  the_packet->source_tid = _Thread_Executing->Object.id;
    119164  the_packet->to_convert =
    120      ( the_packet->to_convert - sizeof(rtems_packet_prefix) ) /
     165     ( the_packet->to_convert - sizeof(MP_packet_Prefix) ) /
    121166       sizeof(unsigned32);
    122167
    123   (*_Configuration_MPCI_table->send_packet)( destination, the_packet );
     168  (*_MPCI_table->send_packet)( destination, the_packet );
    124169}
    125170
     
    132177 */
    133178
    134 rtems_status_code _MPCI_Send_request_packet (
     179unsigned32 _MPCI_Send_request_packet (
    135180  unsigned32          destination,
    136   rtems_packet_prefix   *the_packet,
     181  MP_packet_Prefix   *the_packet,
    137182  States_Control      extra_state
    138183)
     
    141186  the_packet->source_priority = _Thread_Executing->current_priority;
    142187  the_packet->to_convert =
    143      ( the_packet->to_convert - sizeof(rtems_packet_prefix) ) /
     188     ( the_packet->to_convert - sizeof(MP_packet_Prefix) ) /
    144189       sizeof(unsigned32);
    145190
     
    150195  _Thread_Disable_dispatch();
    151196
    152     (*_Configuration_MPCI_table->send_packet)( destination, the_packet );
     197    (*_MPCI_table->send_packet)( destination, the_packet );
    153198
    154199    _MPCI_Remote_blocked_threads.sync = TRUE;
     
    159204
    160205    if (the_packet->timeout == MPCI_DEFAULT_TIMEOUT)
    161         the_packet->timeout = _Configuration_MPCI_table->default_timeout;
     206        the_packet->timeout = _MPCI_table->default_timeout;
    162207
    163208    _Thread_queue_Enqueue( &_MPCI_Remote_blocked_threads, the_packet->timeout );
     
    181226void _MPCI_Send_response_packet (
    182227  unsigned32          destination,
    183   rtems_packet_prefix   *the_packet
     228  MP_packet_Prefix   *the_packet
    184229)
    185230{
    186231  the_packet->source_tid = _Thread_Executing->Object.id;
    187232
    188   (*_Configuration_MPCI_table->send_packet)( destination, the_packet );
     233  (*_MPCI_table->send_packet)( destination, the_packet );
    189234}
    190235
     
    197242 */
    198243
    199 rtems_packet_prefix  *_MPCI_Receive_packet ( void )
    200 {
    201   rtems_packet_prefix  *the_packet;
    202 
    203   (*_Configuration_MPCI_table->receive_packet)( &the_packet );
     244MP_packet_Prefix  *_MPCI_Receive_packet ( void )
     245{
     246  MP_packet_Prefix  *the_packet;
     247
     248  (*_MPCI_table->receive_packet)( &the_packet );
    204249
    205250  return the_packet;
     
    215260
    216261Thread_Control *_MPCI_Process_response (
    217   rtems_packet_prefix  *the_packet
     262  MP_packet_Prefix  *the_packet
    218263)
    219264{
     
    237282}
    238283
     284/*PAGE
     285 *
     286 *  _MPCI_Receive_server
     287 *
     288 */
     289
     290void _MPCI_Receive_server( void )
     291{
     292 
     293  MP_packet_Prefix         *the_packet;
     294  MPCI_Packet_processor     the_function;
     295  Thread_Control           *executing;
     296 
     297  executing = _Thread_Executing;
     298  _MPCI_Receive_server_tcb = executing;
     299
     300  for ( ; ; ) {
     301 
     302    executing->receive_packet = NULL;
     303
     304    _Thread_Disable_dispatch();
     305    _CORE_semaphore_Seize( &_MPCI_Semaphore, 0, TRUE, WATCHDOG_NO_TIMEOUT );
     306    _Thread_Enable_dispatch();
     307 
     308    for ( ; ; ) {
     309      the_packet = _MPCI_Receive_packet();
     310 
     311      if ( !the_packet )
     312        break;
     313 
     314      executing->receive_packet = the_packet;
     315 
     316      if ( !_Mp_packet_Is_valid_packet_class ( the_packet->the_class ) )
     317        break;
     318 
     319      the_function = _MPCI_Packet_processors[ the_packet->the_class ];
     320 
     321      if ( !the_function )
     322        _Internal_error_Occurred(
     323          INTERNAL_ERROR_CORE,
     324          TRUE,
     325          INTERNAL_ERROR_BAD_PACKET
     326        );
     327 
     328        (*the_function)( the_packet );
     329    }
     330  }
     331}
     332
     333/*PAGE
     334 *
     335 *  _MPCI_Announce
     336 *
     337 */
     338 
     339void _MPCI_Announce ( void )
     340{
     341  _Thread_Disable_dispatch();
     342  (void) _CORE_semaphore_Surrender( &_MPCI_Semaphore, 0, 0 );
     343  _Thread_Enable_dispatch();
     344}
     345
    239346/* end of file */
Note: See TracChangeset for help on using the changeset viewer.