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

4.104.114.84.95
Last change on this file since 0bebe52 was 0bebe52, checked in by Joel Sherrill <joel.sherrill@…>, on 01/04/02 at 17:40:52

2002-01-03 Ralf Corsepius <corsepiu@…>

  • clock/p_clock.c: Include rtems/bspIo.h instead of bspIo.h.
  • console/console.c: Include rtems/bspIo.h instead of bspIo.h.
  • irq/irq_init.c: Include rtems/bspIo.h instead of bspIo.h.
  • Property mode set to 100644
File size: 4.1 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 <rtems/bspIo.h>
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];
49static rtems_irq_global_settings        initial_config;
50static rtems_irq_connect_data           defaultIrq = {
51  /* vectorIdex,         hdl            , on            , off           , isOn */
52  0,                     nop_func       , nop_func      , nop_func      , not_connected
53};
54static rtems_irq_prio irqPrioTable[BSP_IRQ_NUMBER]={
55  /*
56   * actual priorities for interrupt :
57   */
58  /*
59   * CPM Interrupts
60   */
61  0,  45, 63, 44, 66, 68, 35, 39, 50, 62, 34,  0,  30, 40, 52, 58,
62  2,  3,  0,  5,  15, 16, 17, 18, 49, 51,  0,  0,  0,  0,  0,  0,
63  6,  7,  8,  0,  11, 12, 0,  0,  20, 21, 22, 23,  0,  0,  0,  0,
64  29, 31, 33, 37, 38, 41, 47, 48, 55, 56, 57, 60, 64, 65, 69, 70,
65  /*
66   * Processor exceptions handled as interrupts
67   */
68  0
69};
70
71
72/*
73 * Initialize CPM interrupt management
74 */
75void
76BSP_CPM_irq_init(void)
77{
78   m8260.simr_l = 0;
79   m8260.simr_h = 0;
80   m8260.sipnr_l = 0xffffffff;
81   m8260.sipnr_h = 0xffffffff;
82   m8260.sicr = 0;
83
84  /*
85   * Initialize the interrupt priorities.
86   */
87   m8260.siprr   = 0x05309770;  /* reset value */
88   m8260.scprr_h = 0x05309770;  /* reset value */
89   m8260.scprr_l = 0x05309770;  /* reset value */
90
91}
92
93void BSP_rtems_irq_mng_init(unsigned cpuId)
94{
95  rtems_raw_except_connect_data vectorDesc;
96  int i;
97 
98  BSP_CPM_irq_init();
99  /*
100   * Initialize Rtems management interrupt table
101   */
102    /*
103     * re-init the rtemsIrq table
104     */
105    for (i = 0; i < BSP_IRQ_NUMBER; i++) {
106      rtemsIrq[i]      = defaultIrq;
107      rtemsIrq[i].name = i;
108    }
109    /*
110     * Init initial Interrupt management config
111     */
112    initial_config.irqNb        = BSP_IRQ_NUMBER;
113    initial_config.defaultEntry = defaultIrq;
114    initial_config.irqHdlTbl    = rtemsIrq;
115    initial_config.irqBase      = BSP_ASM_IRQ_VECTOR_BASE;
116    initial_config.irqPrioTbl   = irqPrioTable;
117
118    if (!BSP_rtems_irq_mngt_set(&initial_config)) {
119      /*
120       * put something here that will show the failure...
121       */
122      BSP_panic("Unable to initialize RTEMS interrupt Management!!! System locked\n");
123    }
124 
125  /*
126   * We must connect the raw irq handler for the two
127   * expected interrupt sources : decrementer and external interrupts.
128   */
129    vectorDesc.exceptIndex      =       ASM_DEC_VECTOR;
130    vectorDesc.hdl.vector       =       ASM_DEC_VECTOR;
131    vectorDesc.hdl.raw_hdl      =       decrementer_exception_vector_prolog_code;
132    vectorDesc.hdl.raw_hdl_size =       (unsigned) &decrementer_exception_vector_prolog_code_size;
133    vectorDesc.on               =       nop_func;
134    vectorDesc.off              =       nop_func;
135    vectorDesc.isOn             =       connected;
136    if (!mpc8xx_set_exception (&vectorDesc)) {
137      BSP_panic("Unable to initialize RTEMS decrementer raw exception\n");
138    }
139    vectorDesc.exceptIndex      =       ASM_EXT_VECTOR;
140    vectorDesc.hdl.vector       =       ASM_EXT_VECTOR;
141    vectorDesc.hdl.raw_hdl      =       external_exception_vector_prolog_code;
142    vectorDesc.hdl.raw_hdl_size =       (unsigned) &external_exception_vector_prolog_code_size;
143    if (!mpc8xx_set_exception (&vectorDesc)) {
144      BSP_panic("Unable to initialize RTEMS external raw exception\n");
145    }
146#ifdef TRACE_IRQ_INIT 
147    printk("RTEMS IRQ management is now operationnal\n");
148#endif
149}
150
Note: See TracBrowser for help on using the repository browser.