New USB driver & API (updated)

Hans Petter Selasky hselasky at c2i.net
Sun Sep 18 10:32:54 PDT 2005


Hi,

I have just updated my USB driver for FreeBSD 5/6/7.

Download the three files below into a new directory and type 
"make install"  (to uninstall type "make deinstall")
http://home.c2i.net/hselasky/isdn4bsd/privat/usb/Makefile
http://home.c2i.net/hselasky/isdn4bsd/privat/usb/new_usb_1_5_4.diff.bz2
http://home.c2i.net/hselasky/isdn4bsd/privat/usb/new_usb_1_5_4.tar.bz2

Type "make help" to get more help.



I have included a patch for "uaudio.c" that will allow "full duplex" to work. 


This time I have added two refcounts to each "struct usbd_xfer". The one 
refcount keeps track of the number of threads that are holding a reference to 
it, and is decremented when memory is freed. The other refcount keeps track 
of the number of re-starts, and is incremented when a USB transfer is 
stopped. For example see "ehci_pcd_enable()" in "/sys/dev/usb2/_ehci.c" and
"usbd_do_callback()" in "/sys/dev/usb2/_usb.c". This is almost like in 
Objective C.

Stopping and starting a transfer does not block or sleep, which means one can 
hold a lock while doing this. I have added a callback, search for 
"priv_func", that will be called just before the USB transfer memory is 
freed. This can be used for mutex destruction purposes, and alike.

I want to use "callout_init_mtx()", but I am not sure when this was 
introduced, and to not break this driver on older versions of FreeBSD, I 
still use "callout_init()". But this is just a matter of a few one-liners.

I have done an great deal of work on "ugen" and it should now support BULK-, 
INTERRUPT- and ISOCHRONOUS- transfers in read and write direction. If you are 
interested, you can have a look at: "/sys/dev/usb2/_ugen.c"

--HPS


More information about the freebsd-multimedia mailing list