1 | /* |
---|
2 | * |
---|
3 | * This file contains the implementation of the function described in irq.h |
---|
4 | * |
---|
5 | * COPYRIGHT (c) 1989-2009. |
---|
6 | * On-Line Applications Research Corporation (OAR). |
---|
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.rtems.org/license/LICENSE. |
---|
11 | */ |
---|
12 | |
---|
13 | #include <rtems.h> |
---|
14 | #include <bsp.h> |
---|
15 | #include <bsp/irq.h> |
---|
16 | #include <bsp/irq_supp.h> |
---|
17 | #include <bsp/vectors.h> |
---|
18 | |
---|
19 | static rtems_irq_connect_data *rtems_hdl_tbl; |
---|
20 | static rtems_irq_connect_data dflt_entry; |
---|
21 | |
---|
22 | /* |
---|
23 | * High level IRQ handler called from shared_raw_irq_code_entry |
---|
24 | */ |
---|
25 | int C_dispatch_irq_handler( |
---|
26 | BSP_Exception_frame *frame, |
---|
27 | unsigned int excNum |
---|
28 | ) |
---|
29 | { |
---|
30 | register unsigned int irq; |
---|
31 | #if (HAS_PMC_PSC8) |
---|
32 | uint16_t check_irq; |
---|
33 | uint16_t status_word; |
---|
34 | #endif |
---|
35 | |
---|
36 | if (excNum == ASM_DEC_VECTOR) { |
---|
37 | bsp_irq_dispatch_list(rtems_hdl_tbl, BSP_DECREMENTER, dflt_entry.hdl); |
---|
38 | return 0; |
---|
39 | } |
---|
40 | |
---|
41 | irq = read_and_clear_irq(); |
---|
42 | |
---|
43 | #if (HAS_PMC_PSC8) |
---|
44 | if (irq == SCORE603E_PCI_IRQ_0) { |
---|
45 | status_word = read_and_clear_PMC_irq( irq ); |
---|
46 | for (check_irq=SCORE603E_IRQ16; check_irq<=SCORE603E_IRQ19; check_irq++) { |
---|
47 | if ( Is_PMC_IRQ( check_irq, status_word )) { |
---|
48 | bsp_irq_dispatch_list_base(rtems_hdl_tbl, check_irq, dflt_entry.hdl); |
---|
49 | } |
---|
50 | } |
---|
51 | } else |
---|
52 | #endif |
---|
53 | { |
---|
54 | bsp_irq_dispatch_list_base(rtems_hdl_tbl, irq, dflt_entry.hdl); |
---|
55 | } |
---|
56 | |
---|
57 | return 0; |
---|
58 | } |
---|
59 | |
---|
60 | void |
---|
61 | BSP_enable_irq_at_pic(const rtems_irq_number irq) |
---|
62 | { |
---|
63 | uint16_t vec_idx = irq - Score_IRQ_First; |
---|
64 | unmask_irq( vec_idx ); |
---|
65 | } |
---|
66 | |
---|
67 | int |
---|
68 | BSP_disable_irq_at_pic(const rtems_irq_number irq) |
---|
69 | { |
---|
70 | uint16_t vec_idx = irq - Score_IRQ_First; |
---|
71 | unmask_irq( vec_idx ); |
---|
72 | return 0; |
---|
73 | } |
---|
74 | |
---|
75 | int |
---|
76 | BSP_setup_the_pic(rtems_irq_global_settings *config) |
---|
77 | { |
---|
78 | dflt_entry = config->defaultEntry; |
---|
79 | rtems_hdl_tbl = config->irqHdlTbl; |
---|
80 | init_irq_data_register(); |
---|
81 | return 1; |
---|
82 | } |
---|