source: rtems/c/src/lib/libbsp/powerpc/mbx8xx/irq/irq_init.c @ 867ab080

4.104.114.84.95
Last change on this file since 867ab080 was 35bb69b, checked in by Joel Sherrill <joel.sherrill@…>, on 04/06/01 at 15:52:03

2001-03-30 Eric Valette <valette@…>

  • clock/.cvsignore, clock/Makefile.am, clock/p_clock.c, include/8xx_immap.h, include/commproc.h, include/mbx.h, irq/.cvsignore, irq/Makefile.am, irq/irq.c, irq/irq.h, irq/irq_asm.S, irq/irq_init.c, vectors/.cvsignore, vectors/Makefile.am, vectors/vectors.S, vectors/vectors.h, vectors/vectors_init.c: New files.
  • Makefile.am, configure.in, console/console.c, include/Makefile.am, network/network.c, startup/Makefile.am, startup/bspstart.c, startup/imbx8xx.c, startup/linkcmds, startup/mmutlbtab.c, startup/start.S, wrapup/Makefile.am: The modifications to this BSP reflect the conversion of the mpc8xx CPU to the "new exception processing model."
  • Property mode set to 100644
File size: 4.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) 2001 valette@crf.canon.fr
7 *
8 *  The license and distribution terms for this file may be
9 *  found in the file LICENSE in this distribution or at
10 *  http://www.OARcorp.com/rtems/license.html.
11 *
12 *  $Id$
13 */
14#include <bsp/irq.h>
15#include <bsp.h>
16#include <libcpu/raw_exception.h>
17#include <bsp/8xx_immap.h>
18#include <bsp/mbx.h>
19#include <bsp/commproc.h>
20
21extern unsigned int external_exception_vector_prolog_code_size;
22extern void external_exception_vector_prolog_code();
23extern unsigned int decrementer_exception_vector_prolog_code_size;
24extern void decrementer_exception_vector_prolog_code();
25
26volatile unsigned int ppc_cached_irq_mask;
27
28/*
29 * default on/off function
30 */
31static void nop_func(){}
32/*
33 * default isOn function
34 */
35static int not_connected() {return 0;}
36/*
37 * default possible isOn function
38 */
39static int connected() {return 1;}
40
41static rtems_irq_connect_data           rtemsIrq[BSP_IRQ_NUMBER];
42static rtems_irq_global_settings        initial_config;
43static rtems_irq_connect_data           defaultIrq = {
44  /* vectorIdex,         hdl            , on            , off           , isOn */
45  0,                     nop_func       , nop_func      , nop_func      , not_connected
46};
47static rtems_irq_prio irqPrioTable[BSP_IRQ_NUMBER]={
48  /*
49   * actual rpiorities for interrupt :
50   *    0   means that only current interrupt is masked
51   *    255 means all other interrupts are masked
52   */
53  /*
54   * SIU interrupts.
55   */
56  7,7, 6,6, 5,5, 4,4, 3,3, 2,2, 1,1, 0,0,
57  /*
58   * CPM Interrupts
59   */
60  0,  1,  2,  3,  4,  5,  6,  7,  8,  9,  10, 11, 12, 13, 14, 15,
61  16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
62  /*
63   * Processor exceptions handled as interrupts
64   */
65  0
66};
67
68void BSP_SIU_irq_init()
69{
70  /*
71   * In theory we should initialize two registers at least :
72   * SIMASK, SIEL. SIMASK is reset at 0 value meaning no interrupt. But
73   * we should take care that a monitor may have restoreed to another value.
74   * If someone find a reasonnable value for SIEL, AND THE NEED TO CHANGE IT
75   * please feel free to add it here.
76   */
77  ((volatile immap_t *)IMAP_ADDR)->im_siu_conf.sc_simask = 0;
78  ((volatile immap_t *)IMAP_ADDR)->im_siu_conf.sc_sipend = 0xffff0000;
79  ppc_cached_irq_mask = 0;
80  ((volatile immap_t *)IMAP_ADDR)->im_siu_conf.sc_siel = ((volatile immap_t *)IMAP_ADDR)->im_siu_conf.sc_siel;
81}
82
83/*
84 * Initialize CPM interrupt management
85 */
86void
87BSP_CPM_irq_init(void)
88{
89  /*
90   * Initialize the CPM interrupt controller.
91   */
92  ((volatile immap_t *)IMAP_ADDR)->im_cpic.cpic_cicr =
93#ifdef mpc860
94    (CICR_SCD_SCC4 | CICR_SCC_SCC3 | CICR_SCB_SCC2 | CICR_SCA_SCC1) |
95#else
96    (CICR_SCB_SCC2 | CICR_SCA_SCC1) |
97#endif   
98    ((BSP_CPM_INTERRUPT/2) << 13) | CICR_HP_MASK;
99  ((volatile immap_t *)IMAP_ADDR)->im_cpic.cpic_cimr = 0;
100
101  ((volatile immap_t *)IMAP_ADDR)->im_cpic.cpic_cicr |= CICR_IEN;
102}
103
104void BSP_rtems_irq_mng_init(unsigned cpuId)
105{
106  rtems_raw_except_connect_data vectorDesc;
107  int i;
108 
109  BSP_SIU_irq_init();
110  BSP_CPM_irq_init();
111  /*
112   * Initialize Rtems management interrupt table
113   */
114    /*
115     * re-init the rtemsIrq table
116     */
117    for (i = 0; i < BSP_IRQ_NUMBER; i++) {
118      rtemsIrq[i]      = defaultIrq;
119      rtemsIrq[i].name = i;
120    }
121    /*
122     * Init initial Interrupt management config
123     */
124    initial_config.irqNb        = BSP_IRQ_NUMBER;
125    initial_config.defaultEntry = defaultIrq;
126    initial_config.irqHdlTbl    = rtemsIrq;
127    initial_config.irqBase      = BSP_ASM_IRQ_VECTOR_BASE;
128    initial_config.irqPrioTbl   = irqPrioTable;
129
130    if (!BSP_rtems_irq_mngt_set(&initial_config)) {
131      /*
132       * put something here that will show the failure...
133       */
134      BSP_panic("Unable to initialize RTEMS interrupt Management!!! System locked\n");
135    }
136 
137  /*
138   * We must connect the raw irq handler for the two
139   * expected interrupt sources : decrementer and external interrupts.
140   */
141    vectorDesc.exceptIndex      =       ASM_DEC_VECTOR;
142    vectorDesc.hdl.vector       =       ASM_DEC_VECTOR;
143    vectorDesc.hdl.raw_hdl      =       decrementer_exception_vector_prolog_code;
144    vectorDesc.hdl.raw_hdl_size =       (unsigned) &decrementer_exception_vector_prolog_code_size;
145    vectorDesc.on               =       nop_func;
146    vectorDesc.off              =       nop_func;
147    vectorDesc.isOn             =       connected;
148    if (!mpc8xx_set_exception (&vectorDesc)) {
149      BSP_panic("Unable to initialize RTEMS decrementer raw exception\n");
150    }
151    vectorDesc.exceptIndex      =       ASM_EXT_VECTOR;
152    vectorDesc.hdl.vector       =       ASM_EXT_VECTOR;
153    vectorDesc.hdl.raw_hdl      =       external_exception_vector_prolog_code;
154    vectorDesc.hdl.raw_hdl_size =       (unsigned) &external_exception_vector_prolog_code_size;
155    if (!mpc8xx_set_exception (&vectorDesc)) {
156      BSP_panic("Unable to initialize RTEMS external raw exception\n");
157    }
158#ifdef TRACE_IRQ_INIT 
159    printk("RTEMS IRQ management is now operationnal\n");
160#endif
161}
162
Note: See TracBrowser for help on using the repository browser.