Back to home page

LXR

 
 

    


File indexing completed on 2025-05-11 08:24:08

0001 /**
0002  * @file
0003  * @ingroup RTEMSBSPsSPARCLEON2
0004  * @brief Installs an interrupt vector on the SPARC simulator
0005  */
0006 
0007 /*  set_vector
0008  *
0009  *  This routine installs an interrupt vector on the SPARC simulator.
0010  *
0011  *  INPUT PARAMETERS:
0012  *    handler - interrupt handler entry point
0013  *    vector  - vector number
0014  *    type    - 0 indicates raw hardware connect
0015  *              1 indicates RTEMS interrupt connect
0016  *
0017  *  OUTPUT PARAMETERS:  NONE
0018  *
0019  *  RETURNS:
0020  *    address of previous interrupt handler
0021  *
0022  *  COPYRIGHT (c) 1989-1998.
0023  *  On-Line Applications Research Corporation (OAR).
0024  *
0025  *  The license and distribution terms for this file may be
0026  *  found in the file LICENSE in this distribution or at
0027  *  http://www.rtems.org/license/LICENSE.
0028  *
0029  *  Ported to LEON implementation of the SPARC by On-Line Applications
0030  *  Research Corporation (OAR) under contract to the European Space
0031  *  Agency (ESA).
0032  *
0033  *  LEON modifications of respective RTEMS file: COPYRIGHT (c) 1995.
0034  *  European Space Agency.
0035  */
0036 
0037 #include <bsp.h>
0038 
0039 rtems_isr_entry set_vector(                   /* returns old vector */
0040   rtems_isr_entry     handler,                /* isr routine        */
0041   rtems_vector_number vector,                 /* vector number      */
0042   int                 type                    /* RTEMS or RAW intr  */
0043 )
0044 {
0045   rtems_isr_entry previous_isr;
0046 
0047   if ( type )
0048     rtems_interrupt_catch( handler, vector, &previous_isr );
0049   else
0050     _CPU_ISR_install_raw_handler( vector, handler, (void *)&previous_isr );
0051 
0052   if ( SPARC_IS_INTERRUPT_TRAP( vector ) ) {
0053     uint32_t source;
0054 
0055     source = SPARC_INTERRUPT_TRAP_TO_SOURCE( vector );
0056 
0057     LEON_Clear_interrupt( source );
0058     LEON_Unmask_interrupt( source );
0059   }
0060 
0061   return previous_isr;
0062 }