Possible problems – Comtrol eCos User Manual

Page 727

Advertising
background image

Testing

Possible Problems

If all transfers succeed within the specified time then both host and target remain in synch and further tests can
be run without problem. However, if at any time a failure occurs then things get more complicated. For example,
if the current test involves a series of bulk OUT transfers and the target detects that for one of these transfers it
received less data than was expected then the test has failed, and the target will stop accepting data on this endpoint.
However the host-side software may not have detected anything wrong and is now blocked trying to send the next
lot of data.

The test code goes to considerable effort to recover from problems such as these. On the host-side separate threads
are used for concurrent transfers, and on the target-side appropriate asynchronous I/O mechanisms are used. In
addition there is a control thread on the host that checks the state of all the main host-side threads, and the state of
the target using private control messages. If it discovers that one side has stopped sending or receiving data because
of an error and the other side is blocked as a result, it will set certain flags and then cause one additional transfer to
take place. That additional transfer will have the effect of unblocking the other side, which then discovers that an
error has occurred by checking the appropriate flags. In this way both host and target should end up back in synch,
and it is possible to move on to the next set of tests.

However, the above assumes that the testing has not triggered any serious hardware conditions. If instead the target-
side hardware has been left in some strange state so that, for example, it will no longer raise an interrupt for traffic
on a particular endpoint then recovery is not currently possible, and the testing software will just hang.

A possible future enhancement to the testing software would allow the host-side to raise a USB reset signal when-
ever a failure occurs, in the hope that this would clear any remaining problems within the target-side USB hardware.

623

Advertising