[PATCH] libusb support for fxload(8) (aka FreeBSD support)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I brought libusb support to fxload(8).

Major motivation was an ease of deployment of such modified version of 
fxload(8), which became de-facto standard in FX2 programming. I want to use 
it on my FreeBSD-based laptop, where I use Xilinx JTAG USB cable. Without 
fxload(8), this hardware is just a piece of crap.

Idea comes from Claudio Lavi, but my code is layered so that further 
enhancements are possible. Instead of using Linux ioctl() interface 
everywhere, I have moved machine-dependent part from ezusb.c to 
ezusb_linux.c

ezusb.c now only has machine-independent stuff. It operates with "backend" 
concept -- plugin, that provides USB functionality.  Backend can be Linux 
ioctl's or user-space functions provided by libusb/. Both are implemented 
and are named "linux" and "libusb" respectively.

Linux users fall into "linux" by default. If, for some reason, they 
want to check "libusb" out, they provide "LIBUSB_SUPPORT=yes" to make. 
Once compiled, one can switch backends with -B:

        ./fxload -B libusb

Other systems use "libusb" by default -- if you want to compile 
fxload(8) on !GNU/Linux system, you must have libusb installed.

As you can imagine, -D meaning is a bit different with -B "libusb".  
You must provide following string:

        -D vid=<VID>,pid=<PID>

Quite longish, but will keep users away of troubles no matter what 
usbconfig(8) on FreeBSD or lsusb(8) on GNU/Linux or whateverusb(8) on 
other OS tool will show.

Unfortunately it's hard to say whether everything is fine with 
a default a3load.hex on my hardware. I used xusb_emb.hex file from 
Xilinx ISE environment which makes a LED on my Spartan 3e500 Starter 
Kit blink and turn on once FX2 gets programmed:

        http://freebsd.czest.pl/~wkoszek/fpga/xusb_emb.hex

Everything has been tested on Debian Linux 5.04 installed from

        http://cdimage.debian.org/debian-cd/5.0.4/i386/iso-cd/debian-504-i386-netinst.iso

with "libusb-dev", "gcc", "vim" and "make" installed. Both "linux" and 
"libusb" plugins lead to successful programming of the FX2 chip. In
terms of FreeBSD and its libusb(3), new fxload(8) worked as well and 
lead to the programmed chip:

        ./fxload -v -t fx2 -I \
                /compat/linux/opt/Xilinx/11.1/ISE/bin/lin/xusb_emb.hex \
                -D vid=0x3fd,pid=0xd

Other the development cycle, I have used git as an exercise with 
a Linux world. Here's how can you get my code:

        git clone http://freebsd.czest.pl/~wkoszek/fpga/fxload-multios.git
        
Finally, if you're bored with git, here's a patch:

        http://freebsd.czest.pl/~wkoszek/fpga/fxload.0.patch

I just got one success story about fxload(8) working well for other FreeBSD 
guy.

Any opinions?

-- 
Wojciech A. Koszek
wkoszek@xxxxxxxxxxx
http://FreeBSD.czest.pl/~wkoszek/
--
To unsubscribe from this list: send the line "unsubscribe linux-hotplug" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel]     [Linux DVB]     [Asterisk Internet PBX]     [DCCP]     [Netdev]     [X.org]     [Util Linux NG]     [Fedora Women]     [ALSA Devel]     [Linux USB]

  Powered by Linux