[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 | |
---|
[9e602b0] | 25 | static rtems_irq_connect_data rtemsIrq[BSP_IRQ_NUMBER]; |
---|
| 26 | static rtems_irq_global_settings initial_config; |
---|
| 27 | static rtems_irq_connect_data defaultIrq = { |
---|
[4243433] | 28 | /* vectorIdex, hdl , handle , on , off , isOn */ |
---|
| 29 | 0, NULL, NULL , NULL, NULL, NULL |
---|
[270ce1ff] | 30 | }; |
---|
| 31 | static rtems_irq_prio irqPrioTable[BSP_IRQ_NUMBER]={ |
---|
| 32 | /* |
---|
| 33 | * Processor exceptions handled as interrupts |
---|
| 34 | */ |
---|
| 35 | 0 |
---|
| 36 | }; |
---|
| 37 | |
---|
| 38 | /* |
---|
| 39 | * This code assumes the exceptions management setup has already |
---|
| 40 | * been done. We just need to replace the exceptions that will |
---|
| 41 | * be handled like interrupt. On mcp750/mpc750 and many PPC processors |
---|
| 42 | * this means the decrementer exception and the external exception. |
---|
| 43 | */ |
---|
| 44 | void BSP_rtems_irq_mng_init(unsigned cpuId) |
---|
| 45 | { |
---|
| 46 | int i; |
---|
| 47 | |
---|
| 48 | /* |
---|
| 49 | * First initialize the Interrupt management hardware |
---|
| 50 | */ |
---|
| 51 | |
---|
| 52 | /* |
---|
| 53 | * Initialize Rtems management interrupt table |
---|
| 54 | */ |
---|
[9e602b0] | 55 | /* |
---|
| 56 | * re-init the rtemsIrq table |
---|
| 57 | */ |
---|
| 58 | for (i = 0; i < BSP_IRQ_NUMBER; i++) { |
---|
| 59 | rtemsIrq[i] = defaultIrq; |
---|
| 60 | rtemsIrq[i].name = i; |
---|
| 61 | } |
---|
| 62 | /* |
---|
| 63 | * Init initial Interrupt management config |
---|
| 64 | */ |
---|
| 65 | initial_config.irqNb = BSP_IRQ_NUMBER; |
---|
| 66 | initial_config.defaultEntry = defaultIrq; |
---|
| 67 | initial_config.irqHdlTbl = rtemsIrq; |
---|
| 68 | initial_config.irqBase = BSP_LOWEST_OFFSET; |
---|
| 69 | initial_config.irqPrioTbl = irqPrioTable; |
---|
| 70 | |
---|
| 71 | if (!BSP_rtems_irq_mngt_set(&initial_config)) { |
---|
[270ce1ff] | 72 | /* |
---|
[9e602b0] | 73 | * put something here that will show the failure... |
---|
[270ce1ff] | 74 | */ |
---|
[9e602b0] | 75 | BSP_panic( |
---|
| 76 | "Unable to initialize RTEMS interrupt Management!!! System locked\n" |
---|
| 77 | ); |
---|
| 78 | } |
---|
[270ce1ff] | 79 | |
---|
[9e602b0] | 80 | #ifdef TRACE_IRQ_INIT |
---|
[270ce1ff] | 81 | printk("RTEMS IRQ management is now operationnal\n"); |
---|
[9e602b0] | 82 | #endif |
---|
[270ce1ff] | 83 | } |
---|