Back to home page

LXR

 
 

    


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

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