Another USB Mass Storage question
Posted: Tue May 26, 2020 8:18 pm
Hey all,
Hope youre all doing well in these troubling times!
Just a quick question.
Ive been reading the spec sheets for EHCI and Bulk-Only Transport and I think I get it. One thing that is confusing me slightly is the following:
Per function endpoint, there exists a value "wMaxPacketSize" which identifies the maximum size of the data packet sendable to that endpoint. Its meaning confuses me slightly. Consider the following:
Say I wanted to send 512 bytes of data to the OUT endpoint with wMaxPacketSize of 08h (for arguments sake). Lets say the Controller is idle for arguments sake, with a pointer to the QH associated to the OUT endpoint of the function on the LUN we are looking at written to ASYNCLISTADDR. (The following is the structure of the Asynch list QH0 = Control EP-> QH1 = OUT EP->QH2 = IN EP-> QH0)
I would, create a qTD (lets call it TD0) associated to QH1, pointing to, in the "Buffer 0 + Current offset" field, a CBW with the value 200h in its "Transfer Length" field. TD0 would have the value 01Fh in the "Total bytes to transfer" field. I would then create another qTD (TD1), linked to TD0 via TD0's "Next qTD pointer" field, with a pointer in the "Buffer 0 + Current offset" field of TD1, the head of the raw 200h of data to be transferred. TD1 would have 200h in the "Total bytes to transfer" field and a null ptr in the "Next qTD pointer" field to indicate that it is the last ptr in the linked list.
Now this is where my confusion arises.
If I now initialise the HC and let it process this QH, would it correctly send the data, with the HC correctly sending 8 byte packets at a time for me OR, do I need to create 40h = (200h/8) data transfer Transfer Descriptors and two Transfer Descriptors for the CBW to account for the value of wMaxPacketSize (of course this value is also mirrored in the "Maximum Packet Length" field of the QH1)? Or is my understanding totally incorrect and I should go and beat myself over the head with the Spec some more?
Thanks for your help in advance!
PS I assume the former but this has been bugging me for a while.
Hope youre all doing well in these troubling times!
Just a quick question.
Ive been reading the spec sheets for EHCI and Bulk-Only Transport and I think I get it. One thing that is confusing me slightly is the following:
Per function endpoint, there exists a value "wMaxPacketSize" which identifies the maximum size of the data packet sendable to that endpoint. Its meaning confuses me slightly. Consider the following:
Say I wanted to send 512 bytes of data to the OUT endpoint with wMaxPacketSize of 08h (for arguments sake). Lets say the Controller is idle for arguments sake, with a pointer to the QH associated to the OUT endpoint of the function on the LUN we are looking at written to ASYNCLISTADDR. (The following is the structure of the Asynch list QH0 = Control EP-> QH1 = OUT EP->QH2 = IN EP-> QH0)
I would, create a qTD (lets call it TD0) associated to QH1, pointing to, in the "Buffer 0 + Current offset" field, a CBW with the value 200h in its "Transfer Length" field. TD0 would have the value 01Fh in the "Total bytes to transfer" field. I would then create another qTD (TD1), linked to TD0 via TD0's "Next qTD pointer" field, with a pointer in the "Buffer 0 + Current offset" field of TD1, the head of the raw 200h of data to be transferred. TD1 would have 200h in the "Total bytes to transfer" field and a null ptr in the "Next qTD pointer" field to indicate that it is the last ptr in the linked list.
Now this is where my confusion arises.
If I now initialise the HC and let it process this QH, would it correctly send the data, with the HC correctly sending 8 byte packets at a time for me OR, do I need to create 40h = (200h/8) data transfer Transfer Descriptors and two Transfer Descriptors for the CBW to account for the value of wMaxPacketSize (of course this value is also mirrored in the "Maximum Packet Length" field of the QH1)? Or is my understanding totally incorrect and I should go and beat myself over the head with the Spec some more?
Thanks for your help in advance!
PS I assume the former but this has been bugging me for a while.