GD32W51x User Manual
328
DMA_CHxCTL register is cleared.
12.4.6.
Switch-buffer mode
Similar to circular mode, switch-buffer mode is also implemented to handle continues
peripheral requests. The SBMEN bit in the DMA_CHxCTL register is used to enable/disable
the switch-buffer mode. When the switch-buffer mode is enabled, the circular mode is
automatically enabled immediately after the channel is enabled. Switch-buffer mode is only
available when the transfer mode is peripheral-to-memory or memory-to-peripheral. When
the transfer mode is memory-to-memory, the switch-buffer mode is automatically disabled
immediately after the channel is enabled.
Switch-buffer mode is supported with two memory buffers and the base address of the two
memory buffers
are
separately configured
in
the
DMA_CHxM0ADDR and
DMA_CHxM1ADDR register. In switch-buffer mode, the DMA memory pointer switches from
the current memory buffer to another at the end of every DMA transfer. During the DMA
transmission, the memory buffer not being processed by DMA can be accessed by other AHB
masters. In switch-buffer mode, the base address of the memory buffer not accessed by DMA
can be updated even if the channel is enabled.
The MBS bit in the DMA_CHxCTL register is configured to select which memory buffer is
accessed by DMA at the first DMA transfer before the channel is enabled. In switch-buffer
mode, this bit switch
es automatically between ‘0’ and ‘1’ at the end of every DMA transfer,
and can be used as a flag indicating the current memory buffer accessed by DMA during the
transmission. The DMA operation of switch-buffer mode are shown in
operation of switch-buffer mode
.
Figure 12-7. DMA operation of switch-buffer mode
MBS = 0
Enable the channel
Peripheral
FIFO
Memory 0
push data
pop data
Peripheral
Memory 1
push data
pop data
transfer finish
MBS = 1
transfer finish
MBS = 0
memory buffer 0
transfer:
memory buffer 1
transfer:
FIFO
transfer mode : peripheral-to-memory
12.4.7.
Transfer flow controller
The transfer flow controller controls the number of data items to be transferred. The TFCS bit
in the DMA_CHxCTL register determines which of DMA and peripheral is selected to control