Back to home page

LXR

 
 

    


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

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