Back to home page

LXR

 
 

    


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

0001 /*  set_vector
0002  *
0003  *  This routine installs an interrupt vector on the sun4v niagara
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-1998. On-Line Applications Research Corporation (OAR).
0017  *  COPYRIGHT (c) 2010. Gedare Bloom.
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 
0024 #include <bsp.h>
0025 
0026 rtems_isr_entry set_vector(                   /* returns old vector */
0027   rtems_isr_entry     handler,                /* isr routine        */
0028   rtems_vector_number vector,                 /* vector number      */
0029   int                 type                    /* RTEMS or RAW intr  */
0030 )
0031 {
0032   rtems_isr_entry previous_isr;
0033   uint32_t      real_trap;
0034   uint32_t      source;
0035   int bit_mask;
0036 
0037   if ( type )
0038     rtems_interrupt_catch( handler, vector, &previous_isr );
0039   else 
0040     _CPU_ISR_install_raw_handler( vector, handler, (void *)&previous_isr );
0041 
0042   real_trap = SPARC_REAL_TRAP_NUMBER( vector );
0043 
0044   /* check if this is an interrupt, if so, clear and unmask interrupts for
0045    * this level
0046    */
0047   /* Interrupts have real_trap numbers between 0x41 and 0x4F (levels 1 - 15) */
0048   if (real_trap >= 0x41 && real_trap <= 0x4F) {
0049     source = real_trap - 0x40;
0050     bit_mask = 1<<source;
0051 
0052     sparc64_clear_interrupt_bits(bit_mask);
0053   }
0054 
0055 
0056   return previous_isr;
0057 }