最近在看cc254x的UART DMA,发现有个地方有疑惑。
/* The trick is to cfg DMA to xfer 2 bytes for every 1 byte of Rx.
* The byte after the Rx Data Buffer is the Baud Cfg Register,
* which always has a known value. So init Rx buffer to inverse of that
* known value. DMA word xfer will flip the bytes, so every valid Rx byte
* in the Rx buffer will be preceded by a DMA_PAD char equal to the
* Baud Cfg Register value.
*/
对这段话不理解
(void)memset(dmaCfg.rxBuf, (DMA_PAD ^ 0xFF), HAL_UART_DMA_RX_MAX*2);
我在watch里面看到执行上面这句之后,dmaCfg.rxBuf被0xff填满了,不知道这样有什么用?哪位大哥大姐知道,帮我解释一下吧~谢谢