Cypress Semiconductor FX2LP Información técnica Pagina 183

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 460
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 182
Chapter 9. Slave FIFOs Page 9-27
Figure 9-36. TD_Init Example, OUT Endpoint Initialization
9.3.7 CPU Access to IN Packets, AUTOIN = 1
Auto-In mode is similar to Auto-Out mode: When an IN FIFO is configured for Auto-In mode (by
setting its AUTOIN bit to 1), data from the master is automatically packetized and committed to
USB without any CPU intervention (see Figure 9-37).
Figure 9-37. TD_Poll Example, AUTOIN = 1
Auto-In mode differs in one important way from Auto-Out mode: In Auto-Out mode, data (excluding
data in short packets) is always auto-committed in 512- or 1024-byte packets; in Auto-In mode, the
auto-commit packet size may be set to any non-zero value (with the single restriction, of course,
that the packet size must be less than or equal to the size of the endpoint buffer). Each FIFO’s
Auto-In packet size is stored in its EPxAUTOINLENH:L register pair.
To
source
an IN packet, FX2 firmware can temporarily halt the flow of data from the external mas-
ter (via a signal on a general-purpose I/O pin, typically), wait for an endpoint buffer to become
available, create a new packet by writing directly to that buffer, then commit the packet to USB and
release the external master. In this way, the firmware can insert its own packets in the data stream.
See Figure 9-38, which illustrates data flowing directly between the master and the host, and
Figure 9-39, which shows the firmware sourcing an IN packet. A firmware example appears in
Figure 9-40.
TD_Init():
… … … … …
REVCTL = 0x03; // MUST set REVCTL.0 and REVCTL.1 to 1
SYNCDELAY;
SYNCDELAY;
EP2CFG = 0xA2; // EP2 is DIR=OUT, TYPE=BULK, SIZE=512, BUF=2x
SYNCDELAY;
EP2FIFOCFG = 0x00; // EP2 is AUTOOUT=0, AUTOIN=0, ZEROLEN=0, WORDWIDE=0
// OUT endpoints do NOT come up armed
SYNCDELAY;
OUTPKTEND = 0x82; // arm first buffer by writing OUTPKTEND w/skip=1
SYNCDELAY;
OUTPKTEND = 0x82; // arm second buffer by writing OUTPKTEND w/skip=1
… … … … …
TD_Poll():
… … … … …
// no code necessary to xfr data from master to host!
// AUTOIN=1 and EP8AUTOINLEN=512 auto commits packets
// in 512 byte chunks.
… … … … …
Vista de pagina 182
1 2 ... 178 179 180 181 182 183 184 185 186 187 188 ... 459 460

Comentarios a estos manuales

Sin comentarios