This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

串口的DMA模式发送函数关于dmaCfg.txSel的一点疑问

在Zigbee的DMA串口发送函数 static uint16 HalUARTWriteDMA(uint8 *buf, uint16 len)中有如下一段代码

/* If an ongoing DMA Tx finished while this buffer was being *appended*, then another DMA Tx
* will have already been started on this buffer, but it did not include the bytes just appended.
* Therefore these bytes have to be re-copied to the start of the new working buffer. 
*/
HAL_ENTER_CRITICAL_SECTION(his);
if (txSel != dmaCfg.txSel)
{
HAL_EXIT_CRITICAL_SECTION(his);
txSel = dmaCfg.txSel;
txIdx = dmaCfg.txIdx[txSel];

for (cnt = 0; cnt < len; cnt++)
{
dmaCfg.txBuf[txSel][txIdx++] = buf[cnt];
}
HAL_ENTER_CRITICAL_SECTION(his);
}

dmaCfg.txIdx[txSel] = txIdx;

注释说了一堆东西,但感觉这段代码几乎不会用到吧? dmaCfg.txSel在中断中并没有被改变啊,只是在

HalUARTPollDMA中会取成另一个通道,请问Ti的工程师 我可以去掉这段代码吗?