1 |
786 |
skrzyp |
//==========================================================================
|
2 |
|
|
//
|
3 |
|
|
// mb93093_misc.c
|
4 |
|
|
//
|
5 |
|
|
// HAL misc board support code for Fujitsu MB93093 (FR-V 403)
|
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, 2004 Free Software Foundation, 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
|
16 |
|
|
// version.
|
17 |
|
|
//
|
18 |
|
|
// eCos is distributed in the hope that it will be useful, but WITHOUT
|
19 |
|
|
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
20 |
|
|
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
21 |
|
|
// for more details.
|
22 |
|
|
//
|
23 |
|
|
// You should have received a copy of the GNU General Public License
|
24 |
|
|
// along with eCos; if not, write to the Free Software Foundation, Inc.,
|
25 |
|
|
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
26 |
|
|
//
|
27 |
|
|
// As a special exception, if other files instantiate templates or use
|
28 |
|
|
// macros or inline functions from this file, or you compile this file
|
29 |
|
|
// and link it with other works to produce a work based on this file,
|
30 |
|
|
// this file does not by itself cause the resulting work to be covered by
|
31 |
|
|
// the GNU General Public License. However the source code for this file
|
32 |
|
|
// must still be made available in accordance with section (3) of the GNU
|
33 |
|
|
// General Public License v2.
|
34 |
|
|
//
|
35 |
|
|
// This exception does not invalidate any other reasons why a work based
|
36 |
|
|
// on this file might be covered by the GNU General Public License.
|
37 |
|
|
// -------------------------------------------
|
38 |
|
|
// ####ECOSGPLCOPYRIGHTEND####
|
39 |
|
|
//==========================================================================
|
40 |
|
|
//#####DESCRIPTIONBEGIN####
|
41 |
|
|
//
|
42 |
|
|
// Author(s): gthomas
|
43 |
|
|
// Contributors: gthomas
|
44 |
|
|
// Date: 2001-09-07
|
45 |
|
|
// Purpose: HAL board support
|
46 |
|
|
// Description: Implementations of HAL board interfaces
|
47 |
|
|
//
|
48 |
|
|
//####DESCRIPTIONEND####
|
49 |
|
|
//
|
50 |
|
|
//========================================================================*/
|
51 |
|
|
|
52 |
|
|
#include <pkgconf/hal.h>
|
53 |
|
|
#include <pkgconf/system.h>
|
54 |
|
|
#include CYGBLD_HAL_PLATFORM_H
|
55 |
|
|
|
56 |
|
|
#include <cyg/infra/cyg_type.h> // base types
|
57 |
|
|
#include <cyg/infra/cyg_trac.h> // tracing macros
|
58 |
|
|
#include <cyg/infra/cyg_ass.h> // assertion macros
|
59 |
|
|
#include <cyg/infra/diag.h> // diag_printf() and friends
|
60 |
|
|
|
61 |
|
|
#include <cyg/hal/hal_io.h> // IO macros
|
62 |
|
|
#include <cyg/hal/hal_arch.h> // Register state info
|
63 |
|
|
#include <cyg/hal/hal_diag.h>
|
64 |
|
|
#include <cyg/hal/hal_intr.h> // Interrupt names
|
65 |
|
|
#include <cyg/hal/hal_cache.h>
|
66 |
|
|
#include <cyg/hal/mb93093.h> // Hardware definitions
|
67 |
|
|
#include <cyg/hal/hal_if.h> // calling interface API
|
68 |
|
|
|
69 |
|
|
static cyg_uint32 _period;
|
70 |
|
|
|
71 |
|
|
void hal_clock_initialize(cyg_uint32 period)
|
72 |
|
|
{
|
73 |
|
|
_period = period;
|
74 |
|
|
// Set timer #1 to run in terminal count mode for period
|
75 |
|
|
HAL_WRITE_UINT8(_FRVGEN_TCTR, _FRVGEN_TCTR_SEL1|_FRVGEN_TCTR_RLOHI|_FRVGEN_TCTR_MODE0);
|
76 |
|
|
HAL_WRITE_UINT8(_FRVGEN_TCSR1, period & 0xFF);
|
77 |
|
|
HAL_WRITE_UINT8(_FRVGEN_TCSR1, period >> 8);
|
78 |
|
|
// Configure interrupt
|
79 |
|
|
HAL_INTERRUPT_CONFIGURE(CYGNUM_HAL_INTERRUPT_TIMER1, 1, 1); // Interrupt when TOUT1 is high
|
80 |
|
|
}
|
81 |
|
|
|
82 |
|
|
void hal_clock_reset(cyg_uint32 vector, cyg_uint32 period)
|
83 |
|
|
{
|
84 |
|
|
cyg_int16 offset;
|
85 |
|
|
cyg_uint8 _val;
|
86 |
|
|
|
87 |
|
|
// Latch & read counter from timer #1
|
88 |
|
|
HAL_WRITE_UINT8(_FRVGEN_TCTR, _FRVGEN_TCTR_LATCH|_FRVGEN_TCTR_RLOHI|_FRVGEN_TCTR_SEL1);
|
89 |
|
|
HAL_READ_UINT8(_FRVGEN_TCSR1, _val);
|
90 |
|
|
offset = _val;
|
91 |
|
|
HAL_READ_UINT8(_FRVGEN_TCSR1, _val);
|
92 |
|
|
offset |= _val << 8; // This will be the number of clocks beyond 0
|
93 |
|
|
period += offset;
|
94 |
|
|
// Reinitialize with adjusted count
|
95 |
|
|
// Set timer #1 to run in terminal count mode for period
|
96 |
|
|
HAL_WRITE_UINT8(_FRVGEN_TCTR, _FRVGEN_TCTR_SEL1|_FRVGEN_TCTR_RLOHI|_FRVGEN_TCTR_MODE0);
|
97 |
|
|
HAL_WRITE_UINT8(_FRVGEN_TCSR1, period & 0xFF);
|
98 |
|
|
HAL_WRITE_UINT8(_FRVGEN_TCSR1, period >> 8);
|
99 |
|
|
}
|
100 |
|
|
|
101 |
|
|
// Read the current value of the clock, returning the number of hardware "ticks"
|
102 |
|
|
// that have occurred (i.e. how far away the current value is from the start)
|
103 |
|
|
|
104 |
|
|
void hal_clock_read(cyg_uint32 *pvalue)
|
105 |
|
|
{
|
106 |
|
|
cyg_int16 offset;
|
107 |
|
|
cyg_uint8 _val;
|
108 |
|
|
|
109 |
|
|
// Latch & read counter from timer #1
|
110 |
|
|
HAL_WRITE_UINT8(_FRVGEN_TCTR, _FRVGEN_TCTR_LATCH|_FRVGEN_TCTR_RLOHI|_FRVGEN_TCTR_SEL1);
|
111 |
|
|
HAL_READ_UINT8(_FRVGEN_TCSR1, _val);
|
112 |
|
|
offset = _val;
|
113 |
|
|
HAL_READ_UINT8(_FRVGEN_TCSR1, _val);
|
114 |
|
|
offset |= _val << 8;
|
115 |
|
|
|
116 |
|
|
// 'offset' is the current timer value
|
117 |
|
|
*pvalue = _period - offset;
|
118 |
|
|
}
|
119 |
|
|
|
120 |
|
|
// Delay for some number of useconds.
|
121 |
|
|
// Assumptions:
|
122 |
|
|
// Use timer #2
|
123 |
|
|
// Min granularity is 10us
|
124 |
|
|
#define _MIN_DELAY 10
|
125 |
|
|
|
126 |
|
|
void hal_delay_us(int us)
|
127 |
|
|
{
|
128 |
|
|
cyg_uint8 stat;
|
129 |
|
|
int timeout;
|
130 |
|
|
|
131 |
|
|
while (us >= _MIN_DELAY) {
|
132 |
|
|
us -= _MIN_DELAY;
|
133 |
|
|
// Set timer #2 to run in terminal count mode for _MIN_DELAY us
|
134 |
|
|
HAL_WRITE_UINT8(_FRVGEN_TCTR, _FRVGEN_TCTR_SEL2|_FRVGEN_TCTR_RLOHI|_FRVGEN_TCTR_MODE0);
|
135 |
|
|
HAL_WRITE_UINT8(_FRVGEN_TCSR2, _MIN_DELAY & 0xFF);
|
136 |
|
|
HAL_WRITE_UINT8(_FRVGEN_TCSR2, _MIN_DELAY >> 8);
|
137 |
|
|
timeout = 100000;
|
138 |
|
|
// Wait for TOUT to indicate terminal count reached
|
139 |
|
|
do {
|
140 |
|
|
HAL_WRITE_UINT8(_FRVGEN_TCTR, _FRVGEN_TCTR_RB|_FRVGEN_TCTR_RB_NCOUNT|_FRVGEN_TCTR_RB_CTR2);
|
141 |
|
|
HAL_READ_UINT8(_FRVGEN_TCSR2, stat);
|
142 |
|
|
if (--timeout == 0) break;
|
143 |
|
|
} while ((stat & _FRVGEN_TCxSR_TOUT) == 0);
|
144 |
|
|
}
|
145 |
|
|
}
|
146 |
|
|
|
147 |
|
|
//
|
148 |
|
|
// Early stage hardware initialization
|
149 |
|
|
// Some initialization has already been done before we get here. For now
|
150 |
|
|
// just set up the interrupt environment and the LEDs
|
151 |
|
|
|
152 |
|
|
|
153 |
|
|
long _system_clock; // Calculated clock frequency
|
154 |
|
|
|
155 |
|
|
void hal_hardware_init(void)
|
156 |
|
|
{
|
157 |
|
|
cyg_uint32 clk, clkc, psr;
|
158 |
|
|
char *model;
|
159 |
|
|
|
160 |
|
|
// Set up interrupt controller
|
161 |
|
|
HAL_WRITE_UINT16(_FRVGEN_IRC_MASK, 0xFFFE); // All masked
|
162 |
|
|
HAL_WRITE_UINT16(_FRVGEN_IRC_RC, 0xFFFE); // All cleared
|
163 |
|
|
HAL_WRITE_UINT16(_FRVGEN_IRC_IRL, 0x10); // Clear IRL (interrupt request latch)
|
164 |
|
|
|
165 |
|
|
#if 0
|
166 |
|
|
// Onboard FPGA interrupts
|
167 |
|
|
HAL_WRITE_UINT16(_FRVGEN_FPGA_CONTROL, _FRVGEN_FPGA_CONTROL_IRQ); // Enable IRQ registers
|
168 |
|
|
HAL_WRITE_UINT16(_FRVGEN_FPGA_IRQ_MASK, // Set up for LAN, PCI INTx
|
169 |
|
|
0x7FFE &
|
170 |
|
|
~(_FRVGEN_FPGA_IRQ_LAN |
|
171 |
|
|
_FRVGEN_FPGA_IRQ_INTA |
|
172 |
|
|
_FRVGEN_FPGA_IRQ_INTB |
|
173 |
|
|
_FRVGEN_FPGA_IRQ_INTC |
|
174 |
|
|
_FRVGEN_FPGA_IRQ_INTD)
|
175 |
|
|
);
|
176 |
|
|
|
177 |
|
|
HAL_WRITE_UINT16(_FRVGEN_FPGA_IRQ_LEVELS, // Set up for LAN, PCI INTx
|
178 |
|
|
0x7FFE &
|
179 |
|
|
~(_FRVGEN_FPGA_IRQ_LAN |
|
180 |
|
|
_FRVGEN_FPGA_IRQ_INTA |
|
181 |
|
|
_FRVGEN_FPGA_IRQ_INTB |
|
182 |
|
|
_FRVGEN_FPGA_IRQ_INTC |
|
183 |
|
|
_FRVGEN_FPGA_IRQ_INTD)
|
184 |
|
|
);
|
185 |
|
|
|
186 |
|
|
#endif
|
187 |
|
|
HAL_INTERRUPT_CONFIGURE(CYGNUM_HAL_INTERRUPT_LAN, 1, 1); // Level, High
|
188 |
|
|
|
189 |
|
|
// _system_clock = 65625000;
|
190 |
|
|
_system_clock = 66000000;
|
191 |
|
|
|
192 |
|
|
// Set scalers to achieve 1us resolution in timer
|
193 |
|
|
HAL_WRITE_UINT8(_FRVGEN_TPRV, _system_clock / (1000*1000));
|
194 |
|
|
HAL_WRITE_UINT8(_FRVGEN_TCKSL0, 0x80);
|
195 |
|
|
HAL_WRITE_UINT8(_FRVGEN_TCKSL1, 0x80);
|
196 |
|
|
HAL_WRITE_UINT8(_FRVGEN_TCKSL2, 0x80);
|
197 |
|
|
|
198 |
|
|
// Make sure UART clock prescaler is at power-on reset setting.
|
199 |
|
|
HAL_WRITE_UINT32(_FRVGEN_UCPSR, 0);
|
200 |
|
|
HAL_WRITE_UINT32(_FRVGEN_UCPVR, 0);
|
201 |
|
|
|
202 |
|
|
hal_if_init();
|
203 |
|
|
|
204 |
|
|
// Initialize real-time clock (for delays, etc, even if kernel doesn't use it)
|
205 |
|
|
hal_clock_initialize(CYGNUM_HAL_RTC_PERIOD);
|
206 |
|
|
}
|
207 |
|
|
|
208 |
|
|
//
|
209 |
|
|
// Interrupt control
|
210 |
|
|
//
|
211 |
|
|
|
212 |
|
|
void hal_interrupt_mask(int vector)
|
213 |
|
|
{
|
214 |
|
|
cyg_uint16 _mask;
|
215 |
|
|
|
216 |
|
|
switch (vector) {
|
217 |
|
|
#if 0
|
218 |
|
|
case CYGNUM_HAL_INTERRUPT_LAN:
|
219 |
|
|
HAL_READ_UINT16(_FRVGEN_FPGA_IRQ_MASK, _mask);
|
220 |
|
|
_mask |= _FRVGEN_FPGA_IRQ_LAN;
|
221 |
|
|
HAL_WRITE_UINT16(_FRVGEN_FPGA_IRQ_MASK, _mask);
|
222 |
|
|
break;
|
223 |
|
|
#endif
|
224 |
|
|
}
|
225 |
|
|
HAL_READ_UINT16(_FRVGEN_IRC_MASK, _mask);
|
226 |
|
|
_mask |= (1<<(vector-CYGNUM_HAL_VECTOR_EXTERNAL_INTERRUPT_LEVEL_1+1));
|
227 |
|
|
HAL_WRITE_UINT16(_FRVGEN_IRC_MASK, _mask);
|
228 |
|
|
}
|
229 |
|
|
|
230 |
|
|
void hal_interrupt_unmask(int vector)
|
231 |
|
|
{
|
232 |
|
|
cyg_uint16 _mask;
|
233 |
|
|
|
234 |
|
|
switch (vector) {
|
235 |
|
|
case CYGNUM_HAL_INTERRUPT_LAN:
|
236 |
|
|
#if 0
|
237 |
|
|
HAL_READ_UINT16(_FRVGEN_FPGA_IRQ_MASK, _mask);
|
238 |
|
|
_mask &= ~_FRVGEN_FPGA_IRQ_LAN;
|
239 |
|
|
HAL_WRITE_UINT16(_FRVGEN_FPGA_IRQ_MASK, _mask);
|
240 |
|
|
break;
|
241 |
|
|
#endif
|
242 |
|
|
}
|
243 |
|
|
HAL_READ_UINT16(_FRVGEN_IRC_MASK, _mask);
|
244 |
|
|
_mask &= ~(1<<(vector-CYGNUM_HAL_VECTOR_EXTERNAL_INTERRUPT_LEVEL_1+1));
|
245 |
|
|
HAL_WRITE_UINT16(_FRVGEN_IRC_MASK, _mask);
|
246 |
|
|
}
|
247 |
|
|
|
248 |
|
|
void hal_interrupt_acknowledge(int vector)
|
249 |
|
|
{
|
250 |
|
|
cyg_uint16 _mask;
|
251 |
|
|
|
252 |
|
|
switch (vector) {
|
253 |
|
|
case CYGNUM_HAL_INTERRUPT_LAN:
|
254 |
|
|
#if 0
|
255 |
|
|
HAL_WRITE_UINT16(_FRVGEN_FPGA_IRQ_REQUEST, // Clear LAN interrupt
|
256 |
|
|
0x7FFE & ~_FRVGEN_FPGA_IRQ_LAN);
|
257 |
|
|
#endif
|
258 |
|
|
break;
|
259 |
|
|
}
|
260 |
|
|
_mask = (1<<(vector-CYGNUM_HAL_VECTOR_EXTERNAL_INTERRUPT_LEVEL_1+1));
|
261 |
|
|
HAL_WRITE_UINT16(_FRVGEN_IRC_RC, _mask);
|
262 |
|
|
HAL_WRITE_UINT16(_FRVGEN_IRC_IRL, 0x10); // Clears IRL latch
|
263 |
|
|
}
|
264 |
|
|
|
265 |
|
|
//
|
266 |
|
|
// Configure an interrupt
|
267 |
|
|
// level - boolean (0=> edge, 1=>level)
|
268 |
|
|
// up - edge: (0=>falling edge, 1=>rising edge)
|
269 |
|
|
// level: (0=>low, 1=>high)
|
270 |
|
|
//
|
271 |
|
|
void hal_interrupt_configure(int vector, int level, int up)
|
272 |
|
|
{
|
273 |
|
|
cyg_uint16 _irr, _tmr, _trig;
|
274 |
|
|
|
275 |
|
|
if (level) {
|
276 |
|
|
if (up) {
|
277 |
|
|
_trig = 0; // level, high
|
278 |
|
|
} else {
|
279 |
|
|
_trig = 1; // level, low
|
280 |
|
|
}
|
281 |
|
|
} else {
|
282 |
|
|
if (up) {
|
283 |
|
|
_trig = 2; // edge, rising
|
284 |
|
|
} else {
|
285 |
|
|
_trig = 3; // edge, falling
|
286 |
|
|
}
|
287 |
|
|
}
|
288 |
|
|
switch (vector) {
|
289 |
|
|
case CYGNUM_HAL_INTERRUPT_TIMER0:
|
290 |
|
|
HAL_READ_UINT16(_FRVGEN_IRC_IRR5, _irr);
|
291 |
|
|
_irr = (_irr & 0xFFF0) | ((vector-CYGNUM_HAL_VECTOR_EXTERNAL_INTERRUPT_LEVEL_1+1)<<0);
|
292 |
|
|
HAL_WRITE_UINT16(_FRVGEN_IRC_IRR5, _irr);
|
293 |
|
|
HAL_READ_UINT16(_FRVGEN_IRC_ITM0, _tmr);
|
294 |
|
|
_tmr = (_tmr & 0xFFFC) | (_trig<<0);
|
295 |
|
|
HAL_WRITE_UINT16(_FRVGEN_IRC_ITM0, _tmr);
|
296 |
|
|
break;
|
297 |
|
|
case CYGNUM_HAL_INTERRUPT_TIMER1:
|
298 |
|
|
HAL_READ_UINT16(_FRVGEN_IRC_IRR5, _irr);
|
299 |
|
|
_irr = (_irr & 0xFF0F) | ((vector-CYGNUM_HAL_VECTOR_EXTERNAL_INTERRUPT_LEVEL_1+1)<<4);
|
300 |
|
|
HAL_WRITE_UINT16(_FRVGEN_IRC_IRR5, _irr);
|
301 |
|
|
HAL_READ_UINT16(_FRVGEN_IRC_ITM0, _tmr);
|
302 |
|
|
_tmr = (_tmr & 0xFFF3) | (_trig<<2);
|
303 |
|
|
HAL_WRITE_UINT16(_FRVGEN_IRC_ITM0, _tmr);
|
304 |
|
|
break;
|
305 |
|
|
case CYGNUM_HAL_INTERRUPT_TIMER2:
|
306 |
|
|
HAL_READ_UINT16(_FRVGEN_IRC_IRR5, _irr);
|
307 |
|
|
_irr = (_irr & 0xF0FF) | ((vector-CYGNUM_HAL_VECTOR_EXTERNAL_INTERRUPT_LEVEL_1+1)<<8);
|
308 |
|
|
HAL_WRITE_UINT16(_FRVGEN_IRC_IRR5, _irr);
|
309 |
|
|
HAL_READ_UINT16(_FRVGEN_IRC_ITM0, _tmr);
|
310 |
|
|
_tmr = (_tmr & 0xFFCF) | (_trig<<4);
|
311 |
|
|
HAL_WRITE_UINT16(_FRVGEN_IRC_ITM0, _tmr);
|
312 |
|
|
break;
|
313 |
|
|
case CYGNUM_HAL_INTERRUPT_DMA0:
|
314 |
|
|
HAL_READ_UINT16(_FRVGEN_IRC_IRR4, _irr);
|
315 |
|
|
_irr = (_irr & 0xFFF0) | ((vector-CYGNUM_HAL_VECTOR_EXTERNAL_INTERRUPT_LEVEL_1+1)<<0);
|
316 |
|
|
HAL_WRITE_UINT16(_FRVGEN_IRC_IRR4, _irr);
|
317 |
|
|
HAL_READ_UINT16(_FRVGEN_IRC_ITM0, _tmr);
|
318 |
|
|
_tmr = (_tmr & 0xFCFF) | (_trig<<8);
|
319 |
|
|
HAL_WRITE_UINT16(_FRVGEN_IRC_ITM0, _tmr);
|
320 |
|
|
break;
|
321 |
|
|
case CYGNUM_HAL_INTERRUPT_DMA1:
|
322 |
|
|
HAL_READ_UINT16(_FRVGEN_IRC_IRR4, _irr);
|
323 |
|
|
_irr = (_irr & 0xFF0F) | ((vector-CYGNUM_HAL_VECTOR_EXTERNAL_INTERRUPT_LEVEL_1+1)<<4);
|
324 |
|
|
HAL_WRITE_UINT16(_FRVGEN_IRC_IRR4, _irr);
|
325 |
|
|
HAL_READ_UINT16(_FRVGEN_IRC_ITM0, _tmr);
|
326 |
|
|
_tmr = (_tmr & 0xF3FF) | (_trig<<10);
|
327 |
|
|
HAL_WRITE_UINT16(_FRVGEN_IRC_ITM0, _tmr);
|
328 |
|
|
break;
|
329 |
|
|
case CYGNUM_HAL_INTERRUPT_DMA2:
|
330 |
|
|
HAL_READ_UINT16(_FRVGEN_IRC_IRR4, _irr);
|
331 |
|
|
_irr = (_irr & 0xF0FF) | ((vector-CYGNUM_HAL_VECTOR_EXTERNAL_INTERRUPT_LEVEL_1+1)<<8);
|
332 |
|
|
HAL_WRITE_UINT16(_FRVGEN_IRC_IRR4, _irr);
|
333 |
|
|
HAL_READ_UINT16(_FRVGEN_IRC_ITM0, _tmr);
|
334 |
|
|
_tmr = (_tmr & 0xCFFF) | (_trig<<12);
|
335 |
|
|
HAL_WRITE_UINT16(_FRVGEN_IRC_ITM0, _tmr);
|
336 |
|
|
break;
|
337 |
|
|
case CYGNUM_HAL_INTERRUPT_DMA3:
|
338 |
|
|
HAL_READ_UINT16(_FRVGEN_IRC_IRR4, _irr);
|
339 |
|
|
_irr = (_irr & 0x0FFF) | ((vector-CYGNUM_HAL_VECTOR_EXTERNAL_INTERRUPT_LEVEL_1+1)<<12);
|
340 |
|
|
HAL_WRITE_UINT16(_FRVGEN_IRC_IRR4, _irr);
|
341 |
|
|
HAL_READ_UINT16(_FRVGEN_IRC_ITM0, _tmr);
|
342 |
|
|
_tmr = (_tmr & 0x3FFF) | (_trig<<14);
|
343 |
|
|
HAL_WRITE_UINT16(_FRVGEN_IRC_ITM0, _tmr);
|
344 |
|
|
break;
|
345 |
|
|
case CYGNUM_HAL_INTERRUPT_UART0:
|
346 |
|
|
HAL_READ_UINT16(_FRVGEN_IRC_IRR6, _irr);
|
347 |
|
|
_irr = (_irr & 0xFFF0) | ((vector-CYGNUM_HAL_VECTOR_EXTERNAL_INTERRUPT_LEVEL_1+1)<<0);
|
348 |
|
|
HAL_WRITE_UINT16(_FRVGEN_IRC_IRR6, _irr);
|
349 |
|
|
HAL_READ_UINT16(_FRVGEN_IRC_ITM1, _tmr);
|
350 |
|
|
_tmr = (_tmr & 0xFCFF) | (_trig<<8);
|
351 |
|
|
HAL_WRITE_UINT16(_FRVGEN_IRC_ITM1, _tmr);
|
352 |
|
|
break;
|
353 |
|
|
case CYGNUM_HAL_INTERRUPT_UART1:
|
354 |
|
|
HAL_READ_UINT16(_FRVGEN_IRC_IRR6, _irr);
|
355 |
|
|
_irr = (_irr & 0xFF0F) | ((vector-CYGNUM_HAL_VECTOR_EXTERNAL_INTERRUPT_LEVEL_1+1)<<4);
|
356 |
|
|
HAL_WRITE_UINT16(_FRVGEN_IRC_IRR6, _irr);
|
357 |
|
|
HAL_READ_UINT16(_FRVGEN_IRC_ITM1, _tmr);
|
358 |
|
|
_tmr = (_tmr & 0xF3FF) | (_trig<<10);
|
359 |
|
|
HAL_WRITE_UINT16(_FRVGEN_IRC_ITM1, _tmr);
|
360 |
|
|
break;
|
361 |
|
|
case CYGNUM_HAL_INTERRUPT_EXT0:
|
362 |
|
|
HAL_READ_UINT16(_FRVGEN_IRC_IRR3, _irr);
|
363 |
|
|
_irr = (_irr & 0xFFF0) | ((vector-CYGNUM_HAL_VECTOR_EXTERNAL_INTERRUPT_LEVEL_1+1)<<0);
|
364 |
|
|
HAL_WRITE_UINT16(_FRVGEN_IRC_IRR3, _irr);
|
365 |
|
|
HAL_READ_UINT16(_FRVGEN_IRC_TM1, _tmr);
|
366 |
|
|
_tmr = (_tmr & 0xFFFC) | (_trig<<0);
|
367 |
|
|
HAL_WRITE_UINT16(_FRVGEN_IRC_TM1, _tmr);
|
368 |
|
|
break;
|
369 |
|
|
case CYGNUM_HAL_INTERRUPT_EXT1:
|
370 |
|
|
HAL_READ_UINT16(_FRVGEN_IRC_IRR3, _irr);
|
371 |
|
|
_irr = (_irr & 0xFF0F) | ((vector-CYGNUM_HAL_VECTOR_EXTERNAL_INTERRUPT_LEVEL_1+1)<<4);
|
372 |
|
|
HAL_WRITE_UINT16(_FRVGEN_IRC_IRR3, _irr);
|
373 |
|
|
HAL_READ_UINT16(_FRVGEN_IRC_TM1, _tmr);
|
374 |
|
|
_tmr = (_tmr & 0xFFF3) | (_trig<<2);
|
375 |
|
|
HAL_WRITE_UINT16(_FRVGEN_IRC_TM1, _tmr);
|
376 |
|
|
break;
|
377 |
|
|
case CYGNUM_HAL_INTERRUPT_EXT2:
|
378 |
|
|
HAL_READ_UINT16(_FRVGEN_IRC_IRR3, _irr);
|
379 |
|
|
_irr = (_irr & 0xF0FF) | ((vector-CYGNUM_HAL_VECTOR_EXTERNAL_INTERRUPT_LEVEL_1+1)<<8);
|
380 |
|
|
HAL_WRITE_UINT16(_FRVGEN_IRC_IRR3, _irr);
|
381 |
|
|
HAL_READ_UINT16(_FRVGEN_IRC_TM1, _tmr);
|
382 |
|
|
_tmr = (_tmr & 0xFFCF) | (_trig<<4);
|
383 |
|
|
HAL_WRITE_UINT16(_FRVGEN_IRC_TM1, _tmr);
|
384 |
|
|
break;
|
385 |
|
|
case CYGNUM_HAL_INTERRUPT_EXT7:
|
386 |
|
|
HAL_READ_UINT16(_FRVGEN_IRC_IRR2, _irr);
|
387 |
|
|
_irr = (_irr & 0x0FFF) | ((vector-CYGNUM_HAL_VECTOR_EXTERNAL_INTERRUPT_LEVEL_1+1)<<12);
|
388 |
|
|
HAL_WRITE_UINT16(_FRVGEN_IRC_IRR2, _irr);
|
389 |
|
|
HAL_READ_UINT16(_FRVGEN_IRC_TM1, _tmr);
|
390 |
|
|
_tmr = (_tmr & 0x3FFF) | (_trig<<14);
|
391 |
|
|
HAL_WRITE_UINT16(_FRVGEN_IRC_TM1, _tmr);
|
392 |
|
|
break;
|
393 |
|
|
default:
|
394 |
|
|
; // Nothing to do
|
395 |
|
|
};
|
396 |
|
|
}
|
397 |
|
|
|
398 |
|
|
void hal_interrupt_set_level(int vector, int level)
|
399 |
|
|
{
|
400 |
|
|
// UNIMPLEMENTED(__FUNCTION__);
|
401 |
|
|
}
|
402 |
|
|
|
403 |
|
|
/*------------------------------------------------------------------------*/
|
404 |
|
|
// EOF mb93093_misc.c
|