看这个三个函数的定义写了哪些位,然后对照器件手册中特定位含义的说明,就明白了函数的参数代表什么了:每个参数有注释的:
void
DMACH1BurstConfig(Uint16 bsize, int16 srcbstep, int16 desbstep)
{
EALLOW;
// Set up BURST registers:
DmaRegs.CH1.BURST_SIZE.all = bsize; // Number of words(X-1)
x-ferred in a burst
DmaRegs.CH1.SRC_BURST_STEP = srcbstep; // Increment source addr between each word
x-ferred
DmaRegs.CH1.DST_BURST_STEP =
desbstep; // Increment dest
addr between each word x-ferred
EDIS;
}
void
DMACH1WrapConfig(Uint16 srcwsize, int16 srcwstep, Uint16 deswsize, int16
deswstep)
{
EALLOW;
// Set up WRAP registers:
DmaRegs.CH1.SRC_WRAP_SIZE = srcwsize; // Wrap source
address after N bursts
DmaRegs.CH1.SRC_WRAP_STEP
= srcwstep; // Step for source wrap
DmaRegs.CH1.DST_WRAP_SIZE = deswsize; // Wrap destination
address after N bursts
DmaRegs.CH1.DST_WRAP_STEP = deswstep; // Step for
destination wrap
EDIS;
}
void
DMACH1TransferConfig(Uint16 tsize, int16 srctstep, int16 deststep)
{
EALLOW;
// Set up TRANSFER registers:
DmaRegs.CH1.TRANSFER_SIZE = tsize; // Number of bursts per transfer, DMA
interrupt will occur after completed transfer
DmaRegs.CH1.SRC_TRANSFER_STEP =
srctstep; //
TRANSFER_STEP is ignored when WRAP occurs
DmaRegs.CH1.DST_TRANSFER_STEP =
deststep; //
TRANSFER_STEP is ignored when WRAP occurs
EDIS;
}
但是DMACH1TransferConfig(9,-15,(-150 + 1)); //一次传送中burst次数为9,后面两个怎么解释?为什么这样设置?
这个里面为负数的两个参数,代表指针增加/减小的步长,器件手册上用的十六进制有符号,例如0xF0000表示将地址减小4096.这里用负数赋值更容易理解