[270ce1ff] | 1 | /* irq_init.c |
---|
| 2 | * |
---|
| 3 | * This file contains the implementation of rtems initialization |
---|
| 4 | * related to interrupt handling. |
---|
| 5 | * |
---|
| 6 | * CopyRight (C) 1999 valette@crf.canon.fr |
---|
| 7 | * |
---|
| 8 | * Enhanced by Jay Kulpinski <jskulpin@eng01.gdds.com> |
---|
| 9 | * to make it valid for MVME2300 Motorola boards. |
---|
| 10 | * |
---|
| 11 | * The license and distribution terms for this file may be |
---|
| 12 | * found in the file LICENSE in this distribution or at |
---|
| 13 | * http://www.rtems.com/license/LICENSE. |
---|
| 14 | * |
---|
| 15 | * irq_init.c,v 1.6.2.5 2003/09/04 18:45:20 joel Exp |
---|
| 16 | */ |
---|
| 17 | |
---|
| 18 | #include <libcpu/io.h> |
---|
| 19 | #include <libcpu/spr.h> |
---|
| 20 | #include <bsp/irq.h> |
---|
| 21 | #include <bsp.h> |
---|
| 22 | #include <libcpu/raw_exception.h> |
---|
| 23 | #include <rtems/bspIo.h> |
---|
| 24 | |
---|
| 25 | /* |
---|
| 26 | * default on/off function |
---|
| 27 | */ |
---|
| 28 | static void nop_func(){} |
---|
| 29 | /* |
---|
| 30 | * default isOn function |
---|
| 31 | */ |
---|
| 32 | static int not_connected() {return 0;} |
---|
| 33 | /* |
---|
| 34 | * default possible isOn function |
---|
| 35 | */ |
---|
| 36 | static int connected() {return 1;} |
---|
| 37 | |
---|
| 38 | static rtems_irq_connect_data rtemsIrq[BSP_IRQ_NUMBER]; |
---|
| 39 | static rtems_irq_global_settings initial_config; |
---|
| 40 | static rtems_irq_connect_data defaultIrq = { |
---|
[6ef01b4] | 41 | /* vectorIdex, hdl , handle , on , off , isOn */ |
---|
| 42 | 0, nop_func , NULL , nop_func , nop_func , not_connected |
---|
[270ce1ff] | 43 | }; |
---|
| 44 | static rtems_irq_prio irqPrioTable[BSP_IRQ_NUMBER]={ |
---|
| 45 | /* |
---|
| 46 | * Processor exceptions handled as interrupts |
---|
| 47 | */ |
---|
| 48 | 0 |
---|
| 49 | }; |
---|
| 50 | |
---|
| 51 | /* |
---|
| 52 | * This code assumes the exceptions management setup has already |
---|
| 53 | * been done. We just need to replace the exceptions that will |
---|
| 54 | * be handled like interrupt. On mcp750/mpc750 and many PPC processors |
---|
| 55 | * this means the decrementer exception and the external exception. |
---|
| 56 | */ |
---|
| 57 | void BSP_rtems_irq_mng_init(unsigned cpuId) |
---|
| 58 | { |
---|
| 59 | int i; |
---|
| 60 | |
---|
| 61 | /* |
---|
| 62 | * First initialize the Interrupt management hardware |
---|
| 63 | */ |
---|
| 64 | |
---|
| 65 | /* |
---|
| 66 | * Initialize Rtems management interrupt table |
---|
| 67 | */ |
---|
| 68 | /* |
---|
| 69 | * re-init the rtemsIrq table |
---|
| 70 | */ |
---|
| 71 | for (i = 0; i < BSP_IRQ_NUMBER; i++) { |
---|
| 72 | rtemsIrq[i] = defaultIrq; |
---|
| 73 | rtemsIrq[i].name = i; |
---|
| 74 | } |
---|
| 75 | /* |
---|
| 76 | * Init initial Interrupt management config |
---|
| 77 | */ |
---|
| 78 | initial_config.irqNb = BSP_IRQ_NUMBER; |
---|
| 79 | initial_config.defaultEntry = defaultIrq; |
---|
| 80 | initial_config.irqHdlTbl = rtemsIrq; |
---|
[8da6d77d] | 81 | initial_config.irqBase = BSP_LOWEST_OFFSET; |
---|
[270ce1ff] | 82 | initial_config.irqPrioTbl = irqPrioTable; |
---|
| 83 | |
---|
| 84 | if (!BSP_rtems_irq_mngt_set(&initial_config)) { |
---|
| 85 | /* |
---|
| 86 | * put something here that will show the failure... |
---|
| 87 | */ |
---|
| 88 | BSP_panic("Unable to initialize RTEMS interrupt Management!!! System locked\n"); |
---|
| 89 | } |
---|
| 90 | |
---|
| 91 | #ifdef TRACE_IRQ_INIT |
---|
| 92 | printk("RTEMS IRQ management is now operationnal\n"); |
---|
| 93 | #endif |
---|
| 94 | } |
---|