source: rtems/c/src/lib/libbsp/powerpc/psim/irq/irq_init.c @ 99f9b868

4.104.114.95
Last change on this file since 99f9b868 was b1a2bbae, checked in by Till Straumann <strauman@…>, on 12/02/07 at 21:42:41

2007-12-02 Till Straumann <strauman@…>

  • irq/irq_init.c: removed irrelevant comment.
  • Property mode set to 100644
File size: 3.8 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 *  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#if 0
25#include <bsp/pci.h>
26#include <bsp/residual.h>
27#include <bsp/openpic.h>
28#include <bsp/motorola.h>
29#endif
30
31/*
32#define SHOW_ISA_PCI_BRIDGE_SETTINGS
33*/
34
35extern unsigned int external_exception_vector_prolog_code_size[];
36extern void external_exception_vector_prolog_code();
37extern unsigned int decrementer_exception_vector_prolog_code_size[];
38extern void decrementer_exception_vector_prolog_code();
39
40/*
41 * default on/off function
42 */
43static void nop_func(){}
44/*
45 * default isOn function
46 */
47static int not_connected() {return 0;}
48/*
49 * default possible isOn function
50 */
51static int connected() {return 1;}
52
53static rtems_irq_connect_data           rtemsIrq[BSP_IRQ_NUMBER];
54static rtems_irq_global_settings        initial_config;
55static rtems_irq_connect_data           defaultIrq = {
56  /* vectorIdex,         hdl            , handle        , on            , off           , isOn */
57  0,                     nop_func       , NULL          , nop_func      , nop_func      , not_connected
58};
59static rtems_irq_prio irqPrioTable[BSP_IRQ_NUMBER]={
60  /*
61   * Processor exceptions handled as interrupts
62   */
63  0
64};
65
66  /*
67   * This code assumes the exceptions management setup has already
68   * been done. We just need to replace the exceptions that will
69   * be handled like interrupt. On mcp750/mpc750 and many PPC processors
70   * this means the decrementer exception and the external exception.
71   */
72void BSP_rtems_irq_mng_init(unsigned cpuId)
73{
74  rtems_raw_except_connect_data vectorDesc;
75  int i;
76 
77  /*
78   * First initialize the Interrupt management hardware
79   */
80
81  /*
82   * Initialize Rtems management interrupt table
83   */
84    /*
85     * re-init the rtemsIrq table
86     */
87    for (i = 0; i < BSP_IRQ_NUMBER; i++) {
88      rtemsIrq[i]      = defaultIrq;
89      rtemsIrq[i].name = i;
90    }
91    /*
92     * Init initial Interrupt management config
93     */
94    initial_config.irqNb        = BSP_IRQ_NUMBER;
95    initial_config.defaultEntry = defaultIrq;
96    initial_config.irqHdlTbl    = rtemsIrq;
97    initial_config.irqBase      = BSP_LOWEST_OFFSET;
98    initial_config.irqPrioTbl   = irqPrioTable;
99
100    if (!BSP_rtems_irq_mngt_set(&initial_config)) {
101      /*
102       * put something here that will show the failure...
103       */
104      BSP_panic("Unable to initialize RTEMS interrupt Management!!! System locked\n");
105    }
106 
107  /*
108   * We must connect the raw irq handler for the two
109   * expected interrupt sources : decrementer and external interrupts.
110   */
111    vectorDesc.exceptIndex      =       ASM_DEC_VECTOR;
112    vectorDesc.hdl.vector       =       ASM_DEC_VECTOR;
113    vectorDesc.hdl.raw_hdl      =       decrementer_exception_vector_prolog_code;
114    vectorDesc.hdl.raw_hdl_size =       (unsigned) decrementer_exception_vector_prolog_code_size;
115    vectorDesc.on               =       nop_func;
116    vectorDesc.off              =       nop_func;
117    vectorDesc.isOn             =       connected;
118    if (!ppc_set_exception (&vectorDesc)) {
119      BSP_panic("Unable to initialize RTEMS decrementer raw exception\n");
120    }
121    vectorDesc.exceptIndex      =       ASM_EXT_VECTOR;
122    vectorDesc.hdl.vector       =       ASM_EXT_VECTOR;
123    vectorDesc.hdl.raw_hdl      =       external_exception_vector_prolog_code;
124    vectorDesc.hdl.raw_hdl_size =       (unsigned) external_exception_vector_prolog_code_size;
125    if (!ppc_set_exception (&vectorDesc)) {
126      BSP_panic("Unable to initialize RTEMS external raw exception\n");
127    }
128#ifdef TRACE_IRQ_INIT 
129    printk("RTEMS IRQ management is now operationnal\n");
130#endif
131}
Note: See TracBrowser for help on using the repository browser.