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

4.104.114.84.95
Last change on this file since ccd81b60 was d36d3a3, checked in by Joel Sherrill <joel.sherrill@…>, on 11/01/02 at 14:21:47

2002-11-01 Andy Dachs <a.dachs@…>

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