source: rtems/c/src/lib/libbsp/i386/shared/irq/irq_init.c @ 9b4422a2

4.115
Last change on this file since 9b4422a2 was 9b4422a2, checked in by Joel Sherrill <joel.sherrill@…>, on 05/03/12 at 15:09:24

Remove All CVS Id Strings Possible Using a Script

Script does what is expected and tries to do it as
smartly as possible.

+ remove occurrences of two blank comment lines

next to each other after Id string line removed.

+ remove entire comment blocks which only exited to

contain CVS Ids

+ If the processing left a blank line at the top of

a file, it was removed.

  • Property mode set to 100644
File size: 4.9 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) 2009 embedded brains GmbH
7 *  CopyRight (C) 1998 valette@crf.canon.fr
8 *
9 *  COPYRIGHT (c) 2011.
10 *  On-Line Applications Research Corporation (OAR).
11 *
12 *  The license and distribution terms for this file may be
13 *  found in the file LICENSE in this distribution or at
14 *  http://www.rtems.com/license/LICENSE.
15 */
16
17#include <rtems/bspIo.h>
18
19#include <libcpu/cpu.h>
20
21#include <bsp.h>
22#include <bsp/irq.h>
23#include <bsp/irq-generic.h>
24
25/*
26 * rtems prologue generated in irq_asm.S
27 */
28extern void rtems_irq_prologue_0(void);
29extern void rtems_irq_prologue_1(void);
30extern void rtems_irq_prologue_2(void);
31extern void rtems_irq_prologue_3(void);
32extern void rtems_irq_prologue_4(void);
33extern void rtems_irq_prologue_5(void);
34extern void rtems_irq_prologue_6(void);
35extern void rtems_irq_prologue_7(void);
36extern void rtems_irq_prologue_8(void);
37extern void rtems_irq_prologue_9(void);
38extern void rtems_irq_prologue_10(void);
39extern void rtems_irq_prologue_11(void);
40extern void rtems_irq_prologue_12(void);
41extern void rtems_irq_prologue_13(void);
42extern void rtems_irq_prologue_14(void);
43extern void rtems_irq_prologue_15(void);
44extern void rtems_irq_prologue_16(void);
45/*
46 * default vectors
47 */
48extern void default_raw_idt_handler(void);
49
50/*
51 * default raw on/off function
52 */
53static void raw_nop_func(const struct __rtems_raw_irq_connect_data__ *unused)
54{
55}
56
57/*
58 * default raw isOn function
59 */
60static int raw_not_connected(
61  const struct __rtems_raw_irq_connect_data__ *unused
62)
63{
64  return 0;
65}
66
67static rtems_raw_irq_connect_data       idtHdl[IDT_SIZE];
68
69static rtems_raw_irq_hdl rtemsIrq[BSP_IRQ_LINES_NUMBER] = {
70  rtems_irq_prologue_0,
71  rtems_irq_prologue_1,
72  rtems_irq_prologue_2,
73  rtems_irq_prologue_3,
74  rtems_irq_prologue_4,
75  rtems_irq_prologue_5,
76  rtems_irq_prologue_6,
77  rtems_irq_prologue_7,
78  rtems_irq_prologue_8,
79  rtems_irq_prologue_9,
80  rtems_irq_prologue_10,
81  rtems_irq_prologue_11,
82  rtems_irq_prologue_12,
83  rtems_irq_prologue_13,
84  rtems_irq_prologue_14,
85  rtems_irq_prologue_15,
86  rtems_irq_prologue_16,
87};
88
89static rtems_raw_irq_connect_data       defaultRawIrq = {
90  0,                       /* vectorIdex */
91  default_raw_idt_handler, /* hdl */
92  raw_nop_func,            /* on */
93  raw_nop_func,            /* off */
94  raw_not_connected        /* isOn */
95};
96
97static interrupt_gate_descriptor        idtEntry;
98
99static rtems_raw_irq_global_settings raw_initial_config;
100
101void raw_idt_notify(void)
102{
103  printk("raw_idt_notify has been called \n");
104}
105
106void  rtems_irq_mngt_init(void)
107{
108    int                         i;
109    interrupt_gate_descriptor*  idt_entry_tbl;
110    unsigned int                limit;
111    rtems_interrupt_level       level;
112
113    i386_get_info_from_IDTR(&idt_entry_tbl, &limit);
114
115    /* Convert into number of entries */
116    limit = (limit + 1)/sizeof(interrupt_gate_descriptor);
117
118    if(limit != IDT_SIZE) {
119       printk("IDT table size mismatch !!! System locked\n");
120       while(1);
121    }
122
123    rtems_interrupt_disable(level);
124
125    /*
126     * Init the complete IDT vector table with defaultRawIrq value
127     */
128    for (i = 0; i < IDT_SIZE ; i++) {
129      idtHdl[i]          = defaultRawIrq;
130      idtHdl[i].idtIndex = i;
131    }
132
133    raw_initial_config.idtSize = IDT_SIZE;
134    raw_initial_config.defaultRawEntry = defaultRawIrq;
135    raw_initial_config.rawIrqHdlTbl = idtHdl;
136
137    if (!i386_init_idt (&raw_initial_config)) {
138      /*
139       * put something here that will show the failure...
140       */
141      printk("Unable to initialize IDT!!! System locked\n");
142      while (1);
143    }
144    /*
145     * Patch the entry that will be used by RTEMS for interrupt management
146     * with RTEMS prologue.
147     */
148    for (i = 0; i < BSP_IRQ_LINES_NUMBER; i++) {
149      create_interrupt_gate_descriptor(&idtEntry, rtemsIrq[i]);
150      idt_entry_tbl[i + BSP_ASM_IRQ_VECTOR_BASE] = idtEntry;
151    }
152    /*
153     * At this point we have completed the initialization of IDT
154     * with raw handlers.  We must now initialize the higher level
155     * interrupt management.
156     */
157
158    /*
159     * Init initial Interrupt management config
160     */
161    if (bsp_interrupt_initialize() != RTEMS_SUCCESSFUL) {
162      /*
163       * put something here that will show the failure...
164       */
165      printk("Unable to initialize RTEMS interrupt Management!!! System locked\n");
166      while (1);
167    }
168
169    /*
170     * #define DEBUG
171     */
172#ifdef DEBUG
173    {
174      /*
175       * following adresses should be the same
176       */
177      unsigned tmp;
178
179      printk("idt_entry_tbl =  %x Interrupt_descriptor_table addr = %x\n",
180             idt_entry_tbl, &Interrupt_descriptor_table);
181      tmp = (unsigned) get_hdl_from_vector (BSP_ASM_IRQ_VECTOR_BASE + BSP_PERIODIC_TIMER);
182      printk("clock isr address from idt = %x should be %x\n",
183             tmp, (unsigned) rtems_irq_prologue_0);
184    }
185    printk("i8259s_cache = %x\n", * (unsigned short*) &i8259s_cache);
186    BSP_wait_polled_input();
187#endif
188}
Note: See TracBrowser for help on using the repository browser.