source: rtems/c/src/lib/libbsp/powerpc/mpc8260ads/irq/irq_init.c @ f05b2ac

4.104.114.84.95
Last change on this file since f05b2ac was f05b2ac, checked in by Ralf Corsepius <ralf.corsepius@…>, on 04/21/04 at 16:01:48

Remove duplicate white lines.

  • Property mode set to 100644
File size: 4.2 KB
RevLine 
[5edbffe]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
[478277a]10 *  http://www.rtems.com/license/LICENSE.
[5edbffe]11 *
12 *  $Id$
13 */
14#include <bsp/irq.h>
15#include <bsp.h>
[0bebe52]16#include <rtems/bspIo.h>
[5edbffe]17#include <libcpu/raw_exception.h>
18/*
19#include <bsp/8xx_immap.h>
20#include <bsp/mbx.h>
21#include <bsp/commproc.h>
22*/
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
29extern void BSP_panic(char *s);
30extern void _BSP_Fatal_error(unsigned int v);
31/*
32volatile unsigned int ppc_cached_irq_mask;
33*/
34
35/*
36 * default on/off function
37 */
38static void nop_func(){}
39/*
40 * default isOn function
41 */
42static int not_connected() {return 0;}
43/*
44 * default possible isOn function
45 */
46static int connected() {return 1;}
47
48static rtems_irq_connect_data           rtemsIrq[BSP_IRQ_NUMBER];
[d36d3a3]49static rtems_irq_global_settings        initial_config;
[5edbffe]50static rtems_irq_connect_data           defaultIrq = {
[d36d3a3]51  /* vectorIdex,        hdl                     , on            , off           , isOn */
52  0,                            nop_func        , nop_func      , nop_func      , not_connected
[5edbffe]53};
[d36d3a3]54
55/*
56        List the interrupts is their order of priority (highest first).
57        This does not have to be the same order as the siprr settings but
58        without knowing more about the application they are kept the same.
59*/
60
61static rtems_irq_prio irqPrioTable[BSP_CPM_IRQ_NUMBER]={
[5edbffe]62  /*
63   * actual priorities for interrupt :
64   */
65  /*
66   * CPM Interrupts
67   */
68  0,  45, 63, 44, 66, 68, 35, 39, 50, 62, 34,  0,  30, 40, 52, 58,
69  2,  3,  0,  5,  15, 16, 17, 18, 49, 51,  0,  0,  0,  0,  0,  0,
[d36d3a3]70  6,  7,  8,  0,  11, 12, 0,  0,  20, 21, 22,  23, 0,  0,  0,  0,
71  29, 31, 33, 37, 38, 41, 47, 48, 55, 56, 57,  60, 64, 65, 69, 70,
72
[5edbffe]73};
74
[6128a4a]75/*
[5edbffe]76 * Initialize CPM interrupt management
77 */
78void
79BSP_CPM_irq_init(void)
80{
81   m8260.simr_l = 0;
82   m8260.simr_h = 0;
83   m8260.sipnr_l = 0xffffffff;
84   m8260.sipnr_h = 0xffffffff;
85   m8260.sicr = 0;
86
87  /*
88   * Initialize the interrupt priorities.
89   */
90   m8260.siprr   = 0x05309770;  /* reset value */
91   m8260.scprr_h = 0x05309770;  /* reset value */
92   m8260.scprr_l = 0x05309770;  /* reset value */
93
94}
95
96void BSP_rtems_irq_mng_init(unsigned cpuId)
97{
98  rtems_raw_except_connect_data vectorDesc;
99  int i;
[6128a4a]100
[5edbffe]101  BSP_CPM_irq_init();
102  /*
103   * Initialize Rtems management interrupt table
104   */
105    /*
106     * re-init the rtemsIrq table
107     */
108    for (i = 0; i < BSP_IRQ_NUMBER; i++) {
109      rtemsIrq[i]      = defaultIrq;
110      rtemsIrq[i].name = i;
111    }
112    /*
113     * Init initial Interrupt management config
114     */
[d36d3a3]115    initial_config.irqNb                = BSP_IRQ_NUMBER;
[5edbffe]116    initial_config.defaultEntry = defaultIrq;
117    initial_config.irqHdlTbl    = rtemsIrq;
[d36d3a3]118    initial_config.irqBase              = BSP_ASM_IRQ_VECTOR_BASE;
[5edbffe]119    initial_config.irqPrioTbl   = irqPrioTable;
120
121    if (!BSP_rtems_irq_mngt_set(&initial_config)) {
122      /*
123       * put something here that will show the failure...
124       */
125      BSP_panic("Unable to initialize RTEMS interrupt Management!!! System locked\n");
126    }
[6128a4a]127
[5edbffe]128  /*
129   * We must connect the raw irq handler for the two
130   * expected interrupt sources : decrementer and external interrupts.
131   */
132    vectorDesc.exceptIndex      =       ASM_DEC_VECTOR;
133    vectorDesc.hdl.vector       =       ASM_DEC_VECTOR;
134    vectorDesc.hdl.raw_hdl      =       decrementer_exception_vector_prolog_code;
135    vectorDesc.hdl.raw_hdl_size =       (unsigned) &decrementer_exception_vector_prolog_code_size;
[d36d3a3]136    vectorDesc.on                       =       nop_func;
137    vectorDesc.off                      =       nop_func;
138    vectorDesc.isOn                     =       connected;
[5edbffe]139    if (!mpc8xx_set_exception (&vectorDesc)) {
140      BSP_panic("Unable to initialize RTEMS decrementer raw exception\n");
141    }
142    vectorDesc.exceptIndex      =       ASM_EXT_VECTOR;
143    vectorDesc.hdl.vector       =       ASM_EXT_VECTOR;
144    vectorDesc.hdl.raw_hdl      =       external_exception_vector_prolog_code;
145    vectorDesc.hdl.raw_hdl_size =       (unsigned) &external_exception_vector_prolog_code_size;
146    if (!mpc8xx_set_exception (&vectorDesc)) {
147      BSP_panic("Unable to initialize RTEMS external raw exception\n");
148    }
[6128a4a]149#ifdef TRACE_IRQ_INIT
[5edbffe]150    printk("RTEMS IRQ management is now operationnal\n");
151#endif
152}
Note: See TracBrowser for help on using the repository browser.