USB-XHCI BulkIn TransferLength

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
bigbob
Member
Member
Posts: 122
Joined: Tue Oct 01, 2013 2:50 am
Location: Budapest, Hungary
Contact:

USB-XHCI BulkIn TransferLength

Post by bigbob »

Hi,

I programmed EHCI and XHCI drivers (in 32-bit intel assembly) by the book Benjamin David Lunt - USB: The Universal Serial Bus (the 1st Ed.).
I can read/write files from/to FAT32 formatted pendrives. It is wonderful.
One of the pendrives I use for testing has BulkIn-MaxPacketSize=512 bytes. It is a 2.0 pendrive.
In case of EHCI, we can use the data-toggle in the QH(i.e. QueueHead) and not in the TD(i.e. TransferDescriptor).
This way we can transfer max. 0x5000 bytes per TD.
This is what my EHCI driver does. It can read a 45MB file in 3 seconds, and it uses much less memory for the TDs (with using just 512 bytes per TD, it would require much more memory).
In case of XHCI, the Data-TRB (i.e. Transfer Request Block) has a "TRB Transfer Length" of maximum 64kB, but it only works for me only with the BulkIn MaxPacketSize (512 bytes). I use that above mentioned 2.0 pendrive for testing XHCI too.
Using 512 bytes as TransferLength per TRB, requires inserting more than 92000 Data TRBs in the BulkIn EndPoint's Transfer Ring in case of reading a 45MB file.
The size of a TRB is 16 bytes, so the Transfer Ring is more than 1MB.
I suspect that XHCI should be faster/better than EHCI, so somehow it should be possible to use that 64kB "TRB Transfer Length".
I checked the XHCI specification, but I found nothing in connection with this.
Does anybody have an idea about this?

Regards,
Rob
User avatar
BenLunt
Member
Member
Posts: 941
Joined: Sat Nov 22, 2014 6:33 pm
Location: USA
Contact:

Re: USB-XHCI BulkIn TransferLength

Post by BenLunt »

bigbob wrote: Sat Oct 05, 2024 5:40 am I programmed EHCI and XHCI drivers (in 32-bit intel assembly) by the book Benjamin David Lunt - USB: The Universal Serial Bus (the 1st Ed.).
Thank you for the kind words.

If done in assembly, that is quite the task. Not recommended, but still worth a nod to you.
bigbob wrote: Sat Oct 05, 2024 5:40 am In case of XHCI, the Data-TRB (i.e. Transfer Request Block) has a "TRB Transfer Length" of maximum 64kB, but it only works for me only with the BulkIn MaxPacketSize (512 bytes). I use that above mentioned 2.0 pendrive for testing XHCI too.
Unless I am mistaken, I think you have confused a small detail. Even though the xHCI controller is capable of these speeds, the USB 2.0 drive is not.

Just because you have a 428 Cobra Jet on nitrous oxide for an engine, if the transmission is just a small C4 out of a Pinto, you aren't going very far very fast :-)

Does this make sense, or did I completely miss the question?

Ben
- https://www.fysnet.net/osdesign_book_series.htm
bigbob
Member
Member
Posts: 122
Joined: Tue Oct 01, 2013 2:50 am
Location: Budapest, Hungary
Contact:

Re: USB-XHCI BulkIn TransferLength

Post by bigbob »

Hi Ben,

Thank you for your answer.
I know that it is a USB2.0 pendrive, but I was just hoping to take advantage of that 64kB Transfer Length somehow, even though it is a USB2.0 pendrive.
To be honest, this was the answer I was waiting for. I just needed an expert to confirm it :oops:

Regards,
Rob
Post Reply