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

Subversion Repositories w11

[/] [w11/] [tags/] [w11a_V0.61/] [tools/] [fx2/] [src/] [lib/] [isr.h] - Blame information for rev 26

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 17 wfjm
/* -*- c++ -*- */
2
/* $Id: isr.h 395 2011-07-17 22:02:55Z mueller $ */
3
/*-----------------------------------------------------------------------------
4
 * Interrupt handling for FX2
5
 *-----------------------------------------------------------------------------
6
 * Code taken from USRP2 firmware (GNU Radio Project), version 3.0.2,
7
 * Copyright 2003 Free Software Foundation, Inc.
8
 *-----------------------------------------------------------------------------
9
 * This code is part of usbjtag. usbjtag is free software; you can redistribute
10
 * it and/or modify it under the terms of the GNU General Public License as
11
 * published by the Free Software Foundation; either version 2 of the License,
12
 * or (at your option) any later version. usbjtag is distributed in the hope
13
 * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
14
 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
 * GNU General Public License for more details.  You should have received a
16
 * copy of the GNU General Public License along with this program in the file
17
 * COPYING; if not, write to the Free Software Foundation, Inc., 51 Franklin
18
 * St, Fifth Floor, Boston, MA  02110-1301  USA
19
 *-----------------------------------------------------------------------------
20
 */
21
 
22
#ifndef _ISR_H_
23
#define _ISR_H_
24
 
25
/*
26
 * ----------------------------------------------------------------
27
 *      routines for managing interrupt services routines
28
 * ----------------------------------------------------------------
29
 */
30
 
31
/*
32
 * The FX2 has three discrete sets of interrupt vectors.
33
 * The first set is the standard 8051 vector (13 8-byte entries).
34
 * The second set is USB interrupt autovector (32 4-byte entries).
35
 * The third set is the FIFO/GPIF autovector (14 4-byte entries).
36
 *
37
 * Since all the code we're running in the FX2 is ram based, we
38
 * forego the typical "initialize the interrupt vectors at link time"
39
 * strategy, in favor of calls at run time that install the correct
40
 * pointers to functions.
41
 */
42
 
43
/*
44
 * Standard Vector numbers
45
 */
46
 
47
#define SV_INT_0                0x03
48
#define SV_TIMER_0              0x0b
49
#define SV_INT_1                0x13
50
#define SV_TIMER_1              0x1b
51
#define SV_SERIAL_0             0x23
52
#define SV_TIMER_2              0x2b
53
#define SV_RESUME               0x33
54
#define SV_SERIAL_1             0x3b
55
#define SV_INT_2                0x43            // (INT_2) points at USB autovector
56
#define SV_I2C                  0x4b
57
#define SV_INT_4                0x53            // (INT_4) points at FIFO/GPIF autovector
58
#define SV_INT_5                0x5b
59
#define SV_INT_6                0x63
60
 
61
#define SV_MIN                  SV_INT_0
62
#define SV_MAX                  SV_INT_6
63
 
64
/*
65
 * USB Auto Vector numbers
66
 */
67
 
68
#define UV_SUDAV                0x00
69
#define UV_SOF                  0x04
70
#define UV_SUTOK                0x08
71
#define UV_SUSPEND              0x0c
72
#define UV_USBRESET             0x10
73
#define UV_HIGHSPEED            0x14
74
#define UV_EP0ACK               0x18
75
#define UV_SPARE_1C             0x1c
76
#define UV_EP0IN                0x20
77
#define UV_EP0OUT               0x24
78
#define UV_EP1IN                0x28
79
#define UV_EP1OUT               0x2c
80
#define UV_EP2                  0x30
81
#define UV_EP4                  0x34
82
#define UV_EP6                  0x38
83
#define UV_EP8                  0x3c
84
#define UV_IBN                  0x40
85
#define UV_SPARE_44             0x44
86
#define UV_EP0PINGNAK           0x48
87
#define UV_EP1PINGNAK           0x4c
88
#define UV_EP2PINGNAK           0x50
89
#define UV_EP4PINGNAK           0x54
90
#define UV_EP6PINGNAK           0x58
91
#define UV_EP8PINGNAK           0x5c
92
#define UV_ERRLIMIT             0x60
93
#define UV_SPARE_64             0x64
94
#define UV_SPARE_68             0x68
95
#define UV_SPARE_6C             0x6c
96
#define UV_EP2ISOERR            0x70
97
#define UV_EP4ISOERR            0x74
98
#define UV_EP6ISOERR            0x78
99
#define UV_EP8ISOERR            0x7c
100
 
101
#define UV_MIN                  UV_SUDAV
102
#define UV_MAX                  UV_EP8ISOERR
103
 
104
/*
105
 * FIFO/GPIF Auto Vector numbers
106
 */
107
 
108
#define FGV_EP2PF               0x80
109
#define FGV_EP4PF               0x84
110
#define FGV_EP6PF               0x88
111
#define FGV_EP8PF               0x8c
112
#define FGV_EP2EF               0x90
113
#define FGV_EP4EF               0x94
114
#define FGV_EP6EF               0x98
115
#define FGV_EP8EF               0x9c
116
#define FGV_EP2FF               0xa0
117
#define FGV_EP4FF               0xa4
118
#define FGV_EP6FF               0xa8
119
#define FGV_EP8FF               0xac
120
#define FGV_GPIFDONE            0xb0
121
#define FGV_GPIFWF              0xb4
122
 
123
#define FGV_MIN                 FGV_EP2PF
124
#define FGV_MAX                 FGV_GPIFWF
125
 
126
 
127
/*
128
 * Hook standard interrupt vector.
129
 *
130
 * vector_number is from the SV_<foo> list above.
131
 * addr is the address of the interrupt service routine.
132
 */
133
void hook_sv (unsigned char vector_number, unsigned short addr);
134
 
135
/*
136
 * Hook usb interrupt vector.
137
 *
138
 * vector_number is from the UV_<foo> list above.
139
 * addr is the address of the interrupt service routine.
140
 */
141
void hook_uv (unsigned char vector_number, unsigned short addr);
142
 
143
/*
144
 * Hook fifo/gpif interrupt vector.
145
 *
146
 * vector_number is from the FGV_<foo> list above.
147
 * addr is the address of the interrupt service routine.
148
 */
149
void hook_fgv (unsigned char vector_number, unsigned short addr);
150
 
151
/*
152
 * One time call to enable autovectoring for both USB and FIFO/GPIF
153
 */
154
void setup_autovectors (void);
155
 
156
 
157
/*
158
 * Must be called in each usb interrupt handler
159
 */
160
#define clear_usb_irq()                 \
161
        EXIF &= ~bmEXIF_USBINT;         \
162
        INT2CLR = 0
163
 
164
/*
165
 * Must be calledin each fifo/gpif interrupt handler
166
 */
167
#define clear_fifo_gpif_irq()           \
168
        EXIF &= ~bmEXIF_IE4;            \
169
        INT4CLR = 0
170
 
171
#endif /* _ISR_H_ */

powered by: WebSVN 2.1.0

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