跳转到主要内容

【干货分享】解决ZDMA应用例子xzdma_simple_example.c的“ZDMA Simple Example Failed”问题

作者:付汉杰,<a href="mailto:hankf@xilinx.com">hankf@xilinx.com</a&gt;,文章转载自:<a id="link_3" href="https://forums.xilinx.com/t5/%E5%B5%8C%E5%85%A5%E5%BC%8F-%E5%B7%A5%E5%8…;

ZDMA应用例子xzdma_simple_example.c 缺省只运行一次。

在XZDma_SimpleExample()里的XZDma_SelfTest( )之后,把运行部分放进一个循环体,可以多次运行。测试工具是Xilinx SDK 2018.2.

但它没有清除 Total byte count寄存器,多次运行后,会溢出, 出现错误"ErrorStatus: 0x8",打印“ZDMA Simple Example Failed”。

在循环体中,添加下述代码,可以清除Totalbyte count寄存器,避免出现错误"ErrorStatus: 0x8"。
<pre> /* Clear the TOTAL BYTE COUNT register to avoid the BYTE_CNT_OVRFLW
*interupt from being set
*/
XZDma_WriteReg((ZdmaInstPtr->Config.BaseAddress),
XZDMA_CH_TOTAL_BYTE_OFFSET, 0x00000000U);</pre>

SDK 2018.3里的ZDMA驱动, 在函数 XZDma_Reset( ) 清除了这个寄存器。
<body>
SDK 2018.3的FSBL,已经清除了这个寄存器。在<a href="https://github.com/Xilinx/embeddedsw/blob/master/doc/ChangeLog&quot; target="_self" rel="nofollow noopener noreferrer"> SDK 2018.3 ChangeLog</a>, 有如下描述
</body>

- Clear total byte counter after every cycle of ADMA to prevent byte count overflow
interrupt from being set.

SDK 2018.3的FSBL的函数XFsbl_AdmaCopy(), 有如下代码。
<pre>
/* Clear the TOTAL BYTE COUNT register to avoid the BYTE_CNT_OVRFLW
*interupt from being set
*/
XFsbl_Out32(ADMA_CH0_ZDMA_CH_CTRL0_TOTAL_BYTE_COUNT,0x00000000U);</pre>