OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [packages/] [hal/] [powerpc/] [mpc8xx/] [v2_0/] [src/] [var_intr.c] - Blame information for rev 27

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 27 unneback
//==========================================================================
2
//
3
//      var_intr.c
4
//
5
//      PowerPC variant interrupt handlers
6
//
7
//==========================================================================
8
//####ECOSGPLCOPYRIGHTBEGIN####
9
// -------------------------------------------
10
// This file is part of eCos, the Embedded Configurable Operating System.
11
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
12
//
13
// eCos is free software; you can redistribute it and/or modify it under
14
// the terms of the GNU General Public License as published by the Free
15
// Software Foundation; either version 2 or (at your option) any later version.
16
//
17
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
18
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
19
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
20
// for more details.
21
//
22
// You should have received a copy of the GNU General Public License along
23
// with eCos; if not, write to the Free Software Foundation, Inc.,
24
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
25
//
26
// As a special exception, if other files instantiate templates or use macros
27
// or inline functions from this file, or you compile this file and link it
28
// with other works to produce a work based on this file, this file does not
29
// by itself cause the resulting work to be covered by the GNU General Public
30
// License. However the source code for this file must still be made available
31
// in accordance with section (3) of the GNU General Public License.
32
//
33
// This exception does not invalidate any other reasons why a work based on
34
// this file might be covered by the GNU General Public License.
35
//
36
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
37
// at http://sources.redhat.com/ecos/ecos-license/
38
// -------------------------------------------
39
//####ECOSGPLCOPYRIGHTEND####
40
//==========================================================================
41
//#####DESCRIPTIONBEGIN####
42
//
43
// Author(s):    jskov
44
// Contributors: jskov
45
// Date:         2000-02-11
46
// Purpose:      PowerPC variant interrupt handlers
47
// Description:  This file contains code to handle interrupt related issues
48
//               on the PowerPC variant.
49
//
50
//####DESCRIPTIONEND####
51
//
52
//==========================================================================
53
 
54
#include <pkgconf/hal.h>
55
#include <cyg/hal/ppc_regs.h>
56
#include <cyg/hal/hal_arbiter.h>
57
 
58
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
59
#ifdef CYGPKG_HAL_POWERPC_MPC860
60
 
61
// Since the interrupt sources do not have fixed vectors on the 860
62
// SIU, some arbitration is required.
63
 
64
// More than one interrupt source can be programmed to use the same
65
// vector, so all sources on the same vector have to be queried to
66
// find the one raising the interrupt. This functionality has not been
67
// implemented, but the arbiter functions for each of the SIU
68
// interrupt sources can be called in sequence without change.
69
 
70
 
71
 
72
// Timebase interrupt can be caused by match on either reference A
73
// or B.  
74
// Note: If only one interrupt source is assigned per vector, and only
75
// reference interrupt A or B is used, this ISR is not
76
// necessary. Attach the timerbase reference A or B ISR directly to
77
// the LVLx vector instead.
78
externC cyg_uint32
79
hal_arbitration_isr_tb (CYG_ADDRWORD vector, CYG_ADDRWORD data)
80
{
81
    cyg_uint32 isr_ret;
82
    cyg_uint16 tbscr;
83
 
84
    HAL_READ_UINT16 (CYGARC_REG_IMM_TBSCR, tbscr);
85
    if (tbscr & CYGARC_REG_IMM_TBSCR_REFA) {
86
        isr_ret = hal_call_isr (CYGNUM_HAL_INTERRUPT_SIU_TB_A);
87
#ifdef CYGIMP_HAL_COMMON_INTERRUPTS_CHAIN
88
        if (isr_ret & CYG_ISR_HANDLED)
89
#endif
90
            return isr_ret;
91
    }
92
 
93
    if (tbscr & CYGARC_REG_IMM_TBSCR_REFB) {
94
        isr_ret = hal_call_isr (CYGNUM_HAL_INTERRUPT_SIU_TB_B);
95
#ifdef CYGIMP_HAL_COMMON_INTERRUPTS_CHAIN
96
        if (isr_ret & CYG_ISR_HANDLED)
97
#endif
98
            return isr_ret;
99
    }
100
 
101
    return 0;
102
}
103
 
