Back to home page

LXR

 
 

    


File indexing completed on 2025-05-11 08:23:52

0001 /* irq_init.c
0002  *
0003  *  This file contains the implementation of rtems initialization
0004  *  related to interrupt handling.
0005  *
0006  *  CopyRight (C) 1999 valette@crf.canon.fr
0007  *
0008  * Enhanced by Jay Kulpinski <jskulpin@eng01.gdds.com>
0009  * to make it valid for MVME2300 Motorola boards.
0010  *
0011  * Modified by T. Straumann for the 'beatnik' BSP.
0012  *
0013  *  The license and distribution terms for this file may be
0014  *  found in the file LICENSE in this distribution or at
0015  *  http://www.rtems.org/license/LICENSE.
0016  */
0017 
0018 #include <rtems.h>
0019 #include <bsp.h>
0020 #include <bsp/irq.h>
0021 #include <bsp/vectors.h>
0022 #include <rtems/bspIo.h>
0023 
0024 #if 0
0025 #include <libcpu/io.h>
0026 #include <libcpu/spr.h>
0027 #include <bsp/pci.h>
0028 #include <bsp/residual.h>
0029 #include <bsp/openpic.h>
0030 #include <bsp/irq.h>
0031 #include <bsp.h>
0032 #include <bsp/motorola.h>
0033 #endif
0034 
0035 /*
0036 #define SHOW_ISA_PCI_BRIDGE_SETTINGS
0037 */
0038 
0039 extern unsigned int external_exception_vector_prolog_code_size[];
0040 extern void external_exception_vector_prolog_code(void);
0041 extern unsigned int decrementer_exception_vector_prolog_code_size[];
0042 extern void decrementer_exception_vector_prolog_code(void);
0043 
0044 /*
0045  * default handler
0046  */
0047 static void nop_func(void *arg){}
0048 
0049 static rtems_irq_connect_data       rtemsIrq[BSP_IRQ_NUMBER];
0050 static rtems_irq_global_settings    initial_config;
0051 static rtems_irq_prio               rtemsPrioTbl[BSP_IRQ_NUMBER];
0052 static rtems_irq_connect_data       defaultIrq = {
0053   name:   0,
0054   hdl:    nop_func,
0055   handle: 0,
0056   on:     0,
0057   off:    0,
0058   isOn:   0
0059 };
0060 
0061 
0062   /*
0063    * This code assumes the exceptions management setup has already
0064    * been done. We just need to replace the exceptions that will
0065    * be handled like interrupt. On mcp750/mpc750 and many PPC processors
0066    * this means the decrementer exception and the external exception.
0067    */
0068 
0069 void BSP_rtems_irq_mng_init(unsigned cpuId)
0070 {
0071 int i;
0072 
0073     /*
0074      * First initialize the Interrupt management hardware
0075      */
0076 
0077     /*
0078      * Initialize RTEMS management interrupt table
0079      */
0080 
0081     /*
0082      * re-init the rtemsIrq table
0083      */
0084     for (i = BSP_LOWEST_OFFSET; i <= BSP_MAX_OFFSET; i++) {
0085         rtemsIrq[i]      = defaultIrq;
0086         rtemsIrq[i].name = i;
0087         rtemsPrioTbl[i]  = BSP_IRQ_DEFAULT_PRIORITY;
0088     }
0089 
0090     /*
0091      * Init initial Interrupt management config
0092      */
0093     initial_config.irqNb    = BSP_IRQ_NUMBER;
0094     initial_config.defaultEntry = defaultIrq;
0095     initial_config.irqHdlTbl    = rtemsIrq;
0096     initial_config.irqBase  = BSP_LOWEST_OFFSET;
0097     initial_config.irqPrioTbl   = rtemsPrioTbl;
0098 
0099     if (!BSP_rtems_irq_mngt_set(&initial_config)) {
0100         /*
0101          * put something here that will show the failure...
0102          */
0103         rtems_panic("Unable to initialize RTEMS interrupt Management!!! System locked\n");
0104     }
0105 
0106 #ifdef TRACE_IRQ_INIT  
0107     printk("RTEMS IRQ management is now operationnal\n");
0108 #endif
0109 }
0110