1 diff -Nur xilprg-0.5/makefile xilprg-patched/makefile
2 --- xilprg-0.5/makefile 2006-08-23 07:41:20.000000000 +0200
3 +++ xilprg-patched/makefile 2007-09-04 20:59:03.000000000 +0200
5 $(SRC_DIR)/prgfile.cpp \
\r
6 $(SRC_DIR)/chip.cpp \
\r
7 $(SRC_DIR)/parport.cpp \
\r
8 + $(SRC_DIR)/onbusb.cpp \
\r
9 $(SRC_DIR)/cable.cpp \
\r
10 $(SRC_DIR)/digilent.cpp \
\r
11 $(SRC_DIR)/xilinx.cpp
\r
12 diff -Nur xilprg-0.5/src/cable.cpp xilprg-patched/src/cable.cpp
13 --- xilprg-0.5/src/cable.cpp 2006-08-23 07:38:34.000000000 +0200
14 +++ xilprg-patched/src/cable.cpp 2007-09-04 20:59:03.000000000 +0200
17 #include "cmdline.h"
\r
18 #include "digilent.h"
\r
19 +#include "onbusb.h"
\r
20 #include "parport.h"
\r
24 if (stricmp(argv[0], "dusb") == 0)
\r
27 + if (stricmp(argv[0], "ousb") ==0)
\r
31 msgf(STR_INVALID_CABLE_DEF);
\r
33 diff -Nur xilprg-0.5/src/onbusb.cpp xilprg-patched/src/onbusb.cpp
34 --- xilprg-0.5/src/onbusb.cpp 1970-01-01 01:00:00.000000000 +0100
35 +++ xilprg-patched/src/onbusb.cpp 2007-09-04 22:12:47.000000000 +0200
40 + * author: till, hunz, koppi, hackbard
\r
44 +#include "xilprg.h"
\r
46 +#include "onbusb.h"
\r
48 +#define GET_TDO 0x20
\r
62 + struct usb_bus *bus;
\r
65 + usb_find_busses();
\r
66 + usb_find_devices();
\r
68 + bus=usb_get_busses();
\r
72 + if(dev->descriptor.idVendor==USB_VENDOR_ID &&
\r
73 + dev->descriptor.idProduct==USB_PRODUCT_ID) {
\r
75 + /* found the device */
\r
76 + handle=usb_open(dev);
\r
80 + if(usb_set_configuration(handle,1)<0)
\r
83 + if(usb_claim_interface(handle,0)<0)
\r
86 + if(usb_set_altinterface(handle,1)<0)
\r
91 + reset_tap_state();
\r
106 + printf("usb init failed!\n");
\r
112 +int onbusb::close()
\r
115 + usb_close(handle);
\r
120 +int onbusb::get_description(string& desc)
\r
123 + sprintf(s, "onboard usb bitbanging (till, hunz, koppi, hackbard)");
\r
128 +void onbusb::set_tdi(int bit)
\r
130 + if (bit) data |= 0x04; else data &= ~0x04;
\r
131 + usb_bulk_write(handle,0x01,&data,1,0);
\r
134 +void onbusb::set_tck(int bit)
\r
136 + if (bit) data |= 0x10; else data &= ~0x10;
\r
137 + usb_bulk_write(handle,0x01,&data,1,0);
\r
140 +void onbusb::set_tms(int bit)
\r
142 + if (bit) data |= 0x08; else data &= ~0x08;
\r
143 + usb_bulk_write(handle,0x01,&data,1,0);
\r
146 +int onbusb::get_tdo()
\r
149 + /* send get tdo command */
\r
151 + //usb_bulk_write(handle,0x01,&data,1,0);
\r
152 + /* receive tdo */
\r
153 + // dirty! 1 dummy read is enough. my guess:
154 + // - either we have to wait that time for correct state at tdi
155 + // - or/and it's due to the EP1INBUF=1 (buf size?) todo: ez-usb doc!
156 + // - initial wrong states don't harm
157 + for(i=0;i<1;i++) usb_bulk_read(handle,0x81,&data,1,1);
158 + usb_bulk_read(handle,0x81,&data,1,0);
\r
159 + return data & 0x01 ? 1 : 0;
\r
161 diff -Nur xilprg-0.5/src/onbusb.h xilprg-patched/src/onbusb.h
162 --- xilprg-0.5/src/onbusb.h 1970-01-01 01:00:00.000000000 +0100
163 +++ xilprg-patched/src/onbusb.h 2007-09-04 20:59:03.000000000 +0200
168 + * author: till, hunz, koppi, hackbard
\r
172 +#ifndef _ONBUSB_H_INCLUDED_
\r
173 +#define _ONBUSB_H_INCLUDED_
\r
175 +#include "cable.h"
\r
179 +class onbusb : public cable
\r
183 + virtual ~onbusb();
\r
187 + USB_VENDOR_ID = 0x04b4,
\r
188 + USB_PRODUCT_ID = 0x8613
\r
191 + virtual int open();
\r
192 + virtual int close();
\r
194 + virtual int get_description(string&);
\r
196 + virtual void set_tdi(int);
\r
197 + virtual void set_tck(int);
\r
198 + virtual void set_tms(int);
\r
199 + virtual int get_tdo();
\r
203 + struct usb_device *dev;
\r
204 + usb_dev_handle *handle;
\r
208 diff -Nur xilprg-0.5/src/strtable.cpp xilprg-patched/src/strtable.cpp
209 --- xilprg-0.5/src/strtable.cpp 2006-08-23 07:38:34.000000000 +0200
210 +++ xilprg-patched/src/strtable.cpp 2007-09-04 20:59:03.000000000 +0200
214 "Sets programmer cable\0"
\r
215 - "cable {xil3 [ioaddr]|dusb}\0",
\r
216 + "cable {xil3 [ioaddr]|dusb|ousb}\0",
\r
219 "Prints supported devices\0"
\r