
EZ-USB FX2 Technical Reference Manual
Page 9-24 EZ-USB FX2 Technical Reference Manual v2.1
9.3.6 CPU Access to OUT Packets, AUTOOUT = 0
In some systems, it may be desirable to allow the FX2’s CPU to participate in the transfer of data
between the host and the slave FIFOs. To configure a FIFO for this “Manual-Out” mode, the
AUTOOUT bit in the appropriate EPxFIFOCFG register must be cleared to 0 (see Figure 9-31).
Figure 9-31. TD_Init Example, Configuring AUTOOUT=0
As Illustrated in Figure 9-32, FX2 firmware can do one of three things when the FX2 is in Manual-
Out mode and a packet is received from the host:
1. It can commit (pass to the FIFOs) the packet by writing OUTPKTEND with SKIP=0 (Figur e9-
33).
2. It can skip (discard) the packet by writing OUTPKTEND with SKIP=1 (Figur e9-34).
3. It can edit the packet (or source an entire OUT packet) by writing to the FIFO buffer directly,
then writing the length of the packet to EPxBCH:L. The write to EPxBCL commits the edited
packet, so EPxBCL should be written after writing EPxBCH (Figure9-35).
In all cases, the OUT buffer automatically re-arms so it can receive the next packet.
See Section 8.6.2.4 for a detailed description of the SKIP bit.
TD_Init():
… … … … …
REVCTL = 0x03; // MUST set REVCTL.0 and REVCTL.1 to 1
SYNCDELAY;
EP2CFG = 0xA2; // EP2 is DIR=OUT, TYPE=BULK, SIZE=512, BUF=2x
SYNCDELAY;
FIFORESET = 0x80; // Reset the FIFO
SYNCDELAY;
FIFORESET = 0x02;
SYNCDELAY;
FIFORESET = 0x00;
SYNCDELAY;
EP2FIFOCFG = 0x00; // EP2 is AUTOOUT=0, AUTOIN=0, ZEROLEN=0, WORDWIDE=0
SYNCDELAY;
OUTPKTEND = 0x82; // Arm both EP2 buffers to “prime the pump”
SYNCDELAY;
OUTPKTEND = 0x82;
… … … … …
Comentarios a estos manuales