USB Transactions
13-73
USB Function Module
Status stage handshaking is controlled by the endpoint 0’s FIFO_En and
Stall_Cmd bits. Successful completion of a non-autodecoded control write
transfer is indicated by the USB function module returning a zero-length data
payload for the data phase of the status stage and an ACK handshake from
the host for the handshake phase of the status stage. While NAK handshaking
can be used to indicate delays in completion of the requested control write, the
USB host may choose to abort the control write after some number of NAKs.
Non-Autodecoded Control Write Transfer Error Conditions
If an error occurs while dealing with the control write, which the local host
cannot deal with itself, the local host must signal STALL to the USB host for
all subsequent transactions until a new setup token to endpoint 0 occurs. This
is true for both data stage and status stage transactions. This is most conve-
niently done by setting the endpoint 0 Stall_Cmd bit, which causes stalling of
all the remaining transactions of all remaining stages of a non-autodecoded
control transfer, up to the reception of the next valid SETUP command.
Error conditions are handled as for BULK/INTERRUPT transactions. If a
packet is received corrupted, the core ignores the transaction and no interrupt
is asserted.
13.3.5.4
Non-Autodecoded Control Read Transfers
Non-autodecoded control read transfers include the GET_INTERFACE_STA-
TUS, GET_CONFIGURATION, GET_INTERFACE, GET_DESCRIPTOR,
SYNCH_FRAME and class- or vendor-specific control read transfers.
Non-autodecoded control read transfers consist of three stages (setup, data,
and status).
The setup stage of a valid non-autodecoded control read transfer consists of
one SETUP transaction from USB host to USB device. At the end of the setup
stage handshake, the USB module generates a local host general USB inter-
rupt with the setup flag set. The local host must respond to this general USB
interrupt by setting the Setup_Sel bit, which clears the setup interrupt flag. The
local host must then read 8 bytes from the setup FIFO via the DATA register,
clear EP_Sel bit, and check the setup flag. If the setup flag is set, the local host
must discard the setup data it has just read, and handle the new setup data
packet following the same scheme. If the setup flag is cleared, the local host
code interprets this request information and then prepares data for the IN
transaction that follows. This includes placing the data being requested (or the
first few bytes, if more than one FIFO worth of data is being returned) into the
endpoint 0 FIFO and setting the Set_FIFO_En bit.