3 * Copyright 2003 Free Software Foundation, Inc.
5 * This file is part of GNU Radio
7 * GNU Radio is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 3, or (at your option)
12 * GNU Radio is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with GNU Radio; see the file COPYING. If not, write to
19 * the Free Software Foundation, Inc., 51 Franklin Street,
20 * Boston, MA 02110-1301, USA.
27 * ----------------------------------------------------------------
28 * routines for managing interrupt services routines
29 * ----------------------------------------------------------------
33 * The FX2 has three discrete sets of interrupt vectors.
34 * The first set is the standard 8051 vector (13 8-byte entries).
35 * The second set is USB interrupt autovector (32 4-byte entries).
36 * The third set is the FIFO/GPIF autovector (14 4-byte entries).
38 * Since all the code we're running in the FX2 is ram based, we
39 * forego the typical "initialize the interrupt vectors at link time"
40 * strategy, in favor of calls at run time that install the correct
41 * pointers to functions.
45 * Standard Vector numbers
49 #define SV_TIMER_0 0x0b
51 #define SV_TIMER_1 0x1b
52 #define SV_SERIAL_0 0x23
53 #define SV_TIMER_2 0x2b
54 #define SV_RESUME 0x33
55 #define SV_SERIAL_1 0x3b
56 #define SV_INT_2 0x43 // (INT_2) points at USB autovector
58 #define SV_INT_4 0x53 // (INT_4) points at FIFO/GPIF autovector
62 #define SV_MIN SV_INT_0
63 #define SV_MAX SV_INT_6
66 * USB Auto Vector numbers
72 #define UV_SUSPEND 0x0c
73 #define UV_USBRESET 0x10
74 #define UV_HIGHSPEED 0x14
75 #define UV_EP0ACK 0x18
76 #define UV_SPARE_1C 0x1c
78 #define UV_EP0OUT 0x24
80 #define UV_EP1OUT 0x2c
86 #define UV_SPARE_44 0x44
87 #define UV_EP0PINGNAK 0x48
88 #define UV_EP1PINGNAK 0x4c
89 #define UV_EP2PINGNAK 0x50
90 #define UV_EP4PINGNAK 0x54
91 #define UV_EP6PINGNAK 0x58
92 #define UV_EP8PINGNAK 0x5c
93 #define UV_ERRLIMIT 0x60
94 #define UV_SPARE_64 0x64
95 #define UV_SPARE_68 0x68
96 #define UV_SPARE_6C 0x6c
97 #define UV_EP2ISOERR 0x70
98 #define UV_EP4ISOERR 0x74
99 #define UV_EP6ISOERR 0x78
100 #define UV_EP8ISOERR 0x7c
102 #define UV_MIN UV_SUDAV
103 #define UV_MAX UV_EP8ISOERR
106 * FIFO/GPIF Auto Vector numbers
109 #define FGV_EP2PF 0x80
110 #define FGV_EP4PF 0x84
111 #define FGV_EP6PF 0x88
112 #define FGV_EP8PF 0x8c
113 #define FGV_EP2EF 0x90
114 #define FGV_EP4EF 0x94
115 #define FGV_EP6EF 0x98
116 #define FGV_EP8EF 0x9c
117 #define FGV_EP2FF 0xa0
118 #define FGV_EP4FF 0xa4
119 #define FGV_EP6FF 0xa8
120 #define FGV_EP8FF 0xac
121 #define FGV_GPIFDONE 0xb0
122 #define FGV_GPIFWF 0xb4
124 #define FGV_MIN FGV_EP2PF
125 #define FGV_MAX FGV_GPIFWF
129 * Hook standard interrupt vector.
131 * vector_number is from the SV_<foo> list above.
132 * addr is the address of the interrupt service routine.
134 void hook_sv (unsigned char vector_number, unsigned short addr);
137 * Hook usb interrupt vector.
139 * vector_number is from the UV_<foo> list above.
140 * addr is the address of the interrupt service routine.
142 void hook_uv (unsigned char vector_number, unsigned short addr);
145 * Hook fifo/gpif interrupt vector.
147 * vector_number is from the FGV_<foo> list above.
148 * addr is the address of the interrupt service routine.
150 void hook_fgv (unsigned char vector_number, unsigned short addr);
153 * One time call to enable autovectoring for both USB and FIFO/GPIF
155 void setup_autovectors (void);
159 * Must be called in each usb interrupt handler
161 #define clear_usb_irq() \
162 EXIF &= ~bmEXIF_USBINT; \
166 * Must be calledin each fifo/gpif interrupt handler
168 #define clear_fifo_gpif_irq() \
169 EXIF &= ~bmEXIF_IE4; \