From: "Wojciech A. Koszek" <wkoszek@FreeBSD.org>
To: linux-hotplug@vger.kernel.org
Subject: [PATCH] libusb support for fxload(8) (aka FreeBSD support)
Date: Tue, 09 Feb 2010 01:55:28 +0000 [thread overview]
Message-ID: <20100209020307.GV97611@FreeBSD.org> (raw)
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@FreeBSD.org
http://FreeBSD.czest.pl/~wkoszek/
next reply other threads:[~2010-02-09 1:55 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-09 1:55 Wojciech A. Koszek [this message]
2010-02-11 8:52 ` [PATCH] libusb support for fxload(8) (aka FreeBSD support) Wojciech A. Koszek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100209020307.GV97611@FreeBSD.org \
--to=wkoszek@freebsd.org \
--cc=linux-hotplug@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).