104
// Periodic interrupt.
105
// Note: If only one interrupt source is assigned per vector, this ISR
106
// is not necessary. Attach the periodic interrupt ISR directly to the
107
// LVLx vector instead.
108
externC cyg_uint32
109
hal_arbitration_isr_pit (CYG_ADDRWORD vector, CYG_ADDRWORD data)
110
{
111
    cyg_uint32 isr_ret;
112
    cyg_uint16 piscr;
113
 
114
    HAL_READ_UINT16 (CYGARC_REG_IMM_PISCR, piscr);
115
    if (piscr & CYGARC_REG_IMM_PISCR_PS) {
116
        isr_ret = hal_call_isr (CYGNUM_HAL_INTERRUPT_SIU_PIT);
117
#ifdef CYGIMP_HAL_COMMON_INTERRUPTS_CHAIN
118
        if (isr_ret & CYG_ISR_HANDLED)
119
#endif
120
            return isr_ret;
121
    }
122
 
123
    return 0;
124
}
125
 
126
// Real time clock interrupts can be caused by the alarm or
127
// once-per-second.
128
// Note: If only one interrupt source is assigned per vector, and only
129
// the alarm or once-per-second interrupt is used, this ISR is not
130
// necessary. Attach the alarm or once-per-second ISR directly to the
131
// LVLx vector instead.
132
externC cyg_uint32
133
hal_arbitration_isr_rtc (CYG_ADDRWORD vector, CYG_ADDRWORD data)
134
{
135
    cyg_uint32 isr_ret;
136
    cyg_uint16 rtcsc;
137
 
138
    HAL_READ_UINT16 (CYGARC_REG_IMM_RTCSC, rtcsc);
139
    if (rtcsc & CYGARC_REG_IMM_RTCSC_SEC) {
140
        isr_ret = hal_call_isr (CYGNUM_HAL_INTERRUPT_SIU_RTC_SEC);
141
#ifdef CYGIMP_HAL_COMMON_INTERRUPTS_CHAIN
142
        if (isr_ret & CYG_ISR_HANDLED)
143
#endif
144
            return isr_ret;
145
    }
146
 
147
    if (rtcsc & CYGARC_REG_IMM_RTCSC_ALR) {
148
        isr_ret = hal_call_isr (CYGNUM_HAL_INTERRUPT_SIU_RTC_ALR);
149
#ifdef CYGIMP_HAL_COMMON_INTERRUPTS_CHAIN
150
        if (isr_ret & CYG_ISR_HANDLED)
151
#endif
152
            return isr_ret;
153
    }
154
 
155
    return 0;
156
}
157
 
158
// Communication Processor Module interrupt can be caused by any of
159
// the CPM sources.
160
externC cyg_uint32
161
hal_arbitration_isr_cpm (CYG_ADDRWORD vector, CYG_ADDRWORD data)
162
{
163
    cyg_uint32 isr_ret;
164
    cyg_uint16 civr;
165
 
166
    HAL_WRITE_UINT16 (CYGARC_REG_IMM_CIVR, CYGARC_REG_IMM_CIVR_IACK);
167
    HAL_READ_UINT16 (CYGARC_REG_IMM_CIVR, civr);
168
    civr >>= CYGARC_REG_IMM_CIVR_VECTOR_SHIFT;
169
    if (civr) {
170
        isr_ret = hal_call_isr (CYGNUM_HAL_INTERRUPT_CPM_LAST - civr);
171
#ifdef CYGIMP_HAL_COMMON_INTERRUPTS_CHAIN
172
        if (isr_ret & CYG_ISR_HANDLED)
173
#endif
174
            return isr_ret;
175
    }
176
 
177
    return 0;
178
}
179
#endif // ifdef CYGPKG_HAL_POWERPC_MPC860
180
 
181
externC void
182
hal_variant_IRQ_init(void)
183
{
184
#ifdef CYGSEM_HAL_POWERPC_MPC860_CPM_ENABLE
185
    // Attach first-level CPM arbiter to the configured SIU level and
186
    // enable CPM interrupts.
187
#define ID_CPM 0xDEAD
188
#define CYGPRI_SIU_LVL (CYGNUM_HAL_INTERRUPT_SIU_LVL0 \
189
                        +CYGHWR_HAL_POWERPC_MPC860_CPM_LVL*2)
190
 
191
    HAL_INTERRUPT_ATTACH (CYGPRI_SIU_LVL, &hal_arbitration_isr_cpm, ID_CPM, 0);
192
    HAL_INTERRUPT_UNMASK (CYGPRI_SIU_LVL);
193
    HAL_INTERRUPT_SET_LEVEL (CYGNUM_HAL_INTERRUPT_SIU_CPM,
194
                             CYGHWR_HAL_POWERPC_MPC860_CPM_LVL);
195
    HAL_INTERRUPT_UNMASK (CYGNUM_HAL_INTERRUPT_SIU_CPM);
196
#endif
197
}
198
 
199
// -------------------------------------------------------------------------
200
// EOF var_intr.c

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.