source: rtems/c/src/lib/libbsp/powerpc/mvme5500/irq/irq_init.c @ ee732739

4.104.114.84.95
Last change on this file since ee732739 was ee732739, checked in by Joel Sherrill <joel.sherrill@…>, on 09/13/07 at 14:26:24

2007-09-07 Kate Feng <feng1@…>

  • ChangeLog?, Makefile.am, README, README.booting, README.irq, preinstall.am, GT64260/MVME5500I2C.c, include/bsp.h, irq/irq.c, irq/irq.h, irq/irq_init.c, pci/detect_host_bridge.c, pci/pci.c, pci/pci_interface.c, pci/pcifinddevice.c, start/preload.S, startup/bspclean.c, startup/bspstart.c, startup/pgtbl_activate.c, startup/reboot.c, vectors/bspException.h, vectors/exceptionhandler.c: Merge my improvements in this BSP including a new network driver for the 1GHz NIC.
  • network/if_100MHz/GT64260eth.c, network/if_100MHz/GT64260eth.h, network/if_100MHz/GT64260ethreg.h, network/if_100MHz/Makefile.am, network/if_1GHz/Makefile.am, network/if_1GHz/POSSIBLEBUG, network/if_1GHz/if_wm.c, network/if_1GHz/if_wmreg.h, network/if_1GHz/pci_map.c, network/if_1GHz/pcireg.h: New files.
  • Property mode set to 100644
