DMA Operation
13-121
USB Function Module
The size of the file to transfer (FTZ) can be assimilated conceptually as a
concatenation of three arguments as shown in Figure 13–41.
Figure 13–41. File Transfer Size
FBT
XSWL
EOTB
FTZ (File transfer size)
EOTB (End of transfer
byte count)
[0 – (EP Buffer size – 1)]
FBT (Full buffer
transfer count)
[0–1023]
XSWL (Extra software
Loop – n DMA transfer)
[0–n]
lsb
MSB
The flowchart in Figure 13–42 shows the necessary steps to prepare and
permit a TX DMA transfer of any size. It also effectively starts the initial DMA
transfer. The completion of this DMA task is signaled to local host via a DONE
interrupt, as depicted in Figure 13–43. The start routine and the associated
interrupt handler are tightly coupled.
An example would be 100603 bytes to transfer via 32 bytes IN bulk endpoint,
which gives XSWL = 0x3, FBT = 0x47, EOTB = 0x1b. In this example, five
passes of DMA transfer, signaled by five TXn_Done interrupts, are required,
as follows:
1) EOT = 0, FBT = 0, loop = 3
32768 bytes transferred (1024 x 32 bytes)
2) EOT = 0, FBT = 0, loop = 2
32768 bytes
3) EOT = 0, FBT = 0, loop = 1
32768 bytes
4) EOT = 0, FBT = 0x47, loop = 0
2272 bytes (71 x 32 bytes)
5) EOT = 1, FBT = 0x1B, loop = 0
27 bytes