aboutsummaryrefslogtreecommitdiffstats
path: root/comms/gnuradio/files
diff options
context:
space:
mode:
authordb <db@FreeBSD.org>2012-10-19 02:29:57 +0800
committerdb <db@FreeBSD.org>2012-10-19 02:29:57 +0800
commite1a742059bc2f2c3dee1cfb34ef8047f5face2f1 (patch)
tree0ba04bba54698fba4cac3b92818e05ef4acfb0a1 /comms/gnuradio/files
parent5d560acf2b3121eface79315a7edf00ae5af8f05 (diff)
downloadfreebsd-ports-gnome-e1a742059bc2f2c3dee1cfb34ef8047f5face2f1.tar.gz
freebsd-ports-gnome-e1a742059bc2f2c3dee1cfb34ef8047f5face2f1.tar.zst
freebsd-ports-gnome-e1a742059bc2f2c3dee1cfb34ef8047f5face2f1.zip
- Unbreak gnuradio build
- sdcc changed syntax slightly, chase this in diffs Feature safe: yes
Diffstat (limited to 'comms/gnuradio/files')
-rw-r--r--comms/gnuradio/files/patch-usrp_firmware_include_fx2regs.h434
-rw-r--r--comms/gnuradio/files/patch-usrp_firmware_include_i2c.h14
-rw-r--r--comms/gnuradio/files/patch-usrp_firmware_include_syncdelay.h13
-rw-r--r--comms/gnuradio/files/patch-usrp_firmware_include_usb_common.h11
-rw-r--r--comms/gnuradio/files/patch-usrp_firmware_include_usb_descriptors.h36
-rw-r--r--comms/gnuradio/files/patch-usrp_firmware_lib_delay.c16
-rw-r--r--comms/gnuradio/files/patch-usrp_firmware_lib_fx2utils.c14
-rw-r--r--comms/gnuradio/files/patch-usrp_firmware_lib_i2c.c20
-rw-r--r--comms/gnuradio/files/patch-usrp_firmware_lib_isr.c42
-rw-r--r--comms/gnuradio/files/patch-usrp_firmware_lib_usb_common.c85
-rw-r--r--comms/gnuradio/files/patch-usrp_firmware_src_common_fpga_load.c40
-rw-r--r--comms/gnuradio/files/patch-usrp_firmware_src_common_fpga_load.h11
-rw-r--r--comms/gnuradio/files/patch-usrp_firmware_src_usrp2_board_specific.c11
-rw-r--r--comms/gnuradio/files/patch-usrp_firmware_src_usrp2_eeprom_init.c11
-rw-r--r--comms/gnuradio/files/patch-usrp_firmware_src_usrp2_eeprom_io.c17
-rw-r--r--comms/gnuradio/files/patch-usrp_firmware_src_usrp2_eeprom_io.h17
-rw-r--r--comms/gnuradio/files/patch-usrp_firmware_src_usrp2_fpga_rev2.c20
-rw-r--r--comms/gnuradio/files/patch-usrp_firmware_src_usrp2_spi.c68
-rw-r--r--comms/gnuradio/files/patch-usrp_firmware_src_usrp2_spi.h18
-rw-r--r--comms/gnuradio/files/patch-usrp_firmware_src_usrp2_usrp_main.c31
20 files changed, 908 insertions, 21 deletions
diff --git a/comms/gnuradio/files/patch-usrp_firmware_include_fx2regs.h b/comms/gnuradio/files/patch-usrp_firmware_include_fx2regs.h
new file mode 100644
index 000000000000..8276ba0bacd0
--- /dev/null
+++ b/comms/gnuradio/files/patch-usrp_firmware_include_fx2regs.h
@@ -0,0 +1,434 @@
+--- usrp/firmware/include/fx2regs.h.orig 2012-10-03 18:13:13.000000000 -0500
++++ usrp/firmware/include/fx2regs.h 2012-10-03 19:22:39.000000000 -0500
+@@ -63,172 +63,176 @@
+
+ #ifdef ALLOCATE_EXTERN
+ #define EXTERN
+-#define _AT_(a) at a
++#define _AT_(a) __at a
+ #else
+ #define EXTERN extern
+ #define _AT_ ;/ ## /
+ #endif
++//#define xdata __xdata
++#define sfr __sfr
++#define at __at
++#define sbit __sbit
+
+ typedef unsigned char BYTE;
+ typedef unsigned short WORD;
+
+-EXTERN xdata _AT_(0xE400) volatile BYTE GPIF_WAVE_DATA[128];
+-EXTERN xdata _AT_(0xE480) volatile BYTE RES_WAVEDATA_END ;
++EXTERN __xdata _AT_(0xE400) volatile BYTE GPIF_WAVE_DATA[128];
++EXTERN __xdata _AT_(0xE480) volatile BYTE RES_WAVEDATA_END ;
+
+ // General Configuration
+
+-EXTERN xdata _AT_(0xE600) volatile BYTE CPUCS ; // Control & Status
+-EXTERN xdata _AT_(0xE601) volatile BYTE IFCONFIG ; // Interface Configuration
+-EXTERN xdata _AT_(0xE602) volatile BYTE PINFLAGSAB ; // FIFO FLAGA and FLAGB Assignments
+-EXTERN xdata _AT_(0xE603) volatile BYTE PINFLAGSCD ; // FIFO FLAGC and FLAGD Assignments
+-EXTERN xdata _AT_(0xE604) volatile BYTE FIFORESET ; // Restore FIFOS to default state
+-EXTERN xdata _AT_(0xE605) volatile BYTE BREAKPT ; // Breakpoint
+-EXTERN xdata _AT_(0xE606) volatile BYTE BPADDRH ; // Breakpoint Address H
+-EXTERN xdata _AT_(0xE607) volatile BYTE BPADDRL ; // Breakpoint Address L
+-EXTERN xdata _AT_(0xE608) volatile BYTE UART230 ; // 230 Kbaud clock for T0,T1,T2
+-EXTERN xdata _AT_(0xE609) volatile BYTE FIFOPINPOLAR ; // FIFO polarities
+-EXTERN xdata _AT_(0xE60A) volatile BYTE REVID ; // Chip Revision
+-EXTERN xdata _AT_(0xE60B) volatile BYTE REVCTL ; // Chip Revision Control
++EXTERN __xdata _AT_(0xE600) volatile BYTE CPUCS ; // Control & Status
++EXTERN __xdata _AT_(0xE601) volatile BYTE IFCONFIG ; // Interface Configuration
++EXTERN __xdata _AT_(0xE602) volatile BYTE PINFLAGSAB ; // FIFO FLAGA and FLAGB Assignments
++EXTERN __xdata _AT_(0xE603) volatile BYTE PINFLAGSCD ; // FIFO FLAGC and FLAGD Assignments
++EXTERN __xdata _AT_(0xE604) volatile BYTE FIFORESET ; // Restore FIFOS to default state
++EXTERN __xdata _AT_(0xE605) volatile BYTE BREAKPT ; // Breakpoint
++EXTERN __xdata _AT_(0xE606) volatile BYTE BPADDRH ; // Breakpoint Address H
++EXTERN __xdata _AT_(0xE607) volatile BYTE BPADDRL ; // Breakpoint Address L
++EXTERN __xdata _AT_(0xE608) volatile BYTE UART230 ; // 230 Kbaud clock for T0,T1,T2
++EXTERN __xdata _AT_(0xE609) volatile BYTE FIFOPINPOLAR ; // FIFO polarities
++EXTERN __xdata _AT_(0xE60A) volatile BYTE REVID ; // Chip Revision
++EXTERN __xdata _AT_(0xE60B) volatile BYTE REVCTL ; // Chip Revision Control
+
+ // Endpoint Configuration
+
+-EXTERN xdata _AT_(0xE610) volatile BYTE EP1OUTCFG ; // Endpoint 1-OUT Configuration
+-EXTERN xdata _AT_(0xE611) volatile BYTE EP1INCFG ; // Endpoint 1-IN Configuration
+-EXTERN xdata _AT_(0xE612) volatile BYTE EP2CFG ; // Endpoint 2 Configuration
+-EXTERN xdata _AT_(0xE613) volatile BYTE EP4CFG ; // Endpoint 4 Configuration
+-EXTERN xdata _AT_(0xE614) volatile BYTE EP6CFG ; // Endpoint 6 Configuration
+-EXTERN xdata _AT_(0xE615) volatile BYTE EP8CFG ; // Endpoint 8 Configuration
+-EXTERN xdata _AT_(0xE618) volatile BYTE EP2FIFOCFG ; // Endpoint 2 FIFO configuration
+-EXTERN xdata _AT_(0xE619) volatile BYTE EP4FIFOCFG ; // Endpoint 4 FIFO configuration
+-EXTERN xdata _AT_(0xE61A) volatile BYTE EP6FIFOCFG ; // Endpoint 6 FIFO configuration
+-EXTERN xdata _AT_(0xE61B) volatile BYTE EP8FIFOCFG ; // Endpoint 8 FIFO configuration
+-EXTERN xdata _AT_(0xE620) volatile BYTE EP2AUTOINLENH ; // Endpoint 2 Packet Length H (IN only)
+-EXTERN xdata _AT_(0xE621) volatile BYTE EP2AUTOINLENL ; // Endpoint 2 Packet Length L (IN only)
+-EXTERN xdata _AT_(0xE622) volatile BYTE EP4AUTOINLENH ; // Endpoint 4 Packet Length H (IN only)
+-EXTERN xdata _AT_(0xE623) volatile BYTE EP4AUTOINLENL ; // Endpoint 4 Packet Length L (IN only)
+-EXTERN xdata _AT_(0xE624) volatile BYTE EP6AUTOINLENH ; // Endpoint 6 Packet Length H (IN only)
+-EXTERN xdata _AT_(0xE625) volatile BYTE EP6AUTOINLENL ; // Endpoint 6 Packet Length L (IN only)
+-EXTERN xdata _AT_(0xE626) volatile BYTE EP8AUTOINLENH ; // Endpoint 8 Packet Length H (IN only)
+-EXTERN xdata _AT_(0xE627) volatile BYTE EP8AUTOINLENL ; // Endpoint 8 Packet Length L (IN only)
+-EXTERN xdata _AT_(0xE630) volatile BYTE EP2FIFOPFH ; // EP2 Programmable Flag trigger H
+-EXTERN xdata _AT_(0xE631) volatile BYTE EP2FIFOPFL ; // EP2 Programmable Flag trigger L
+-EXTERN xdata _AT_(0xE632) volatile BYTE EP4FIFOPFH ; // EP4 Programmable Flag trigger H
+-EXTERN xdata _AT_(0xE633) volatile BYTE EP4FIFOPFL ; // EP4 Programmable Flag trigger L
+-EXTERN xdata _AT_(0xE634) volatile BYTE EP6FIFOPFH ; // EP6 Programmable Flag trigger H
+-EXTERN xdata _AT_(0xE635) volatile BYTE EP6FIFOPFL ; // EP6 Programmable Flag trigger L
+-EXTERN xdata _AT_(0xE636) volatile BYTE EP8FIFOPFH ; // EP8 Programmable Flag trigger H
+-EXTERN xdata _AT_(0xE637) volatile BYTE EP8FIFOPFL ; // EP8 Programmable Flag trigger L
+-EXTERN xdata _AT_(0xE640) volatile BYTE EP2ISOINPKTS ; // EP2 (if ISO) IN Packets per frame (1-3)
+-EXTERN xdata _AT_(0xE641) volatile BYTE EP4ISOINPKTS ; // EP4 (if ISO) IN Packets per frame (1-3)
+-EXTERN xdata _AT_(0xE642) volatile BYTE EP6ISOINPKTS ; // EP6 (if ISO) IN Packets per frame (1-3)
+-EXTERN xdata _AT_(0xE643) volatile BYTE EP8ISOINPKTS ; // EP8 (if ISO) IN Packets per frame (1-3)
+-EXTERN xdata _AT_(0xE648) volatile BYTE INPKTEND ; // Force IN Packet End
+-EXTERN xdata _AT_(0xE649) volatile BYTE OUTPKTEND ; // Force OUT Packet End
++EXTERN __xdata _AT_(0xE610) volatile BYTE EP1OUTCFG ; // Endpoint 1-OUT Configuration
++EXTERN __xdata _AT_(0xE611) volatile BYTE EP1INCFG ; // Endpoint 1-IN Configuration
++EXTERN __xdata _AT_(0xE612) volatile BYTE EP2CFG ; // Endpoint 2 Configuration
++EXTERN __xdata _AT_(0xE613) volatile BYTE EP4CFG ; // Endpoint 4 Configuration
++EXTERN __xdata _AT_(0xE614) volatile BYTE EP6CFG ; // Endpoint 6 Configuration
++EXTERN __xdata _AT_(0xE615) volatile BYTE EP8CFG ; // Endpoint 8 Configuration
++EXTERN __xdata _AT_(0xE618) volatile BYTE EP2FIFOCFG ; // Endpoint 2 FIFO configuration
++EXTERN __xdata _AT_(0xE619) volatile BYTE EP4FIFOCFG ; // Endpoint 4 FIFO configuration
++EXTERN __xdata _AT_(0xE61A) volatile BYTE EP6FIFOCFG ; // Endpoint 6 FIFO configuration
++EXTERN __xdata _AT_(0xE61B) volatile BYTE EP8FIFOCFG ; // Endpoint 8 FIFO configuration
++EXTERN __xdata _AT_(0xE620) volatile BYTE EP2AUTOINLENH ; // Endpoint 2 Packet Length H (IN only)
++EXTERN __xdata _AT_(0xE621) volatile BYTE EP2AUTOINLENL ; // Endpoint 2 Packet Length L (IN only)
++EXTERN __xdata _AT_(0xE622) volatile BYTE EP4AUTOINLENH ; // Endpoint 4 Packet Length H (IN only)
++EXTERN __xdata _AT_(0xE623) volatile BYTE EP4AUTOINLENL ; // Endpoint 4 Packet Length L (IN only)
++EXTERN __xdata _AT_(0xE624) volatile BYTE EP6AUTOINLENH ; // Endpoint 6 Packet Length H (IN only)
++EXTERN __xdata _AT_(0xE625) volatile BYTE EP6AUTOINLENL ; // Endpoint 6 Packet Length L (IN only)
++EXTERN __xdata _AT_(0xE626) volatile BYTE EP8AUTOINLENH ; // Endpoint 8 Packet Length H (IN only)
++EXTERN __xdata _AT_(0xE627) volatile BYTE EP8AUTOINLENL ; // Endpoint 8 Packet Length L (IN only)
++EXTERN __xdata _AT_(0xE630) volatile BYTE EP2FIFOPFH ; // EP2 Programmable Flag trigger H
++EXTERN __xdata _AT_(0xE631) volatile BYTE EP2FIFOPFL ; // EP2 Programmable Flag trigger L
++EXTERN __xdata _AT_(0xE632) volatile BYTE EP4FIFOPFH ; // EP4 Programmable Flag trigger H
++EXTERN __xdata _AT_(0xE633) volatile BYTE EP4FIFOPFL ; // EP4 Programmable Flag trigger L
++EXTERN __xdata _AT_(0xE634) volatile BYTE EP6FIFOPFH ; // EP6 Programmable Flag trigger H
++EXTERN __xdata _AT_(0xE635) volatile BYTE EP6FIFOPFL ; // EP6 Programmable Flag trigger L
++EXTERN __xdata _AT_(0xE636) volatile BYTE EP8FIFOPFH ; // EP8 Programmable Flag trigger H
++EXTERN __xdata _AT_(0xE637) volatile BYTE EP8FIFOPFL ; // EP8 Programmable Flag trigger L
++EXTERN __xdata _AT_(0xE640) volatile BYTE EP2ISOINPKTS ; // EP2 (if ISO) IN Packets per frame (1-3)
++EXTERN __xdata _AT_(0xE641) volatile BYTE EP4ISOINPKTS ; // EP4 (if ISO) IN Packets per frame (1-3)
++EXTERN __xdata _AT_(0xE642) volatile BYTE EP6ISOINPKTS ; // EP6 (if ISO) IN Packets per frame (1-3)
++EXTERN __xdata _AT_(0xE643) volatile BYTE EP8ISOINPKTS ; // EP8 (if ISO) IN Packets per frame (1-3)
++EXTERN __xdata _AT_(0xE648) volatile BYTE INPKTEND ; // Force IN Packet End
++EXTERN __xdata _AT_(0xE649) volatile BYTE OUTPKTEND ; // Force OUT Packet End
+
+ // Interrupts
+
+-EXTERN xdata _AT_(0xE650) volatile BYTE EP2FIFOIE ; // Endpoint 2 Flag Interrupt Enable
+-EXTERN xdata _AT_(0xE651) volatile BYTE EP2FIFOIRQ ; // Endpoint 2 Flag Interrupt Request
+-EXTERN xdata _AT_(0xE652) volatile BYTE EP4FIFOIE ; // Endpoint 4 Flag Interrupt Enable
+-EXTERN xdata _AT_(0xE653) volatile BYTE EP4FIFOIRQ ; // Endpoint 4 Flag Interrupt Request
+-EXTERN xdata _AT_(0xE654) volatile BYTE EP6FIFOIE ; // Endpoint 6 Flag Interrupt Enable
+-EXTERN xdata _AT_(0xE655) volatile BYTE EP6FIFOIRQ ; // Endpoint 6 Flag Interrupt Request
+-EXTERN xdata _AT_(0xE656) volatile BYTE EP8FIFOIE ; // Endpoint 8 Flag Interrupt Enable
+-EXTERN xdata _AT_(0xE657) volatile BYTE EP8FIFOIRQ ; // Endpoint 8 Flag Interrupt Request
+-EXTERN xdata _AT_(0xE658) volatile BYTE IBNIE ; // IN-BULK-NAK Interrupt Enable
+-EXTERN xdata _AT_(0xE659) volatile BYTE IBNIRQ ; // IN-BULK-NAK interrupt Request
+-EXTERN xdata _AT_(0xE65A) volatile BYTE NAKIE ; // Endpoint Ping NAK interrupt Enable
+-EXTERN xdata _AT_(0xE65B) volatile BYTE NAKIRQ ; // Endpoint Ping NAK interrupt Request
+-EXTERN xdata _AT_(0xE65C) volatile BYTE USBIE ; // USB Int Enables
+-EXTERN xdata _AT_(0xE65D) volatile BYTE USBIRQ ; // USB Interrupt Requests
+-EXTERN xdata _AT_(0xE65E) volatile BYTE EPIE ; // Endpoint Interrupt Enables
+-EXTERN xdata _AT_(0xE65F) volatile BYTE EPIRQ ; // Endpoint Interrupt Requests
+-EXTERN xdata _AT_(0xE660) volatile BYTE GPIFIE ; // GPIF Interrupt Enable
+-EXTERN xdata _AT_(0xE661) volatile BYTE GPIFIRQ ; // GPIF Interrupt Request
+-EXTERN xdata _AT_(0xE662) volatile BYTE USBERRIE ; // USB Error Interrupt Enables
+-EXTERN xdata _AT_(0xE663) volatile BYTE USBERRIRQ ; // USB Error Interrupt Requests
+-EXTERN xdata _AT_(0xE664) volatile BYTE ERRCNTLIM ; // USB Error counter and limit
+-EXTERN xdata _AT_(0xE665) volatile BYTE CLRERRCNT ; // Clear Error Counter EC[3..0]
+-EXTERN xdata _AT_(0xE666) volatile BYTE INT2IVEC ; // Interupt 2 (USB) Autovector
+-EXTERN xdata _AT_(0xE667) volatile BYTE INT4IVEC ; // Interupt 4 (FIFOS & GPIF) Autovector
+-EXTERN xdata _AT_(0xE668) volatile BYTE INTSETUP ; // Interrupt 2&4 Setup
++EXTERN __xdata _AT_(0xE650) volatile BYTE EP2FIFOIE ; // Endpoint 2 Flag Interrupt Enable
++EXTERN __xdata _AT_(0xE651) volatile BYTE EP2FIFOIRQ ; // Endpoint 2 Flag Interrupt Request
++EXTERN __xdata _AT_(0xE652) volatile BYTE EP4FIFOIE ; // Endpoint 4 Flag Interrupt Enable
++EXTERN __xdata _AT_(0xE653) volatile BYTE EP4FIFOIRQ ; // Endpoint 4 Flag Interrupt Request
++EXTERN __xdata _AT_(0xE654) volatile BYTE EP6FIFOIE ; // Endpoint 6 Flag Interrupt Enable
++EXTERN __xdata _AT_(0xE655) volatile BYTE EP6FIFOIRQ ; // Endpoint 6 Flag Interrupt Request
++EXTERN __xdata _AT_(0xE656) volatile BYTE EP8FIFOIE ; // Endpoint 8 Flag Interrupt Enable
++EXTERN __xdata _AT_(0xE657) volatile BYTE EP8FIFOIRQ ; // Endpoint 8 Flag Interrupt Request
++EXTERN __xdata _AT_(0xE658) volatile BYTE IBNIE ; // IN-BULK-NAK Interrupt Enable
++EXTERN __xdata _AT_(0xE659) volatile BYTE IBNIRQ ; // IN-BULK-NAK interrupt Request
++EXTERN __xdata _AT_(0xE65A) volatile BYTE NAKIE ; // Endpoint Ping NAK interrupt Enable
++EXTERN __xdata _AT_(0xE65B) volatile BYTE NAKIRQ ; // Endpoint Ping NAK interrupt Request
++EXTERN __xdata _AT_(0xE65C) volatile BYTE USBIE ; // USB Int Enables
++EXTERN __xdata _AT_(0xE65D) volatile BYTE USBIRQ ; // USB Interrupt Requests
++EXTERN __xdata _AT_(0xE65E) volatile BYTE EPIE ; // Endpoint Interrupt Enables
++EXTERN __xdata _AT_(0xE65F) volatile BYTE EPIRQ ; // Endpoint Interrupt Requests
++EXTERN __xdata _AT_(0xE660) volatile BYTE GPIFIE ; // GPIF Interrupt Enable
++EXTERN __xdata _AT_(0xE661) volatile BYTE GPIFIRQ ; // GPIF Interrupt Request
++EXTERN __xdata _AT_(0xE662) volatile BYTE USBERRIE ; // USB Error Interrupt Enables
++EXTERN __xdata _AT_(0xE663) volatile BYTE USBERRIRQ ; // USB Error Interrupt Requests
++EXTERN __xdata _AT_(0xE664) volatile BYTE ERRCNTLIM ; // USB Error counter and limit
++EXTERN __xdata _AT_(0xE665) volatile BYTE CLRERRCNT ; // Clear Error Counter EC[3..0]
++EXTERN __xdata _AT_(0xE666) volatile BYTE INT2IVEC ; // Interupt 2 (USB) Autovector
++EXTERN __xdata _AT_(0xE667) volatile BYTE INT4IVEC ; // Interupt 4 (FIFOS & GPIF) Autovector
++EXTERN __xdata _AT_(0xE668) volatile BYTE INTSETUP ; // Interrupt 2&4 Setup
+
+ // Input/Output
+
+-EXTERN xdata _AT_(0xE670) volatile BYTE PORTACFG ; // I/O PORTA Alternate Configuration
+-EXTERN xdata _AT_(0xE671) volatile BYTE PORTCCFG ; // I/O PORTC Alternate Configuration
+-EXTERN xdata _AT_(0xE672) volatile BYTE PORTECFG ; // I/O PORTE Alternate Configuration
+-EXTERN xdata _AT_(0xE678) volatile BYTE I2CS ; // Control & Status
+-EXTERN xdata _AT_(0xE679) volatile BYTE I2DAT ; // Data
+-EXTERN xdata _AT_(0xE67A) volatile BYTE I2CTL ; // I2C Control
+-EXTERN xdata _AT_(0xE67B) volatile BYTE XAUTODAT1 ; // Autoptr1 MOVX access
+-EXTERN xdata _AT_(0xE67C) volatile BYTE XAUTODAT2 ; // Autoptr2 MOVX access
++EXTERN __xdata _AT_(0xE670) volatile BYTE PORTACFG ; // I/O PORTA Alternate Configuration
++EXTERN __xdata _AT_(0xE671) volatile BYTE PORTCCFG ; // I/O PORTC Alternate Configuration
++EXTERN __xdata _AT_(0xE672) volatile BYTE PORTECFG ; // I/O PORTE Alternate Configuration
++EXTERN __xdata _AT_(0xE678) volatile BYTE I2CS ; // Control & Status
++EXTERN __xdata _AT_(0xE679) volatile BYTE I2DAT ; // Data
++EXTERN __xdata _AT_(0xE67A) volatile BYTE I2CTL ; // I2C Control
++EXTERN __xdata _AT_(0xE67B) volatile BYTE XAUTODAT1 ; // Autoptr1 MOVX access
++EXTERN __xdata _AT_(0xE67C) volatile BYTE XAUTODAT2 ; // Autoptr2 MOVX access
+
+ #define EXTAUTODAT1 XAUTODAT1
+ #define EXTAUTODAT2 XAUTODAT2
+
+ // USB Control
+
+-EXTERN xdata _AT_(0xE680) volatile BYTE USBCS ; // USB Control & Status
+-EXTERN xdata _AT_(0xE681) volatile BYTE SUSPEND ; // Put chip into suspend
+-EXTERN xdata _AT_(0xE682) volatile BYTE WAKEUPCS ; // Wakeup source and polarity
+-EXTERN xdata _AT_(0xE683) volatile BYTE TOGCTL ; // Toggle Control
+-EXTERN xdata _AT_(0xE684) volatile BYTE USBFRAMEH ; // USB Frame count H
+-EXTERN xdata _AT_(0xE685) volatile BYTE USBFRAMEL ; // USB Frame count L
+-EXTERN xdata _AT_(0xE686) volatile BYTE MICROFRAME ; // Microframe count, 0-7
+-EXTERN xdata _AT_(0xE687) volatile BYTE FNADDR ; // USB Function address
++EXTERN __xdata _AT_(0xE680) volatile BYTE USBCS ; // USB Control & Status
++EXTERN __xdata _AT_(0xE681) volatile BYTE SUSPEND ; // Put chip into suspend
++EXTERN __xdata _AT_(0xE682) volatile BYTE WAKEUPCS ; // Wakeup source and polarity
++EXTERN __xdata _AT_(0xE683) volatile BYTE TOGCTL ; // Toggle Control
++EXTERN __xdata _AT_(0xE684) volatile BYTE USBFRAMEH ; // USB Frame count H
++EXTERN __xdata _AT_(0xE685) volatile BYTE USBFRAMEL ; // USB Frame count L
++EXTERN __xdata _AT_(0xE686) volatile BYTE MICROFRAME ; // Microframe count, 0-7
++EXTERN __xdata _AT_(0xE687) volatile BYTE FNADDR ; // USB Function address
+
+ // Endpoints
+
+-EXTERN xdata _AT_(0xE68A) volatile BYTE EP0BCH ; // Endpoint 0 Byte Count H
+-EXTERN xdata _AT_(0xE68B) volatile BYTE EP0BCL ; // Endpoint 0 Byte Count L
+-EXTERN xdata _AT_(0xE68D) volatile BYTE EP1OUTBC ; // Endpoint 1 OUT Byte Count
+-EXTERN xdata _AT_(0xE68F) volatile BYTE EP1INBC ; // Endpoint 1 IN Byte Count
+-EXTERN xdata _AT_(0xE690) volatile BYTE EP2BCH ; // Endpoint 2 Byte Count H
+-EXTERN xdata _AT_(0xE691) volatile BYTE EP2BCL ; // Endpoint 2 Byte Count L
+-EXTERN xdata _AT_(0xE694) volatile BYTE EP4BCH ; // Endpoint 4 Byte Count H
+-EXTERN xdata _AT_(0xE695) volatile BYTE EP4BCL ; // Endpoint 4 Byte Count L
+-EXTERN xdata _AT_(0xE698) volatile BYTE EP6BCH ; // Endpoint 6 Byte Count H
+-EXTERN xdata _AT_(0xE699) volatile BYTE EP6BCL ; // Endpoint 6 Byte Count L
+-EXTERN xdata _AT_(0xE69C) volatile BYTE EP8BCH ; // Endpoint 8 Byte Count H
+-EXTERN xdata _AT_(0xE69D) volatile BYTE EP8BCL ; // Endpoint 8 Byte Count L
+-EXTERN xdata _AT_(0xE6A0) volatile BYTE EP0CS ; // Endpoint Control and Status
+-EXTERN xdata _AT_(0xE6A1) volatile BYTE EP1OUTCS ; // Endpoint 1 OUT Control and Status
+-EXTERN xdata _AT_(0xE6A2) volatile BYTE EP1INCS ; // Endpoint 1 IN Control and Status
+-EXTERN xdata _AT_(0xE6A3) volatile BYTE EP2CS ; // Endpoint 2 Control and Status
+-EXTERN xdata _AT_(0xE6A4) volatile BYTE EP4CS ; // Endpoint 4 Control and Status
+-EXTERN xdata _AT_(0xE6A5) volatile BYTE EP6CS ; // Endpoint 6 Control and Status
+-EXTERN xdata _AT_(0xE6A6) volatile BYTE EP8CS ; // Endpoint 8 Control and Status
+-EXTERN xdata _AT_(0xE6A7) volatile BYTE EP2FIFOFLGS ; // Endpoint 2 Flags
+-EXTERN xdata _AT_(0xE6A8) volatile BYTE EP4FIFOFLGS ; // Endpoint 4 Flags
+-EXTERN xdata _AT_(0xE6A9) volatile BYTE EP6FIFOFLGS ; // Endpoint 6 Flags
+-EXTERN xdata _AT_(0xE6AA) volatile BYTE EP8FIFOFLGS ; // Endpoint 8 Flags
+-EXTERN xdata _AT_(0xE6AB) volatile BYTE EP2FIFOBCH ; // EP2 FIFO total byte count H
+-EXTERN xdata _AT_(0xE6AC) volatile BYTE EP2FIFOBCL ; // EP2 FIFO total byte count L
+-EXTERN xdata _AT_(0xE6AD) volatile BYTE EP4FIFOBCH ; // EP4 FIFO total byte count H
+-EXTERN xdata _AT_(0xE6AE) volatile BYTE EP4FIFOBCL ; // EP4 FIFO total byte count L
+-EXTERN xdata _AT_(0xE6AF) volatile BYTE EP6FIFOBCH ; // EP6 FIFO total byte count H
+-EXTERN xdata _AT_(0xE6B0) volatile BYTE EP6FIFOBCL ; // EP6 FIFO total byte count L
+-EXTERN xdata _AT_(0xE6B1) volatile BYTE EP8FIFOBCH ; // EP8 FIFO total byte count H
+-EXTERN xdata _AT_(0xE6B2) volatile BYTE EP8FIFOBCL ; // EP8 FIFO total byte count L
+-EXTERN xdata _AT_(0xE6B3) volatile BYTE SUDPTRH ; // Setup Data Pointer high address byte
+-EXTERN xdata _AT_(0xE6B4) volatile BYTE SUDPTRL ; // Setup Data Pointer low address byte
+-EXTERN xdata _AT_(0xE6B5) volatile BYTE SUDPTRCTL ; // Setup Data Pointer Auto Mode
+-EXTERN xdata _AT_(0xE6B8) volatile BYTE SETUPDAT[8] ; // 8 bytes of SETUP data
++EXTERN __xdata _AT_(0xE68A) volatile BYTE EP0BCH ; // Endpoint 0 Byte Count H
++EXTERN __xdata _AT_(0xE68B) volatile BYTE EP0BCL ; // Endpoint 0 Byte Count L
++EXTERN __xdata _AT_(0xE68D) volatile BYTE EP1OUTBC ; // Endpoint 1 OUT Byte Count
++EXTERN __xdata _AT_(0xE68F) volatile BYTE EP1INBC ; // Endpoint 1 IN Byte Count
++EXTERN __xdata _AT_(0xE690) volatile BYTE EP2BCH ; // Endpoint 2 Byte Count H
++EXTERN __xdata _AT_(0xE691) volatile BYTE EP2BCL ; // Endpoint 2 Byte Count L
++EXTERN __xdata _AT_(0xE694) volatile BYTE EP4BCH ; // Endpoint 4 Byte Count H
++EXTERN __xdata _AT_(0xE695) volatile BYTE EP4BCL ; // Endpoint 4 Byte Count L
++EXTERN __xdata _AT_(0xE698) volatile BYTE EP6BCH ; // Endpoint 6 Byte Count H
++EXTERN __xdata _AT_(0xE699) volatile BYTE EP6BCL ; // Endpoint 6 Byte Count L
++EXTERN __xdata _AT_(0xE69C) volatile BYTE EP8BCH ; // Endpoint 8 Byte Count H
++EXTERN __xdata _AT_(0xE69D) volatile BYTE EP8BCL ; // Endpoint 8 Byte Count L
++EXTERN __xdata _AT_(0xE6A0) volatile BYTE EP0CS ; // Endpoint Control and Status
++EXTERN __xdata _AT_(0xE6A1) volatile BYTE EP1OUTCS ; // Endpoint 1 OUT Control and Status
++EXTERN __xdata _AT_(0xE6A2) volatile BYTE EP1INCS ; // Endpoint 1 IN Control and Status
++EXTERN __xdata _AT_(0xE6A3) volatile BYTE EP2CS ; // Endpoint 2 Control and Status
++EXTERN __xdata _AT_(0xE6A4) volatile BYTE EP4CS ; // Endpoint 4 Control and Status
++EXTERN __xdata _AT_(0xE6A5) volatile BYTE EP6CS ; // Endpoint 6 Control and Status
++EXTERN __xdata _AT_(0xE6A6) volatile BYTE EP8CS ; // Endpoint 8 Control and Status
++EXTERN __xdata _AT_(0xE6A7) volatile BYTE EP2FIFOFLGS ; // Endpoint 2 Flags
++EXTERN __xdata _AT_(0xE6A8) volatile BYTE EP4FIFOFLGS ; // Endpoint 4 Flags
++EXTERN __xdata _AT_(0xE6A9) volatile BYTE EP6FIFOFLGS ; // Endpoint 6 Flags
++EXTERN __xdata _AT_(0xE6AA) volatile BYTE EP8FIFOFLGS ; // Endpoint 8 Flags
++EXTERN __xdata _AT_(0xE6AB) volatile BYTE EP2FIFOBCH ; // EP2 FIFO total byte count H
++EXTERN __xdata _AT_(0xE6AC) volatile BYTE EP2FIFOBCL ; // EP2 FIFO total byte count L
++EXTERN __xdata _AT_(0xE6AD) volatile BYTE EP4FIFOBCH ; // EP4 FIFO total byte count H
++EXTERN __xdata _AT_(0xE6AE) volatile BYTE EP4FIFOBCL ; // EP4 FIFO total byte count L
++EXTERN __xdata _AT_(0xE6AF) volatile BYTE EP6FIFOBCH ; // EP6 FIFO total byte count H
++EXTERN __xdata _AT_(0xE6B0) volatile BYTE EP6FIFOBCL ; // EP6 FIFO total byte count L
++EXTERN __xdata _AT_(0xE6B1) volatile BYTE EP8FIFOBCH ; // EP8 FIFO total byte count H
++EXTERN __xdata _AT_(0xE6B2) volatile BYTE EP8FIFOBCL ; // EP8 FIFO total byte count L
++EXTERN __xdata _AT_(0xE6B3) volatile BYTE SUDPTRH ; // Setup Data Pointer high address byte
++EXTERN __xdata _AT_(0xE6B4) volatile BYTE SUDPTRL ; // Setup Data Pointer low address byte
++EXTERN __xdata _AT_(0xE6B5) volatile BYTE SUDPTRCTL ; // Setup Data Pointer Auto Mode
++EXTERN __xdata _AT_(0xE6B8) volatile BYTE SETUPDAT[8] ; // 8 bytes of SETUP data
+
+ // GPIF
+
+-EXTERN xdata _AT_(0xE6C0) volatile BYTE GPIFWFSELECT ; // Waveform Selector
+-EXTERN xdata _AT_(0xE6C1) volatile BYTE GPIFIDLECS ; // GPIF Done, GPIF IDLE drive mode
+-EXTERN xdata _AT_(0xE6C2) volatile BYTE GPIFIDLECTL ; // Inactive Bus, CTL states
+-EXTERN xdata _AT_(0xE6C3) volatile BYTE GPIFCTLCFG ; // CTL OUT pin drive
+-EXTERN xdata _AT_(0xE6C4) volatile BYTE GPIFADRH ; // GPIF Address H
+-EXTERN xdata _AT_(0xE6C5) volatile BYTE GPIFADRL ; // GPIF Address L
+-
+-EXTERN xdata _AT_(0xE6CE) volatile BYTE GPIFTCB3 ; // GPIF Transaction Count Byte 3
+-EXTERN xdata _AT_(0xE6CF) volatile BYTE GPIFTCB2 ; // GPIF Transaction Count Byte 2
+-EXTERN xdata _AT_(0xE6D0) volatile BYTE GPIFTCB1 ; // GPIF Transaction Count Byte 1
+-EXTERN xdata _AT_(0xE6D1) volatile BYTE GPIFTCB0 ; // GPIF Transaction Count Byte 0
++EXTERN __xdata _AT_(0xE6C0) volatile BYTE GPIFWFSELECT ; // Waveform Selector
++EXTERN __xdata _AT_(0xE6C1) volatile BYTE GPIFIDLECS ; // GPIF Done, GPIF IDLE drive mode
++EXTERN __xdata _AT_(0xE6C2) volatile BYTE GPIFIDLECTL ; // Inactive Bus, CTL states
++EXTERN __xdata _AT_(0xE6C3) volatile BYTE GPIFCTLCFG ; // CTL OUT pin drive
++EXTERN __xdata _AT_(0xE6C4) volatile BYTE GPIFADRH ; // GPIF Address H
++EXTERN __xdata _AT_(0xE6C5) volatile BYTE GPIFADRL ; // GPIF Address L
++
++EXTERN __xdata _AT_(0xE6CE) volatile BYTE GPIFTCB3 ; // GPIF Transaction Count Byte 3
++EXTERN __xdata _AT_(0xE6CF) volatile BYTE GPIFTCB2 ; // GPIF Transaction Count Byte 2
++EXTERN __xdata _AT_(0xE6D0) volatile BYTE GPIFTCB1 ; // GPIF Transaction Count Byte 1
++EXTERN __xdata _AT_(0xE6D1) volatile BYTE GPIFTCB0 ; // GPIF Transaction Count Byte 0
+
+ #define EP2GPIFTCH GPIFTCB1 // these are here for backwards compatibility
+ #define EP2GPIFTCL GPIFTCB0 // before REVE silicon (ie. REVB and REVD)
+@@ -239,68 +243,68 @@
+ #define EP8GPIFTCH GPIFTCB1 // these are here for backwards compatibility
+ #define EP8GPIFTCL GPIFTCB0 // before REVE silicon (ie. REVB and REVD)
+
+-// EXTERN xdata volatile BYTE EP2GPIFTCH _AT_ 0xE6D0; // EP2 GPIF Transaction Count High
+-// EXTERN xdata volatile BYTE EP2GPIFTCL _AT_ 0xE6D1; // EP2 GPIF Transaction Count Low
+-EXTERN xdata _AT_(0xE6D2) volatile BYTE EP2GPIFFLGSEL ; // EP2 GPIF Flag select
+-EXTERN xdata _AT_(0xE6D3) volatile BYTE EP2GPIFPFSTOP ; // Stop GPIF EP2 transaction on prog. flag
+-EXTERN xdata _AT_(0xE6D4) volatile BYTE EP2GPIFTRIG ; // EP2 FIFO Trigger
+-// EXTERN xdata volatile BYTE EP4GPIFTCH _AT_ 0xE6D8; // EP4 GPIF Transaction Count High
+-// EXTERN xdata volatile BYTE EP4GPIFTCL _AT_ 0xE6D9; // EP4 GPIF Transactionr Count Low
+-EXTERN xdata _AT_(0xE6DA) volatile BYTE EP4GPIFFLGSEL ; // EP4 GPIF Flag select
+-EXTERN xdata _AT_(0xE6DB) volatile BYTE EP4GPIFPFSTOP ; // Stop GPIF EP4 transaction on prog. flag
+-EXTERN xdata _AT_(0xE6DC) volatile BYTE EP4GPIFTRIG ; // EP4 FIFO Trigger
+-// EXTERN xdata volatile BYTE EP6GPIFTCH _AT_ 0xE6E0; // EP6 GPIF Transaction Count High
+-// EXTERN xdata volatile BYTE EP6GPIFTCL _AT_ 0xE6E1; // EP6 GPIF Transaction Count Low
+-EXTERN xdata _AT_(0xE6E2) volatile BYTE EP6GPIFFLGSEL ; // EP6 GPIF Flag select
+-EXTERN xdata _AT_(0xE6E3) volatile BYTE EP6GPIFPFSTOP ; // Stop GPIF EP6 transaction on prog. flag
+-EXTERN xdata _AT_(0xE6E4) volatile BYTE EP6GPIFTRIG ; // EP6 FIFO Trigger
+-// EXTERN xdata volatile BYTE EP8GPIFTCH _AT_ 0xE6E8; // EP8 GPIF Transaction Count High
+-// EXTERN xdata volatile BYTE EP8GPIFTCL _AT_ 0xE6E9; // EP8GPIF Transaction Count Low
+-EXTERN xdata _AT_(0xE6EA) volatile BYTE EP8GPIFFLGSEL ; // EP8 GPIF Flag select
+-EXTERN xdata _AT_(0xE6EB) volatile BYTE EP8GPIFPFSTOP ; // Stop GPIF EP8 transaction on prog. flag
+-EXTERN xdata _AT_(0xE6EC) volatile BYTE EP8GPIFTRIG ; // EP8 FIFO Trigger
+-EXTERN xdata _AT_(0xE6F0) volatile BYTE XGPIFSGLDATH ; // GPIF Data H (16-bit mode only)
+-EXTERN xdata _AT_(0xE6F1) volatile BYTE XGPIFSGLDATLX ; // Read/Write GPIF Data L & trigger transac
+-EXTERN xdata _AT_(0xE6F2) volatile BYTE XGPIFSGLDATLNOX ; // Read GPIF Data L, no transac trigger
+-EXTERN xdata _AT_(0xE6F3) volatile BYTE GPIFREADYCFG ; // Internal RDY,Sync/Async, RDY5CFG
+-EXTERN xdata _AT_(0xE6F4) volatile BYTE GPIFREADYSTAT ; // RDY pin states
+-EXTERN xdata _AT_(0xE6F5) volatile BYTE GPIFABORT ; // Abort GPIF cycles
++// EXTERN __xdata volatile BYTE EP2GPIFTCH _AT_ 0xE6D0; // EP2 GPIF Transaction Count High
++// EXTERN __xdata volatile BYTE EP2GPIFTCL _AT_ 0xE6D1; // EP2 GPIF Transaction Count Low
++EXTERN __xdata _AT_(0xE6D2) volatile BYTE EP2GPIFFLGSEL ; // EP2 GPIF Flag select
++EXTERN __xdata _AT_(0xE6D3) volatile BYTE EP2GPIFPFSTOP ; // Stop GPIF EP2 transaction on prog. flag
++EXTERN __xdata _AT_(0xE6D4) volatile BYTE EP2GPIFTRIG ; // EP2 FIFO Trigger
++// EXTERN __xdata volatile BYTE EP4GPIFTCH _AT_ 0xE6D8; // EP4 GPIF Transaction Count High
++// EXTERN __xdata volatile BYTE EP4GPIFTCL _AT_ 0xE6D9; // EP4 GPIF Transactionr Count Low
++EXTERN __xdata _AT_(0xE6DA) volatile BYTE EP4GPIFFLGSEL ; // EP4 GPIF Flag select
++EXTERN __xdata _AT_(0xE6DB) volatile BYTE EP4GPIFPFSTOP ; // Stop GPIF EP4 transaction on prog. flag
++EXTERN __xdata _AT_(0xE6DC) volatile BYTE EP4GPIFTRIG ; // EP4 FIFO Trigger
++// EXTERN __xdata volatile BYTE EP6GPIFTCH _AT_ 0xE6E0; // EP6 GPIF Transaction Count High
++// EXTERN __xdata volatile BYTE EP6GPIFTCL _AT_ 0xE6E1; // EP6 GPIF Transaction Count Low
++EXTERN __xdata _AT_(0xE6E2) volatile BYTE EP6GPIFFLGSEL ; // EP6 GPIF Flag select
++EXTERN __xdata _AT_(0xE6E3) volatile BYTE EP6GPIFPFSTOP ; // Stop GPIF EP6 transaction on prog. flag
++EXTERN __xdata _AT_(0xE6E4) volatile BYTE EP6GPIFTRIG ; // EP6 FIFO Trigger
++// EXTERN __xdata volatile BYTE EP8GPIFTCH _AT_ 0xE6E8; // EP8 GPIF Transaction Count High
++// EXTERN __xdata volatile BYTE EP8GPIFTCL _AT_ 0xE6E9; // EP8GPIF Transaction Count Low
++EXTERN __xdata _AT_(0xE6EA) volatile BYTE EP8GPIFFLGSEL ; // EP8 GPIF Flag select
++EXTERN __xdata _AT_(0xE6EB) volatile BYTE EP8GPIFPFSTOP ; // Stop GPIF EP8 transaction on prog. flag
++EXTERN __xdata _AT_(0xE6EC) volatile BYTE EP8GPIFTRIG ; // EP8 FIFO Trigger
++EXTERN __xdata _AT_(0xE6F0) volatile BYTE XGPIFSGLDATH ; // GPIF Data H (16-bit mode only)
++EXTERN __xdata _AT_(0xE6F1) volatile BYTE XGPIFSGLDATLX ; // Read/Write GPIF Data L & trigger transac
++EXTERN __xdata _AT_(0xE6F2) volatile BYTE XGPIFSGLDATLNOX ; // Read GPIF Data L, no transac trigger
++EXTERN __xdata _AT_(0xE6F3) volatile BYTE GPIFREADYCFG ; // Internal RDY,Sync/Async, RDY5CFG
++EXTERN __xdata _AT_(0xE6F4) volatile BYTE GPIFREADYSTAT ; // RDY pin states
++EXTERN __xdata _AT_(0xE6F5) volatile BYTE GPIFABORT ; // Abort GPIF cycles
+
+ // UDMA
+
+-EXTERN xdata _AT_(0xE6C6) volatile BYTE FLOWSTATE ; //Defines GPIF flow state
+-EXTERN xdata _AT_(0xE6C7) volatile BYTE FLOWLOGIC ; //Defines flow/hold decision criteria
+-EXTERN xdata _AT_(0xE6C8) volatile BYTE FLOWEQ0CTL ; //CTL states during active flow state
+-EXTERN xdata _AT_(0xE6C9) volatile BYTE FLOWEQ1CTL ; //CTL states during hold flow state
+-EXTERN xdata _AT_(0xE6CA) volatile BYTE FLOWHOLDOFF ;
+-EXTERN xdata _AT_(0xE6CB) volatile BYTE FLOWSTB ; //CTL/RDY Signal to use as master data strobe
+-EXTERN xdata _AT_(0xE6CC) volatile BYTE FLOWSTBEDGE ; //Defines active master strobe edge
+-EXTERN xdata _AT_(0xE6CD) volatile BYTE FLOWSTBHPERIOD ; //Half Period of output master strobe
+-EXTERN xdata _AT_(0xE60C) volatile BYTE GPIFHOLDAMOUNT ; //Data delay shift
+-EXTERN xdata _AT_(0xE67D) volatile BYTE UDMACRCH ; //CRC Upper byte
+-EXTERN xdata _AT_(0xE67E) volatile BYTE UDMACRCL ; //CRC Lower byte
+-EXTERN xdata _AT_(0xE67F) volatile BYTE UDMACRCQUAL ; //UDMA In only, host terminated use only
++EXTERN __xdata _AT_(0xE6C6) volatile BYTE FLOWSTATE ; //Defines GPIF flow state
++EXTERN __xdata _AT_(0xE6C7) volatile BYTE FLOWLOGIC ; //Defines flow/hold decision criteria
++EXTERN __xdata _AT_(0xE6C8) volatile BYTE FLOWEQ0CTL ; //CTL states during active flow state
++EXTERN __xdata _AT_(0xE6C9) volatile BYTE FLOWEQ1CTL ; //CTL states during hold flow state
++EXTERN __xdata _AT_(0xE6CA) volatile BYTE FLOWHOLDOFF ;
++EXTERN __xdata _AT_(0xE6CB) volatile BYTE FLOWSTB ; //CTL/RDY Signal to use as master data strobe
++EXTERN __xdata _AT_(0xE6CC) volatile BYTE FLOWSTBEDGE ; //Defines active master strobe edge
++EXTERN __xdata _AT_(0xE6CD) volatile BYTE FLOWSTBHPERIOD ; //Half Period of output master strobe
++EXTERN __xdata _AT_(0xE60C) volatile BYTE GPIFHOLDAMOUNT ; //Data delay shift
++EXTERN __xdata _AT_(0xE67D) volatile BYTE UDMACRCH ; //CRC Upper byte
++EXTERN __xdata _AT_(0xE67E) volatile BYTE UDMACRCL ; //CRC Lower byte
++EXTERN __xdata _AT_(0xE67F) volatile BYTE UDMACRCQUAL ; //UDMA In only, host terminated use only
+
+
+ // Debug/Test
+
+-EXTERN xdata _AT_(0xE6F8) volatile BYTE DBUG ; // Debug
+-EXTERN xdata _AT_(0xE6F9) volatile BYTE TESTCFG ; // Test configuration
+-EXTERN xdata _AT_(0xE6FA) volatile BYTE USBTEST ; // USB Test Modes
+-EXTERN xdata _AT_(0xE6FB) volatile BYTE CT1 ; // Chirp Test--Override
+-EXTERN xdata _AT_(0xE6FC) volatile BYTE CT2 ; // Chirp Test--FSM
+-EXTERN xdata _AT_(0xE6FD) volatile BYTE CT3 ; // Chirp Test--Control Signals
+-EXTERN xdata _AT_(0xE6FE) volatile BYTE CT4 ; // Chirp Test--Inputs
++EXTERN __xdata _AT_(0xE6F8) volatile BYTE DBUG ; // Debug
++EXTERN __xdata _AT_(0xE6F9) volatile BYTE TESTCFG ; // Test configuration
++EXTERN __xdata _AT_(0xE6FA) volatile BYTE USBTEST ; // USB Test Modes
++EXTERN __xdata _AT_(0xE6FB) volatile BYTE CT1 ; // Chirp Test--Override
++EXTERN __xdata _AT_(0xE6FC) volatile BYTE CT2 ; // Chirp Test--FSM
++EXTERN __xdata _AT_(0xE6FD) volatile BYTE CT3 ; // Chirp Test--Control Signals
++EXTERN __xdata _AT_(0xE6FE) volatile BYTE CT4 ; // Chirp Test--Inputs
+
+ // Endpoint Buffers
+
+-EXTERN xdata _AT_(0xE740) volatile BYTE EP0BUF[64] ; // EP0 IN-OUT buffer
+-EXTERN xdata _AT_(0xE780) volatile BYTE EP1OUTBUF[64] ; // EP1-OUT buffer
+-EXTERN xdata _AT_(0xE7C0) volatile BYTE EP1INBUF[64] ; // EP1-IN buffer
+-EXTERN xdata _AT_(0xF000) volatile BYTE EP2FIFOBUF[1024] ; // 512/1024-byte EP2 buffer (IN or OUT)
+-EXTERN xdata _AT_(0xF400) volatile BYTE EP4FIFOBUF[1024] ; // 512 byte EP4 buffer (IN or OUT)
+-EXTERN xdata _AT_(0xF800) volatile BYTE EP6FIFOBUF[1024] ; // 512/1024-byte EP6 buffer (IN or OUT)
+-EXTERN xdata _AT_(0xFC00) volatile BYTE EP8FIFOBUF[1024] ; // 512 byte EP8 buffer (IN or OUT)
++EXTERN __xdata _AT_(0xE740) volatile BYTE EP0BUF[64] ; // EP0 IN-OUT buffer
++EXTERN __xdata _AT_(0xE780) volatile BYTE EP1OUTBUF[64] ; // EP1-OUT buffer
++EXTERN __xdata _AT_(0xE7C0) volatile BYTE EP1INBUF[64] ; // EP1-IN buffer
++EXTERN __xdata _AT_(0xF000) volatile BYTE EP2FIFOBUF[1024] ; // 512/1024-byte EP2 buffer (IN or OUT)
++EXTERN __xdata _AT_(0xF400) volatile BYTE EP4FIFOBUF[1024] ; // 512 byte EP4 buffer (IN or OUT)
++EXTERN __xdata _AT_(0xF800) volatile BYTE EP6FIFOBUF[1024] ; // 512/1024-byte EP6 buffer (IN or OUT)
++EXTERN __xdata _AT_(0xFC00) volatile BYTE EP8FIFOBUF[1024] ; // 512 byte EP8 buffer (IN or OUT)
+
+ #undef EXTERN
+ #undef _AT_
diff --git a/comms/gnuradio/files/patch-usrp_firmware_include_i2c.h b/comms/gnuradio/files/patch-usrp_firmware_include_i2c.h
new file mode 100644
index 000000000000..78953f4db99d
--- /dev/null
+++ b/comms/gnuradio/files/patch-usrp_firmware_include_i2c.h
@@ -0,0 +1,14 @@
+--- usrp/firmware/include/i2c.h.orig 2012-10-03 18:58:56.000000000 -0500
++++ usrp/firmware/include/i2c.h 2012-10-03 19:13:39.000000000 -0500
+@@ -24,9 +24,9 @@
+ #define _I2C_H_
+
+ // returns non-zero if successful, else 0
+-unsigned char i2c_read (unsigned char addr, xdata unsigned char *buf, unsigned char len);
++unsigned char i2c_read (unsigned char addr, __xdata unsigned char *buf, unsigned char len);
+
+ // returns non-zero if successful, else 0
+-unsigned char i2c_write (unsigned char addr, xdata const unsigned char *buf, unsigned char len);
++unsigned char i2c_write (unsigned char addr, __xdata const unsigned char *buf, unsigned char len);
+
+ #endif /* _I2C_H_ */
diff --git a/comms/gnuradio/files/patch-usrp_firmware_include_syncdelay.h b/comms/gnuradio/files/patch-usrp_firmware_include_syncdelay.h
new file mode 100644
index 000000000000..5e646fbd3fdc
--- /dev/null
+++ b/comms/gnuradio/files/patch-usrp_firmware_include_syncdelay.h
@@ -0,0 +1,13 @@
+--- usrp/firmware/include/syncdelay.h.orig 2012-10-03 19:01:59.000000000 -0500
++++ usrp/firmware/include/syncdelay.h 2012-10-03 19:04:30.000000000 -0500
+@@ -58,8 +58,8 @@
+ /*
+ * FIXME ensure that the peep hole optimizer isn't screwing us
+ */
+-#define SYNCDELAY _asm nop; nop; nop; _endasm
+-#define NOP _asm nop; _endasm
++#define SYNCDELAY __asm nop; nop; nop; __endasm
++#define NOP __asm nop; __endasm
+
+
+ #endif /* _SYNCDELAY_H_ */
diff --git a/comms/gnuradio/files/patch-usrp_firmware_include_usb_common.h b/comms/gnuradio/files/patch-usrp_firmware_include_usb_common.h
new file mode 100644
index 000000000000..1dbb000e0165
--- /dev/null
+++ b/comms/gnuradio/files/patch-usrp_firmware_include_usb_common.h
@@ -0,0 +1,11 @@
+--- usrp/firmware/include/usb_common.h.orig 2012-10-03 19:05:29.000000000 -0500
++++ usrp/firmware/include/usb_common.h 2012-10-03 19:05:52.000000000 -0500
+@@ -23,7 +23,7 @@
+ #ifndef _USB_COMMON_H_
+ #define _USB_COMMON_H_
+
+-extern volatile bit _usb_got_SUDAV;
++extern volatile __bit _usb_got_SUDAV;
+
+ // Provided by user application to handle VENDOR commands.
+ // returns non-zero if it handled the command.
diff --git a/comms/gnuradio/files/patch-usrp_firmware_include_usb_descriptors.h b/comms/gnuradio/files/patch-usrp_firmware_include_usb_descriptors.h
new file mode 100644
index 000000000000..b8c8d4dca47e
--- /dev/null
+++ b/comms/gnuradio/files/patch-usrp_firmware_include_usb_descriptors.h
@@ -0,0 +1,36 @@
+--- usrp/firmware/include/usb_descriptors.h.orig 2012-10-03 19:25:49.000000000 -0500
++++ usrp/firmware/include/usb_descriptors.h 2012-10-03 19:26:47.000000000 -0500
+@@ -20,21 +20,21 @@
+ * Boston, MA 02110-1301, USA.
+ */
+
+-extern xdata const char high_speed_device_descr[];
+-extern xdata const char high_speed_devqual_descr[];
+-extern xdata const char high_speed_config_descr[];
++extern __xdata const char high_speed_device_descr[];
++extern __xdata const char high_speed_devqual_descr[];
++extern __xdata const char high_speed_config_descr[];
+
+-extern xdata const char full_speed_device_descr[];
+-extern xdata const char full_speed_devqual_descr[];
+-extern xdata const char full_speed_config_descr[];
++extern __xdata const char full_speed_device_descr[];
++extern __xdata const char full_speed_devqual_descr[];
++extern __xdata const char full_speed_config_descr[];
+
+-extern xdata unsigned char nstring_descriptors;
+-extern xdata char * xdata string_descriptors[];
++extern __xdata unsigned char nstring_descriptors;
++extern __xdata char * __xdata string_descriptors[];
+
+ /*
+ * We patch these locations with info read from the usrp config eeprom
+ */
+-extern xdata char usb_desc_hw_rev_binary_patch_location_0[];
+-extern xdata char usb_desc_hw_rev_binary_patch_location_1[];
+-extern xdata char usb_desc_hw_rev_ascii_patch_location_0[];
+-extern xdata char usb_desc_serial_number_ascii[];
++extern __xdata char usb_desc_hw_rev_binary_patch_location_0[];
++extern __xdata char usb_desc_hw_rev_binary_patch_location_1[];
++extern __xdata char usb_desc_hw_rev_ascii_patch_location_0[];
++extern __xdata char usb_desc_serial_number_ascii[];
diff --git a/comms/gnuradio/files/patch-usrp_firmware_lib_delay.c b/comms/gnuradio/files/patch-usrp_firmware_lib_delay.c
index cbdd7213f4c7..f23734d7107b 100644
--- a/comms/gnuradio/files/patch-usrp_firmware_lib_delay.c
+++ b/comms/gnuradio/files/patch-usrp_firmware_lib_delay.c
@@ -1,12 +1,11 @@
---- usrp/firmware/lib/delay.c.orig 2010-11-19 21:26:31.000000000 -0500
-+++ usrp/firmware/lib/delay.c 2010-11-19 21:28:04.000000000 -0500
-@@ -24,11 +24,12 @@
+--- usrp/firmware/lib/delay.c.orig 2009-01-21 11:05:07.000000000 -0500
++++ usrp/firmware/lib/delay.c 2012-10-03 20:01:36.000000000 -0500
+@@ -24,11 +24,11 @@
* Delay approximately 1 microsecond (including overhead in udelay).
*/
static void
-udelay1 (void) _naked
-+udelay1 (void)
-+//__naked
++udelay1 (void) __naked
{
- _asm ; lcall that got us here took 4 bus cycles
+ __asm ; lcall that got us here took 4 bus cycles
@@ -16,20 +15,19 @@
}
/*
-@@ -51,9 +52,10 @@
+@@ -51,9 +51,9 @@
* but explains the factor of 4 problem below).
*/
static void
-mdelay1 (void) _naked
-+mdelay1 (void)
-+// _naked
++mdelay1 (void) __naked
{
- _asm
+ __asm
mov dptr,#(-1200 & 0xffff)
002$:
inc dptr ; 3 bus cycles
-@@ -62,7 +64,7 @@
+@@ -62,7 +62,7 @@
jnz 002$ ; 3 bus cycles
ret
diff --git a/comms/gnuradio/files/patch-usrp_firmware_lib_fx2utils.c b/comms/gnuradio/files/patch-usrp_firmware_lib_fx2utils.c
new file mode 100644
index 000000000000..7f6b0de7462a
--- /dev/null
+++ b/comms/gnuradio/files/patch-usrp_firmware_lib_fx2utils.c
@@ -0,0 +1,14 @@
+--- usrp/firmware/lib/fx2utils.c.orig 2012-10-03 19:10:48.000000000 -0500
++++ usrp/firmware/lib/fx2utils.c 2012-10-03 19:11:30.000000000 -0500
+@@ -42,8 +42,9 @@
+ {
+ USBCS |= bmDISCON | bmRENUM;
+
+- // mdelay (1500); // FIXME why 1.5 seconds?
+- mdelay (250); // FIXME why 1.5 seconds?
++ mdelay (1500); // FIXME why 1.5 seconds?
++// Does not seem to settle fast enough on some USRPs -- db
++// mdelay (250); // FIXME why 1.5 seconds?
+
+ USBIRQ = 0xff; // clear any pending USB irqs...
+ EPIRQ = 0xff; // they're from before the renumeration
diff --git a/comms/gnuradio/files/patch-usrp_firmware_lib_i2c.c b/comms/gnuradio/files/patch-usrp_firmware_lib_i2c.c
new file mode 100644
index 000000000000..39681e88774a
--- /dev/null
+++ b/comms/gnuradio/files/patch-usrp_firmware_lib_i2c.c
@@ -0,0 +1,20 @@
+--- usrp/firmware/lib/i2c.c.orig 2012-10-03 19:23:19.000000000 -0500
++++ usrp/firmware/lib/i2c.c 2012-10-03 19:23:53.000000000 -0500
+@@ -30,7 +30,7 @@
+
+ // returns non-zero if successful, else 0
+ unsigned char
+-i2c_read (unsigned char addr, xdata unsigned char *buf, unsigned char len)
++i2c_read (unsigned char addr, __xdata unsigned char *buf, unsigned char len)
+ {
+ volatile unsigned char junk;
+
+@@ -89,7 +89,7 @@
+
+ // returns non-zero if successful, else 0
+ unsigned char
+-i2c_write (unsigned char addr, xdata const unsigned char *buf, unsigned char len)
++i2c_write (unsigned char addr, __xdata const unsigned char *buf, unsigned char len)
+ {
+ while (I2CS & bmSTOP) // wait for stop to clear
+ ;
diff --git a/comms/gnuradio/files/patch-usrp_firmware_lib_isr.c b/comms/gnuradio/files/patch-usrp_firmware_lib_isr.c
new file mode 100644
index 000000000000..51f87788e23e
--- /dev/null
+++ b/comms/gnuradio/files/patch-usrp_firmware_lib_isr.c
@@ -0,0 +1,42 @@
+--- usrp/firmware/lib/isr.c.orig 2012-10-03 19:00:09.000000000 -0500
++++ usrp/firmware/lib/isr.c 2012-10-03 19:25:18.000000000 -0500
+@@ -24,9 +24,9 @@
+ #include "fx2regs.h"
+ #include "syncdelay.h"
+
+-extern xdata unsigned char _standard_interrupt_vector[];
+-extern xdata unsigned char _usb_autovector[];
+-extern xdata unsigned char _fifo_gpif_autovector[];
++extern __xdata unsigned char _standard_interrupt_vector[];
++extern __xdata unsigned char _usb_autovector[];
++extern __xdata unsigned char _fifo_gpif_autovector[];
+
+ #define LJMP_OPCODE 0x02
+
+@@ -39,7 +39,7 @@
+ void
+ hook_sv (unsigned char vector_number, unsigned short addr)
+ {
+- bit t;
++ __bit t;
+
+ // sanity checks
+
+@@ -66,7 +66,7 @@
+ void
+ hook_uv (unsigned char vector_number, unsigned short addr)
+ {
+- bit t;
++ __bit t;
+
+ // sanity checks
+
+@@ -93,7 +93,7 @@
+ void
+ hook_fgv (unsigned char vector_number, unsigned short addr)
+ {
+- bit t;
++ __bit t;
+
+ // sanity checks
+
diff --git a/comms/gnuradio/files/patch-usrp_firmware_lib_usb_common.c b/comms/gnuradio/files/patch-usrp_firmware_lib_usb_common.c
new file mode 100644
index 000000000000..bf29c425ce0f
--- /dev/null
+++ b/comms/gnuradio/files/patch-usrp_firmware_lib_usb_common.c
@@ -0,0 +1,85 @@
+--- usrp/firmware/lib/usb_common.c.orig 2012-10-03 19:06:18.000000000 -0500
++++ usrp/firmware/lib/usb_common.c 2012-10-03 19:13:10.000000000 -0500
+@@ -28,12 +28,12 @@
+ #include "usb_descriptors.h"
+ #include "usb_requests.h"
+
+-extern xdata char str0[];
+-extern xdata char str1[];
+-extern xdata char str2[];
+-extern xdata char str3[];
+-extern xdata char str4[];
+-extern xdata char str5[];
++extern __xdata char str0[];
++extern __xdata char str1[];
++extern __xdata char str2[];
++extern __xdata char str3[];
++extern __xdata char str4[];
++extern __xdata char str5[];
+
+
+ #define bRequestType SETUPDAT[0]
+@@ -48,15 +48,15 @@
+ #define MSB(x) (((unsigned short) x) >> 8)
+ #define LSB(x) (((unsigned short) x) & 0xff)
+
+-volatile bit _usb_got_SUDAV;
++volatile __bit _usb_got_SUDAV;
+
+ unsigned char _usb_config = 0;
+ unsigned char _usb_alt_setting = 0; // FIXME really 1/interface
+
+-xdata unsigned char *current_device_descr;
+-xdata unsigned char *current_devqual_descr;
+-xdata unsigned char *current_config_descr;
+-xdata unsigned char *other_config_descr;
++__xdata unsigned char *current_device_descr;
++__xdata unsigned char *current_devqual_descr;
++__xdata unsigned char *current_config_descr;
++__xdata unsigned char *other_config_descr;
+
+ static void
+ setup_descriptors (void)
+@@ -81,21 +81,21 @@
+ }
+
+ static void
+-isr_SUDAV (void) interrupt
++isr_SUDAV (void) __interrupt
+ {
+ clear_usb_irq ();
+ _usb_got_SUDAV = 1;
+ }
+
+ static void
+-isr_USBRESET (void) interrupt
++isr_USBRESET (void) __interrupt
+ {
+ clear_usb_irq ();
+ setup_descriptors ();
+ }
+
+ static void
+-isr_HIGHSPEED (void) interrupt
++isr_HIGHSPEED (void) __interrupt
+ {
+ clear_usb_irq ();
+ setup_descriptors ();
+@@ -133,7 +133,7 @@
+ // return pointer to control and status register for endpoint.
+ // only called with plausible_endpoints
+
+-xdata volatile unsigned char *
++__xdata volatile unsigned char *
+ epcs (unsigned char ep)
+ {
+ if (ep == 0x01) // ep1 has different in and out CS regs
+@@ -234,7 +234,7 @@
+ if (wValueL >= nstring_descriptors)
+ fx2_stall_ep0 ();
+ else {
+- xdata char *p = string_descriptors[wValueL];
++ __xdata char *p = string_descriptors[wValueL];
+ SUDPTRH = MSB (p);
+ SUDPTRL = LSB (p);
+ }
diff --git a/comms/gnuradio/files/patch-usrp_firmware_src_common_fpga_load.c b/comms/gnuradio/files/patch-usrp_firmware_src_common_fpga_load.c
index 663256ff6cd2..f0ee946b2dbd 100644
--- a/comms/gnuradio/files/patch-usrp_firmware_src_common_fpga_load.c
+++ b/comms/gnuradio/files/patch-usrp_firmware_src_common_fpga_load.c
@@ -1,12 +1,40 @@
---- usrp/firmware/src/common/fpga_load.c.orig 2010-11-19 22:24:42.000000000 -0500
-+++ usrp/firmware/src/common/fpga_load.c 2010-11-19 22:25:05.000000000 -0500
-@@ -89,7 +89,8 @@
+--- usrp/firmware/src/common/fpga_load.c.orig 2009-01-21 11:05:07.000000000 -0500
++++ usrp/firmware/src/common/fpga_load.c 2012-10-03 20:16:27.000000000 -0500
+@@ -89,9 +89,9 @@
#else
static void
-clock_out_config_byte (unsigned char bits) _naked
-+clock_out_config_byte (unsigned char bits)
-+// _naked
++clock_out_config_byte (unsigned char bits) __naked
{
- _asm
+- _asm
++ __asm
mov a, dpl
+
+ rrc a
+@@ -136,14 +136,14 @@
+
+ ret
+
+- _endasm;
++ __endasm;
+ }
+
+ #endif
+
+ static void
+ clock_out_bytes (unsigned char bytecount,
+- unsigned char xdata *p)
++ unsigned char __xdata *p)
+ {
+ while (bytecount-- > 0)
+ clock_out_config_byte (*p++);
+@@ -163,7 +163,7 @@
+ * ALTERA_NSTATUS = 1 (input)
+ */
+ unsigned char
+-fpga_load_xfer (xdata unsigned char *p, unsigned char bytecount)
++fpga_load_xfer (__xdata unsigned char *p, unsigned char bytecount)
+ {
+ clock_out_bytes (bytecount, p);
+ return 1;
diff --git a/comms/gnuradio/files/patch-usrp_firmware_src_common_fpga_load.h b/comms/gnuradio/files/patch-usrp_firmware_src_common_fpga_load.h
new file mode 100644
index 000000000000..6d8a63e2c356
--- /dev/null
+++ b/comms/gnuradio/files/patch-usrp_firmware_src_common_fpga_load.h
@@ -0,0 +1,11 @@
+--- usrp/firmware/src/common/fpga_load.h.orig 2012-10-03 19:17:59.000000000 -0500
++++ usrp/firmware/src/common/fpga_load.h 2012-10-03 19:18:11.000000000 -0500
+@@ -22,7 +22,7 @@
+ #define INCLUDED_FPGA_LOAD_H
+
+ unsigned char fpga_load_begin (void);
+-unsigned char fpga_load_xfer (xdata unsigned char *p, unsigned char len);
++unsigned char fpga_load_xfer (__xdata unsigned char *p, unsigned char len);
+ unsigned char fpga_load_end (void);
+
+ #endif /* INCLUDED_FPGA_LOAD_H */
diff --git a/comms/gnuradio/files/patch-usrp_firmware_src_usrp2_board_specific.c b/comms/gnuradio/files/patch-usrp_firmware_src_usrp2_board_specific.c
new file mode 100644
index 000000000000..a9e5449b530e
--- /dev/null
+++ b/comms/gnuradio/files/patch-usrp_firmware_src_usrp2_board_specific.c
@@ -0,0 +1,11 @@
+--- usrp/firmware/src/usrp2/board_specific.c.orig 2012-10-03 19:29:27.000000000 -0500
++++ usrp/firmware/src/usrp2/board_specific.c 2012-10-03 19:29:52.000000000 -0500
+@@ -64,7 +64,7 @@
+ // NOP on usrp1
+ }
+
+-static xdata unsigned char xbuf[1];
++static __xdata unsigned char xbuf[1];
+
+ void
+ write_9862 (unsigned char which, unsigned char regno, unsigned char value)
diff --git a/comms/gnuradio/files/patch-usrp_firmware_src_usrp2_eeprom_init.c b/comms/gnuradio/files/patch-usrp_firmware_src_usrp2_eeprom_init.c
new file mode 100644
index 000000000000..ad9126ce7569
--- /dev/null
+++ b/comms/gnuradio/files/patch-usrp_firmware_src_usrp2_eeprom_init.c
@@ -0,0 +1,11 @@
+--- usrp/firmware/src/usrp2/eeprom_init.c.orig 2012-10-03 19:27:16.000000000 -0500
++++ usrp/firmware/src/usrp2/eeprom_init.c 2012-10-03 19:27:32.000000000 -0500
+@@ -29,7 +29,7 @@
+ * into hash1.
+ */
+ #define USRP_HASH_SIZE 16
+-xdata at USRP_HASH_SLOT_0_ADDR unsigned char hash0[USRP_HASH_SIZE];
++__xdata at USRP_HASH_SLOT_0_ADDR unsigned char hash0[USRP_HASH_SIZE];
+
+
+ #define enable_codecs() USRP_PA &= ~(bmPA_SEN_CODEC_A | bmPA_SEN_CODEC_B)
diff --git a/comms/gnuradio/files/patch-usrp_firmware_src_usrp2_eeprom_io.c b/comms/gnuradio/files/patch-usrp_firmware_src_usrp2_eeprom_io.c
new file mode 100644
index 000000000000..1f946d8fa2cb
--- /dev/null
+++ b/comms/gnuradio/files/patch-usrp_firmware_src_usrp2_eeprom_io.c
@@ -0,0 +1,17 @@
+--- usrp/firmware/src/usrp2/eeprom_io.c.orig 2012-10-03 19:21:20.000000000 -0500
++++ usrp/firmware/src/usrp2/eeprom_io.c 2012-10-03 19:21:39.000000000 -0500
+@@ -27,12 +27,12 @@
+ // returns non-zero if successful, else 0
+ unsigned char
+ eeprom_read (unsigned char i2c_addr, unsigned char eeprom_offset,
+- xdata unsigned char *buf, unsigned char len)
++ __xdata unsigned char *buf, unsigned char len)
+ {
+ // We setup a random read by first doing a "zero byte write".
+ // Writes carry an address. Reads use an implicit address.
+
+- static xdata unsigned char cmd[1];
++ static __xdata unsigned char cmd[1];
+ cmd[0] = eeprom_offset;
+ if (!i2c_write(i2c_addr, cmd, 1))
+ return 0;
diff --git a/comms/gnuradio/files/patch-usrp_firmware_src_usrp2_eeprom_io.h b/comms/gnuradio/files/patch-usrp_firmware_src_usrp2_eeprom_io.h
new file mode 100644
index 000000000000..10e89478ada6
--- /dev/null
+++ b/comms/gnuradio/files/patch-usrp_firmware_src_usrp2_eeprom_io.h
@@ -0,0 +1,17 @@
+--- usrp/firmware/src/usrp2/eeprom_io.h.orig 2012-10-03 19:20:17.000000000 -0500
++++ usrp/firmware/src/usrp2/eeprom_io.h 2012-10-03 19:20:44.000000000 -0500
+@@ -27,12 +27,12 @@
+ // returns non-zero if successful, else 0
+ unsigned char
+ eeprom_read (unsigned char i2c_addr, unsigned char eeprom_offset,
+- xdata unsigned char *buf, unsigned char len);
++ __xdata unsigned char *buf, unsigned char len);
+
+ // returns non-zero if successful, else 0
+ unsigned char
+ eeprom_write (unsigned char i2c_addr, unsigned char eeprom_offset,
+- const xdata unsigned char *buf, unsigned char len);
++ const __xdata unsigned char *buf, unsigned char len);
+
+
+ #endif /* INCLUDED_EEPROM_IO_H */
diff --git a/comms/gnuradio/files/patch-usrp_firmware_src_usrp2_fpga_rev2.c b/comms/gnuradio/files/patch-usrp_firmware_src_usrp2_fpga_rev2.c
new file mode 100644
index 000000000000..bee93f3b098a
--- /dev/null
+++ b/comms/gnuradio/files/patch-usrp_firmware_src_usrp2_fpga_rev2.c
@@ -0,0 +1,20 @@
+--- usrp/firmware/src/usrp2/fpga_rev2.c.orig 2012-10-03 19:32:03.000000000 -0500
++++ usrp/firmware/src/usrp2/fpga_rev2.c 2012-10-03 19:32:41.000000000 -0500
+@@ -30,7 +30,7 @@
+ unsigned char g_rx_reset = 0;
+
+ void
+-fpga_write_reg (unsigned char regno, const xdata unsigned char *regval)
++fpga_write_reg (unsigned char regno, const __xdata unsigned char *regval)
+ {
+ spi_write (0, 0x00 | (regno & 0x7f),
+ SPI_ENABLE_FPGA,
+@@ -39,7 +39,7 @@
+ }
+
+
+-static xdata unsigned char regval[4] = {0, 0, 0, 0};
++static __xdata unsigned char regval[4] = {0, 0, 0, 0};
+
+ static void
+ write_fpga_master_ctrl (void)
diff --git a/comms/gnuradio/files/patch-usrp_firmware_src_usrp2_spi.c b/comms/gnuradio/files/patch-usrp_firmware_src_usrp2_spi.c
index 628ed4256bc8..a3ee8b00e1ed 100644
--- a/comms/gnuradio/files/patch-usrp_firmware_src_usrp2_spi.c
+++ b/comms/gnuradio/files/patch-usrp_firmware_src_usrp2_spi.c
@@ -1,12 +1,68 @@
---- usrp/firmware/src/usrp2/spi.c.orig 2010-11-19 22:13:00.000000000 -0500
-+++ usrp/firmware/src/usrp2/spi.c 2010-11-19 22:13:12.000000000 -0500
-@@ -320,7 +320,8 @@
+--- usrp/firmware/src/usrp2/spi.c.orig 2009-01-21 11:05:08.000000000 -0500
++++ usrp/firmware/src/usrp2/spi.c 2012-10-03 20:03:07.000000000 -0500
+@@ -98,17 +98,17 @@
+ write_byte_msb (unsigned char v);
+
+ static void
+-write_bytes_msb (const xdata unsigned char *buf, unsigned char len);
++write_bytes_msb (const __xdata unsigned char *buf, unsigned char len);
+
+ static void
+-read_bytes_msb (xdata unsigned char *buf, unsigned char len);
++read_bytes_msb (__xdata unsigned char *buf, unsigned char len);
+
+
+ // returns non-zero if successful, else 0
+ unsigned char
+ spi_read (unsigned char header_hi, unsigned char header_lo,
+ unsigned char enables, unsigned char format,
+- xdata unsigned char *buf, unsigned char len)
++ __xdata unsigned char *buf, unsigned char len)
+ {
+ if (count_bits8 (enables) > 1)
+ return 0; // error, too many enables set
+@@ -165,7 +165,7 @@
+ unsigned char
+ spi_write (unsigned char header_hi, unsigned char header_lo,
+ unsigned char enables, unsigned char format,
+- const xdata unsigned char *buf, unsigned char len)
++ const __xdata unsigned char *buf, unsigned char len)
+ {
+ setup_enables (enables);
+
+@@ -261,7 +261,7 @@
+ }
+
+ static void
+-write_bytes_msb (const xdata unsigned char *buf, unsigned char len)
++write_bytes_msb (const __xdata unsigned char *buf, unsigned char len)
+ {
+ while (len-- != 0){
+ write_byte_msb (*buf++);
+@@ -320,9 +320,9 @@
}
#else
static unsigned char
-read_byte_msb (void) _naked
-+read_byte_msb (void)
-+// _naked
++read_byte_msb (void) __naked
{
- _asm
+- _asm
++ __asm
clr a
+
+ setb _bitS_CLK
+@@ -367,12 +367,12 @@
+
+ mov dpl,a
+ ret
+- _endasm;
++ __endasm;
+ }
+ #endif
+
+ static void
+-read_bytes_msb (xdata unsigned char *buf, unsigned char len)
++read_bytes_msb (__xdata unsigned char *buf, unsigned char len)
+ {
+ while (len-- != 0){
+ *buf++ = read_byte_msb ();
diff --git a/comms/gnuradio/files/patch-usrp_firmware_src_usrp2_spi.h b/comms/gnuradio/files/patch-usrp_firmware_src_usrp2_spi.h
new file mode 100644
index 000000000000..d6b7662cac4b
--- /dev/null
+++ b/comms/gnuradio/files/patch-usrp_firmware_src_usrp2_spi.h
@@ -0,0 +1,18 @@
+--- usrp/firmware/src/usrp2/spi.h.orig 2012-10-03 19:18:32.000000000 -0500
++++ usrp/firmware/src/usrp2/spi.h 2012-10-03 19:18:59.000000000 -0500
+@@ -31,13 +31,13 @@
+ unsigned char
+ spi_read (unsigned char header_hi, unsigned char header_lo,
+ unsigned char enables, unsigned char format,
+- xdata unsigned char *buf, unsigned char len);
++ __xdata unsigned char *buf, unsigned char len);
+
+ // returns non-zero if successful, else 0
+ unsigned char
+ spi_write (unsigned char header_hi, unsigned char header_lo,
+ unsigned char enables, unsigned char format,
+- const xdata unsigned char *buf, unsigned char len);
++ const __xdata unsigned char *buf, unsigned char len);
+
+
+ #endif /* INCLUDED_SPI_H */
diff --git a/comms/gnuradio/files/patch-usrp_firmware_src_usrp2_usrp_main.c b/comms/gnuradio/files/patch-usrp_firmware_src_usrp2_usrp_main.c
new file mode 100644
index 000000000000..97f7b8b1c7d7
--- /dev/null
+++ b/comms/gnuradio/files/patch-usrp_firmware_src_usrp2_usrp_main.c
@@ -0,0 +1,31 @@
+--- usrp/firmware/src/usrp2/usrp_main.c.orig 2012-10-03 19:14:58.000000000 -0500
++++ usrp/firmware/src/usrp2/usrp_main.c 2012-10-03 19:28:55.000000000 -0500
+@@ -62,7 +62,7 @@
+ * into hash1.
+ */
+ #define USRP_HASH_SIZE 16
+-xdata at USRP_HASH_SLOT_1_ADDR unsigned char hash1[USRP_HASH_SIZE];
++__xdata at USRP_HASH_SLOT_1_ADDR unsigned char hash1[USRP_HASH_SIZE];
+
+ static void
+ get_ep0_data (void)
+@@ -304,7 +304,7 @@
+ * Toggle led 0
+ */
+ void
+-isr_tick (void) interrupt
++isr_tick (void) __interrupt
+ {
+ static unsigned char count = 1;
+
+@@ -323,8 +323,8 @@
+ void
+ patch_usb_descriptors(void)
+ {
+- static xdata unsigned char hw_rev;
+- static xdata unsigned char serial_no[8];
++ static __xdata unsigned char hw_rev;
++ static __xdata unsigned char serial_no[8];
+ unsigned char i;
+
+ eeprom_read(I2C_ADDR_BOOT, HW_REV_OFFSET, &hw_rev, 1); // LSB of device id