Universal Serial Bus (USB)
Am186™CC/CH/CU Microcontrollers User’s Manual
18-21
endpoint is configured to use a Smart DMA channel, information in the FIFO descriptor
indicates if a byte is the last byte or a null byte.
18.5.6.3
Setting Up DMA for USB
The USB peripheral controller gives the programmer a large degree of freedom in using
DMA with USB endpoints. In general, most methods of using DMA with USB fall into one
of three categories:
■
Undelimited Transfers are generally used for isochronous data that has no natural
boundaries, such as audio data. For these types of transfers, either the SmartDMA
channel or the general-purpose DMA serve equally well to transfer data into a circular
FIFO. In addition, SmartDMA control can transfer data to or from another peripheral,
such as the HDLC controller on the Am186CC microcontroller.
For undelimited IN (to the host) transfers, the amount of data transferred in each packet
is the endpoint’s maximum packet size unless Auto Rate control is enabled on the
endpoint. If Auto Rate control is enabled, the packet size can equal the number of
samples received during the previous frame multiplied by a programmable byte/sample
factor, if this value is less than the programmed maximum packet size.
■
Buffer-Per-Packet transfers can be used for either bulk transactions or nonstreaming
isochronous transfers. The amount of data transferred for each packet is determined by
the FIFO size. Buffer per packet transfers are required if SmartDMA is used with packet
status stored in the FIFO descriptor (MODE = 101b in the xEPDEF3 register).
■
Buffer-Per-I/O Request Packet (IRP) transfers are similar to buffer-per-packet transfers,
except that a DMA FIFO contains multiple packets. In general, Buffer-per-IRP is simpler
to program for the normal case, but error handling is more complicated because DMA
must be restarted in the middle of the FIFO. Buffer per IRP transfers are highly
recommended for IN endpoints using a SmartDMA channel.
18.5.6.4
Short Packets
Short packets typically delineate the end of a USB I/O request packet (IRP). For example,
if the maximum packet size is 64 bytes, and a FIFO that is 260 bytes is to be transferred,
four full-length packets are transferred followed by a packet that contains only four bytes.
This delineation is very useful because it provides an “out-of-band” indication of where one
information FIFO ends and the next one starts. In fact, it is so useful that USB specifically
allows for zero-length packets, to ensure that this delineation can be performed even when
the FIFO size is a multiple of the maximum packet size.
The SmartDMA channel is fully capable of sending and receiving zero-length packets. (On
receive, it simply stores the byte count provided by the USB peripheral controller, which is
zero, and on transmit, a special signal from the SmartDMA controller indicates that the
packet has no data.)
With general-purpose DMA, receiving a zero-length packet is exactly the same as receiving
any other short packet—the USB should be set to stop on receipt of a short packet, and
the software examines the received length. Sending a zero-length packet is performed
differently because no data is transferred through the DMA controller. To send a short packet
of one byte or greater, simply program the DMA controller to send the desired count, after
programming the USB peripheral controller’s DMA mode to 011. In this mode, when the
DMA controller sends the last byte, the packet is sent, even if the USB FIFO is not full.
To send a zero-byte packet in general-purpose DMA mode, you must clear the NOT_ZERO
bit in the xEPCTL register, and then write one byte (of any value) to the endpoint’s FIFO.
Содержание Am186 CC
Страница 1: ...Am186 CC CH CU Microcontrollers User s Manual Order 21914B...
Страница 4: ...iv Am186 CC CH CU Microcontrollers User s Manual...
Страница 18: ...Table of Contents xviii Am186 CC CH CU Microcontrollers User s Manual...
Страница 24: ...Introduction xxiv Am186 CC CH CU Microcontrollers User s Manual...
Страница 39: ...Architectural Overview Am186 CC CH CU Microcontrollers User s Manual 1 15 Figure 1 6 32 Channel Linecard CH CC...
Страница 40: ...Architectural Overview 1 16 Am186 CC CH CU Microcontrollers User s Manual...
Страница 86: ...System Overview 3 36 Am186 CC CH CU Microcontrollers User s Manual...
Страница 92: ...Emulator Support 4 6 Am186 CC CH CU Microcontrollers User s Manual...
Страница 112: ...DRAM Controller 6 8 Am186 CC CH CU Microcontrollers User s Manual...
Страница 134: ...Interrupts 7 22 Am186 CC CH CU Microcontrollers User s Manual...
Страница 186: ...Programmable I O Signals 9 8 Am186 CC CH CU Microcontrollers User s Manual...
Страница 200: ...Watchdog Timer 11 6 Am186 CC CH CU Microcontrollers User s Manual...
Страница 232: ...Asynchronous Serial Ports UARTs 13 24 Am186 CC CH CU Microcontrollers User s Manual...
Страница 242: ...Synchronous Serial Port SSI 14 10 Am186 CC CH CU Microcontrollers User s Manual...
Страница 264: ...High Level Data Link Control HDLC 15 22 Am186 CC CH CU Microcontrollers User s Manual...
Страница 332: ...Universal Serial Bus USB 18 34 Am186 CC CH CU Microcontrollers User s Manual...
Страница 348: ...Register Summary A 16 Am186 CC CH CU Microcontrollers User s Manual...
Страница 376: ...Index Index 18 Am186 CC CH CU Microcontrollers User s Manual...