GNU Radio 3.4.2 C++ API
|
00001 /* -*- c++ -*- */ 00002 /* 00003 * Copyright 2003 Free Software Foundation, Inc. 00004 * 00005 * This file is part of GNU Radio 00006 * 00007 * GNU Radio is free software; you can redistribute it and/or modify 00008 * it under the terms of the GNU General Public License as published by 00009 * the Free Software Foundation; either version 3, or (at your option) 00010 * any later version. 00011 * 00012 * GNU Radio is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 * GNU General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU General Public License 00018 * along with GNU Radio; see the file COPYING. If not, write to 00019 * the Free Software Foundation, Inc., 51 Franklin Street, 00020 * Boston, MA 02110-1301, USA. 00021 */ 00022 00023 #ifndef _ISR_H_ 00024 #define _ISR_H_ 00025 00026 /* 00027 * ---------------------------------------------------------------- 00028 * routines for managing interrupt services routines 00029 * ---------------------------------------------------------------- 00030 */ 00031 00032 /* 00033 * The FX2 has three discrete sets of interrupt vectors. 00034 * The first set is the standard 8051 vector (13 8-byte entries). 00035 * The second set is USB interrupt autovector (32 4-byte entries). 00036 * The third set is the FIFO/GPIF autovector (14 4-byte entries). 00037 * 00038 * Since all the code we're running in the FX2 is ram based, we 00039 * forego the typical "initialize the interrupt vectors at link time" 00040 * strategy, in favor of calls at run time that install the correct 00041 * pointers to functions. 00042 */ 00043 00044 /* 00045 * Standard Vector numbers 00046 */ 00047 00048 #define SV_INT_0 0x03 00049 #define SV_TIMER_0 0x0b 00050 #define SV_INT_1 0x13 00051 #define SV_TIMER_1 0x1b 00052 #define SV_SERIAL_0 0x23 00053 #define SV_TIMER_2 0x2b 00054 #define SV_RESUME 0x33 00055 #define SV_SERIAL_1 0x3b 00056 #define SV_INT_2 0x43 // (INT_2) points at USB autovector 00057 #define SV_I2C 0x4b 00058 #define SV_INT_4 0x53 // (INT_4) points at FIFO/GPIF autovector 00059 #define SV_INT_5 0x5b 00060 #define SV_INT_6 0x63 00061 00062 #define SV_MIN SV_INT_0 00063 #define SV_MAX SV_INT_6 00064 00065 /* 00066 * USB Auto Vector numbers 00067 */ 00068 00069 #define UV_SUDAV 0x00 00070 #define UV_SOF 0x04 00071 #define UV_SUTOK 0x08 00072 #define UV_SUSPEND 0x0c 00073 #define UV_USBRESET 0x10 00074 #define UV_HIGHSPEED 0x14 00075 #define UV_EP0ACK 0x18 00076 #define UV_SPARE_1C 0x1c 00077 #define UV_EP0IN 0x20 00078 #define UV_EP0OUT 0x24 00079 #define UV_EP1IN 0x28 00080 #define UV_EP1OUT 0x2c 00081 #define UV_EP2 0x30 00082 #define UV_EP4 0x34 00083 #define UV_EP6 0x38 00084 #define UV_EP8 0x3c 00085 #define UV_IBN 0x40 00086 #define UV_SPARE_44 0x44 00087 #define UV_EP0PINGNAK 0x48 00088 #define UV_EP1PINGNAK 0x4c 00089 #define UV_EP2PINGNAK 0x50 00090 #define UV_EP4PINGNAK 0x54 00091 #define UV_EP6PINGNAK 0x58 00092 #define UV_EP8PINGNAK 0x5c 00093 #define UV_ERRLIMIT 0x60 00094 #define UV_SPARE_64 0x64 00095 #define UV_SPARE_68 0x68 00096 #define UV_SPARE_6C 0x6c 00097 #define UV_EP2ISOERR 0x70 00098 #define UV_EP4ISOERR 0x74 00099 #define UV_EP6ISOERR 0x78 00100 #define UV_EP8ISOERR 0x7c 00101 00102 #define UV_MIN UV_SUDAV 00103 #define UV_MAX UV_EP8ISOERR 00104 00105 /* 00106 * FIFO/GPIF Auto Vector numbers 00107 */ 00108 00109 #define FGV_EP2PF 0x00 00110 #define FGV_EP4PF 0x04 00111 #define FGV_EP6PF 0x08 00112 #define FGV_EP8PF 0x0c 00113 #define FGV_EP2EF 0x10 00114 #define FGV_EP4EF 0x14 00115 #define FGV_EP6EF 0x18 00116 #define FGV_EP8EF 0x1c 00117 #define FGV_EP2FF 0x20 00118 #define FGV_EP4FF 0x24 00119 #define FGV_EP6FF 0x28 00120 #define FGV_EP8FF 0x2c 00121 #define FGV_GPIFDONE 0x30 00122 #define FGV_GPIFWF 0x34 00123 00124 #define FGV_MIN FGV_EP2PF 00125 #define FGV_MAX FGV_GPIFWF 00126 00127 00128 /* 00129 * Hook standard interrupt vector. 00130 * 00131 * vector_number is from the SV_<foo> list above. 00132 * addr is the address of the interrupt service routine. 00133 */ 00134 void hook_sv (unsigned char vector_number, unsigned short addr); 00135 00136 /* 00137 * Hook usb interrupt vector. 00138 * 00139 * vector_number is from the UV_<foo> list above. 00140 * addr is the address of the interrupt service routine. 00141 */ 00142 void hook_uv (unsigned char vector_number, unsigned short addr); 00143 00144 /* 00145 * Hook fifo/gpif interrupt vector. 00146 * 00147 * vector_number is from the FGV_<foo> list above. 00148 * addr is the address of the interrupt service routine. 00149 */ 00150 void hook_fgv (unsigned char vector_number, unsigned short addr); 00151 00152 /* 00153 * One time call to enable autovectoring for both USB and FIFO/GPIF 00154 */ 00155 void setup_autovectors (void); 00156 00157 00158 /* 00159 * Must be called in each usb interrupt handler 00160 */ 00161 #define clear_usb_irq() \ 00162 EXIF &= ~bmEXIF_USBINT; \ 00163 INT2CLR = 0 00164 00165 /* 00166 * Must be calledin each fifo/gpif interrupt handler 00167 */ 00168 #define clear_fifo_gpif_irq() \ 00169 EXIF &= ~bmEXIF_IE4; \ 00170 INT4CLR = 0 00171 00172 #endif /* _ISR_H_ */