1 diff -Nur xilprg-0.5/cypress_fx2_xilprg.patch xilprg-new/cypress_fx2_xilprg.patch
2 --- xilprg-0.5/cypress_fx2_xilprg.patch 1970-01-01 01:00:00.000000000 +0100
3 +++ xilprg-new/cypress_fx2_xilprg.patch 2007-04-10 10:33:17.000000000 +0200
5 +diff -Nur xilprg-0.5/makefile xilprg-new/makefile
6 +--- xilprg-0.5/makefile 2006-08-23 07:41:20.000000000 +0200
7 ++++ xilprg-new/makefile 2007-04-07 17:09:16.000000000 +0200
9 + $(SRC_DIR)/prgfile.cpp \
\r
10 + $(SRC_DIR)/chip.cpp \
\r
11 + $(SRC_DIR)/parport.cpp \
\r
12 ++ $(SRC_DIR)/onbusb.cpp \
\r
13 + $(SRC_DIR)/cable.cpp \
\r
14 + $(SRC_DIR)/digilent.cpp \
\r
15 + $(SRC_DIR)/xilinx.cpp
\r
16 +diff -Nur xilprg-0.5/src/cable.cpp xilprg-new/src/cable.cpp
17 +--- xilprg-0.5/src/cable.cpp 2006-08-23 07:38:34.000000000 +0200
18 ++++ xilprg-new/src/cable.cpp 2007-04-07 17:20:55.000000000 +0200
21 + #include "cmdline.h"
\r
22 + #include "digilent.h"
\r
23 ++#include "onbusb.h"
\r
24 + #include "parport.h"
\r
28 + if (stricmp(argv[0], "dusb") == 0)
\r
29 + cbl = new digilent;
\r
31 ++ if (stricmp(argv[0], "ousb") ==0)
\r
32 ++ cbl = new onbusb;
\r
35 + msgf(STR_INVALID_CABLE_DEF);
\r
37 +diff -Nur xilprg-0.5/src/onbusb.cpp xilprg-new/src/onbusb.cpp
38 +--- xilprg-0.5/src/onbusb.cpp 1970-01-01 01:00:00.000000000 +0100
39 ++++ xilprg-new/src/onbusb.cpp 2007-04-07 17:15:34.000000000 +0200
44 ++ * author: till & frank zirkelbach
\r
48 ++#include "xilprg.h"
\r
49 ++#include "utils.h"
\r
50 ++#include "onbusb.h"
\r
61 ++int onbusb::open()
\r
64 ++ struct usb_bus *bus;
\r
67 ++ usb_find_busses();
\r
68 ++ usb_find_devices();
\r
70 ++ bus=usb_get_busses();
\r
72 ++ dev=bus->devices;
\r
74 ++ if(dev->descriptor.idVendor==USB_VENDOR_ID &&
\r
75 ++ dev->descriptor.idProduct==USB_PRODUCT_ID)
\r
76 ++ /* found the device */
\r
85 ++ handle=usb_open(dev);
\r
89 ++ if(usb_set_configuration(handle,1)<0)
\r
92 ++ if(usb_claim_interface(handle,0)<0)
\r
95 ++ if(usb_set_altinterface(handle,1)<0)
\r
100 ++ reset_tap_state();
\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");
\r
128 ++void onbusb::set_tdi(int bit)
\r
130 ++ if (bit) data |= 0x04; else data &= ~0x04;
\r
132 ++ usb_bulk_write(handle,0x01,&data,1,0);
\r
135 ++void onbusb::set_tck(int bit)
\r
137 ++ if (bit) data |= 0x10; else data &= ~0x10;
\r
139 ++ usb_bulk_write(handle,0x01,&data,1,0);
\r
142 ++void onbusb::set_tms(int bit)
\r
144 ++ if (bit) data |= 0x08; else data &= ~0x08;
\r
146 ++ usb_bulk_write(handle,0x01,&data,1,0);
\r
149 ++int onbusb::get_tdo()
\r
151 ++ usb_bulk_read(handle,0x81,&data,1,0);
\r
152 ++ return data & 0x01 ? 1 : 0;
\r
154 +diff -Nur xilprg-0.5/src/onbusb.h xilprg-new/src/onbusb.h
155 +--- xilprg-0.5/src/onbusb.h 1970-01-01 01:00:00.000000000 +0100
156 ++++ xilprg-new/src/onbusb.h 2007-04-07 17:14:07.000000000 +0200
161 ++ * author: till & frank zirkelbach
\r
165 ++#ifndef _ONBUSB_H_INCLUDED_
\r
166 ++#define _ONBUSB_H_INCLUDED_
\r
168 ++#include "cable.h"
\r
172 ++class onbusb : public cable
\r
176 ++ virtual ~onbusb();
\r
180 ++ USB_VENDOR_ID = 0x04b4,
\r
181 ++ USB_PRODUCT_ID = 0x8613
\r
184 ++ virtual int open();
\r
185 ++ virtual int close();
\r
187 ++ virtual int get_description(string&);
\r
189 ++ virtual void set_tdi(int);
\r
190 ++ virtual void set_tck(int);
\r
191 ++ virtual void set_tms(int);
\r
192 ++ virtual int get_tdo();
\r
196 ++ struct usb_device *dev;
\r
197 ++ usb_dev_handle *handle;
\r
201 +diff -Nur xilprg-0.5/src/strtable.cpp xilprg-new/src/strtable.cpp
202 +--- xilprg-0.5/src/strtable.cpp 2006-08-23 07:38:34.000000000 +0200
203 ++++ xilprg-new/src/strtable.cpp 2007-04-07 16:56:25.000000000 +0200
207 + "Sets programmer cable\0"
\r
208 +- "cable {xil3 [ioaddr]|dusb}\0",
\r
209 ++ "cable {xil3 [ioaddr]|dusb|ousb}\0",
\r
212 + "Prints supported devices\0"
\r
213 diff -Nur xilprg-0.5/makefile xilprg-new/makefile
214 --- xilprg-0.5/makefile 2006-08-23 07:41:20.000000000 +0200
215 +++ xilprg-new/makefile 2007-04-10 10:33:28.000000000 +0200
217 $(SRC_DIR)/prgfile.cpp \
\r
218 $(SRC_DIR)/chip.cpp \
\r
219 $(SRC_DIR)/parport.cpp \
\r
220 + $(SRC_DIR)/onbusb.cpp \
\r
221 $(SRC_DIR)/cable.cpp \
\r
222 $(SRC_DIR)/digilent.cpp \
\r
223 $(SRC_DIR)/xilinx.cpp
\r
224 diff -Nur xilprg-0.5/src/cable.cpp xilprg-new/src/cable.cpp
225 --- xilprg-0.5/src/cable.cpp 2006-08-23 07:38:34.000000000 +0200
226 +++ xilprg-new/src/cable.cpp 2007-04-10 10:33:28.000000000 +0200
229 #include "cmdline.h"
\r
230 #include "digilent.h"
\r
231 +#include "onbusb.h"
\r
232 #include "parport.h"
\r
236 if (stricmp(argv[0], "dusb") == 0)
\r
237 cbl = new digilent;
\r
239 + if (stricmp(argv[0], "ousb") ==0)
\r
240 + cbl = new onbusb;
\r
243 msgf(STR_INVALID_CABLE_DEF);
\r
245 diff -Nur xilprg-0.5/src/onbusb.cpp xilprg-new/src/onbusb.cpp
246 --- xilprg-0.5/src/onbusb.cpp 1970-01-01 01:00:00.000000000 +0100
247 +++ xilprg-new/src/onbusb.cpp 2007-04-21 14:12:15.000000000 +0200
252 + * author: till & frank zirkelbach
\r
256 +#include "xilprg.h"
\r
257 +#include "utils.h"
\r
258 +#include "onbusb.h"
\r
269 +int onbusb::open()
\r
272 + struct usb_bus *bus;
\r
275 + usb_find_busses();
\r
276 + usb_find_devices();
\r
278 + bus=usb_get_busses();
\r
280 + dev=bus->devices;
\r
282 + if(dev->descriptor.idVendor==USB_VENDOR_ID &&
\r
283 + dev->descriptor.idProduct==USB_PRODUCT_ID) {
285 + /* found the device */
\r
287 + printf("found matching usb device\n");
289 + handle=usb_open(dev);
\r
293 + printf("got handle\n");
295 + if(usb_set_configuration(handle,1)<0)
\r
298 + printf("set configuration\n");
300 + if(usb_claim_interface(handle,0)<0)
\r
303 + printf("claimed interface\n");
305 + if(usb_set_altinterface(handle,1)<0)
\r
308 + printf("set alt interface\n");
312 + reset_tap_state();
\r
325 + perror("device open");
333 +int onbusb::close()
\r
336 + usb_close(handle);
\r
341 +int onbusb::get_description(string& desc)
\r
344 + sprintf(s, "onboard usb bitbanging");
\r
349 +void onbusb::set_tdi(int bit)
\r
351 + if (bit) data |= 0x04; else data &= ~0x04;
\r
355 +void onbusb::set_tck(int bit)
\r
357 + if (bit) data |= 0x10; else data &= ~0x10;
\r
359 + usb_bulk_write(handle,0x01,&data,1,0);
\r
360 + // if(data&0x10) printf("tms: %d tdi: %d\n",data&0x08?1:0,data&0x04?1:0);
363 +void onbusb::set_tms(int bit)
\r
365 + if (bit) data |= 0x08; else data &= ~0x08;
\r
369 +int onbusb::get_tdo()
\r
371 + usb_bulk_read(handle,0x81,&data,1,0);
\r
372 + // printf(" ----> %d\n",data&0x01?1:0);
373 + return data & 0x01 ? 1 : 0;
\r
375 diff -Nur xilprg-0.5/src/onbusb.h xilprg-new/src/onbusb.h
376 --- xilprg-0.5/src/onbusb.h 1970-01-01 01:00:00.000000000 +0100
377 +++ xilprg-new/src/onbusb.h 2007-04-10 10:33:28.000000000 +0200
382 + * author: till & frank zirkelbach
\r
386 +#ifndef _ONBUSB_H_INCLUDED_
\r
387 +#define _ONBUSB_H_INCLUDED_
\r
389 +#include "cable.h"
\r
393 +class onbusb : public cable
\r
397 + virtual ~onbusb();
\r
401 + USB_VENDOR_ID = 0x04b4,
\r
402 + USB_PRODUCT_ID = 0x8613
\r
405 + virtual int open();
\r
406 + virtual int close();
\r
408 + virtual int get_description(string&);
\r
410 + virtual void set_tdi(int);
\r
411 + virtual void set_tck(int);
\r
412 + virtual void set_tms(int);
\r
413 + virtual int get_tdo();
\r
417 + struct usb_device *dev;
\r
418 + usb_dev_handle *handle;
\r
422 diff -Nur xilprg-0.5/src/strtable.cpp xilprg-new/src/strtable.cpp
423 --- xilprg-0.5/src/strtable.cpp 2006-08-23 07:38:34.000000000 +0200
424 +++ xilprg-new/src/strtable.cpp 2007-04-10 10:33:28.000000000 +0200
428 "Sets programmer cable\0"
\r
429 - "cable {xil3 [ioaddr]|dusb}\0",
\r
430 + "cable {xil3 [ioaddr]|dusb|ousb}\0",
\r
433 "Prints supported devices\0"
\r