z-stack中DMA主要用于串口、FLASH控制器以及RADIO,串口中应用DMA在另外的文章讲,本章主要介绍DMA在FLASH控制器的应用。首先看cc2530的datasheet。
The Direct Memory Access (DMA) Controller can be used to relieve the 8051 CPU core of handling data
movement operations, thus achieving high overall performance with good power efficiency. The DMA
controller can move data from a peripheral unit such as ADC or RF transceiver to memory with minimum
CPU intervention。
DMA的作用就是为了减轻CPU的负担,它能在内存和外设单元直接传输数据而不经过CPU,这样更加提高系统效率。cc2530有5个独立的DMA通道,3个可以配置的DMA通道优先级,32个可以配置的传送触发事件,源地址和目标地址的独立控制,单独传送、数据块传送和重复传送模式,支持可变长度数据域的传送,可以工作在字或字节模式。在使用DMA通道之前先要配置DMA.我们看一下DMA如何配置的。
DMA主要配置一下几个参数:
Source address:The first address from which the DMA channel should read data
Destination address: The first address to which the DMA channel should write the data read from the
source address. The user must ensure that the destination is writable.
VLEN setting: The DMA channel is capable of variable-length transfers, using the first byte or word to
set the transfer length. When doing this, various options are available regarding how to count the
number of bytes to transfer.
Priority: The priority of the DMA transfers for the DMA channel with respect to the CPU and other
DMA channels and access ports.
Trigger event:All DMA transfers are