File size: 5.4 KB
Line 
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 * Modified and added support for the MVME5500.
9 * Copyright 2003, 2004, 2005, Brookhaven National Laboratory and
10 *                 Shuchen Kate Feng <feng1@bnl.gov>
11 *
12 * The license and distribution terms for this file may be
13 * found in the file LICENSE in this distribution or at
14 * http://www.rtems.com/license/LICENSE
15 *
16 */
17#include <libcpu/io.h>
18#include <libcpu/spr.h>
19#include <bsp/irq.h>
20#include <bsp.h>
21#include <libcpu/raw_exception.h>  /* ASM_EXT_VECTOR, ASM_DEC_VECTOR ... */
22/*#define  TRACE_IRQ_INIT*/
23
24extern unsigned int external_exception_vector_prolog_code_size[];
25extern void external_exception_vector_prolog_code();
26extern unsigned int decrementer_exception_vector_prolog_code_size[];
27extern void decrementer_exception_vector_prolog_code();
28
29/*
30 * default on/off function
31 */
32static void nop_func(){}
33/*
34 * default isOn function
35 */
36static int not_connected() {return 0;}
37/*
38 * default possible isOn function
39 */
40static int connected() {return 1;}
41
42static rtems_irq_connect_data           rtemsIrq[BSP_IRQ_NUMBER];
43static rtems_irq_global_settings        initial_config;
44static rtems_irq_connect_data           defaultIrq = {
45  /* vectorIdex,         hdl      , handle      , on            , off           , isOn */
46  0,                     nop_func  , NULL       , nop_func      , nop_func      , not_connected
47};
48
49rtems_irq_prio BSPirqPrioTable[BSP_PIC_IRQ_NUMBER]={
50  /*
51   * This table is where the developers can change the levels of priority
52   * based on the need of their applications.
53   *
54   * actual priorities for CPU MAIN and GPP interrupts (0-95)
55   *
56   *    0   means that only current interrupt is masked (lowest priority)
57   *    255 is only used by bits 24, 25, 26 and 27 of the CPU high
58   *        interrupt Mask: (e.g. GPP7_0, GPP15_8, GPP23_16, GPP31_24).
59   *        The IRQs of those four bits are always enabled. When it's used,
60   *        the IRQ number is never listed in the dynamic picIsrTable[96].
61   *
62   *        The priorities of GPP interrupts were decided by their own
63   *        value set at  BSPirqPrioTable.
64   *           
65   */
66  /* CPU Main cause low interrupt */
67  /* 0-15 */
68  0, 0, 0, 0, 0, 0, 0, 0, 64/*Timer*/, 0, 0, 0, 0, 0, 0, 0,
69   /* 16-31 */
70  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
71  /* CPU Main cause high interrupt */
72  /* 32-47 */
73  2/*10/100MHZ*/, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
74  /* 48-63 */
75  0, 0, 0, 0, 0, 0, 0, 0,
76  255 /*GPP0-7*/, 255/*GPP8-15*/, 255/*GPP16-23*/, 255/*GPP24-31*/, 0, 0, 0, 0,
77  /* GPP interrupts */
78  /* GPP0-7 */
79  1/*serial*/,0, 0, 0, 0, 0, 0, 0,
80  /* GPP8-15 */
81  47/*PMC1A*/,46/*PMC1B*/,45/*PMC1C*/,44/*PMC1D*/,30/*VME0*/, 29/*VME1*/,3,1,
82  /* GPP16-23 */
83  37/*PMC2A*/,36/*PMC2B*/,35/*PMC2C*/,34/*PMC2D*/,23/*1GHZ*/, 0,0,0, 
84  /* GPP24-31 */
85  7/*watchdog*/, 0,0,0,0,0,0,0
86};
87
88/*
89 * This code assumes the exceptions management setup has already
90 * been done. We just need to replace the exceptions that will
91 * be handled like interrupt. On MPC7455 and many PPC processors
92 * this means the decrementer exception and the external exception.
93 */
94void BSP_rtems_irq_mng_init(unsigned cpuId)
95{
96  rtems_raw_except_connect_data vectorDesc;
97  int i;
98
99  /*
100   * First initialize the Interrupt management hardware
101   */
102#ifdef TRACE_IRQ_INIT 
103  printk("Initializing the interrupt controller of the GT64260\n");
104#endif       
105
106#ifdef TRACE_IRQ_INIT 
107  printk("Going to re-initialize the rtemsIrq table %d\n",BSP_IRQ_NUMBER);
108#endif       
109  /*
110   * Initialize Rtems management interrupt table
111   */
112  /*
113   * re-init the rtemsIrq table
114   */
115  for (i = 0; i < BSP_IRQ_NUMBER; i++) {
116    rtemsIrq[i]      = defaultIrq;   
117    rtemsIrq[i].name = i;
118  }
119
120  /*
121   * Init initial Interrupt management config
122   */
123  initial_config.irqNb  = BSP_IRQ_NUMBER;
124  initial_config.defaultEntry   = defaultIrq;
125  initial_config.irqHdlTbl      = rtemsIrq;
126  initial_config.irqBase        = BSP_ASM_IRQ_VECTOR_BASE;
127  initial_config.irqPrioTbl     = BSPirqPrioTable;
128
129#ifdef TRACE_IRQ_INIT 
130  printk("Going to setup irq mngt configuration\n");
131#endif       
132
133  if (!BSP_rtems_irq_mngt_set(&initial_config)) {
134      /*
135       * put something here that will show the failure...
136       */
137      BSP_panic("Unable to initialize RTEMS interrupt Management!!! System locked\n");
138  }
139#ifdef TRACE_IRQ_INIT 
140  printk("Done setup irq mngt configuration\n");
141#endif     
142
143  /*
144   * We must connect the raw irq handler for the two
145   * expected interrupt sources : decrementer and external interrupts.
146   */
147  vectorDesc.exceptIndex        = ASM_DEC_VECTOR;
148  vectorDesc.hdl.vector = ASM_DEC_VECTOR;
149  vectorDesc.hdl.raw_hdl        = decrementer_exception_vector_prolog_code;
150  vectorDesc.hdl.raw_hdl_size   = (unsigned) decrementer_exception_vector_prolog_code_size;
151  vectorDesc.on         = nop_func;
152  vectorDesc.off                = nop_func;
153  vectorDesc.isOn               = connected;
154  if (!ppc_set_exception (&vectorDesc)) {
155      BSP_panic("Unable to initialize RTEMS decrementer raw exception\n");
156  }
157  vectorDesc.exceptIndex        = ASM_EXT_VECTOR;
158  vectorDesc.hdl.vector = ASM_EXT_VECTOR;
159  vectorDesc.hdl.raw_hdl        = external_exception_vector_prolog_code;
160  vectorDesc.hdl.raw_hdl_size   = (unsigned) external_exception_vector_prolog_code_size;
161  if (!ppc_set_exception (&vectorDesc)) {
162      BSP_panic("Unable to initialize RTEMS external raw exception\n");
163    }
164#ifdef TRACE_IRQ_INIT 
165  printk("RTEMS IRQ management is now operationnal\n");
166#endif
167}
Note: See TracBrowser for help on using the repository browser.