On Tue, 1 Jul 2003, Alexander Dreweke wrote:

> Hi,
> 
> I'm trying to understand the data-toggle mechanism but I find the spec a
> little bit confusing. Could someone please explain me the details?
> 
> What I (believe to) know at the moment is:
> 1: If the toggle-bit in a transfer-descriptor is set, then the data1-pid
> is used, if it isn't set then data0-pid is used.
> 2: For isochronous transfers there is no alternating, data0-pid is
> always used.
> 3: For control transfer the setup-stage begins with a data0-pid and
> the data-stage with a data1-pid.
> 4: I must maintain the toggle bit for each established pipe (beside for
> the iso).

1 - 3 are correct.  4 is misleading: _You_ don't have to maintain
anything; the host controller driver automatically takes care of that for
you.

> What I don't understand is:
> 1: What is the default value to start with for interrupt and for bulk?

When the device is initially configured, the value of the toggle is 0.  
After that, it just toggles back and forth.  You can reset it back to 0 by 
clearing the HALT feature for the endpoint.

> 2: After having started to alter the toggle-bit for interrupt and bulk
> the bit is just altered all the time or does each new communication
> start with the default value again?

Each new transaction continues from where the previous one left off.

> 3: During a control transfer, after the setup-stage and the data-stage
> there comes the status-stage, what's the correct toggle-bit to start
> with?

If my memory is correct, the status-stage toggle is just the next value 
after the last data-stage toggle.

>  Must I just alter the toggle-bit as if the status-stage would be
> part of the data-stage or do I have to start by zero again
> (getStatus-request) and the continue the transfer of the status-data
> with a data1-pid?

Again, _you_ don't have to do anything.  The host controller driver will 
automatically alter the toggle bit appropriately.

> 4: How do I do a save toggle recovery if something during the transfer
> went wrong and host and function toggle are out of sync?

Use a control message to clear the HALT feature (see usb_clear_halt()).  
You will generally have to do this anyway, because when anything goes 
wrong the device will stall the endpoint.

Alan Stern



-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100006ave/direct;at.asp_061203_01/01
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to