From bfdb50c8dfa96ad8a804b152c92c5a5880c8bdb7 Mon Sep 17 00:00:00 2001 From: Dobrica Pavlinusic Date: Sun, 17 Aug 2014 19:44:28 +0200 Subject: [PATCH] version 4.2.0 --- Makefile | 89 +----- eeprom.c | 77 ----- eeprom.h | 26 -- fx2/Makefile | 35 -- fx2/delay.c | 74 ----- fx2/delay.h | 36 --- fx2/fx2regs.h | 718 +----------------------------------------- fx2/fx2utils.c | 52 --- fx2/fx2utils.h | 30 -- fx2/i2c.c | 121 ------- fx2/i2c.h | 30 -- fx2/isr.c | 168 ---------- fx2/syncdelay.h | 64 ---- fx2/timer.c | 47 --- fx2/timer.h | 32 -- fx2/usb_common.c | 376 ---------------------- fx2/usb_common.h | 50 --- fx2/usb_descriptors.h | 38 --- fx2/usb_requests.h | 86 ----- hardware.h | 34 -- hw_basic.c | 38 ++- hw_xpcu_i.c | 160 +--------- hw_xpcu_x.c | 213 +------------ startup.a51 | 78 ----- usbjtag.c | 6 +- usbjtag.hex | 431 ++++++++++++------------- usbjtag.iic | Bin 4216 -> 4300 bytes vectors.a51 | 176 ----------- 28 files changed, 254 insertions(+), 3031 deletions(-) diff --git a/Makefile b/Makefile index 8af9262..a0ba08a 100644 --- a/Makefile +++ b/Makefile @@ -1,174 +1,89 @@ #----------------------------------------------------------------------------- - # Makefile for usb_jtag FX2 firmware - #----------------------------------------------------------------------------- - # Copyright 2007 Kolja Waschk, ixo.de - #----------------------------------------------------------------------------- - # This code is part of usbjtag. usbjtag is free software; you can redistribute - # it and/or modify it under the terms of the GNU General Public License as - # published by the Free Software Foundation; either version 2 of the License, - # or (at your option) any later version. usbjtag is distributed in the hope - # that it will be useful, but WITHOUT ANY WARRANTY; without even the implied - # warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - # GNU General Public License for more details. You should have received a - # copy of the GNU General Public License along with this program in the file - # COPYING; if not, write to the Free Software Foundation, Inc., 51 Franklin - # St, Fifth Floor, Boston, MA 02110-1301 USA - #----------------------------------------------------------------------------- - - LIBDIR=fx2 - LIB=libfx2.lib - - ifeq (${HARDWARE},) - HARDWARE=hw_basic - + #HARDWARE=hw_saxo_l #HARDWARE=hw_xpcu_i - #HARDWARE=hw_xpcu_x - endif - - CC=sdcc - CFLAGS+=-mmcs51 --no-xinit-opt -I${LIBDIR} -D${HARDWARE} CFLAGS+=--opt-code-size - - AS=asx8051 - ASFLAGS+=-plosgff - - LDFLAGS=--code-loc 0x0000 --code-size 0x1800 - LDFLAGS+=--xram-loc 0x1800 --xram-size 0x0800 - LDFLAGS+=-Wl '-b USBDESCSEG = 0xE100' - LDFLAGS+=-L ${LIBDIR} - - %.rel : %.a51 - $(AS) $(ASFLAGS) $< - - %.rel : %.c - $(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@ - +default: usbjtag.iic %.iic : %.hex - ./hex2bix -ir -f 0xC2 -m 0xF000 -c 0x1 -o $@ $< - - -default: usbjtag.iic - - - usbjtag.hex: vectors.rel usbjtag.rel dscr.rel eeprom.rel ${HARDWARE}.rel startup.rel ${LIBDIR}/${LIB} - $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $+ - packihx $@ > .tmp.hex - rm $@ - mv .tmp.hex $@ - - ${LIBDIR}/${LIB}: - make -C ${LIBDIR} - - .PHONY: boot - boot: usbjtag.hex - -test -e /dev/usb_jtag && /sbin/fxload -D /dev/usb_jtag -I usbjtag.hex -t fx2 - -test -e /dev/tracii_xl2 && /sbin/fxload -D /dev/tracii_xl2 -I usbjtag.hex -t fx2 - -test -e /dev/xilinx_xpcu && /sbin/fxload -D /dev/xilinx_xpcu -I usbjtag.hex -t fx2 - - REF=/home/kawk/work/xilinx/xtern/xusbdfwu/xusbdfwu-1025.hex - - .PHONY: ref - ref: - -test -e /dev/usb_jtag && /sbin/fxload -D /dev/usb_jtag -I ${REF} -t fx2 - -test -e /dev/tracii_xl2 && /sbin/fxload -D /dev/tracii_xl2 -I ${REF} -t fx2 - -test -e /dev/xilinx_xpcu && /sbin/fxload -D /dev/xilinx_xpcu -I ${REF} -t fx2 - - dscr.rel: dscr.a51 - eeprom.rel: eeprom.c eeprom.h - usbjtag.rel: usbjtag.c hardware.h eeprom.h - ${HARDWARE}.rel: ${HARDWARE}.c hardware.h - - .PHONY: clean distclean - - clean: - make -C ${LIBDIR} clean - rm -f *.lst *.asm *.lib *.sym *.rel *.mem *.map *.rst *.lnk *.hex *.ihx *.iic - - distclean: clean - - - - diff --git a/eeprom.c b/eeprom.c index fc1f319..4bb377d 100644 --- a/eeprom.c +++ b/eeprom.c @@ -1,154 +1,77 @@ /*----------------------------------------------------------------------------- - * FTDI EEPROM emulation - *----------------------------------------------------------------------------- - * Copyright (C) 2007 Kolja Waschk, ixo.de - *----------------------------------------------------------------------------- - * This code is part of usbjtag. usbjtag is free software; you can redistribute - * it and/or modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the License, - * or (at your option) any later version. usbjtag is distributed in the hope - * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. You should have received a - * copy of the GNU General Public License along with this program in the file - * COPYING; if not, write to the Free Software Foundation, Inc., 51 Franklin - * St, Fifth Floor, Boston, MA 02110-1301 USA - *----------------------------------------------------------------------------- - */ - - #include "eeprom.h" - #include "usb_descriptors.h" - - xdata unsigned char eeprom[128]; - - extern xdata char dscr_vidpidver[6]; - extern xdata char dscr_attrpow[2]; - extern xdata char dscr_usbver[2]; - extern xdata char dscr_strorder[4]; - extern xdata char str1[]; - extern xdata char str2[]; - extern xdata char str3[]; - - static unsigned char ee_ptr; - static unsigned short ee_cksum; - - void eeprom_append(unsigned char nb) - { - unsigned char pree_ptr = ee_ptr & ~1; - if(pree_ptr != ee_ptr) - { - ee_cksum = ee_cksum ^((unsigned short)nb << 8); - ee_cksum = ee_cksum ^ eeprom[pree_ptr]; - ee_cksum = (ee_cksum << 1) | (ee_cksum >> 15); - }; - eeprom[ee_ptr++] = nb; - } - - void eeprom_init(void) - { - char j,sofs; - ee_ptr = 0; - ee_cksum = 0xAAAA; - - eeprom_append(0x00); - eeprom_append(0x00); - for(j=0;j<6;j++) eeprom_append(dscr_vidpidver[j]); - for(j=0;j<2;j++) eeprom_append(dscr_attrpow[j]); - eeprom_append(0x1C); - eeprom_append(0x00); - for(j=0;j<2;j++) eeprom_append(dscr_usbver[j]); - sofs = 0x80 + ee_ptr + 6; - eeprom_append(sofs); - eeprom_append(str1[0]); - sofs += str1[0]; - eeprom_append(sofs); - eeprom_append(str2[0]); - sofs += str2[0]; - eeprom_append(sofs); - eeprom_append(str3[0]); - for(j=0;j>8)&0xFF; - } - - diff --git a/eeprom.h b/eeprom.h index 09efb08..3358e13 100644 --- a/eeprom.h +++ b/eeprom.h @@ -1,52 +1,26 @@ /*----------------------------------------------------------------------------- - * FTDI EEPROM emulation - *----------------------------------------------------------------------------- - * Copyright (C) 2007 Kolja Waschk, ixo.de - *----------------------------------------------------------------------------- - * This code is part of usbjtag. usbjtag is free software; you can redistribute - * it and/or modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the License, - * or (at your option) any later version. usbjtag is distributed in the hope - * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. You should have received a - * copy of the GNU General Public License along with this program in the file - * COPYING; if not, write to the Free Software Foundation, Inc., 51 Franklin - * St, Fifth Floor, Boston, MA 02110-1301 USA - *----------------------------------------------------------------------------- - */ - - #ifndef _EEPROM_H - #define _EEPROM_H 1 - - extern xdata unsigned char eeprom[128]; - extern void eeprom_init(void); - - #endif /* _EEPROM_H */ - - diff --git a/fx2/Makefile b/fx2/Makefile index 29f2ff0..8c06db5 100644 --- a/fx2/Makefile +++ b/fx2/Makefile @@ -1,70 +1,35 @@ #----------------------------------------------------------------------------- - # Makefile for FX2 library code - #----------------------------------------------------------------------------- - # Copyright (C) 2007 Kolja Waschk, ixo.de - #----------------------------------------------------------------------------- - # This code is part of usbjtag. usbjtag is free software; you can redistribute - # it and/or modify it under the terms of the GNU General Public License as - # published by the Free Software Foundation; either version 2 of the License, - # or (at your option) any later version. usbjtag is distributed in the hope - # that it will be useful, but WITHOUT ANY WARRANTY; without even the implied - # warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - # GNU General Public License for more details. You should have received a - # copy of the GNU General Public License along with this program in the file - # COPYING; if not, write to the Free Software Foundation, Inc., 51 Franklin - # St, Fifth Floor, Boston, MA 02110-1301 USA - #----------------------------------------------------------------------------- - - CC=sdcc - CFLAGS+=-mmcs51 --no-xinit-opt -I. - CPPFLAGS+= - - %.rel : %.c - $(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@ - - libfx2.lib: delay.rel fx2utils.rel i2c.rel isr.rel timer.rel usb_common.rel - rm -f $@ - touch $@ - for obj in $^ ; do basename $$obj .rel >> $@ ; done - - clean: - rm -f *.lst *.asm *.lib *.sym *.rel *.lib - - - - - diff --git a/fx2/delay.c b/fx2/delay.c index 621363a..161fb66 100644 --- a/fx2/delay.c +++ b/fx2/delay.c @@ -1,148 +1,74 @@ /* -*- c++ -*- */ - /*----------------------------------------------------------------------------- - * Delay routines - *----------------------------------------------------------------------------- - * Code taken from USRP2 firmware (GNU Radio Project), version 3.0.2, - * Copyright 2003 Free Software Foundation, Inc. - *----------------------------------------------------------------------------- - * This code is part of usbjtag. usbjtag is free software; you can redistribute - * it and/or modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the License, - * or (at your option) any later version. usbjtag is distributed in the hope - * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. You should have received a - * copy of the GNU General Public License along with this program in the file - * COPYING; if not, write to the Free Software Foundation, Inc., 51 Franklin - * St, Fifth Floor, Boston, MA 02110-1301 USA - *----------------------------------------------------------------------------- - */ - - /* - * Delay approximately 1 microsecond (including overhead in udelay). - */ - static void - udelay1 (void) _naked - { - _asm ; lcall that got us here took 4 bus cycles - ret ; 4 bus cycles - _endasm; - } - - /* - * delay for approximately usecs microseconds - */ - void - udelay (unsigned char usecs) - { - do { - udelay1 (); - } while (--usecs != 0); - } - - - /* - * Delay approximately 1 millisecond. - * We're running at 48 MHz, so we need 48,000 clock cycles. - * - * Note however, that each bus cycle takes 4 clock cycles (not obvious, - * but explains the factor of 4 problem below). - */ - static void - mdelay1 (void) _naked - { - _asm - mov dptr,#(-1200 & 0xffff) - 002$: - inc dptr ; 3 bus cycles - mov a, dpl ; 2 bus cycles - orl a, dph ; 2 bus cycles - jnz 002$ ; 3 bus cycles - - ret - _endasm; - } - - void - mdelay (unsigned int msecs) - { - do { - mdelay1 (); - } while (--msecs != 0); - } - - - diff --git a/fx2/delay.h b/fx2/delay.h index a159ac8..701c8f1 100644 --- a/fx2/delay.h +++ b/fx2/delay.h @@ -1,72 +1,36 @@ /* -*- c++ -*- */ - /*----------------------------------------------------------------------------- - * Delay routines - *----------------------------------------------------------------------------- - * Code taken from USRP2 firmware (GNU Radio Project), version 3.0.2, - * Copyright 2003 Free Software Foundation, Inc. - *----------------------------------------------------------------------------- - * This code is part of usbjtag. usbjtag is free software; you can redistribute - * it and/or modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the License, - * or (at your option) any later version. usbjtag is distributed in the hope - * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. You should have received a - * copy of the GNU General Public License along with this program in the file - * COPYING; if not, write to the Free Software Foundation, Inc., 51 Franklin - * St, Fifth Floor, Boston, MA 02110-1301 USA - *----------------------------------------------------------------------------- - */ - - #ifndef _DELAY_H_ - #define _DELAY_H_ - - /* - * delay for approximately usecs microseconds - * Note limit of 255 usecs. - */ - void udelay (unsigned char usecs); - - /* - * delay for approximately msecs milliseconds - */ - void mdelay (unsigned short msecs); - - - #endif /* _DELAY_H_ */ - diff --git a/fx2/fx2regs.h b/fx2/fx2regs.h index 597777a..d93e706 100644 --- a/fx2/fx2regs.h +++ b/fx2/fx2regs.h @@ -1,1428 +1,714 @@ /* -*- c++ -*- */ - /*----------------------------------------------------------------------------- - * FX2 register definitions - *----------------------------------------------------------------------------- - * Code taken from USRP2 firmware (GNU Radio Project), version 3.0.2, - * Copyright 2003 Free Software Foundation, Inc. - *----------------------------------------------------------------------------- - * This code is part of usbjtag. usbjtag is free software; you can redistribute - * it and/or modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the License, - * or (at your option) any later version. usbjtag is distributed in the hope - * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. You should have received a - * copy of the GNU General Public License along with this program in the file - * COPYING; if not, write to the Free Software Foundation, Inc., 51 Franklin - * St, Fifth Floor, Boston, MA 02110-1301 USA - *----------------------------------------------------------------------------- - */ - - /* - //----------------------------------------------------------------------------- - // File: FX2regs.h - // Contents: EZ-USB FX2 register declarations and bit mask definitions. - // - // $Archive: /USB/Target/Inc/fx2regs.h $ - -// $Date: 2009/09/30 14:08:56 $ - -// $Revision: 1.5 $ - +// $Date: 2009/11/09 14:48:44 $ +// $Revision: 1.6 $ // - // - // Copyright (c) 2000 Cypress Semiconductor, All rights reserved - //----------------------------------------------------------------------------- - */ - - - #ifndef FX2REGS_H /* Header Sentry */ - #define FX2REGS_H - - #define ALLOCATE_EXTERN // required for "right thing to happen" with fx2regs.h - - /* - //----------------------------------------------------------------------------- - // FX2 Related Register Assignments - //----------------------------------------------------------------------------- - - // The Ez-USB FX2 registers are defined here. We use FX2regs.h for register - // address allocation by using "#define ALLOCATE_EXTERN". - // When using "#define ALLOCATE_EXTERN", you get (for instance): - // xdata volatile BYTE OUT7BUF[64] _at_ 0x7B40; - // Such lines are created from FX2.h by using the preprocessor. - // Incidently, these lines will not generate any space in the resulting hex - // file; they just bind the symbols to the addresses for compilation. - // You just need to put "#define ALLOCATE_EXTERN" in your main program file; - // i.e. fw.c or a stand-alone C source file. - // Without "#define ALLOCATE_EXTERN", you just get the external reference: - // extern xdata volatile BYTE OUT7BUF[64] ;// 0x7B40; - // This uses the concatenation operator "##" to insert a comment "//" - // to cut off the end of the line, "_at_ 0x7B40;", which is not wanted. - */ - - - #ifdef ALLOCATE_EXTERN - #define EXTERN - #define _AT_(a) at a - #else - #define EXTERN extern - #define _AT_ ;/ ## / - #endif - - 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 ; - - // 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 - - // 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 - - // 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 - - // 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 - - #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 - - // 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 - - // 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 - - #define EP2GPIFTCH GPIFTCB1 // these are here for backwards compatibility - #define EP2GPIFTCL GPIFTCB0 // before REVE silicon (ie. REVB and REVD) - #define EP4GPIFTCH GPIFTCB1 // these are here for backwards compatibility - #define EP4GPIFTCL GPIFTCB0 // before REVE silicon (ie. REVB and REVD) - #define EP6GPIFTCH GPIFTCB1 // these are here for backwards compatibility - #define EP6GPIFTCL GPIFTCB0 // before REVE silicon (ie. REVB and REVD) - #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 - - // 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 - - - // 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 - - // 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) - - #undef EXTERN - #undef _AT_ - - /*----------------------------------------------------------------------------- - Special Function Registers (SFRs) - The byte registers and bits defined in the following list are based - on the Synopsis definition of the 8051 Special Function Registers for EZ-USB. - If you modify the register definitions below, please regenerate the file - "ezregs.inc" which includes the same basic information for assembly inclusion. - -----------------------------------------------------------------------------*/ - - sfr at 0x80 IOA; - sfr at 0x81 SP; - sfr at 0x82 DPL; - sfr at 0x83 DPH; - sfr at 0x84 DPL1; - sfr at 0x85 DPH1; - sfr at 0x86 DPS; - /* DPS */ - sbit at 0x86+0 SEL; - sfr at 0x87 PCON; /* PCON */ - //sbit IDLE = 0x87+0; - //sbit STOP = 0x87+1; - //sbit GF0 = 0x87+2; - //sbit GF1 = 0x87+3; - //sbit SMOD0 = 0x87+7; - sfr at 0x88 TCON; - /* TCON */ - sbit at 0x88+0 IT0; - sbit at 0x88+1 IE0; - sbit at 0x88+2 IT1; - sbit at 0x88+3 IE1; - sbit at 0x88+4 TR0; - sbit at 0x88+5 TF0; - sbit at 0x88+6 TR1; - sbit at 0x88+7 TF1; - sfr at 0x89 TMOD; - /* TMOD */ - //sbit M00 = 0x89+0; - //sbit M10 = 0x89+1; - //sbit CT0 = 0x89+2; - //sbit GATE0 = 0x89+3; - //sbit M01 = 0x89+4; - //sbit M11 = 0x89+5; - //sbit CT1 = 0x89+6; - //sbit GATE1 = 0x89+7; - sfr at 0x8A TL0; - sfr at 0x8B TL1; - sfr at 0x8C TH0; - sfr at 0x8D TH1; - sfr at 0x8E CKCON; - /* CKCON */ - //sbit MD0 = 0x89+0; - //sbit MD1 = 0x89+1; - //sbit MD2 = 0x89+2; - //sbit T0M = 0x89+3; - //sbit T1M = 0x89+4; - //sbit T2M = 0x89+5; - // sfr at 0x8F SPC_FNC; // Was WRS in Reg320 - /* CKCON */ - //sbit WRS = 0x8F+0; - sfr at 0x90 IOB; - sfr at 0x91 EXIF; // EXIF Bit Values differ from Reg320 - /* EXIF */ - //sbit USBINT = 0x91+4; - //sbit I2CINT = 0x91+5; - //sbit IE4 = 0x91+6; - //sbit IE5 = 0x91+7; - sfr at 0x92 MPAGE; - sfr at 0x98 SCON0; - /* SCON0 */ - sbit at 0x98+0 RI; - sbit at 0x98+1 TI; - sbit at 0x98+2 RB8; - sbit at 0x98+3 TB8; - sbit at 0x98+4 REN; - sbit at 0x98+5 SM2; - sbit at 0x98+6 SM1; - sbit at 0x98+7 SM0; - sfr at 0x99 SBUF0; - - sfr at 0x9A APTR1H; - sfr at 0x9B APTR1L; - sfr at 0x9C AUTODAT1; - sfr at 0x9D AUTOPTRH2; - sfr at 0x9E AUTOPTRL2; - sfr at 0x9F AUTODAT2; - sfr at 0xA0 IOC; - sfr at 0xA1 INT2CLR; - sfr at 0xA2 INT4CLR; - - #define AUTOPTRH1 APTR1H - #define AUTOPTRL1 APTR1L - - sfr at 0xA8 IE; - /* IE */ - sbit at 0xA8+0 EX0; - sbit at 0xA8+1 ET0; - sbit at 0xA8+2 EX1; - sbit at 0xA8+3 ET1; - sbit at 0xA8+4 ES0; - sbit at 0xA8+5 ET2; - sbit at 0xA8+6 ES1; - sbit at 0xA8+7 EA; - - sfr at 0xAA EP2468STAT; - /* EP2468STAT */ - //sbit EP2E = 0xAA+0; - //sbit EP2F = 0xAA+1; - //sbit EP4E = 0xAA+2; - //sbit EP4F = 0xAA+3; - //sbit EP6E = 0xAA+4; - //sbit EP6F = 0xAA+5; - //sbit EP8E = 0xAA+6; - //sbit EP8F = 0xAA+7; - - sfr at 0xAB EP24FIFOFLGS; - sfr at 0xAC EP68FIFOFLGS; - sfr at 0xAF AUTOPTRSETUP; - /* AUTOPTRSETUP */ - sbit at 0xAF+0 EXTACC; - sbit at 0xAF+1 APTR1FZ; - sbit at 0xAF+2 APTR2FZ; - - sfr at 0xB0 IOD; - sfr at 0xB1 IOE; - sfr at 0xB2 OEA; - sfr at 0xB3 OEB; - sfr at 0xB4 OEC; - sfr at 0xB5 OED; - sfr at 0xB6 OEE; - - sfr at 0xB8 IP; - /* IP */ - sbit at 0xB8+0 PX0; - sbit at 0xB8+1 PT0; - sbit at 0xB8+2 PX1; - sbit at 0xB8+3 PT1; - sbit at 0xB8+4 PS0; - sbit at 0xB8+5 PT2; - sbit at 0xB8+6 PS1; - - sfr at 0xBA EP01STAT; - sfr at 0xBB GPIFTRIG; - - sfr at 0xBD GPIFSGLDATH; - sfr at 0xBE GPIFSGLDATLX; - sfr at 0xBF GPIFSGLDATLNOX; - - sfr at 0xC0 SCON1; - /* SCON1 */ - sbit at 0xC0+0 RI1; - sbit at 0xC0+1 TI1; - sbit at 0xC0+2 RB81; - sbit at 0xC0+3 TB81; - sbit at 0xC0+4 REN1; - sbit at 0xC0+5 SM21; - sbit at 0xC0+6 SM11; - sbit at 0xC0+7 SM01; - sfr at 0xC1 SBUF1; - sfr at 0xC8 T2CON; - /* T2CON */ - sbit at 0xC8+0 CP_RL2; - sbit at 0xC8+1 C_T2; - sbit at 0xC8+2 TR2; - sbit at 0xC8+3 EXEN2; - sbit at 0xC8+4 TCLK; - sbit at 0xC8+5 RCLK; - sbit at 0xC8+6 EXF2; - sbit at 0xC8+7 TF2; - sfr at 0xCA RCAP2L; - sfr at 0xCB RCAP2H; - sfr at 0xCC TL2; - sfr at 0xCD TH2; - sfr at 0xD0 PSW; - /* PSW */ - sbit at 0xD0+0 P; - sbit at 0xD0+1 FL; - sbit at 0xD0+2 OV; - sbit at 0xD0+3 RS0; - sbit at 0xD0+4 RS1; - sbit at 0xD0+5 F0; - sbit at 0xD0+6 AC; - sbit at 0xD0+7 CY; - sfr at 0xD8 EICON; // Was WDCON in DS80C320 EICON; Bit Values differ from Reg320 - /* EICON */ - sbit at 0xD8+3 INT6; - sbit at 0xD8+4 RESI; - sbit at 0xD8+5 ERESI; - sbit at 0xD8+7 SMOD1; - sfr at 0xE0 ACC; - sfr at 0xE8 EIE; // EIE Bit Values differ from Reg320 - /* EIE */ - sbit at 0xE8+0 EIUSB; - sbit at 0xE8+1 EI2C; - sbit at 0xE8+2 EIEX4; - sbit at 0xE8+3 EIEX5; - sbit at 0xE8+4 EIEX6; - sfr at 0xF0 B; - sfr at 0xF8 EIP; // EIP Bit Values differ from Reg320 - /* EIP */ - sbit at 0xF8+0 PUSB; - sbit at 0xF8+1 PI2C; - sbit at 0xF8+2 EIPX4; - sbit at 0xF8+3 EIPX5; - sbit at 0xF8+4 EIPX6; - - /*----------------------------------------------------------------------------- - Bit Masks - -----------------------------------------------------------------------------*/ - - #define bmBIT0 1 - #define bmBIT1 2 - #define bmBIT2 4 - #define bmBIT3 8 - #define bmBIT4 16 - #define bmBIT5 32 - #define bmBIT6 64 - #define bmBIT7 128 - - /* CPU Control & Status Register (CPUCS) */ - #define bmPRTCSTB bmBIT5 - #define bmCLKSPD (bmBIT4 | bmBIT3) - #define bmCLKSPD1 bmBIT4 - #define bmCLKSPD0 bmBIT3 - #define bmCLKINV bmBIT2 - #define bmCLKOE bmBIT1 - #define bm8051RES bmBIT0 - /* Port Alternate Configuration Registers */ - /* Port A (PORTACFG) */ - #define bmFLAGD bmBIT7 - #define bmINT1 bmBIT1 - #define bmINT0 bmBIT0 - /* Port C (PORTCCFG) */ - #define bmGPIFA7 bmBIT7 - #define bmGPIFA6 bmBIT6 - #define bmGPIFA5 bmBIT5 - #define bmGPIFA4 bmBIT4 - #define bmGPIFA3 bmBIT3 - #define bmGPIFA2 bmBIT2 - #define bmGPIFA1 bmBIT1 - #define bmGPIFA0 bmBIT0 - /* Port E (PORTECFG) */ - #define bmGPIFA8 bmBIT7 - #define bmT2EX bmBIT6 - #define bmINT6 bmBIT5 - #define bmRXD1OUT bmBIT4 - #define bmRXD0OUT bmBIT3 - #define bmT2OUT bmBIT2 - #define bmT1OUT bmBIT1 - #define bmT0OUT bmBIT0 - - /* I2C Control & Status Register (I2CS) */ - #define bmSTART bmBIT7 - #define bmSTOP bmBIT6 - #define bmLASTRD bmBIT5 - #define bmID (bmBIT4 | bmBIT3) - #define bmBERR bmBIT2 - #define bmACK bmBIT1 - #define bmDONE bmBIT0 - /* I2C Control Register (I2CTL) */ - #define bmSTOPIE bmBIT1 - #define bm400KHZ bmBIT0 - /* Interrupt 2 (USB) Autovector Register (INT2IVEC) */ - #define bmIV4 bmBIT6 - #define bmIV3 bmBIT5 - #define bmIV2 bmBIT4 - #define bmIV1 bmBIT3 - #define bmIV0 bmBIT2 - /* USB Interrupt Request & Enable Registers (USBIE/USBIRQ) */ - #define bmEP0ACK bmBIT6 - #define bmHSGRANT bmBIT5 - #define bmURES bmBIT4 - #define bmSUSP bmBIT3 - #define bmSUTOK bmBIT2 - #define bmSOF bmBIT1 - #define bmSUDAV bmBIT0 - /* Breakpoint register (BREAKPT) */ - #define bmBREAK bmBIT3 - #define bmBPPULSE bmBIT2 - #define bmBPEN bmBIT1 - /* Interrupt 2 & 4 Setup (INTSETUP) */ - #define bmAV2EN bmBIT3 - #define bmINT4IN bmBIT1 - #define bmAV4EN bmBIT0 - /* USB Control & Status Register (USBCS) */ - #define bmHSM bmBIT7 - #define bmDISCON bmBIT3 - #define bmNOSYNSOF bmBIT2 - #define bmRENUM bmBIT1 - #define bmSIGRESUME bmBIT0 - /* Wakeup Control and Status Register (WAKEUPCS) */ - #define bmWU2 bmBIT7 - #define bmWU bmBIT6 - #define bmWU2POL bmBIT5 - #define bmWUPOL bmBIT4 - #define bmDPEN bmBIT2 - #define bmWU2EN bmBIT1 - #define bmWUEN bmBIT0 - /* End Point 0 Control & Status Register (EP0CS) */ - #define bmHSNAK bmBIT7 - /* End Point 0-1 Control & Status Registers (EP0CS/EP1OUTCS/EP1INCS) */ - #define bmEPBUSY bmBIT1 - #define bmEPSTALL bmBIT0 - /* End Point 2-8 Control & Status Registers (EP2CS/EP4CS/EP6CS/EP8CS) */ - #define bmNPAK (bmBIT6 | bmBIT5 | bmBIT4) - #define bmEPFULL bmBIT3 - #define bmEPEMPTY bmBIT2 - /* Endpoint Status (EP2468STAT) SFR bits */ - #define bmEP8FULL bmBIT7 - #define bmEP8EMPTY bmBIT6 - #define bmEP6FULL bmBIT5 - #define bmEP6EMPTY bmBIT4 - #define bmEP4FULL bmBIT3 - #define bmEP4EMPTY bmBIT2 - #define bmEP2FULL bmBIT1 - #define bmEP2EMPTY bmBIT0 - /* SETUP Data Pointer Auto Mode (SUDPTRCTL) */ - #define bmSDPAUTO bmBIT0 - /* Endpoint Data Toggle Control (TOGCTL) */ - #define bmQUERYTOGGLE bmBIT7 - #define bmSETTOGGLE bmBIT6 - #define bmRESETTOGGLE bmBIT5 - #define bmTOGCTLEPMASK bmBIT3 | bmBIT2 | bmBIT1 | bmBIT0 - /* IBN (In Bulk Nak) enable and request bits (IBNIE/IBNIRQ) */ - #define bmEP8IBN bmBIT5 - #define bmEP6IBN bmBIT4 - #define bmEP4IBN bmBIT3 - #define bmEP2IBN bmBIT2 - #define bmEP1IBN bmBIT1 - #define bmEP0IBN bmBIT0 - - /* PING-NAK enable and request bits (NAKIE/NAKIRQ) */ - #define bmEP8PING bmBIT7 - #define bmEP6PING bmBIT6 - #define bmEP4PING bmBIT5 - #define bmEP2PING bmBIT4 - #define bmEP1PING bmBIT3 - #define bmEP0PING bmBIT2 - #define bmIBN bmBIT0 - - /* Interface Configuration bits (IFCONFIG) */ - #define bmIFCLKSRC bmBIT7 // set == INTERNAL - #define bm3048MHZ bmBIT6 // set == 48 MHz - #define bmIFCLKOE bmBIT5 - #define bmIFCLKPOL bmBIT4 - #define bmASYNC bmBIT3 - #define bmGSTATE bmBIT2 - #define bmIFCFG1 bmBIT1 - #define bmIFCFG0 bmBIT0 - #define bmIFCFGMASK (bmIFCFG0 | bmIFCFG1) - #define bmIFGPIF bmIFCFG1 - - /* EP 2468 FIFO Configuration bits (EP2FIFOCFG,EP4FIFOCFG,EP6FIFOCFG,EP8FIFOCFG) */ - #define bmINFM bmBIT6 - #define bmOEP bmBIT5 - #define bmAUTOOUT bmBIT4 - #define bmAUTOIN bmBIT3 - #define bmZEROLENIN bmBIT2 - // must be zero bmBIT1 - #define bmWORDWIDE bmBIT0 - - /* - * Chip Revision Control Bits (REVCTL) - used to ebable/disable revision specific features - */ - #define bmNOAUTOARM bmBIT1 // these don't match the docs - #define bmSKIPCOMMIT bmBIT0 // these don't match the docs - - #define bmDYN_OUT bmBIT1 // these do... - #define bmENH_PKT bmBIT0 - - - /* Fifo Reset bits (FIFORESET) */ - #define bmNAKALL bmBIT7 - - /* Endpoint Configuration (EPxCFG) */ - #define bmVALID bmBIT7 - #define bmIN bmBIT6 - #define bmTYPE1 bmBIT5 - #define bmTYPE0 bmBIT4 - #define bmISOCHRONOUS bmTYPE0 - #define bmBULK bmTYPE1 - #define bmINTERRUPT (bmTYPE1 | bmTYPE0) - #define bm1KBUF bmBIT3 - #define bmBUF1 bmBIT1 - #define bmBUF0 bmBIT0 - #define bmQUADBUF 0 - #define bmINVALIDBUF bmBUF0 - #define bmDOUBLEBUF bmBUF1 - #define bmTRIPLEBUF (bmBUF1 | bmBUF0) - - /* OUTPKTEND */ - #define bmSKIP bmBIT7 // low 4 bits specify which end point - - /* GPIFTRIG defs */ - #define bmGPIF_IDLE bmBIT7 // status bit - - #define bmGPIF_EP2_START 0 - #define bmGPIF_EP4_START 1 - #define bmGPIF_EP6_START 2 - #define bmGPIF_EP8_START 3 - #define bmGPIF_READ bmBIT2 - #define bmGPIF_WRITE 0 - - /* EXIF bits */ - #define bmEXIF_USBINT bmBIT4 - #define bmEXIF_I2CINT bmBIT5 - #define bmEXIF_IE4 bmBIT6 - #define bmEXIF_IE5 bmBIT7 - - - #endif /* FX2REGS_H */ - diff --git a/fx2/fx2utils.c b/fx2/fx2utils.c index b6797cc..d5d88fb 100644 --- a/fx2/fx2utils.c +++ b/fx2/fx2utils.c @@ -1,104 +1,52 @@ /* -*- c++ -*- */ - /*----------------------------------------------------------------------------- - * FX2 specific subroutines - *----------------------------------------------------------------------------- - * Code taken from USRP2 firmware (GNU Radio Project), version 3.0.2, - * Copyright 2003 Free Software Foundation, Inc. - *----------------------------------------------------------------------------- - * This code is part of usbjtag. usbjtag is free software; you can redistribute - * it and/or modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the License, - * or (at your option) any later version. usbjtag is distributed in the hope - * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. You should have received a - * copy of the GNU General Public License along with this program in the file - * COPYING; if not, write to the Free Software Foundation, Inc., 51 Franklin - * St, Fifth Floor, Boston, MA 02110-1301 USA - *----------------------------------------------------------------------------- - */ - - #include "fx2utils.h" - #include "fx2regs.h" - #include "delay.h" - - void - fx2_stall_ep0 (void) - { - EP0CS |= bmEPSTALL; - } - - void - fx2_reset_data_toggle (unsigned char ep) - { - TOGCTL = ((ep & 0x80) >> 3 | (ep & 0x0f)); - TOGCTL |= bmRESETTOGGLE; - } - - void - fx2_renumerate (void) - { - USBCS |= bmDISCON | bmRENUM; - - // mdelay (1500); // FIXME why 1.5 seconds? - mdelay (250); // FIXME why 1.5 seconds? - - USBIRQ = 0xff; // clear any pending USB irqs... - EPIRQ = 0xff; // they're from before the renumeration - - EXIF &= ~bmEXIF_USBINT; - - USBCS &= ~bmDISCON; // reconnect USB - } - diff --git a/fx2/fx2utils.h b/fx2/fx2utils.h index 54c61df..d937a16 100644 --- a/fx2/fx2utils.h +++ b/fx2/fx2utils.h @@ -1,60 +1,30 @@ /* -*- c++ -*- */ - /*----------------------------------------------------------------------------- - * FX2 specific subroutines - *----------------------------------------------------------------------------- - * Code taken from USRP2 firmware (GNU Radio Project), version 3.0.2, - * Copyright 2003 Free Software Foundation, Inc. - *----------------------------------------------------------------------------- - * This code is part of usbjtag. usbjtag is free software; you can redistribute - * it and/or modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the License, - * or (at your option) any later version. usbjtag is distributed in the hope - * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. You should have received a - * copy of the GNU General Public License along with this program in the file - * COPYING; if not, write to the Free Software Foundation, Inc., 51 Franklin - * St, Fifth Floor, Boston, MA 02110-1301 USA - *----------------------------------------------------------------------------- - */ - - #ifndef _FX2UTILS_H_ - #define _FX2UTILS_H_ - - void fx2_stall_ep0 (void); - void fx2_reset_data_toggle (unsigned char ep); - void fx2_renumerate (void); - - - - #endif /* _FX2UTILS_H_ */ - diff --git a/fx2/i2c.c b/fx2/i2c.c index 99ed1f7..2fefdf5 100644 --- a/fx2/i2c.c +++ b/fx2/i2c.c @@ -1,242 +1,121 @@ /* -*- c++ -*- */ - /*----------------------------------------------------------------------------- - * I2C read/write functions for FX2 - *----------------------------------------------------------------------------- - * Code taken from USRP2 firmware (GNU Radio Project), version 3.0.2, - * Copyright 2003 Free Software Foundation, Inc. - *----------------------------------------------------------------------------- - * This code is part of usbjtag. usbjtag is free software; you can redistribute - * it and/or modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the License, - * or (at your option) any later version. usbjtag is distributed in the hope - * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. You should have received a - * copy of the GNU General Public License along with this program in the file - * COPYING; if not, write to the Free Software Foundation, Inc., 51 Franklin - * St, Fifth Floor, Boston, MA 02110-1301 USA - *----------------------------------------------------------------------------- - */ - - #include "i2c.h" - #include "fx2regs.h" - #include - - - // issue a stop bus cycle and wait for completion - - - // returns non-zero if successful, else 0 - unsigned char - i2c_read (unsigned char addr, xdata unsigned char *buf, unsigned char len) - { - volatile unsigned char junk; - - if (len == 0) // reading zero bytes always works - return 1; - - while (I2CS & bmSTOP) // wait for stop to clear - ; - - I2CS = bmSTART; - I2DAT = (addr << 1) | 1; // write address and direction (1's the read bit) - - while ((I2CS & bmDONE) == 0) - ; - - if ((I2CS & bmBERR) || (I2CS & bmACK) == 0) // no device answered... - goto fail; - - if (len == 1) - I2CS |= bmLASTRD; - - junk = I2DAT; // trigger the first read cycle - - while (--len != 0){ - while ((I2CS & bmDONE) == 0) - ; - - if (I2CS & bmBERR) - goto fail; - - if (len == 1) - I2CS |= bmLASTRD; - - *buf++ = I2DAT; // get data, trigger another read - } - - // wait for final byte - - while ((I2CS & bmDONE) == 0) - ; - - if (I2CS & bmBERR) - goto fail; - - I2CS |= bmSTOP; - *buf = I2DAT; - - return 1; - - fail: - I2CS |= bmSTOP; - return 0; - } - - - - // returns non-zero if successful, else 0 - unsigned char - i2c_write (unsigned char addr, xdata const unsigned char *buf, unsigned char len) - { - while (I2CS & bmSTOP) // wait for stop to clear - ; - - I2CS = bmSTART; - I2DAT = (addr << 1) | 0; // write address and direction (0's the write bit) - - while ((I2CS & bmDONE) == 0) - ; - - if ((I2CS & bmBERR) || (I2CS & bmACK) == 0) // no device answered... - goto fail; - - while (len > 0){ - I2DAT = *buf++; - len--; - - while ((I2CS & bmDONE) == 0) - ; - - if ((I2CS & bmBERR) || (I2CS & bmACK) == 0) // no device answered... - goto fail; - } - - I2CS |= bmSTOP; - return 1; - - fail: - I2CS |= bmSTOP; - return 0; - } - diff --git a/fx2/i2c.h b/fx2/i2c.h index 2be98ad..d681e8c 100644 --- a/fx2/i2c.h +++ b/fx2/i2c.h @@ -1,60 +1,30 @@ /* -*- c++ -*- */ - /*----------------------------------------------------------------------------- - * I2C read/write functions for FX2 - *----------------------------------------------------------------------------- - * Code taken from USRP2 firmware (GNU Radio Project), version 3.0.2, - * Copyright 2003 Free Software Foundation, Inc. - *----------------------------------------------------------------------------- - * This code is part of usbjtag. usbjtag is free software; you can redistribute - * it and/or modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the License, - * or (at your option) any later version. usbjtag is distributed in the hope - * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. You should have received a - * copy of the GNU General Public License along with this program in the file - * COPYING; if not, write to the Free Software Foundation, Inc., 51 Franklin - * St, Fifth Floor, Boston, MA 02110-1301 USA - *----------------------------------------------------------------------------- - */ - - #ifndef _I2C_H_ - #define _I2C_H_ - - // returns non-zero if successful, else 0 - 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); - - #endif /* _I2C_H_ */ - diff --git a/fx2/isr.c b/fx2/isr.c index f92a064..cb1e0b8 100644 --- a/fx2/isr.c +++ b/fx2/isr.c @@ -1,336 +1,168 @@ /* -*- c++ -*- */ - /*----------------------------------------------------------------------------- - * Interrupt handling for FX2 - *----------------------------------------------------------------------------- - * Code taken from USRP2 firmware (GNU Radio Project), version 3.0.2, - * Copyright 2003 Free Software Foundation, Inc. - *----------------------------------------------------------------------------- - * This code is part of usbjtag. usbjtag is free software; you can redistribute - * it and/or modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the License, - * or (at your option) any later version. usbjtag is distributed in the hope - * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. You should have received a - * copy of the GNU General Public License along with this program in the file - * COPYING; if not, write to the Free Software Foundation, Inc., 51 Franklin - * St, Fifth Floor, Boston, MA 02110-1301 USA - *----------------------------------------------------------------------------- - */ - - #include "isr.h" - #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[]; - - #define LJMP_OPCODE 0x02 - - /* - * Hook standard interrupt vector. - * - * vector_number is from the SV_ list. - * addr is the address of the interrupt service routine. - */ - void - hook_sv (unsigned char vector_number, unsigned short addr) - { - bit t; - - // sanity checks - - if (vector_number < SV_MIN || vector_number > SV_MAX) - return; - - if ((vector_number & 0x0f) != 0x03 && (vector_number & 0x0f) != 0x0b) - return; - - t = EA; - EA = 0; - _standard_interrupt_vector[vector_number] = LJMP_OPCODE; - _standard_interrupt_vector[vector_number + 1] = addr >> 8; - _standard_interrupt_vector[vector_number + 2] = addr & 0xff; - EA = t; - } - - /* - * Hook usb interrupt vector. - * - * vector_number is from the UV_ list. - * addr is the address of the interrupt service routine. - */ - void - hook_uv (unsigned char vector_number, unsigned short addr) - { - bit t; - - // sanity checks - - #if UV_MIN>0 - if (vector_number < UV_MIN) return; - #endif - if (vector_number > UV_MAX) - return; - - if ((vector_number & 0x3) != 0) - return; - - t = EA; - EA = 0; - _usb_autovector[vector_number] = LJMP_OPCODE; - _usb_autovector[vector_number + 1] = addr >> 8; - _usb_autovector[vector_number + 2] = addr & 0xff; - EA = t; - } - - /* - * Hook fifo/gpif interrupt vector. - * - * vector_number is from the FGV_ list. - * addr is the address of the interrupt service routine. - */ - void - hook_fgv (unsigned char vector_number, unsigned short addr) - { - bit t; - - // sanity checks - - if (vector_number < FGV_MIN || vector_number > FGV_MAX) - return; - - if ((vector_number & 0x3) != 0) - return; - - t = EA; - EA = 0; - _fifo_gpif_autovector[vector_number] = LJMP_OPCODE; - _fifo_gpif_autovector[vector_number + 1] = addr >> 8; - _fifo_gpif_autovector[vector_number + 2] = addr & 0xff; - EA = t; - } - - /* - * One time call to enable autovectoring for both USB and FIFO/GPIF. - * - * This disables all USB and FIFO/GPIF interrupts and clears - * any pending interrupts too. It leaves the master USB and FIFO/GPIF - * interrupts enabled. - */ - void - setup_autovectors (void) - { - // disable master usb and fifo/gpif interrupt enables - EIUSB = 0; - EIEX4 = 0; - - hook_sv (SV_INT_2, (unsigned short) _usb_autovector); - hook_sv (SV_INT_4, (unsigned short) _fifo_gpif_autovector); - - // disable all fifo interrupt enables - SYNCDELAY; - EP2FIFOIE = 0; SYNCDELAY; - EP4FIFOIE = 0; SYNCDELAY; - EP6FIFOIE = 0; SYNCDELAY; - EP8FIFOIE = 0; SYNCDELAY; - - // clear all pending fifo irqs - EP2FIFOIRQ = 0xff; SYNCDELAY; - EP4FIFOIRQ = 0xff; SYNCDELAY; - EP6FIFOIRQ = 0xff; SYNCDELAY; - EP8FIFOIRQ = 0xff; SYNCDELAY; - - IBNIE = 0; - IBNIRQ = 0xff; - NAKIE = 0; - NAKIRQ = 0xff; - USBIE = 0; - USBIRQ = 0xff; - EPIE = 0; - EPIRQ = 0xff; - SYNCDELAY; GPIFIE = 0; - SYNCDELAY; GPIFIRQ = 0xff; - USBERRIE = 0; - USBERRIRQ = 0xff; - CLRERRCNT = 0; - - INTSETUP = bmAV2EN | bmAV4EN | bmINT4IN; - - // clear master irq's for usb and fifo/gpif - EXIF &= ~bmEXIF_USBINT; - EXIF &= ~bmEXIF_IE4; - - // enable master usb and fifo/gpif interrrupts - EIUSB = 1; - EIEX4 = 1; - } - diff --git a/fx2/syncdelay.h b/fx2/syncdelay.h index 178f316..3293fd9 100644 --- a/fx2/syncdelay.h +++ b/fx2/syncdelay.h @@ -1,128 +1,64 @@ /* -*- c++ -*- */ - /*----------------------------------------------------------------------------- - * Synchronization delay for FX2 access to specific registers - *----------------------------------------------------------------------------- - * Code taken from USRP2 firmware (GNU Radio Project), version 3.0.2, - * Copyright 2003 Free Software Foundation, Inc. - *----------------------------------------------------------------------------- - * This code is part of usbjtag. usbjtag is free software; you can redistribute - * it and/or modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the License, - * or (at your option) any later version. usbjtag is distributed in the hope - * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. You should have received a - * copy of the GNU General Public License along with this program in the file - * COPYING; if not, write to the Free Software Foundation, Inc., 51 Franklin - * St, Fifth Floor, Boston, MA 02110-1301 USA - *----------------------------------------------------------------------------- - */ - - #ifndef _SYNCDELAY_H_ - #define _SYNCDELAY_H_ - - /* - * Magic delay required between access to certain xdata registers (TRM page 15-106). - * For our configuration, 48 MHz FX2 / 48 MHz IFCLK, we need three cycles. Each - * NOP is a single cycle.... - * - * From TRM page 15-105: - * - * Under certain conditions, some read and write access to the FX2 registers must - * be separated by a "synchronization delay". The delay is necessary only under the - * following conditions: - * - * - between a write to any register in the 0xE600 - 0xE6FF range and a write to one - * of the registers listed below. - * - * - between a write to one of the registers listed below and a read from any register - * in the 0xE600 - 0xE6FF range. - * - * Registers which require a synchronization delay: - * - * FIFORESET FIFOPINPOLAR - * INPKTEND EPxBCH:L - * EPxFIFOPFH:L EPxAUTOINLENH:L - * EPxFIFOCFG EPxGPIFFLGSEL - * PINFLAGSAB PINFLAGSCD - * EPxFIFOIE EPxFIFOIRQ - * GPIFIE GPIFIRQ - * UDMACRCH:L GPIFADRH:L - * GPIFTRIG EPxGPIFTRIG - * OUTPKTEND REVCTL - * GPIFTCB3 GPIFTCB2 - * GPIFTCB1 GPIFTCB0 - */ - - /* - * FIXME ensure that the peep hole optimizer isn't screwing us - */ - #define SYNCDELAY _asm nop; nop; nop; _endasm - #define NOP _asm nop; _endasm - - - #endif /* _SYNCDELAY_H_ */ - diff --git a/fx2/timer.c b/fx2/timer.c index 44e46e8..3b268ac 100644 --- a/fx2/timer.c +++ b/fx2/timer.c @@ -1,94 +1,47 @@ /* -*- c++ -*- */ - /*----------------------------------------------------------------------------- - * Timer handling for FX2 - *----------------------------------------------------------------------------- - * Code taken from USRP2 firmware (GNU Radio Project), version 3.0.2, - * Copyright 2003 Free Software Foundation, Inc. - *----------------------------------------------------------------------------- - * This code is part of usbjtag. usbjtag is free software; you can redistribute - * it and/or modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the License, - * or (at your option) any later version. usbjtag is distributed in the hope - * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. You should have received a - * copy of the GNU General Public License along with this program in the file - * COPYING; if not, write to the Free Software Foundation, Inc., 51 Franklin - * St, Fifth Floor, Boston, MA 02110-1301 USA - *----------------------------------------------------------------------------- - */ - - #include "timer.h" - #include "fx2regs.h" - #include "isr.h" - - /* - * Arrange to have isr_tick_handler called at 100 Hz. - * - * The cpu clock is running at 48e6. The input to the timer - * is 48e6 / 12 = 4e6. - * - * We arrange to have the timer overflow every 40000 clocks == 100 Hz - */ - - #define RELOAD_VALUE ((unsigned short) -40000) - - void - hook_timer_tick (unsigned short isr_tick_handler) - { - ET2 = 0; // disable timer 2 interrupts - hook_sv (SV_TIMER_2, isr_tick_handler); - - RCAP2H = RELOAD_VALUE >> 8; // setup the auto reload value - RCAP2L = RELOAD_VALUE & 0xFF; - - T2CON = 0x04; // interrupt on overflow; reload; run - ET2 = 1; // enable timer 2 interrupts - } - diff --git a/fx2/timer.h b/fx2/timer.h index 69f3927..79cc436 100644 --- a/fx2/timer.h +++ b/fx2/timer.h @@ -1,65 +1,33 @@ /* -*- c++ -*- */ - /*----------------------------------------------------------------------------- - * Timer handling for FX2 - *----------------------------------------------------------------------------- - * Code taken from USRP2 firmware (GNU Radio Project), version 3.0.2, - * Copyright 2003 Free Software Foundation, Inc. - *----------------------------------------------------------------------------- - * This code is part of usbjtag. usbjtag is free software; you can redistribute - * it and/or modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the License, - * or (at your option) any later version. usbjtag is distributed in the hope - * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. You should have received a - * copy of the GNU General Public License along with this program in the file - * COPYING; if not, write to the Free Software Foundation, Inc., 51 Franklin - * St, Fifth Floor, Boston, MA 02110-1301 USA - *----------------------------------------------------------------------------- - */ - - #ifndef _TIMER_H_ - #define _TIMER_H_ - - /* - * Arrange to have isr_tick_handler called at 100 Hz - */ - void hook_timer_tick (unsigned short isr_tick_handler); - - #define clear_timer_irq() \ TF2 = 0 /* clear overflow flag */ - - - #endif /* _TIMER_H_ */ - diff --git a/fx2/usb_common.c b/fx2/usb_common.c index 8805e45..4fc3492 100644 --- a/fx2/usb_common.c +++ b/fx2/usb_common.c @@ -1,752 +1,376 @@ /* -*- c++ -*- */ - /*----------------------------------------------------------------------------- - * Common USB code for FX2 - *----------------------------------------------------------------------------- - * Code taken from USRP2 firmware (GNU Radio Project), version 3.0.2, - * Copyright 2003 Free Software Foundation, Inc. - *----------------------------------------------------------------------------- - * This code is part of usbjtag. usbjtag is free software; you can redistribute - * it and/or modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the License, - * or (at your option) any later version. usbjtag is distributed in the hope - * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. You should have received a - * copy of the GNU General Public License along with this program in the file - * COPYING; if not, write to the Free Software Foundation, Inc., 51 Franklin - * St, Fifth Floor, Boston, MA 02110-1301 USA - *----------------------------------------------------------------------------- - */ - - #include "usb_common.h" - #include "fx2regs.h" - #include "syncdelay.h" - #include "fx2utils.h" - #include "isr.h" - #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[]; - - 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; - - static void - setup_descriptors (void) - { - if (USBCS & bmHSM){ // high speed mode - current_device_descr = high_speed_device_descr; - current_devqual_descr = high_speed_devqual_descr; - current_config_descr = high_speed_config_descr; - other_config_descr = full_speed_config_descr; - EP8AUTOINLENH = 0x02; SYNCDELAY; // Size in bytes of the IN data automatically commited (512 bytes here) - EP8AUTOINLENL = 0x00; SYNCDELAY; // Can use signal PKTEND if you want to commit a shorter packet - } - else { - current_device_descr = full_speed_device_descr; - current_devqual_descr = full_speed_devqual_descr; - current_config_descr = full_speed_config_descr; - other_config_descr = high_speed_config_descr; - EP8AUTOINLENH = 0x00; SYNCDELAY; // Size in bytes of the IN data automatically commited (64 bytes here) - EP8AUTOINLENL = 0x40; SYNCDELAY; // Can use signal PKTEND if you want to commit a shorter packet - } - - // whack the type fields - // FIXME, may not be required. - // current_config_descr[1] = DT_CONFIG; - // other_config_descr[1] = DT_OTHER_SPEED; - } - - static void - isr_SUDAV (void) interrupt - { - clear_usb_irq (); - _usb_got_SUDAV = 1; - } - - static void - isr_USBRESET (void) interrupt - { - clear_usb_irq (); - setup_descriptors (); - } - - static void - isr_HIGHSPEED (void) interrupt - { - clear_usb_irq (); - setup_descriptors (); - } - - void - usb_install_handlers (void) - { - setup_descriptors (); // ensure that they're set before use - - hook_uv (UV_SUDAV, (unsigned short) isr_SUDAV); - hook_uv (UV_USBRESET, (unsigned short) isr_USBRESET); - hook_uv (UV_HIGHSPEED, (unsigned short) isr_HIGHSPEED); - - USBIE = bmSUDAV | bmURES | bmHSGRANT; - } - - // On the FX2 the only plausible endpoints are 0, 1, 2, 4, 6, 8 - // This doesn't check to see that they're enabled - - unsigned char - plausible_endpoint (unsigned char ep) - { - ep &= ~0x80; // ignore direction bit - - if (ep > 8) - return 0; - - if (ep == 1) - return 1; - - return (ep & 0x1) == 0; // must be even - } - - // return pointer to control and status register for endpoint. - // only called with plausible_endpoints - - xdata volatile unsigned char * - epcs (unsigned char ep) - { - if (ep == 0x01) // ep1 has different in and out CS regs - return EP1OUTCS; - - if (ep == 0x81) - return EP1INCS; - - ep &= ~0x80; // ignore direction bit - - if (ep == 0x00) // ep0 - return EP0CS; - - return EP2CS + (ep >> 1); // 2, 4, 6, 8 are consecutive - } - - void - usb_handle_setup_packet (void) - { - _usb_got_SUDAV = 0; - - // handle the standard requests... - - switch (bRequestType & bmRT_TYPE_MASK){ - - case bmRT_TYPE_CLASS: - case bmRT_TYPE_RESERVED: - fx2_stall_ep0 (); // we don't handle these. indicate error - break; - - case bmRT_TYPE_VENDOR: - // call the application code. - // If it handles the command it returns non-zero - - if (!app_vendor_cmd ()) - fx2_stall_ep0 (); - break; - - case bmRT_TYPE_STD: - // these are the standard requests... - - if ((bRequestType & bmRT_DIR_MASK) == bmRT_DIR_IN){ - - //////////////////////////////////// - // handle the IN requests - //////////////////////////////////// - - switch (bRequest){ - - case RQ_GET_CONFIG: - EP0BUF[0] = _usb_config; // FIXME app should handle - EP0BCH = 0; - EP0BCL = 1; - break; - - // -------------------------------- - - case RQ_GET_INTERFACE: - EP0BUF[0] = _usb_alt_setting; // FIXME app should handle - EP0BCH = 0; - EP0BCL = 1; - break; - - // -------------------------------- - - case RQ_GET_DESCR: - switch (wValueH){ - - case DT_DEVICE: - SUDPTRH = MSB (current_device_descr); - SUDPTRL = LSB (current_device_descr); - break; - - case DT_DEVQUAL: - SUDPTRH = MSB (current_devqual_descr); - SUDPTRL = LSB (current_devqual_descr); - break; - - case DT_CONFIG: - if (0 && wValueL != 1) // FIXME only a single configuration - fx2_stall_ep0 (); - else { - SUDPTRH = MSB (current_config_descr); - SUDPTRL = LSB (current_config_descr); - } - break; - - case DT_OTHER_SPEED: - if (0 && wValueL != 1) // FIXME only a single configuration - fx2_stall_ep0 (); - else { - SUDPTRH = MSB (other_config_descr); - SUDPTRL = LSB (other_config_descr); - } - break; - - case DT_STRING: - if (wValueL >= nstring_descriptors) - fx2_stall_ep0 (); - else { - xdata char *p = string_descriptors[wValueL]; - SUDPTRH = MSB (p); - SUDPTRL = LSB (p); - } - break; - - default: - fx2_stall_ep0 (); // invalid request - break; - } - break; - - // -------------------------------- - - case RQ_GET_STATUS: - switch (bRequestType & bmRT_RECIP_MASK){ - case bmRT_RECIP_DEVICE: - EP0BUF[0] = 0; - EP0BUF[1] = 0; - EP0BCH = 0; - EP0BCL = 2; - break; - - case bmRT_RECIP_INTERFACE: - EP0BUF[0] = 0; - EP0BUF[1] = 0; - EP0BCH = 0; - EP0BCL = 2; - break; - - case bmRT_RECIP_ENDPOINT: - if (plausible_endpoint (wIndexL)){ - EP0BUF[0] = *epcs (wIndexL) & bmEPSTALL; - EP0BUF[1] = 0; - EP0BCH = 0; - EP0BCL = 2; - } - else - fx2_stall_ep0 (); - break; - - default: - fx2_stall_ep0 (); - break; - } - break; - - // -------------------------------- - - case RQ_SYNCH_FRAME: // not implemented - default: - fx2_stall_ep0 (); - break; - } - } - - else { - - //////////////////////////////////// - // handle the OUT requests - //////////////////////////////////// - - switch (bRequest){ - - case RQ_SET_CONFIG: - IOE &= ~(1 << 6); - _usb_config = wValueL; // FIXME app should handle - break; - - case RQ_SET_INTERFACE: - _usb_alt_setting = wValueL; // FIXME app should handle - break; - - // -------------------------------- - - case RQ_CLEAR_FEATURE: - switch (bRequestType & bmRT_RECIP_MASK){ - - case bmRT_RECIP_DEVICE: - switch (wValueL){ - case FS_DEV_REMOTE_WAKEUP: - default: - fx2_stall_ep0 (); - } - break; - - case bmRT_RECIP_ENDPOINT: - if (wValueL == FS_ENDPOINT_HALT && plausible_endpoint (wIndexL)){ - *epcs (wIndexL) &= ~bmEPSTALL; - fx2_reset_data_toggle (wIndexL); - } - else - fx2_stall_ep0 (); - break; - - default: - fx2_stall_ep0 (); - break; - } - break; - - // -------------------------------- - - case RQ_SET_FEATURE: - switch (bRequestType & bmRT_RECIP_MASK){ - - case bmRT_RECIP_DEVICE: - switch (wValueL){ - case FS_TEST_MODE: - // hardware handles this after we complete SETUP phase handshake - break; - - case FS_DEV_REMOTE_WAKEUP: - default: - fx2_stall_ep0 (); - break; - } - } - break; - - case bmRT_RECIP_ENDPOINT: - switch (wValueL){ - case FS_ENDPOINT_HALT: - if (plausible_endpoint (wIndexL)) - *epcs (wIndexL) |= bmEPSTALL; - else - fx2_stall_ep0 (); - break; - - default: - fx2_stall_ep0 (); - break; - } - break; - - // -------------------------------- - - case RQ_SET_ADDRESS: // handled by fx2 hardware - case RQ_SET_DESCR: // not implemented - default: - fx2_stall_ep0 (); - } - - } - break; - - } // bmRT_TYPE_MASK - - // ack handshake phase of device request - EP0CS |= bmHSNAK; - } - diff --git a/fx2/usb_common.h b/fx2/usb_common.h index b34e4b8..4e86af6 100644 --- a/fx2/usb_common.h +++ b/fx2/usb_common.h @@ -1,100 +1,50 @@ /* -*- c++ -*- */ - /*----------------------------------------------------------------------------- - * Common USB code for FX2 - *----------------------------------------------------------------------------- - * Code taken from USRP2 firmware (GNU Radio Project), version 3.0.2, - * Copyright 2003 Free Software Foundation, Inc. - *----------------------------------------------------------------------------- - * This code is part of usbjtag. usbjtag is free software; you can redistribute - * it and/or modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the License, - * or (at your option) any later version. usbjtag is distributed in the hope - * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. You should have received a - * copy of the GNU General Public License along with this program in the file - * COPYING; if not, write to the Free Software Foundation, Inc., 51 Franklin - * St, Fifth Floor, Boston, MA 02110-1301 USA - *----------------------------------------------------------------------------- - */ - - #ifndef _USB_COMMON_H_ - #define _USB_COMMON_H_ - - #define bRequestType SETUPDAT[0] - #define bRequest SETUPDAT[1] - #define wValueL SETUPDAT[2] - #define wValueH SETUPDAT[3] - #define wIndexL SETUPDAT[4] - #define wIndexH SETUPDAT[5] - #define wLengthL SETUPDAT[6] - #define wLengthH SETUPDAT[7] - - #define MSB(x) (((unsigned short) x) >> 8) - #define LSB(x) (((unsigned short) x) & 0xff) - - extern volatile bit _usb_got_SUDAV; - - // Provided by user application to report device status. - // returns non-zero if it handled the command. - unsigned char app_get_status (void); - // Provided by user application to handle VENDOR commands. - // returns non-zero if it handled the command. - unsigned char app_vendor_cmd (void); - - void usb_install_handlers (void); - void usb_handle_setup_packet (void); - - #define usb_setup_packet_avail() _usb_got_SUDAV - - #endif /* _USB_COMMON_H_ */ - diff --git a/fx2/usb_descriptors.h b/fx2/usb_descriptors.h index f4a2faf..cbf9610 100644 --- a/fx2/usb_descriptors.h +++ b/fx2/usb_descriptors.h @@ -1,76 +1,38 @@ /* -*- c++ -*- */ - /*----------------------------------------------------------------------------- - * USB descriptor references - *----------------------------------------------------------------------------- - * Code taken from USRP2 firmware (GNU Radio Project), version 3.0.2, - * Copyright 2003 Free Software Foundation, Inc. - *----------------------------------------------------------------------------- - * This code is part of usbjtag. usbjtag is free software; you can redistribute - * it and/or modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the License, - * or (at your option) any later version. usbjtag is distributed in the hope - * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. You should have received a - * copy of the GNU General Public License along with this program in the file - * COPYING; if not, write to the Free Software Foundation, Inc., 51 Franklin - * St, Fifth Floor, 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 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[]; - - /* - * 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[]; - diff --git a/fx2/usb_requests.h b/fx2/usb_requests.h index 5af607f..0cad7a4 100644 --- a/fx2/usb_requests.h +++ b/fx2/usb_requests.h @@ -1,172 +1,86 @@ /* -*- c++ -*- */ - /*----------------------------------------------------------------------------- - * USB request definitions - *----------------------------------------------------------------------------- - * Code taken from USRP2 firmware (GNU Radio Project), version 3.0.2, - * Copyright 2003 Free Software Foundation, Inc. - *----------------------------------------------------------------------------- - * This code is part of usbjtag. usbjtag is free software; you can redistribute - * it and/or modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the License, - * or (at your option) any later version. usbjtag is distributed in the hope - * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. You should have received a - * copy of the GNU General Public License along with this program in the file - * COPYING; if not, write to the Free Software Foundation, Inc., 51 Franklin - * St, Fifth Floor, Boston, MA 02110-1301 USA - *----------------------------------------------------------------------------- - */ - - // Standard USB requests. - // These are contained in end point 0 setup packets - - - #ifndef _USB_REQUESTS_H_ - #define _USB_REQUESTS_H_ - - // format of bmRequestType byte - - #define bmRT_DIR_MASK (0x1 << 7) - #define bmRT_DIR_IN (1 << 7) - #define bmRT_DIR_OUT (0 << 7) - - #define bmRT_TYPE_MASK (0x3 << 5) - #define bmRT_TYPE_STD (0 << 5) - #define bmRT_TYPE_CLASS (1 << 5) - #define bmRT_TYPE_VENDOR (2 << 5) - #define bmRT_TYPE_RESERVED (3 << 5) - - #define bmRT_RECIP_MASK (0x1f << 0) - #define bmRT_RECIP_DEVICE (0 << 0) - #define bmRT_RECIP_INTERFACE (1 << 0) - #define bmRT_RECIP_ENDPOINT (2 << 0) - #define bmRT_RECIP_OTHER (3 << 0) - - - // standard request codes (bRequest) - - #define RQ_GET_STATUS 0 - #define RQ_CLEAR_FEATURE 1 - #define RQ_RESERVED_2 2 - #define RQ_SET_FEATURE 3 - #define RQ_RESERVED_4 4 - #define RQ_SET_ADDRESS 5 - #define RQ_GET_DESCR 6 - #define RQ_SET_DESCR 7 - #define RQ_GET_CONFIG 8 - #define RQ_SET_CONFIG 9 - #define RQ_GET_INTERFACE 10 - #define RQ_SET_INTERFACE 11 - #define RQ_SYNCH_FRAME 12 - - // standard descriptor types - - #define DT_DEVICE 1 - #define DT_CONFIG 2 - #define DT_STRING 3 - #define DT_INTERFACE 4 - #define DT_ENDPOINT 5 - #define DT_DEVQUAL 6 - #define DT_OTHER_SPEED 7 - #define DT_INTERFACE_POWER 8 - - // standard feature selectors - - #define FS_ENDPOINT_HALT 0 // recip: endpoint - #define FS_DEV_REMOTE_WAKEUP 1 // recip: device - #define FS_TEST_MODE 2 // recip: device - - // Get Status device attributes - - #define bmGSDA_SELF_POWERED 0x01 - #define bmGSDA_REM_WAKEUP 0x02 - - - #endif /* _USB_REQUESTS_H_ */ - diff --git a/hardware.h b/hardware.h index 59f29e6..4cb5d02 100644 --- a/hardware.h +++ b/hardware.h @@ -1,68 +1,34 @@ /*----------------------------------------------------------------------------- - * Hardware-dependent code for usb_jtag - *----------------------------------------------------------------------------- - * Copyright (C) 2007 Kolja Waschk, ixo.de - *----------------------------------------------------------------------------- - * This code is part of usbjtag. usbjtag is free software; you can redistribute - * it and/or modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the License, - * or (at your option) any later version. usbjtag is distributed in the hope - * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. You should have received a - * copy of the GNU General Public License along with this program in the file - * COPYING; if not, write to the Free Software Foundation, Inc., 51 Franklin - * St, Fifth Floor, Boston, MA 02110-1301 USA - *----------------------------------------------------------------------------- - */ - - #ifndef _HARDWARE_H - #define _HARDWARE_H 1 - - extern void ProgIO_Init(void); - extern void ProgIO_Poll(void); - extern void ProgIO_Enable(void); - extern void ProgIO_Disable(void); - extern void ProgIO_Deinit(void); - - extern void ProgIO_Set_State(unsigned char d); - extern unsigned char ProgIO_Set_Get_State(unsigned char d); - extern void ProgIO_ShiftOut(unsigned char x); - extern unsigned char ProgIO_ShiftInOut(unsigned char x); - - #endif /* _HARDWARE_H */ - - diff --git a/hw_basic.c b/hw_basic.c index 2014fbe..69867dc 100644 --- a/hw_basic.c +++ b/hw_basic.c @@ -21,22 +21,26 @@ #include "delay.h" //----------------------------------------------------------------------------- +// comment out (undefine!) if you don't want PS, AS or OE signals #define HAVE_PS_MODE 1 #define HAVE_AS_MODE 1 #define HAVE_OE_LED 1 +// comment in (define!) if you want outputs disabled when possible +//#define HAVE_OENABLE 1 + //----------------------------------------------------------------------------- /* JTAG TCK, AS/PS DCLK */ -sbit at 0xA2 TCK; /* Port C.0 */ +sbit at 0xA2 TCK; /* Port C.2 */ #define bmTCKOE bmBIT2 #define SetTCK(x) do{TCK=(x);}while(0) /* JTAG TDI, AS ASDI, PS DATA0 */ -sbit at 0xA0 TDI; /* Port C.2 */ +sbit at 0xA0 TDI; /* Port C.0 */ #define bmTDIOE bmBIT0 #define SetTDI(x) do{TDI=(x);}while(0) @@ -53,7 +57,7 @@ sbit at 0xA1 TDO; /* Port C.1 */ #define GetTDO(x) TDO /* JTAG ENABLE */ -sbit JTAG_EN = 0xA0+7; +sbit JTAG_EN = 0xA7; /* Port C.7 */ #define bmJTAG_EN bmBIT7 //----------------------------------------------------------------------------- @@ -69,7 +73,7 @@ sbit JTAG_EN = 0xA0+7; #else #define bmASDOOE 0 - #define GetASDO(x) 0 + #define GetASDO(x) 1 #endif @@ -138,6 +142,15 @@ void ProgIO_Init(void) /* The following code depends on your actual circuit design. Make required changes _before_ you try the code! */ + // set the CPU clock to 48MHz, enable clock output to FPGA + CPUCS = bmCLKOE | bmCLKSPD1; + + // put the system in FIFO mode by default + // internal clock source at 48Mhz, drive output pin, synchronous mode + // NOTE: Altera USB-Blaster does not work in another mode + IFCONFIG = bmIFCLKSRC | bm3048MHZ | bmIFCLKOE; + IFCONFIG |= bmASYNC | bmIFCFG1 | bmIFCFG0; + // set port C output enable (so we can handle the JTAG enable signal) OEC = (1 << 7); @@ -148,17 +161,8 @@ void ProgIO_Init(void) // more than 100ma) IOE = (1 << 6); - // set the CPU clock to 48MHz - CPUCS = bmCLKSPD1; - // activate JTAG outputs on Port C OEC = bmTDIOE | bmTCKOE | bmTMSOE | bmJTAG_EN; - - // put the system in FIFO mode by default - // internal clock source at 48Mhz, drive output pin, synchronous mode - // NOTE: Altera USB-Blaster does not work in another mode - IFCONFIG = bmIFCLKSRC | bm3048MHZ | bmIFCLKOE; - IFCONFIG |= bmASYNC | bmIFCFG1 | bmIFCFG0; } void ProgIO_Set_State(unsigned char d) @@ -170,7 +174,7 @@ void ProgIO_Set_State(unsigned char d) * d.2 => nCE (only #ifdef HAVE_AS_MODE) * d.3 => nCS (only #ifdef HAVE_AS_MODE) * d.4 => TDI - * d.6 => LED / Output Enable + * d.5 => LED / Output Enable */ SetTCK((d & bmBIT0) ? 1 : 0); @@ -187,14 +191,14 @@ void ProgIO_Set_State(unsigned char d) unsigned char ProgIO_Set_Get_State(unsigned char d) { - ProgIO_Set_State(d); - - /* Read state of input pins: + /* Set state of output pins (s.a.) + * then read state of input pins: * * TDO => d.0 * DATAOUT => d.1 (only #ifdef HAVE_AS_MODE) */ + ProgIO_Set_State(d); return (GetASDO()<<1)|GetTDO(); } diff --git a/hw_xpcu_i.c b/hw_xpcu_i.c index 0e80063..c4bb681 100644 --- a/hw_xpcu_i.c +++ b/hw_xpcu_i.c @@ -1,300 +1,152 @@ /*----------------------------------------------------------------------------- - * - * Hardware-dependent code for usb_jtag - *----------------------------------------------------------------------------- - * Copyright (C) 2007 Kolja Waschk, ixo.de - *----------------------------------------------------------------------------- - * This code is part of usbjtag. usbjtag is free software; you can redistribute - * it and/or modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the License, - * or (at your option) any later version. usbjtag is distributed in the hope - * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. You should have received a - * copy of the GNU General Public License along with this program in the file - * COPYING; if not, write to the Free Software Foundation, Inc., 51 Franklin - * St, Fifth Floor, Boston, MA 02110-1301 USA - *----------------------------------------------------------------------------- - */ - - #include "hardware.h" - #include "fx2regs.h" - #include "syncdelay.h" - - //--------------------------------------------------------------------------- - - #define SetTCK(x) do{if(x) IOE|=0x08; else IOE&=~0x08; }while(0) - #define SetTMS(x) do{if(x) IOE|=0x10; else IOE&=~0x10; }while(0) - #define SetTDI(x) do{if(x) IOE|=0x40; else IOE&=~0x40; }while(0) - #define GetTDO() ((IOE>>5)&1) - - /* XPCU has neither AS nor PS mode pins */ - - #define HAVE_OE_LED 1 - /* +0=green led, +1=red led */ - sbit at 0x80+1 OELED; - #define SetOELED(x) do{OELED=(x);}while(0) - - //----------------------------------------------------------------------------- - - void ProgIO_Poll(void) {} - void ProgIO_Enable(void) {} - void ProgIO_Disable(void) {} - void ProgIO_Deinit(void) {} - - void ProgIO_Init(void) - { - /* The following code depends on your actual circuit design. - Make required changes _before_ you try the code! */ - - // set the CPU clock to 48MHz, enable clock output to FPGA - CPUCS = bmCLKOE | bmCLKSPD1; - - // Use internal 48 MHz, enable output, use "Port" mode for all pins - IFCONFIG = bmIFCLKSRC | bm3048MHZ | bmIFCLKOE; - - GPIFABORT = 0xFF; - - PORTACFG = 0x00; OEA = 0x03; IOA=0x01; - PORTCCFG = 0x00; OEC = 0x00; IOC=0x00; - PORTECFG = 0x00; OEE = 0x58; IOE=0x00; - } - - void ProgIO_Set_State(unsigned char d) - { - - /* Set state of output pins: - + /* Set state of output pins + * (d is the byte from the host): * - * d.0 => TCK - * d.1 => TMS - * d.2 => nCE (only #ifdef HAVE_AS_MODE) - * d.3 => nCS (only #ifdef HAVE_AS_MODE) - * d.4 => TDI - * d.6 => LED / Output Enable - */ - - SetTCK((d & bmBIT0) ? 1 : 0); - SetTMS((d & bmBIT1) ? 1 : 0); - SetTDI((d & bmBIT4) ? 1 : 0); - #ifdef HAVE_OE_LED - SetOELED((d & bmBIT5) ? 1 : 0); - #endif - } - - unsigned char ProgIO_Set_Get_State(unsigned char d) - { - - /* Read state of input pins: - + /* Set state of output pins (s.a.) + * then read state of input pins: * - * TDO => d.0 - * DATAOUT => d.1 (only #ifdef HAVE_AS_MODE) - */ - - ProgIO_Set_State(d); - - return 2|GetTDO(); - + return 2|GetTDO(); /* DATAOUT assumed high, no AS mode */ } - - void ProgIO_ShiftOut(unsigned char c) - { - /* Shift out byte C: - * - * 8x { - * Output least significant bit on TDI - * Raise TCK - * Shift c right - * Lower TCK - * } - */ - - unsigned char lc=c; - - if(lc&1) IOE|=0x40; else IOE&=~0x40; IOE|=0x08; lc>>=1; IOE&=~0x08; - if(lc&1) IOE|=0x40; else IOE&=~0x40; IOE|=0x08; lc>>=1; IOE&=~0x08; - if(lc&1) IOE|=0x40; else IOE&=~0x40; IOE|=0x08; lc>>=1; IOE&=~0x08; - if(lc&1) IOE|=0x40; else IOE&=~0x40; IOE|=0x08; lc>>=1; IOE&=~0x08; - - if(lc&1) IOE|=0x40; else IOE&=~0x40; IOE|=0x08; lc>>=1; IOE&=~0x08; - if(lc&1) IOE|=0x40; else IOE&=~0x40; IOE|=0x08; lc>>=1; IOE&=~0x08; - if(lc&1) IOE|=0x40; else IOE&=~0x40; IOE|=0x08; lc>>=1; IOE&=~0x08; - if(lc&1) IOE|=0x40; else IOE&=~0x40; IOE|=0x08; lc>>=1; IOE&=~0x08; - } - - unsigned char ProgIO_ShiftInOut(unsigned char c) - { - /* Shift out byte C, shift in from TDO: - * - * 8x { - * Read carry from TDO - * Output least significant bit on TDI - * Raise TCK - - * Shift c right, append carry (TDO) at left - + * Shift c right, append carry (TDO) at left (into MSB) * Lower TCK - * } - * Return c. - */ - - unsigned char carry; - unsigned char lc=c; - - carry = (IOE&0x20)<<2; if(lc&1) IOE|=0x40; else IOE&=~0x40; IOE|=0x08; lc=carry|(lc>>1); IOE&=~0x08; - carry = (IOE&0x20)<<2; if(lc&1) IOE|=0x40; else IOE&=~0x40; IOE|=0x08; lc=carry|(lc>>1); IOE&=~0x08; - carry = (IOE&0x20)<<2; if(lc&1) IOE|=0x40; else IOE&=~0x40; IOE|=0x08; lc=carry|(lc>>1); IOE&=~0x08; - carry = (IOE&0x20)<<2; if(lc&1) IOE|=0x40; else IOE&=~0x40; IOE|=0x08; lc=carry|(lc>>1); IOE&=~0x08; - - carry = (IOE&0x20)<<2; if(lc&1) IOE|=0x40; else IOE&=~0x40; IOE|=0x08; lc=carry|(lc>>1); IOE&=~0x08; - carry = (IOE&0x20)<<2; if(lc&1) IOE|=0x40; else IOE&=~0x40; IOE|=0x08; lc=carry|(lc>>1); IOE&=~0x08; - carry = (IOE&0x20)<<2; if(lc&1) IOE|=0x40; else IOE&=~0x40; IOE|=0x08; lc=carry|(lc>>1); IOE&=~0x08; - carry = (IOE&0x20)<<2; if(lc&1) IOE|=0x40; else IOE&=~0x40; IOE|=0x08; lc=carry|(lc>>1); IOE&=~0x08; - - return lc; - } - - - diff --git a/hw_xpcu_x.c b/hw_xpcu_x.c index 957de1f..d24c38f 100644 --- a/hw_xpcu_x.c +++ b/hw_xpcu_x.c @@ -1,65 +1,34 @@ /*----------------------------------------------------------------------------- - * Hardware-dependent code for usb_jtag - *----------------------------------------------------------------------------- - * Copyright (C) 2007 Kolja Waschk, ixo.de - *----------------------------------------------------------------------------- - * This code is part of usbjtag. usbjtag is free software; you can redistribute - * it and/or modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the License, - * or (at your option) any later version. usbjtag is distributed in the hope - * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. You should have received a - * copy of the GNU General Public License along with this program in the file - * COPYING; if not, write to the Free Software Foundation, Inc., 51 Franklin - * St, Fifth Floor, Boston, MA 02110-1301 USA - *----------------------------------------------------------------------------- - */ - - #include "delay.h" - #include "syncdelay.h" - #include "hardware.h" - - #include "isr.h" - #include "timer.h" - #include "delay.h" - #include "fx2regs.h" - #include "fx2utils.h" - #include "usb_common.h" - #include "usb_descriptors.h" - #include "usb_requests.h" - #include "syncdelay.h" - #include "eeprom.h" @@ -73,368 +42,190 @@ sbit at 0x80+1 OELED; // red LED on S3E Starter Kit (0x80+0 is green one) void ProgIO_Poll(void) {} - void ProgIO_Enable(void) {} - void ProgiO_Disable(void) {} - void ProgiO_Deinit(void) {} - - static unsigned char curios; - - const unsigned char wavedata[64] = - { - /* Single Write: - s0: BITS=D0 NEXT/SGLCRC DATA WAIT 4 - s1: BITS= DATA WAIT 4 - s2: BITS=D1|D0 DATA WAIT 4 - s3: BITS=D1 DATA WAIT 3 - s4: BITS=D1 DATA DP IF(RDY0) THEN 5 ELSE 2 - s5: BITS=D1|D0 DATA WAIT 4 - s6: BITS=D1 DATA WAIT 3 - s7: BITS=D1 DATA FIN */ - - 4, 4, 4, 3, 0x2A, 4, 3, 7, - 6, 2, 2, 2, 3, 2, 2, 2, - 1, 0, 3, 2, 2, 3, 2, 2, - 0, 0, 0, 0, 0, 0, 0, 0x3F, - - /* Single Read: - s0: BITS=D0 WAIT 4 - s1: BITS= WAIT 4 - s2: BITS=D1|D0 WAIT 4 - s3: BITS=D1 WAIT 4 - s4: BITS=D1|D0 WAIT 3 - s5: BITS=D1|D0 DP IF(RDY0) THEN 6 ELSE 3 - s6: BITS=D1 DATA WAIT 4 - s7: BITS=D1 FIN */ - - 4, 4, 4, 4, 3, 0x33, 4, 7, - 0, 0, 0, 0, 0, 1, 2, 0, - 1, 0, 3, 2, 3, 3, 2, 2, - 0, 0, 0, 0, 0, 0, 0, 0x3F - }; - - void ProgIO_Init(void) - { - unsigned char i; - - /* The following code depends on your actual circuit design. - Make required changes _before_ you try the code! */ - - // set the CPU clock to 48MHz, enable clock output to FPGA - CPUCS = bmCLKOE | bmCLKSPD1; - - // Use internal 48 MHz, enable output, GPIF Master mode - IFCONFIG = bmIFCLKSRC | bm3048MHZ | bmIFCLKOE | bmIFGPIF; - - PORTACFG = 0x00; OEA = 0xFB; IOA = 0x20; - PORTCCFG = 0x00; OEC = 0xFF; IOC = 0x10; - PORTECFG = 0x00; OEE = 0xFC; IOE = 0xC0; - - GPIFABORT = 0xFF; - - GPIFREADYCFG = 0xA0; - GPIFCTLCFG = 0x00; - GPIFIDLECS = 0x00; - GPIFIDLECTL = 0x00; - GPIFWFSELECT = 0x01; - - // Copy waveform data - AUTOPTRSETUP = 0x07; - APTR1H = MSB( &wavedata ); - APTR1L = LSB( &wavedata ); - AUTOPTRH2 = 0xE4; - AUTOPTRL2 = 0x00; - for ( i = 0; i < 64; i++ ) EXTAUTODAT2 = EXTAUTODAT1; - - SYNCDELAY; - GPIFADRH = 0x00; - SYNCDELAY; - GPIFADRL = 0x00; - - FLOWSTATE = 0x00; - FLOWLOGIC = 0x00; - FLOWEQ0CTL = 0x00; - FLOWEQ1CTL = 0x00; - FLOWHOLDOFF = 0x00; - FLOWSTB = 0x00; - FLOWSTBEDGE = 0x00; - FLOWSTBHPERIOD = 0x00; - - curios = 0; - } - - unsigned char GetTDO(unsigned char r) - { - unsigned char x; - - IOC = 0x41; - while(!(GPIFTRIG & 0x80)); x = XGPIFSGLDATLX; - while(!(GPIFTRIG & 0x80)); x = XGPIFSGLDATLNOX; - - if(IOA & 0x20) IOA |= 0x40; else IOA &= ~0x40; - - return (x&1) ? r : 0; - } - - #define SetPins(x) while(!(GPIFTRIG & 0x80)); XGPIFSGLDATLX = (x) - - void ProgIO_Set_State(unsigned char d) - { - /* Set state of output pins: - * - * d.0 => TCK (PE.6) - * d.1 => TMS (PE.5) - * d.4 => TDI (PE.4) - * d.6 => LED / Output Enable - */ - - curios = (d & bmBIT0) ? 0x40 : 0; // TCK - curios |= (d & bmBIT1) ? 0x20 : 0; // TMS - curios |= (d & bmBIT4) ? 0x10 : 0; // TDI - - - IOC = 0x81; - + IOC = 0x81; /* Select direction */ SetPins(curios); - - if(d & bmBIT6) IOA=(IOA&~3)|1; else IOA=(IOA&~3)|2; - } - - unsigned char ProgIO_Set_Get_State(unsigned char d) - { ProgIO_Set_State(d); - - /* Read state of input pins: - * - * TDO => d.0 - * DATAOUT => d.1 (only #ifdef HAVE_AS_MODE) - */ - - return 2|GetTDO(0x01); - } void ProgIO_ShiftOut(unsigned char c) - { - unsigned char r,i; - unsigned char locios = curios & ~0x50; - - - IOC = 0x81; - - + IOC = 0x81; /* Select direction */ for(i=0,r=1;i<8;i++) - { - unsigned char t = locios; - if(c & r) t |= 0x10; - SetPins(t); - SetPins(t|0x40); - r <<= 1; - SetPins(t); - }; - - curios = locios; - } - - - unsigned char ProgIO_ShiftInOut(unsigned char c) - { - unsigned char r,i,n; - unsigned char locios = curios & ~0x50; - - for(i=0,r=1,n=0;i<8;i++) - { - unsigned char t = locios; - - n |= GetTDO(r); - - IOC = 0x81; if(c & r) t |= 0x10; SetPins(t); - SetPins(t|0x40); - r <<= 1; - SetPins(t); - }; - - curios = locios; - return n; - } - - - diff --git a/startup.a51 b/startup.a51 index 84ec4df..eb12b81 100644 --- a/startup.a51 +++ b/startup.a51 @@ -1,156 +1,78 @@ ;;; -*- asm -*- - ;;; - ;;;----------------------------------------------------------------------------- - ;;; Startup code - ;;;----------------------------------------------------------------------------- - ;;; Code taken from USRP2 firmware (GNU Radio Project), version 3.0.2, - ;;; Copyright 2003 Free Software Foundation, Inc. - ;;;----------------------------------------------------------------------------- - ;;; This code is part of usbjtag. usbjtag is free software; you can redistribute - ;;; it and/or modify it under the terms of the GNU General Public License as - ;;; published by the Free Software Foundation; either version 2 of the License, - ;;; or (at your option) any later version. usbjtag is distributed in the hope - ;;; that it will be useful, but WITHOUT ANY WARRANTY; without even the implied - ;;; warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - ;;; GNU General Public License for more details. You should have received a - ;;; copy of the GNU General Public License along with this program in the file - ;;; COPYING; if not, write to the Free Software Foundation, Inc., 51 Franklin - ;;; St, Fifth Floor, Boston, MA 02110-1301 USA - ;;;----------------------------------------------------------------------------- - - ;;; The default external memory initialization provided by sdcc is not - ;;; appropriate to the FX2. This is derived from the sdcc code, but uses - ;;; the FX2 specific _MPAGE sfr. - - - ;; .area XISEG (XDATA) ; the initialized external data area - ;; .area XINIT (CODE) ; the code space consts to init XISEG - .area XSEG (XDATA) ; zero initialized xdata - .area USBDESCSEG (XDATA) ; usb descriptors - - - .area CSEG (CODE) - - ;; sfr that sets upper address byte of MOVX using @r0 or @r1 - _MPAGE = 0x0092 - - __sdcc_external_startup:: - ;; This system is now compiled with the --no-xinit-opt - ;; which means that any initialized XDATA is handled - ;; inline by code in the GSINIT segs emitted for each file. - ;; - ;; We zero XSEG and all of the internal ram to ensure - ;; a known good state for uninitialized variables. - - ; _mcs51_genRAMCLEAR() start - mov r0,#l_XSEG - mov a,r0 - orl a,#(l_XSEG >> 8) - jz 00002$ - mov r1,#((l_XSEG + 255) >> 8) - mov dptr,#s_XSEG - clr a - - 00001$: movx @dptr,a - inc dptr - djnz r0,00001$ - djnz r1,00001$ - - ;; We're about to clear internal memory. This will overwrite - ;; the stack which contains our return address. - ;; Pop our return address into DPH, DPL - 00002$: pop dph - pop dpl - - ;; R0 and A contain 0. This loop will execute 256 times. - ;; - ;; FWIW the first iteration writes direct address 0x00, - ;; which is the location of r0. We get lucky, we're - ;; writing the correct value (0) - - 00003$: mov @r0,a - djnz r0,00003$ - - push dpl ; restore our return address - push dph - - mov dpl,#0 ; indicate that data init is still required - ret - diff --git a/usbjtag.c b/usbjtag.c index 3c81823..decf8cb 100644 --- a/usbjtag.c +++ b/usbjtag.c @@ -20,7 +20,7 @@ */ // The firmware version should be regularly updated. -#define FWVERSION "4.1.0" +#define FWVERSION "4.2.0" #include "isr.h" #include "timer.h" @@ -297,7 +297,7 @@ void usb_jtag_activity(void) // Called repeatedly while the device is idle if(!(EP2468STAT & bmEP2EMPTY) && (Pending < OUTBUFFER_LEN-0x3F)) { - BYTE i, n = EP2BCL; + WORD i, n = EP2BCL|EP2BCH<<8; APTR1H = MSB( EP2FIFOBUF ); APTR1L = LSB( EP2FIFOBUF ); @@ -306,7 +306,7 @@ void usb_jtag_activity(void) // Called repeatedly while the device is idle { if(ClockBytes > 0) { - BYTE m; + WORD m; m = n-i; if(ClockBytes < m) m = ClockBytes; diff --git a/usbjtag.hex b/usbjtag.hex index 9b3fbfa..d1bb952 100644 --- a/usbjtag.hex +++ b/usbjtag.hex @@ -1,4 +1,4 @@ -:06000000020FA402006BD8 +:06000000020FF802006B84 :03000B0002006B85 :0300130002006B7D :03001B0002006B75 @@ -24,10 +24,10 @@ :1001500002006B0002006B0002006B0002006B00EB :1001600002006B0002006B0002006B0002006B00DB :1001700002006B0002006B0002006B0002006B00CB -:030FAC00020FAF82 -:030FC200020180A9 -:1001800012057B80FEC200E4F508F509F50AD201EC -:10019000750B00750C0012077812077575CB637527 +:03100000021003D8 +:0310160002018054 +:100180001205CF80FEC200E4F508F509F50AD20198 +:10019000750B00750C001207CC1207C975CB63757F :1001A000CAC0758E0075C804D2AFD2B0D2B190E685 :1001B0000B7403F00090E6047480F00090E6047481 :1001C00002F00090E6047404F00090E6047406F077 @@ -42,7 +42,7 @@ :10025000E6917480F00090E6957480F00043A080F1 :1002600090E6FBE0FA54FDF090E601E0FA54F7F076 :1002700022AA82850C827583E0EAF0050C0509E468 -:10028000B50902050A222000012212077490E6A295 +:10028000B50902050A22200001221207C890E6A241 :10029000E0FA30E10302031FE509450A60697AC00C :1002A0007BE78B9D7AC07BE77B008A9E90E67C741F :1002B00031F07460F0C3743E9509E4950A50107AE9 @@ -53,46 +53,51 @@ :10030000022BF0D2CF801830CF1590E7C07431F0B7 :1003100090E7C17460F00090E68F7402F0C2CFE500 :10032000AA30E00122C3E50994C1E50A9400400126 -:100330002290E691E0FA7B007CF08C9A7B007CF0C6 -:100340007C008B9B7B00C3EB9A4003020403E5080F -:100350006065EAC39BFCC3E5089C5002AC08E50855 -:10036000C39CF508EC2BFB3001208C058D061DEE9F -:1003700060D490E67BE0FEF582C002C003C00512A7 -:10038000080AD005D003D00280E28C051CED60B6CF -:1003900090E67BE0FDF582C002C003C0041208476E -:1003A000D004D003D002C002C003C004120271D036 -:1003B00004D003D00280D390E67BE0FC30E6047DDD -:1003C0000080027D01ED24FF9201EC30E707743FCD -:1003D0005CF508802A30010F8C82C002C00312072E -:1003E0009AD003D00280188C82C002C0031207F793 -:1003F000D003D002C002C003120271D003D0020B9E -:100400000203460090E6917480F02290E6B8E0FA8C -:1004100020E70C90E6B9E07002D2007582012290CC -:10042000E6B9E0FABA9002801ABA9102805ABA92FA -:10043000030204C0BA93030204DABA940302050A61 -:1004400002054390E6BCE025E0547FFA2400F582E3 -:10045000E43418F583E0FB90E740F074012A2400AF -:10046000F582E43418F583E0FA90E741F090E6BEB7 -:10047000E0FABA0200500790E6BEE0FA80027A0283 -:1004800090E68BEAF002056C90E6BCE0701390E613 -:10049000FBE0FA54FDF090E7407402F01209398055 -:1004A0001190E6FBE0FA4402F090E7407401F0128C -:1004B000093990E68AE4F090E68B7401F002056C4D -:1004C00090E6BCE0700543A080800353A07F90E6D7 -:1004D0008AE4F090E68BF002056C90E6BCE0700FC9 -:1004E00090E601E0FA54F7F090E740E4F0800E90D7 -:1004F000E601E0FA4408F090E7407401F090E68AE3 -:10050000E4F090E68B7401F080627A007B00EA24CC -:10051000C5FCEB340FFD7E808C828D838EF0120F34 -:1005200088FC6013EA2440F582EB34E7F583ECF0B5 -:100530000ABA00DA0B80D790E68AE4F090E68BEAFC -:10054000F0802990E7407436F090E7417483F09092 -:10055000E68AE4F090E6BEE0FABA0200500790E6C0 -:10056000BEE0FA80027A0290E68BEAF07582012200 -:10057000300203120AD412028680F5C2AF1201853E -:100580001205D8120EB9120A3ED2AF12093902056D -:0105900070FA -:060FC500342E312E300035 +:100330002290E690E0FA8A037A0090E691E0FC7D54 +:1003400000EA4CF50DEB4DF50E7C007DF08D9A7CAE +:10035000007DF07D008C9B7C007D00C3EC950DED55 +:10036000950E4003020457E5087003020407E50DEB +:10037000C39CFEE50E9DFFA8087900C3E89EE99F97 +:100380005004880689078E00E508C398F508EE2C0E +:10039000FCEF3DFD30012D8E008F0188028903188E +:1003A000B8FF0119EA4B60B390E67BE0FAF582C032 +:1003B00004C005C000C00112085ED001D000D00505 +:1003C000D00480D78E028F038A068B071ABAFF01EA +:1003D0001BEE4F700302035B90E67BE0FEF582C0EC +:1003E00002C003C004C00512089BD005D004D0038E +:1003F000D002C002C003C004C005120271D005D0F3 +:1004000004D003D00280C190E67BE0FA30E6047BA2 +:100410000080027B01EB24FF9201EA30E707743F82 +:100420005AF508802A30010F8A82C004C0051207DD +:10043000EED005D00480188A82C004C00512084B93 +:10044000D005D004C004C005120271D005D0040C40 +:10045000BC00010D02035B0090E6917480F02290D5 +:10046000E6B8E0FA20E70C90E6B9E07002D2007539 +:1004700082012290E6B9E0FABA9002801ABA91029B +:10048000805ABA9203020514BA930302052EBA9455 +:100490000302055E02059790E6BCE025E0547FFA72 +:1004A0002400F582E43418F583E0FB90E740F07413 +:1004B000012A2400F582E43418F583E0FA90E7413C +:1004C000F090E6BEE0FABA0200500790E6BEE0FA0D +:1004D00080027A0290E68BEAF00205C090E6BCE06A +:1004E000701390E6FBE0FA54FDF090E7407402F0E0 +:1004F00012098D801190E6FBE0FA4402F090E7408B +:100500007401F012098D90E68AE4F090E68B740194 +:10051000F00205C090E6BCE0700543A08080035364 +:10052000A07F90E68AE4F090E68BF00205C090E6AA +:10053000BCE0700F90E601E0FA54F7F090E740E479 +:10054000F0800E90E601E0FA4408F090E740740174 +:10055000F090E68AE4F090E68B7401F080627A0015 +:100560007B00EA2419FCEB3410FD7E808C828D83A5 +:100570008EF0120FDCFC6013EA2440F582EB34E7C6 +:10058000F583ECF00ABA00DA0B80D790E68AE4F043 +:1005900090E68BEAF0802990E7407436F090E741CE +:1005A0007483F090E68AE4F090E6BEE0FABA0200C6 +:1005B000500790E6BEE0FA80027A0290E68BEAF0FD +:1005C00075820122300203120B2812028680F5C2C6 +:1005D000AF12018512062C120F0D120A92D2AF1221 +:0505E000098D0205C4B5 +:06101900342E322E3000DF :10E1000012011001FF000040FB0901600004010240 :10E1100003010A061001FFFFFF400100090237005A :10E1200002010080FA0904000002FFFFFF02070558 @@ -109,171 +114,171 @@ :10E1C400530042002D0042006C0061007300740093 :10E1D400650072001203300030003000300030005F :06E1E400300030003000A5 -:10059100AA82E50D54FEFBB50D02802A8A048C0562 -:1005A100E4FC620EED620FEB2400F582E43418F5F1 -:1005B10083E0FB7C00620EEC620FE50E33C50F3366 -:1005C100C50F92E0F50EAB0D050DEB2400F582E4AD -:1005D1003418F583EAF022750D00750EAA750FAA7D -:1005E1007582001205917582001205917A00C3EAA5 -:1005F100648094865018EA2408F582E434E1F58396 -:10060100E0FBF582C002120591D0020A80E07A0077 -:10061100C3EA648094825018EA2423F582E434E129 -:10062100F583E0FBF582C002120591D0020A80E059 -:1006310075821C1205917582001205917A00C3EA38 -:10064100648094825018EA2402F582E434E1F5834F -:10065100E0FBF582C002120591D0020A80E07486A7 -:10066100250DFAF582C002120591D00290E1B6E0A3 -:10067100FBF582C002120591D00290E1B6E0FB2A9F -:10068100FAF582C002120591D00290E1C0E0FBF5BB -:1006910082C002120591D00290E1C0E0FB2AFAF576 -:1006A1008212059190E1D8E0FAF5821205917A0063 -:1006B10090E1B6E0FBC3EA64808BF063F08095F0D3 -:1006C1005018EA24B6F582E434E1F583E0FBF582C3 -:1006D100C002120591D0020A80D67A0090E1C0E0F2 -:1006E100FBC3EA64808BF063F08095F05018EA2434 -:1006F100C0F582E434E1F583E0FBF582C002120526 -:1007010091D0020A80D67A0090E1D8E0FBC3EA6476 -:10071100808BF063F08095F05018EA24D8F582E4DC -:1007210034E1F583E0FBF582C002120591D0020AA3 -:1007310080D67A00C3EA648094845018EA240EF5C6 -:1007410082E434E1F583E0FBF582C002120591D029 -:10075100020A80E07482250D40087582001205911D -:1007610080F2AA0E7B0090187EEAF0AA0F90187F03 -:03077100EAF02289 -:020FA400D22158 -:100774002222222275B48075B67F75B14090E600BE -:100784007410F075B48D90E60174E0F0E0FA90E630 -:1007940001740B4AF022E582FA30E0047B01800206 -:1007A4007B00EB24FF92A2EA30E1047B0180027B10 -:1007B40000EB24FF92A3EA30E2047B0180027B0079 -:1007C400EB24FF92A5EA30E3047B0180027B00EB7B -:1007D40024FF92A4EA30E4047B0180027B00EB2432 -:1007E400FF92A0EA30E5047A0180027A00EA24FF4D -:1007F40092A72212079AE4A2A63325E0FAE4A2A162 -:1008040033FB4AF58222E5821392A0D2A213C2A23C -:1008140092A0D2A213C2A292A0D2A213C2A292A068 -:10082400D2A213C2A292A0D2A213C2A292A0D2A216 -:1008340013C2A292A0D2A213C2A292A0D2A200C2B8 -:10084400A22222AA8230A4058A820208568A82023F -:1008540008A4E582A2A11392A0D2A2C2A2A2A113CB -:1008640092A0D2A2C2A2A2A11392A0D2A2C2A2A278 -:10087400A11392A0D2A2C2A2A2A11392A0D2A2C2F8 -:10088400A2A2A11392A0D2A2C2A2A2A11392A0D208 -:10089400A2C2A2A2A11392A0D2A2C2A2F582222233 -:1008A400E582A2A61392A0D2A2C2A2A2A61392A0EB -:1008B400D2A2C2A2A2A61392A0D2A2C2A2A2A6139C -:1008C40092A0D2A2C2A2A2A61392A0D2A2C2A2A213 -:1008D400A61392A0D2A2C2A2A2A61392A0D2A2C28E -:1008E400A2A2A61392A0D2A2C2A2F582222278804A -:1008F400E84400600C7901901800E4F0A3D8FCD916 -:10090400FAD083D082F6D8FDC082C08375820022DB -:1009140090E6A0E0FA4401F022AA8274805AFBC453 -:1009240023541FFB740F5A90E6834BF090E683E048 -:10093400FA4420F02290E680E0FA440AF09000FAAB -:10094400120F7590E65D74FFF090E65F74FFF0534C -:0B09540091EF90E680E0FA54F7F022EB -:060FBC00E478FFF6D8FD09 -:060FA6007510007511003A -:10095F0090E680E0FA30E7267512007513E1751402 -:10096F00127515E175161C7517E17518707519E17B -:10097F0090E6267402F00090E627E4F0002275124C -:10098F00547513E17514667515E17516707517E1D9 -:10099F0075181C7519E190E626E4F00090E62774AF -:1009AF0040F000225391EF75A100D20232C0E0C097 -:1009BF00F0C082C083C002C003C004C005C006C01F -:1009CF0007C000C001C0D075D0005391EF75A100D2 -:1009DF0012095FD0D0D001D000D007D006D005D0FB -:1009EF0004D003D002D083D082D0F0D0E032C0E068 -:1009FF00C0F0C082C083C002C003C004C005C006DF -:100A0F00C007C000C001C0D075D0005391EF75A1D1 -:100A1F000012095FD0D0D001D000D007D006D0058A -:100A2F00D004D003D002D083D082D0F0D0E03212E5 -:100A3F00095F751AB3751B09758200120E0A751AB4 -:100A4F00BC751B09758210120E0A751AFD751B09EC -:100A5F00758214120E0A90E65C7431F022E582540E -:100A6F007FFA24F7500475820022BA0104758201BF -:100A7F0022530201E4BA000104F58222AA82BA01CC -:100A8F000C90E6A1E0FB7C008B828C8322BA810C58 -:100A9F0090E6A2E0FB7C008B828C832253027FEADC -:100AAF00700C90E6A0E0FB7C008B828C832290E69A -:100ABF00A3E0FB7C00EAC313FA7D00EA2BFBED3CBD -:100ACF008B82F58322C20290E6B8E0FA530260BA35 -:100ADF0000028028BA2002800DBA4002800EBA6050 -:100AEF00028003020D9E120914020D9E12040BE5E3 -:100AFF00826003020D9E120914020D9E90E6B8E06B -:100B0F00FA530280BA80028003020C9790E6B9E094 -:100B1F00FABA0003020C0EBA06028035BA08028038 -:100B2F0008BA0A028017020C9190E740E510F09086 -:100B3F00E68AE4F090E68B7401F0020D9E90E74098 -:100B4F00E511F090E68AE4F090E68B7401F0020D67 -:100B5F009E90E6BBE0FABA01028017BA0202803813 -:100B6F00BA03028059BA0602801BBA0702803C0200 -:100B7F000C08AA12AB1390E6B3EBF07B0090E6B42F -:100B8F00EAF0020D9EAA14AB1590E6B3EBF07B00D2 -:100B9F0090E6B4EAF0020D9EAA16AB1790E6B3EBFF -:100BAF00F07B0090E6B4EAF0020D9EAA18AB199004 -:100BBF00E6B3EBF07B0090E6B4EAF0020D9E90E610 -:100BCF00BAE0FA90E1A7E0FBC3EA9B4006120914D2 -:100BDF00020D9E90E6BAE0FA75F002A424A8F58201 -:100BEF0074E135F0F583E0FAA3E0FB90E6B3F07B18 -:100BFF000090E6B4EAF0020D9E120914020D9E90C9 -:100C0F00E6B8E0FA53021FBA0002800ABA01028066 -:100C1F001BBA0268802C90E740E4F090E741F09017 -:100C2F00E68AF090E68B7402F0020D9E90E740E4A6 -:100C3F00F090E741F090E68AF090E68B7402F002B4 -:100C4F000D9E90E6BCE0FAF582120A6CE5826026F2 -:100C5F0090E6BCE0FAF582120A8BE0FA530201909B -:100C6F00E740EAF090E741E4F090E68AF090E68BF7 -:100C7F007402F0020D9E120914020D9E1209140245 -:100C8F000D9E120914020D9E90E6B9E0FA24F4505D -:100C9F0003020D9BEA2A2A900CAA73020D9B020CE9 -:100CAF00E3020D61020D42020D9B020D9B020D9B93 -:100CBF00020D9B020D9B020CCE020D9B020CDA5310 -:100CCF00B1BF90E6BAE0F510020D9E90E6BAE0F5DE -:100CDF0011020D9E90E6B8E0FA53021FBA0002808F -:100CEF0005BA024A800A90E6BAE0120914020D9E74 -:100CFF0090E6BAE0703390E6BCE0FAF582120A6C27 -:100D0F00E582602590E6BCE0FAF582120A8BAA8292 -:100D1F00AB83E0FC5304FE8A828B83ECF090E6BC3D -:100D2F00E0FAF58212091D8066120914806112091A -:100D3F0014805C90E6B8E0FA53021FBA005190E6B7 -:100D4F00BAE0FABA01028005BA020280421209140F -:100D5F00803D90E6BAE0FA702E90E6BCE0FAF5829C -:100D6F00120A6CE582601B90E6BCE0FAF582120A6B -:100D7F008BAA82AB83E0FC4304018A828B83ECF065 -:100D8F00800D12091480081209148003120914909F -:100D9F00E6A0E0FA4480F022AA82BA03004005EAF6 -:100DAF00249C500122740F5AFBBB03028007740F5F -:100DBF005AFBBB0B45A2AF9203C2AFEA2400F582E8 -:100DCF00E43400F5837402F07B0074012AFCE43BE9 -:100DDF00FDEC2400F582ED3400F583E51BFCF07487 -:100DEF00022AFAE43BFBEA2400F582EB3400F58398 -:100DFF00AA1A7B00EAF0A20392AF22E582FA2483BB -:100E0F0050012274035AFB600122A2AF9204C2AFB9 -:100E1F00EA2400F582E43401F5837402F07B007458 -:100E2F00012AFCE43BFDEC2400F582ED3401F5834F -:100E3F00E51BFCF074022AFAE43BFBEA2400F5827E -:100E4F00EB3401F583AA1A7B00EAF0A20492AF22D9 -:100E5F00AA82BA80004005EA244B50012274035A3B -:100E6F00FB600122A2AF9205C2AFEA2480F582E4B3 -:100E7F003400F5837402F07B0074012AFCE43BFD1F -:100E8F00EC2480F582ED3400F583E51BFCF0740251 -:100E9F002AFAE43BFBEA2480F582EB3400F583AABF -:100EAF001A7B00EAF0A20592AF22C2E8C2EA751AD5 -:100EBF0000751B01758243120DA7751A80751B00F3 -:100ECF00758253120DA70090E650E4F00090E652A1 -:100EDF00E4F00090E654E4F00090E656E4F0009061 -:100EEF00E65174FFF00090E65374FFF00090E65562 -:100EFF0074FFF00090E65774FFF00090E658E4F0AE -:100F0F0090E65974FFF090E65AE4F090E65B74FFB8 -:100F1F00F090E65CE4F090E65D74FFF090E65EE43E -:100F2F00F090E65F74FFF00090E660E4F00090E66A -:100F3F006174FFF090E662E4F090E66374FFF09066 -:100F4F00E665E4F090E668740BF05391AFD2E8D207 -:100F5F00EA2222AA82120F61DAFB2290FB50A3E54C -:100F6F0082458370F922AA82AB83120F6A1ABAFFE5 -:090F7F00011BBA00F5BB00F222CF -:0D0FAF007581201208F2E5826003020180C6 -:100F880020F71430F6148883A88220F507E6A88392 -:0C0F980075830022E280F7E49322E0223F +:1005E500AA82E50F54FEFBB50F02802A8A048C050A +:1005F500E4FC6210ED6211EB2400F582E43418F599 +:1006050083E0FB7C006210EC6211E51033C5113309 +:10061500C51192E0F510AB0F050FEB2400F582E450 +:100625003418F583EAF022750F007510AA7511AA22 +:100635007582001205E57582001205E57A00C3EAA8 +:10064500648094865018EA2408F582E434E1F58341 +:10065500E0FBF582C0021205E5D0020A80E07A00CF +:10066500C3EA648094825018EA2423F582E434E1D5 +:10067500F583E0FBF582C0021205E5D0020A80E0B1 +:1006850075821C1205E57582001205E57A00C3EA3C +:10069500648094825018EA2402F582E434E1F583FB +:1006A500E0FBF582C0021205E5D0020A80E07486FF +:1006B500250FFAF582C0021205E5D00290E1B6E0F9 +:1006C500FBF582C0021205E5D00290E1B6E0FB2AF7 +:1006D500FAF582C0021205E5D00290E1C0E0FBF513 +:1006E50082C0021205E5D00290E1C0E0FB2AFAF5CE +:1006F500821205E590E1D8E0FAF5821205E57A0067 +:1007050090E1B6E0FBC3EA64808BF063F08095F07E +:100715005018EA24B6F582E434E1F583E0FBF5826E +:10072500C0021205E5D0020A80D67A0090E1C0E049 +:10073500FBC3EA64808BF063F08095F05018EA24DF +:10074500C0F582E434E1F583E0FBF582C0021205D1 +:10075500E5D0020A80D67A0090E1D8E0FBC3EA64CE +:10076500808BF063F08095F05018EA24D8F582E488 +:1007750034E1F583E0FBF582C0021205E5D0020AFB +:1007850080D67A00C3EA648094845018EA240EF572 +:1007950082E434E1F583E0FBF582C0021205E5D081 +:1007A500020A80E07482250F40087582001205E573 +:1007B50080F2AA107B0090187EEAF0AA1190187FAB +:0307C500EAF02235 +:020FF800D22104 +:1007C8002222222290E6007412F090E60174E0F0F2 +:1007D800E0FA90E601740B4AF075B48075B67F753F +:1007E800B14075B48D22E582FA30E0047B018002C5 +:1007F8007B00EB24FF92A2EA30E1047B0180027BBC +:1008080000EB24FF92A3EA30E2047B0180027B0024 +:10081800EB24FF92A5EA30E3047B0180027B00EB26 +:1008280024FF92A4EA30E4047B0180027B00EB24DD +:10083800FF92A0EA30E5047A0180027A00EA24FFF8 +:1008480092A7221207EEE4A2A63325E0FAE4A2A1B9 +:1008580033FB4AF58222E5821392A0D2A213C2A2E8 +:1008680092A0D2A213C2A292A0D2A213C2A292A014 +:10087800D2A213C2A292A0D2A213C2A292A0D2A2C2 +:1008880013C2A292A0D2A213C2A292A0D2A200C264 +:10089800A22222AA8230A4058A820208AA8A820297 +:1008A80008F8E582A2A11392A0D2A2C2A2A2A11323 +:1008B80092A0D2A2C2A2A2A11392A0D2A2C2A2A224 +:1008C800A11392A0D2A2C2A2A2A11392A0D2A2C2A4 +:1008D800A2A2A11392A0D2A2C2A2A2A11392A0D2B4 +:1008E800A2C2A2A2A11392A0D2A2C2A2F5822222DF +:1008F800E582A2A61392A0D2A2C2A2A2A61392A097 +:10090800D2A2C2A2A2A61392A0D2A2C2A2A2A61347 +:1009180092A0D2A2C2A2A2A61392A0D2A2C2A2A2BE +:10092800A61392A0D2A2C2A2A2A61392A0D2A2C239 +:10093800A2A2A61392A0D2A2C2A2F58222227880F5 +:10094800E84400600C7901901800E4F0A3D8FCD9C1 +:10095800FAD083D082F6D8FDC082C0837582002287 +:1009680090E6A0E0FA4401F022AA8274805AFBC4FF +:1009780023541FFB740F5A90E6834BF090E683E0F4 +:10098800FA4420F02290E680E0FA440AF09000FA57 +:10099800120FC990E65D74FFF090E65F74FFF053A4 +:0B09A80091EF90E680E0FA54F7F02297 +:06101000E478FFF6D8FDB4 +:060FFA00751200751300E2 +:1009B30090E680E0FA30E7267514007515E17516A8 +:1009C300127517E175181C7519E1751A70751BE11D +:1009D30090E6267402F00090E627E4F000227514F6 +:1009E300547515E17516667517E17518707519E17B +:1009F300751A1C751BE190E626E4F00090E6277457 +:100A030040F000225391EF75A100D20232C0E0C042 +:100A1300F0C082C083C002C003C004C005C006C0CA +:100A230007C000C001C0D075D0005391EF75A1007D +:100A33001209B3D0D0D001D000D007D006D005D052 +:100A430004D003D002D083D082D0F0D0E032C0E013 +:100A5300C0F0C082C083C002C003C004C005C0068A +:100A6300C007C000C001C0D075D0005391EF75A17D +:100A7300001209B3D0D0D001D000D007D006D005E2 +:100A8300D004D003D002D083D082D0F0D0E0321291 +:100A930009B3751C07751D0A758200120E5E751C5D +:100AA30010751D0A758210120E5E751C51751D0A94 +:100AB300758214120E5E90E65C7431F022E5825466 +:100AC3007FFA24F7500475820022BA01047582016B +:100AD30022530201E4BA000104F58222AA82BA0178 +:100AE3000C90E6A1E0FB7C008B828C8322BA810C04 +:100AF30090E6A2E0FB7C008B828C832253027FEA88 +:100B0300700C90E6A0E0FB7C008B828C832290E645 +:100B1300A3E0FB7C00EAC313FA7D00EA2BFBED3C68 +:100B23008B82F58322C20290E6B8E0FA530260BAE0 +:100B330000028028BA2002800DBA4002800EBA60FB +:100B4300028003020DF2120968020DF212045FE53E +:100B5300826003020DF2120968020DF290E6B8E01A +:100B6300FA530280BA80028003020CEB90E6B9E0EC +:100B7300FABA0003020C62BA06028035BA08028090 +:100B830008BA0A028017020CE590E740E512F090DC +:100B9300E68AE4F090E68B7401F0020DF290E740F0 +:100BA300E513F090E68AE4F090E68B7401F0020D11 +:100BB300F290E6BBE0FABA01028017BA020280386B +:100BC300BA03028059BA0602801BBA0702803C02AC +:100BD3000C5CAA14AB1590E6B3EBF07B0090E6B483 +:100BE300EAF0020DF2AA16AB1790E6B3EBF07B0026 +:100BF30090E6B4EAF0020DF2AA18AB1990E6B3EB53 +:100C0300F07B0090E6B4EAF0020DF2AA1AAB1B9057 +:100C1300E6B3EBF07B0090E6B4EAF0020DF290E667 +:100C2300BAE0FA90E1A7E0FBC3EA9B400612096829 +:100C3300020DF290E6BAE0FA75F002A424A8F58258 +:100C430074E135F0F583E0FAA3E0FB90E6B3F07BC3 +:100C53000090E6B4EAF0020DF2120968020DF29078 +:100C6300E6B8E0FA53021FBA0002800ABA01028012 +:100C73001BBA0268802C90E740E4F090E741F090C3 +:100C8300E68AF090E68B7402F0020DF290E740E4FE +:100C9300F090E741F090E68AF090E68B7402F00260 +:100CA3000DF290E6BCE0FAF582120AC0E5826026F6 +:100CB30090E6BCE0FAF582120ADFE0FA53020190F3 +:100CC300E740EAF090E741E4F090E68AF090E68BA3 +:100CD3007402F0020DF2120968020DF212096802A1 +:100CE3000DF2120968020DF290E6B9E0FA24F4500D +:100CF30003020DEFEA2A2A900CFE73020DEF020D98 +:100D030037020DB5020D96020DEF020DEF020DEF46 +:100D1300020DEF020DEF020D22020DEF020D2E5315 +:100D2300B1BF90E6BAE0F512020DF290E6BAE0F533 +:100D330013020DF290E6B8E0FA53021FBA000280E4 +:100D430005BA024A800A90E6BAE0120968020DF277 +:100D530090E6BAE0703390E6BCE0FAF582120AC07E +:100D6300E582602590E6BCE0FAF582120ADFAA82EA +:100D7300AB83E0FC5304FE8A828B83ECF090E6BCE9 +:100D8300E0FAF5821209718066120968806112091E +:100D930068805C90E6B8E0FA53021FBA005190E60F +:100DA300BAE0FABA01028005BA0202804212096867 +:100DB300803D90E6BAE0FA702E90E6BCE0FAF58248 +:100DC300120AC0E582601B90E6BCE0FAF582120AC3 +:100DD300DFAA82AB83E0FC4304018A828B83ECF0BD +:100DE300800D12096880081209688003120968904F +:100DF300E6A0E0FA4480F022AA82BA03004005EAA2 +:100E0300249C500122740F5AFBBB03028007740F0A +:100E13005AFBBB0B45A2AF9203C2AFEA2400F58293 +:100E2300E43400F5837402F07B0074012AFCE43B94 +:100E3300FDEC2400F582ED3400F583E51DFCF07430 +:100E4300022AFAE43BFBEA2400F582EB3400F58343 +:100E5300AA1C7B00EAF0A20392AF22E582FA248364 +:100E630050012274035AFB600122A2AF9204C2AF65 +:100E7300EA2400F582E43401F5837402F07B007404 +:100E8300012AFCE43BFDEC2400F582ED3401F583FB +:100E9300E51DFCF074022AFAE43BFBEA2400F58228 +:100EA300EB3401F583AA1C7B00EAF0A20492AF2283 +:100EB300AA82BA80004005EA244B50012274035AE7 +:100EC300FB600122A2AF9205C2AFEA2480F582E45F +:100ED3003400F5837402F07B0074012AFCE43BFDCB +:100EE300EC2480F582ED3400F583E51DFCF07402FB +:100EF3002AFAE43BFBEA2480F582EB3400F583AA6B +:100F03001C7B00EAF0A20592AF22C2E8C2EA751C7C +:100F130000751D01758243120DFB751C80751D0044 +:100F2300758253120DFB0090E650E4F00090E652F8 +:100F3300E4F00090E654E4F00090E656E4F000900C +:100F4300E65174FFF00090E65374FFF00090E6550D +:100F530074FFF00090E65774FFF00090E658E4F059 +:100F630090E65974FFF090E65AE4F090E65B74FF64 +:100F7300F090E65CE4F090E65D74FFF090E65EE4EA +:100F8300F090E65F74FFF00090E660E4F00090E616 +:100F93006174FFF090E662E4F090E66374FFF09012 +:100FA300E665E4F090E668740BF05391AFD2E8D2B3 +:100FB300EA2222AA82120FB5DAFB2290FB50A3E5A4 +:100FC30082458370F922AA82AB83120FBE1ABAFF3D +:090FD300011BBA00F5BB00F2227B +:0D100300758120120946E58260030201801C +:100FDC0020F71430F6148883A88220F507E6A8833E +:0C0FEC0075830022E280F7E49322E022EB :00000001FF diff --git a/usbjtag.iic b/usbjtag.iic index c612e4b086fa93b3a0e934bd804dc359b312d777..a91717036035f22736e83180e1d51f4e65553ba7 100644 GIT binary patch delta 1813 zcmZWpe{2&~9Dnz&*Iv7J*WJeGwhmddO*3#z7?A`PN*81+cRhZ57d*AQp z`}_O8?;b3@UMGxi=ANkofB|*@pzvT+Si)5Qf^*|w(%=oJ;kv<~5`f%5bX*r5*T`l@ zXMQGY;8zh@&GfPdfvlZWXSzY^1;dlxZj>GZ-TJ`CChZ3O!}JX%rcQb8o+=Hp(6%SZ zhv>_Z^h|t`OO~F_pXJ{L6L&uS^Ru0{WA@{YL6GDpJ~H^}0zfoj8#nHfjD^dG3omJ5R+=T?Fg@b#o%#M3nTQJxjE4> z-Du_X&B^>WQ?yitaPBLB@zDI_TXsbmR}mvDYY7|`=x=NL0uGnCyK2-Qu34tk78r|oX8vz?aM{MBf5reoTHH;_hVE_3cGUI z3j)MVy|#XCa;DRJx3er=4-9Ft)o1jm*+ZbyJJng1^sf4;j6OrE;T;h;;Xjj<9zX&> z-Y6=IA_<6GvOo`liPW2zoZ%{&B)QDhiAe>zu! zA&$IkhO3D=AYKREuSF|H7RlOJTBnDiologBP_%Mn@j}QqQne7O9;sOX$y$t_UE*ss zJCPa=+UNVCAkyI%^=Az!oLEi1ELr53>zQ0FS-!$7oL;%x8_e42zmJ}Z*$%z7=5D#- zbWDv!=@#+3Yl<^0Omc31bYAs;?W7aEmuhN~-8nYko_(82(DN+xT!5YrES`$RCt&f- z?V~@Kr5mD^mNMlQW1YtnF#s_agIlr7v?=to!DK_Liba_vHWZ~>QE8+{ooTn_dZoUe zDcVw@6XyZEkNV>`C?Ws2mjw6YHfv;|=6MsVSvuCa*5@K^v@wN9*kk(hCSlDWFL}0C z*3Rf**p!)En@yRYk#s9CdZK=E$+Q0dD#lWIN;j>2)C(8A=x0qo!wsDajNchgAwNL1 z43ajAo-FcXR11*QPI=N_db0AuZ`pvH-T8S^daft*Fkp5p3g44e!m>IMpmG4cEP8LL a=zQMVaRyJmlmGkXEM#zN^GXsC9{vmSUL^|v delta 1679 zcmZWqe`pg|9Dn!jF1e(+Tzl3wHmx+J=^zfR*nz`2GwbH&*lHgiq=cxeXYY{~Z6-dh~10muhb_i@#Y$bQb^ z5@aX*Iyq_-`@ukqEu%*<= zwGN9Tu9k;AcXYGgShBTgIL%Lss^py$=lD5@e;XE?AM{*d+VYB4P^JBI0@FIif(qZK z>|4zGHnUsoG=)V)YGp)K6Ye9lAB3&n1-SJ)RjrkmG{_y*l98O1|oOTQmYKuh&JkLw)KKIn)z zCeqEpoTZyX3C@CI#ZT3jk zz^9g~d_vmASkik(g=ermGof-Hsp4JLe^vFqcx!@Ygkn6U<>f<5rSD~kBZI=Qm|N`g zKj>5D+kvg+x&roqQ923w{0n_b-oN99LhrMN?N7_1{GUm|YC|$W{uEMDNCT=kTA?Sv zY~dYD9*Yg!D3M(ub#xATv4OPastJj@nh#gRi8Eoj$X*;(&OtqU#V9?^Mb>JkpVCr} zX{o24y=znu`Oeir^Zw%6LaFFxbh|rrU?rIrmZMUoO#CS2?+1F|biqm~dLT*LVHcXh z=t>ezMs*V;YArN1qMKa8u#6)6tvO(kbM78)jFjDnrNe_7lrH8ql9bx%vz7cTwUX-; z+fuE-FH1{A^t{R;@}?*Bf(p=vEUH)0#w==RMvYk%h@(we-Rz*70d(`3oCVsDddRUl z>R81ct7f!`q&>U2BP8Mt62TjGP)qm-YPyVq9@dQCi<+)ExYogC2iH?fj(I;zo>x8f zP(H5;HF>RvXUO4o^9Q3CgE)gB=ArKk-MnfPGk`*W#s%?n83|%34VY0gQGV@0ogriOw2=UGg4>37WBlk%uHBFDh<#~(F+?*;{)IU|9-nd@WkZxQr z3Zyr!6X|A#zK-lAqcmF>kGd-DkUwj}?v>WaM&GmBSbg+l-G7Od=$tUfva*xOR>gaa zPNSpB4UxDncw}`{m4U5{iH@cHuY+`O_oY6d2>O19axawkGQ9To-E_3~Vw2Zd znRcy{l7c!4$U|S?wR#9|`pT@3j1k{aEr691u5v>uEj?f?#)PFoZD?SDmS3sb(}IuE zesM1)xwv#u4ATYT`5&ta2-nx&^Kh3Cql1VuWWwzLDQ(2rgO)7%ApQiwevzy%#j_J_Gk?q!P!m8w4r$%0dgd1A1p2U5l^!{3%i-Md<;Qo+ Oki%VDx0Bn-lYapu*wN1b diff --git a/vectors.a51 b/vectors.a51 index 9ca70bd..9d33c89 100644 --- a/vectors.a51 +++ b/vectors.a51 @@ -1,352 +1,176 @@ ;;; -*- asm -*- - ;;; - ;;;----------------------------------------------------------------------------- - ;;; Interrupt vectors - ;;;----------------------------------------------------------------------------- - ;;; Code taken from USRP2 firmware (GNU Radio Project), version 3.0.2, - ;;; Copyright 2003 Free Software Foundation, Inc. - ;;;----------------------------------------------------------------------------- - ;;; This code is part of usbjtag. usbjtag is free software; you can redistribute - ;;; it and/or modify it under the terms of the GNU General Public License as - ;;; published by the Free Software Foundation; either version 2 of the License, - ;;; or (at your option) any later version. usbjtag is distributed in the hope - ;;; that it will be useful, but WITHOUT ANY WARRANTY; without even the implied - ;;; warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - ;;; GNU General Public License for more details. You should have received a - ;;; copy of the GNU General Public License along with this program in the file - ;;; COPYING; if not, write to the Free Software Foundation, Inc., 51 Franklin - ;;; St, Fifth Floor, Boston, MA 02110-1301 USA - ;;;----------------------------------------------------------------------------- - - ;;; N.B. This object module must come first in the list of modules - - .module vectors - - ;;; ---------------------------------------------------------------- - ;;; standard FX2 interrupt vectors - ;;; ---------------------------------------------------------------- - - .area CSEG (CODE) - .area GSINIT (CODE) - .area CSEG (CODE) - __standard_interrupt_vector:: - __reset_vector:: - ljmp s_GSINIT - - ;; 13 8-byte entries. We point them all at __isr_nop - ljmp __isr_nop ; 3 bytes - .ds 5 ; + 5 = 8 bytes for vector slot - ljmp __isr_nop - .ds 5 - ljmp __isr_nop - .ds 5 - ljmp __isr_nop - .ds 5 - ljmp __isr_nop - .ds 5 - ljmp __isr_nop - .ds 5 - ljmp __isr_nop - .ds 5 - ljmp __isr_nop - .ds 5 - ljmp __isr_nop - .ds 5 - ljmp __isr_nop - .ds 5 - ljmp __isr_nop - .ds 5 - ljmp __isr_nop - .ds 5 - ljmp __isr_nop - .ds 5 - - __isr_nop:: - reti - - ;;; ---------------------------------------------------------------- - ;;; the FIFO/GPIF autovector. 14 4-byte entries. - ;;; must start on a 128 byte boundary. - ;;; ---------------------------------------------------------------- - - . = __reset_vector + 0x0080 - - __fifo_gpif_autovector:: - ljmp __isr_nop - nop - ljmp __isr_nop - nop - ljmp __isr_nop - nop - ljmp __isr_nop - nop - ljmp __isr_nop - nop - ljmp __isr_nop - nop - ljmp __isr_nop - nop - ljmp __isr_nop - nop - ljmp __isr_nop - nop - ljmp __isr_nop - nop - ljmp __isr_nop - nop - ljmp __isr_nop - nop - ljmp __isr_nop - nop - ljmp __isr_nop - nop - - - ;;; ---------------------------------------------------------------- - ;;; the USB autovector. 32 4-byte entries. - ;;; must start on a 256 byte boundary. - ;;; ---------------------------------------------------------------- - - . = __reset_vector + 0x0100 - - __usb_autovector:: - ljmp __isr_nop - nop - ljmp __isr_nop - nop - ljmp __isr_nop - nop - ljmp __isr_nop - nop - ljmp __isr_nop - nop - ljmp __isr_nop - nop - ljmp __isr_nop - nop - ljmp __isr_nop - nop - ljmp __isr_nop - nop - ljmp __isr_nop - nop - ljmp __isr_nop - nop - ljmp __isr_nop - nop - ljmp __isr_nop - nop - ljmp __isr_nop - nop - ljmp __isr_nop - nop - ljmp __isr_nop - nop - ljmp __isr_nop - nop - ljmp __isr_nop - nop - ljmp __isr_nop - nop - ljmp __isr_nop - nop - ljmp __isr_nop - nop - ljmp __isr_nop - nop - ljmp __isr_nop - nop - ljmp __isr_nop - nop - ljmp __isr_nop - nop - ljmp __isr_nop - nop - ljmp __isr_nop - nop - ljmp __isr_nop - nop - ljmp __isr_nop - nop - ljmp __isr_nop - nop - ljmp __isr_nop - nop - ljmp __isr_nop - nop - -- 2.20.1