Hi Hans, I have a couple of questions about usbd_xfer_max_framelen() and usbd_xfer_max_len(): 1. You mentioned the frame length should be a multiple of usbd_xfer_max_framelen(). If there is only 1 frame in the transfer, is it okay if the frame length is less than usbd_xfer_max_framelen()? When I set the frame length to 8 bytes for SCSI OP Read Capacity, it works without error. Similarly, when I set the frame length to 254 bytes for SCSI OP Inquiry, it also works without error. 2. usbd_xfer_max_len() returns 131,072 bytes, which is the value of UMASS_BULK_SIZE. I'm able to transfer 131,072 bytes, using only a single frame, without error. You mentioned each frame in encoded in one or more USB packets with each packet size presumably being wMaxPacketSize (512 byte). Does that mean the controller code (i.e. ehci.c) will split up the single 131,072 byte frame into 256 USB packets, 512 bytes each packet? I ask because I'm debugging an issue where the USB EHCI host controller does a DMA write into physical address 0.
Thanks Aman On 02/08/2013 06:01 PM, Hans Petter Selasky wrote: On Friday 08 February 2013 22:48:02 aman.sawrup wrote: Hello, We have ported the FreeBSD USB stack to my employers proprietary RTOS. The code was taken from the MAIN branch a little while after RELENG_8_BP tag was created. I'm trying to read data from the following mass storage device umass0: ehci0: [FILTER+ITHREAD] usbus0: EHCI version 1.0 usbus0: 480Mbps High Speed USB v2.0 ugen0.1: <Intel EHCI root HUB> at usbus0 uhub0: <Intel EHCI root HUB, class 9/0, rev 2.00/1.00, addr 1> on usbus0 uhub0: 2 ports with 2 removable, self powered ugen0.2: <vendor 0x8087 product 0x0024> at usbus0 uhub1: <vendor 0x8087 product 0x0024, class 9/0, rev 2.00/0.00, addr 2> on usbus0 uhub1: 8 ports with 8 removable, self powered ugen0.3: <ATP Electronics ATP IG eUSB> at usbus0 umass0: <ATP Electronics ATP IG eUSB, class 0/0, rev 2.00/11.00, addr 3> on usbus0 umass0: SCSI over Bulk-Only; quirks = 0x4800 Reading data one frame per transfer works. For example, if I want to read 512 bytes that is physically contiguous and is placed in a single frame, that works fine. However, when attempting to read 1024 bytes, that is not physically contiguous, using 3 frames for the same transfer, I get USB_ERR_STALLED. I have the frames setup as follows: frame = 200 bytes frame = 512 bytes frame = 312 bytes Hi, The frame lengths must be a multiple of the wMaxPacketSize (typically 64 or 512). Each frame is encoded like one or more USB packets independent of the next one. I.E. USB packet data may not cross a frame. This is not supported by the EHCI/OHCI and UHCI hardware, and the USB stack will not make a fixup buffer for this. The USB stack returns the device independent multiplier length for this purpose when calling usbd_xfer_max_framelen(). Only when (frame[n] % usbd_xfer_max_framelen() == 0) it will work like you want. --HPS _______________________________________________ firstname.lastname@example.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-usb To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"