From owner-freebsd-usb@FreeBSD.ORG Fri Feb 4 04:02:14 2011 Return-Path: Delivered-To: freebsd-usb@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 59E7A1065695 for ; Fri, 4 Feb 2011 04:02:14 +0000 (UTC) (envelope-from doconnor@gsoft.com.au) Received: from cain.gsoft.com.au (cain.gsoft.com.au [203.31.81.10]) by mx1.freebsd.org (Postfix) with ESMTP id B61048FC13 for ; Fri, 4 Feb 2011 04:02:13 +0000 (UTC) Received: from ur.gsoft.com.au (Ur.gsoft.com.au [203.31.81.44]) (authenticated bits=0) by cain.gsoft.com.au (8.14.4/8.14.3) with ESMTP id p14421dk030763 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Fri, 4 Feb 2011 14:32:02 +1030 (CST) (envelope-from doconnor@gsoft.com.au) Mime-Version: 1.0 (Apple Message framework v1082) Content-Type: text/plain; charset=us-ascii From: "Daniel O'Connor" In-Reply-To: <201102031156.37148.hselasky@c2i.net> Date: Fri, 4 Feb 2011 14:32:01 +1030 Content-Transfer-Encoding: quoted-printable Message-Id: References: <9CF6C32F-E230-446B-94FC-C57F0F02B0E4@gsoft.com.au> <201102030822.49266.hselasky@c2i.net> <4DAFAF80-746B-4272-86CC-BB284E59D4F6@gsoft.com.au> <201102031156.37148.hselasky@c2i.net> To: Hans Petter Selasky X-Mailer: Apple Mail (2.1082) X-Spam-Score: -2.51 () ALL_TRUSTED,BAYES_00,T_RP_MATCHES_RCVD X-Scanned-By: MIMEDefang 2.67 on 203.31.81.10 Cc: freebsd-usb@freebsd.org Subject: Re: libusb performance on 8.1 X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Feb 2011 04:02:14 -0000 On 03/02/2011, at 21:26, Hans Petter Selasky wrote: >>> You need to set the multiplier to 2 or 3. Then you get 3*1024 bytes = at >>> maximum. >>=20 >> OK, so I need.. >> usb_xf[i].xf =3D libusb_alloc_transfer(3); >> p =3D malloc(3 * 1024); >> libusb_fill_iso_transfer(usb_xf[i].xf, h, 0x82 p, 3 * 1024, 3, usbcb, >> &usb_xf[i], 2000); >>=20 >=20 > No. Please read the description of wMaxPacketSize in the USB2.0 spec, = and the=20 > multiplier bits. I checked that but it didn't work, I'll try it again. Also I read somewhere that setting it to zero was "as many as possible" = but I can't find that now so maybe I was dreaming. > High-speed USB executes 8 isoc packets per second! Number of packets = should=20 > not be less than 56 for High-speed USB due to underflow risc. OK, I didn't realise it was so high > usb_xf[i].xf =3D libusb_alloc_transfer(56); > p =3D malloc(3 * 1024 * 56); > libusb_fill_iso_transfer(usb_xf[i].xf, 0x82, p, 3 * 56 * 1024, 56, = usbcb, > &usb_xf[i], 2000); >=20 > libusb_set_iso_packet_lengths(usb_xf[i].xf, 3 * 1024); OK, I have that, it seems I need to work on the firmware as it's not = sending data properly when I set it to iso. I'll work on that and try = and figure it out. Unfortunately there isn't much example code on = isochronous data transfer with the FX2 :( However I see the requests return saying they are complete but the = amount of data transferred is 0. Setting the "short not OK" flag doesn't = change the behaviour. I'm not sure if this is a bug in libusb, expected behaviour, or a bug in = my program. > You need to allocate 2x "libusb_alloc_transfer(56)" and submit to get = double=20 > buffering! Ahh that's no problem, I have many in flight requests as a buffer when = my main thread has to sleep waiting for a slave process to read in some = data (128Mb worth). -- Daniel O'Connor software and network engineer for Genesis Software - http://www.gsoft.com.au "The nice thing about standards is that there are so many of them to choose from." -- Andrew Tanenbaum GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C