![FTDI FT51A Скачать руководство пользователя страница 136](http://html1.mh-extra.com/html/ftdi/ft51a/ft51a_application-note_2341158136.webp)
Application Note
AN_289 FT51A Programming Guide
Version 1.0
Document Reference No.: FT_000962 Clearance No.: FTDI# 483
135
Copyright © 2015 Future Technology Devices International Limited
2.14.16
DMA_AFULL_TRIGGER_x
Bit
Position
Bit Field Name
Type
Reset
Description
5..0
dma_afull_trigger
R/W
0
IO Peripheral DMA Almost Full Trigger
Value
Table 2.183 IO Peripheral DMA Almost Full Trigger Value
2.14.17
Use Cases
DMA can be configured in three modes: Push, Pull and FIFO. The first two perform a one-shot
transfer, while the last one is for continuous reception of data.
Push is used to transfer data from memory to I/O register, while Pull and FIFO are used to transfer
data in the opposite direction. Below is a list of steps necessary to setup DMA engine 1 in the Push
mode.
1.
Enable global and ‘External 0’ interrupts via SFR IE register.
IE |= (IE_GLOBAL | IE_EXTERNAL_0);
2.
Enable interrupts on the DMA engine.
WRITE_IO_REG(DMA_IRQ_ENA_1, DMA0_IRQ_IEN);
3.
Enable individual DMA engine.
WRITE_IO_REG(DMA_CONTROL_1, DMA_CONTROL_0_DEV_EN);
4.
Enable interrupts for the Push mode.
WRITE_IO_REG(DMA_IRQ_ENA_1, (DMA_IRQ_DONE_IEN | (0 << MASK_DMA_MODE)));
5.
Specify transfer size.
WRITE_IO_REG(DMA_TRANS_CNT_U_1, transfer_size >>8 );
WRITE_IO_REG(DMA_TRANS_CNT_L_1, transfer_size);
6.
Define source.
WRITE_IO_REG(DMA_SRC_MEM_ADDR_U_1, source >>8 );
WRITE_IO_REG(DMA_SRC_MEM_ADDR_L_1, source);
7.
Define destination along with specifying flow control.
destination |= ((uint16_t)(flow_control) << 8);
WRITE_IO_REG(DMA_IO_ADDR_U_1, destination >> 8);
WRITE_IO_REG(DMA_IO_ADDR_L_1, destination);
8.
Start the DMA engine.
WRITE_IO_REG(DMA_ENABLE_1, DMA_START)
The DMA relieves the CPU from performing the transfer. In the case of Push mode, the only time
when the CPU gets interrupted is when the transfer has completed. In the case of Pull/FIFO mode,
the DMA may also interrupt when its buffer has been filled to a specified level, as set by the
DMA_AFULL_TRIGGER_1
register.
Preferably, one would want to react on any received interrupt, for example, by calling some call-
back function. The implementation of such scenario is presented below.