
C161U
USB Interface Controller
Data Sheet
347
2001-04-19
for non-Iso-transfers: if fhe transfer was ACK’d, the next packet can be set up for
transmission, otherwise, host expects the same data to be resent
SW must set up again the EPEC source-, destination-pointer and packetlength and
start the transfer
If SW has already set up data in a tx-fifo and now, e.g. host changes the configuration
or interfaces, SW can use a write into the command-register to flush the fifo of the
corresponding endpoint. Before doing this, the EPEC-channel must be disabled or
reprorgammed, otherwise the next pending bytes will be transferred into the tx-fifo.
15.7.3
Out-Transfer (Receive)
During an Out-transfer, host is transferring data to the device. SW must provide an free
memory-block for each endpoint and set up the EPEC for moving arriving data from the
USB-block to a free memory-location.
SW provides an free memory-block and sets up source- (usbd_rxrr-registerX),
destination-pointer (free memory-block) and packet lenght of the EPEC and sets the
TXR_ENAx bit (refer to Table 18, “EPEC_CTRL_REGx Source Pointer Register,” on
page 101); the packetlength supported by the EPEC must always be an even number
of bytes (in receive-direction the EPEC only does word-transfers) and have at least
space for the maxpacketlength of the endpoint.
when host sends data, it is forwarded through the fifo’s and with every transferred
word that can be read from usbd_rxrr-registerX the usbd_rxrr-interruptX is set (for
normal functionality this can be ignored); EPEC transferes this data into the memory
EPEC generates an EPEC-interrupt when it has transferred all the data into the
memory (this interrupt is generated shortly after the USB-block has generated the
udc_rx_done-interrupt); SW must read the EPEC-interrupt-register and clear the (to
the endpoint) corresponding bit in this register by writing a ‘1’ into it
when USB-block has finished the whole transfer, it generates the udc_rx_done-
interrupt; SW must then read the usbd_rx_bytecnt-register, in order to determine the
number of bytes of the received packet and to release the interlocking of the fifo for
the next transfer; the most significant bit in this register contains also the status-bit of
the status-register and shows whether this packet had transmission-errors or not
if host has sent a packet of zero lenght, no rxrr-interrupt is generated but only a
rx_done-interrupt; here also SW must read the rxbytecountX-register
in order to prepare a receive on this endpoint again SW must provide a new free
memory-block, set up the source-, destination-pointer and packetlength of the EPEC
and write the start-bit
15.7.4
Reading out Setup-Packets
Setup-packets are treated without the EPEC. If host sends a setup-packet which is
forwarded to the CPU (there are only three commands: get_descriptor, set_descriptor
and synch_frame all the other ones are treated internally), and the packet is valid, the