source: rtems/c/src/lib/libbsp/powerpc/psim/irq/irq_init.c @ 8da6d77d

4.104.114.95
Last change on this file since 8da6d77d was 8da6d77d, checked in by Till Straumann <strauman@…>, on 11/30/07 at 20:28:02

2007-11-30 Till Straumann <strauman@…>

  • irq/irq.h, irq/irq_init.c: Removed the definition of ASM_IRQ_VECTOR_BASE; this symbol was only use to initialize the irqBase member of the rtems_irq_global_settings struct. However, irqBase is an rtems_irq_symbolic_name, so using BSP_LOWEST_OFFSET is more appropriate.
  • Property mode set to 100644
File size: 3.9 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 * Enhanced by Jay Kulpinski <jskulpin@eng01.gdds.com>
9 * to make it valid for MVME2300 Motorola boards.
10 *
11 * Till Straumann <strauman@slac.stanford.edu>, 12/20/2001:
12 * Use the new interface to openpic_init
13 *
14 *  The license and distribution terms for this file may be
15 *  found in the file LICENSE in this distribution or at
16 *  http://www.rtems.com/license/LICENSE.
17 *
18 *  irq_init.c,v 1.6.2.5 2003/09/04 18:45:20 joel Exp
19 */
20
21#include <libcpu/io.h>
22#include <libcpu/spr.h>
23#include <bsp/irq.h>
24#include <bsp.h>
25#include <libcpu/raw_exception.h>
26#include <rtems/bspIo.h>
27#if 0
28#include <bsp/pci.h>
29#include <bsp/residual.h>
30#include <bsp/openpic.h>
31#include <bsp/motorola.h>
32#endif
33
34/*
35#define SHOW_ISA_PCI_BRIDGE_SETTINGS
36*/
37
38extern unsigned int external_exception_vector_prolog_code_size[];
39extern void external_exception_vector_prolog_code();
40extern unsigned int decrementer_exception_vector_prolog_code_size[];
41extern void decrementer_exception_vector_prolog_code();
42
43/*
44 * default on/off function
45 */
46static void nop_func(){}
47/*
48 * default isOn function
49 */
50static int not_connected() {return 0;}
51/*
52 * default possible isOn function
53 */
54static int connected() {return 1;}
55
56static rtems_irq_connect_data           rtemsIrq[BSP_IRQ_NUMBER];
57static rtems_irq_global_settings        initial_config;
58static rtems_irq_connect_data           defaultIrq = {
59  /* vectorIdex,         hdl            , handle        , on            , off           , isOn */
60  0,                     nop_func       , NULL          , nop_func      , nop_func      , not_connected
61};
62static rtems_irq_prio irqPrioTable[BSP_IRQ_NUMBER]={
63  /*
64   * Processor exceptions handled as interrupts
65   */
66  0
67};
68
69  /*
70   * This code assumes the exceptions management setup has already
71   * been done. We just need to replace the exceptions that will
72   * be handled like interrupt. On mcp750/mpc750 and many PPC processors
73   * this means the decrementer exception and the external exception.
74   */
75void BSP_rtems_irq_mng_init(unsigned cpuId)
76{
77  rtems_raw_except_connect_data vectorDesc;
78  int i;
79 
80  /*
81   * First initialize the Interrupt management hardware
82   */
83
84  /*
85   * Initialize Rtems management interrupt table
86   */
87    /*
88     * re-init the rtemsIrq table
89     */
90    for (i = 0; i < BSP_IRQ_NUMBER; i++) {
91      rtemsIrq[i]      = defaultIrq;
92      rtemsIrq[i].name = i;
93    }
94    /*
95     * Init initial Interrupt management config
96     */
97    initial_config.irqNb        = BSP_IRQ_NUMBER;
98    initial_config.defaultEntry = defaultIrq;
99    initial_config.irqHdlTbl    = rtemsIrq;
100    initial_config.irqBase      = BSP_LOWEST_OFFSET;
101    initial_config.irqPrioTbl   = irqPrioTable;
102
103    if (!BSP_rtems_irq_mngt_set(&initial_config)) {
104      /*
105       * put something here that will show the failure...
106       */
107      BSP_panic("Unable to initialize RTEMS interrupt Management!!! System locked\n");
108    }
109 
110  /*
111   * We must connect the raw irq handler for the two
112   * expected interrupt sources : decrementer and external interrupts.
113   */
114    vectorDesc.exceptIndex      =       ASM_DEC_VECTOR;
115    vectorDesc.hdl.vector       =       ASM_DEC_VECTOR;
116    vectorDesc.hdl.raw_hdl      =       decrementer_exception_vector_prolog_code;
117    vectorDesc.hdl.raw_hdl_size =       (unsigned) decrementer_exception_vector_prolog_code_size;
118    vectorDesc.on               =       nop_func;
119    vectorDesc.off              =       nop_func;
120    vectorDesc.isOn             =       connected;
121    if (!ppc_set_exception (&vectorDesc)) {
122      BSP_panic("Unable to initialize RTEMS decrementer raw exception\n");
123    }
124    vectorDesc.exceptIndex      =       ASM_EXT_VECTOR;
125    vectorDesc.hdl.vector       =       ASM_EXT_VECTOR;
126    vectorDesc.hdl.raw_hdl      =       external_exception_vector_prolog_code;
127    vectorDesc.hdl.raw_hdl_size =       (unsigned) external_exception_vector_prolog_code_size;
128    if (!ppc_set_exception (&vectorDesc)) {
129      BSP_panic("Unable to initialize RTEMS external raw exception\n");
130    }
131#ifdef TRACE_IRQ_INIT 
132    printk("RTEMS IRQ management is now operationnal\n");
133#endif
134}
Note: See TracBrowser for help on using the repository browser.