2009年11月1日 星期日

USB2.0 do_next_ping

Re: [linux-usb-devel] Scenario: usbtest test-14 failure: MUSBHDRC + Netchip2280
http://www.mail-archive.com/linux-usb-devel@lists.sourceforge.net/msg52405.html

Thus, using the PING protocol involves the host switching between two modes: one where it must send a PING and one where it can send an OUT. The phrase "return to using a PING token until the endpoint indicates it has space" means that the host must switch from the second mode back to the first. "return" == return to the first mode. "using a PING token" == send a PING before doing another OUT != send a PING.

http://www.mail-archive.com/linux-usb-devel@lists.sourceforge.net/msg52356.html
It says "return to using a PING token". As I mentioned above, that is
different from "send a PING".


EHCI r1.0, p.89
3 A Nyet response to an OUT means that the device has accepted the data, but cannot receive any more at this time. Host must (1)advance the transfer state and additionally, (2)transition the Ping State bit to Do Ping.

The Ping State bit has the following encoding:
Value:Meaning
0B: Do OUT The host controller will use an OUT PID during the next bus transaction to this endpoint.
1B: Do Ping The host controller will use a PING PID during the next bus transaction to this endpoint.

The defined ping protocol (see USB 2.0 Specification, Chapter 8) allows the host to be imprecise on the initialization of the ping protocol (i.e. start in Do OUT when we don't know whether there is space on the device or not).

The host controller manages the Ping State bit. System software sets the initial value in the queue head when it initializes a queue head. The host controller preserves the Ping State bit across all queue advancements. This means that when a new qTD is written into the queue head overlay area, the previous value of the Ping
State bit is preserved.
So, upon receiving NYET, one don't have to send Ping immediately. Ping can be deferred to the point before sending next OUT.

USB 2.0 Specification, 8.5.1 NAK Limiting via Ping Flow Control, p.217
If the endpoint instead responds to the OUT/DATA transaction with a NYET handshake, this means that the endpoint accepted the data but does not have room for another wMaxPacketSize data payload. The host controller must return to using a PING token until the endpoint indicates it has space.

沒有留言: