From: hackbard Date: Tue, 4 Sep 2007 20:17:03 +0000 (+0200) Subject: somehow dirty still accurate fix X-Git-Url: https://hackdaworld.org/gitweb/?a=commitdiff_plain;h=428f6220f2ed679f658e077d8c30cc29958e1f26;p=my-code%2Ffpga.git somehow dirty still accurate fix --- diff --git a/fx2/cypress_fx2_xilprg.patch b/fx2/cypress_fx2_xilprg.patch index 8aa0971..23984e0 100644 --- a/fx2/cypress_fx2_xilprg.patch +++ b/fx2/cypress_fx2_xilprg.patch @@ -1,6 +1,6 @@ -diff -Nur xilprg-0.5/makefile xilprg-new/makefile +diff -Nur xilprg-0.5/makefile xilprg-patched/makefile --- xilprg-0.5/makefile 2006-08-23 07:41:20.000000000 +0200 -+++ xilprg-new/makefile 2007-04-07 17:09:16.000000000 +0200 ++++ xilprg-patched/makefile 2007-09-04 20:59:03.000000000 +0200 @@ -40,6 +40,7 @@ $(SRC_DIR)/prgfile.cpp \ $(SRC_DIR)/chip.cpp \ @@ -9,9 +9,9 @@ diff -Nur xilprg-0.5/makefile xilprg-new/makefile $(SRC_DIR)/cable.cpp \ $(SRC_DIR)/digilent.cpp \ $(SRC_DIR)/xilinx.cpp -diff -Nur xilprg-0.5/src/cable.cpp xilprg-new/src/cable.cpp +diff -Nur xilprg-0.5/src/cable.cpp xilprg-patched/src/cable.cpp --- xilprg-0.5/src/cable.cpp 2006-08-23 07:38:34.000000000 +0200 -+++ xilprg-new/src/cable.cpp 2007-04-07 17:20:55.000000000 +0200 ++++ xilprg-patched/src/cable.cpp 2007-09-04 20:59:03.000000000 +0200 @@ -49,6 +49,7 @@ #include "chip.h" #include "cmdline.h" @@ -30,10 +30,10 @@ diff -Nur xilprg-0.5/src/cable.cpp xilprg-new/src/cable.cpp { msgf(STR_INVALID_CABLE_DEF); return NULL; -diff -Nur xilprg-0.5/src/onbusb.cpp xilprg-new/src/onbusb.cpp +diff -Nur xilprg-0.5/src/onbusb.cpp xilprg-patched/src/onbusb.cpp --- xilprg-0.5/src/onbusb.cpp 1970-01-01 01:00:00.000000000 +0100 -+++ xilprg-new/src/onbusb.cpp 2007-09-04 21:39:30.000000000 +0200 -@@ -0,0 +1,119 @@ ++++ xilprg-patched/src/onbusb.cpp 2007-09-04 22:12:47.000000000 +0200 +@@ -0,0 +1,124 @@ +/* + * onboard usb + * @@ -145,17 +145,22 @@ diff -Nur xilprg-0.5/src/onbusb.cpp xilprg-new/src/onbusb.cpp + +int onbusb::get_tdo() +{ ++int i; + /* send get tdo command */ -+ data=GET_TDO; -+ usb_bulk_write(handle,0x01,&data,1,0); -+ ++ //data=GET_TDO; ++ //usb_bulk_write(handle,0x01,&data,1,0); + /* receive tdo */ ++ // dirty! 1 dummy read is enough. my guess: ++ // - either we have to wait that time for correct state at tdi ++ // - or/and it's due to the EP1INBUF=1 (buf size?) todo: ez-usb doc! ++ // - initial wrong states don't harm ++ for(i=0;i<1;i++) usb_bulk_read(handle,0x81,&data,1,1); + usb_bulk_read(handle,0x81,&data,1,0); + return data & 0x01 ? 1 : 0; +} -diff -Nur xilprg-0.5/src/onbusb.h xilprg-new/src/onbusb.h +diff -Nur xilprg-0.5/src/onbusb.h xilprg-patched/src/onbusb.h --- xilprg-0.5/src/onbusb.h 1970-01-01 01:00:00.000000000 +0100 -+++ xilprg-new/src/onbusb.h 2007-09-04 21:17:18.000000000 +0200 ++++ xilprg-patched/src/onbusb.h 2007-09-04 20:59:03.000000000 +0200 @@ -0,0 +1,43 @@ +/* + * onboard usb @@ -200,9 +205,9 @@ diff -Nur xilprg-0.5/src/onbusb.h xilprg-new/src/onbusb.h +}; + +#endif -diff -Nur xilprg-0.5/src/strtable.cpp xilprg-new/src/strtable.cpp +diff -Nur xilprg-0.5/src/strtable.cpp xilprg-patched/src/strtable.cpp --- xilprg-0.5/src/strtable.cpp 2006-08-23 07:38:34.000000000 +0200 -+++ xilprg-new/src/strtable.cpp 2007-04-07 16:56:25.000000000 +0200 ++++ xilprg-patched/src/strtable.cpp 2007-09-04 20:59:03.000000000 +0200 @@ -137,7 +137,7 @@ //STR_CMD_CABLE "cable\0" diff --git a/fx2/fx2.c b/fx2/fx2.c index a8f0467..49f0da5 100644 --- a/fx2/fx2.c +++ b/fx2/fx2.c @@ -252,21 +252,17 @@ void main() { fx2_init(); /* jtag by polling ep1 */ + while(1) { if(!(EP1OUTCS&BUSY)) { + set=IOD; buf=EP1OUTBUF[0]; - if(buf!=GET_TDO) { - set=(IOD&(~0x1c))|(buf&0x1c); - IOD=set; - EP1OUTBC=1; - } - else { - while(EP1INCS&BUSY) - continue; - buf=IOD&0x01?1:0; - EP1INBUF[0]=buf; - EP1INBC=1; - } + IOD=(IOD&(~0x1c))|(buf&0x1c); + EP1OUTBC=1; + } + if(!(EP1INCS&BUSY)) { + EP1INBUF[0]=IOD&0x01; + EP1INBC=1; } }