【开发者分享】有关 Zynq UltraScale+ RFSoC 的 AXI CDMA Linux 用户空间示例

本文转载自: XILINX技术社区微信公众号

本篇博文将为您演示如何创建 AXI CDMA Linux 用户空间示例应用。

示例设计将在 Zynq UltraScale+ RFSoC ZCU111 评估板上实现通过 AXI CDMA 把数据从 PS DDR 传输至 AXI BRAM。

适用平台

Vivado 和 PetaLinux 2019.2。

Zynq UltraScale+ RFSoC ZCU111 评估板

启动模式:JTAG,SD

模块框图


Vivado步骤

步骤 1:基于ZCU111 评估版创建一个工程,并根据上图中的模块设计完成相应的模块设计。

步骤 2:按下列设置来配置 AXI CDMA:

步骤 3:成功完成后,选择“验证设计 (Validate design)”以验证设计,并检查地址编辑器。

步骤4:创建整个模块设计的顶层文件并生成比特流。

步骤 5:导出硬件设计以获取 XSA 文件。

PetaLinux步骤

以下步骤用于生成启动镜像和 Linux 用户空间应用。

步骤 1:

使用以下命令和随附内容 (axicdma.c) 创建 AXI CDMA 用户空间应用。

vim axicmda.c

步骤 2:

petalinux-create -t project -n bram --template zynqMP

步骤3:

petalinux-config --v --get-hw-description=<hdf directory>

步骤4:

在 system-user.dtsi 文件中添加以下更改以禁用 CDMA 驱动并保留内存。

/include/ "system-conf.dtsi"
           / {
           #address-cells = >2< ;
           #size-cells = >2< ;
           memory {
           device_type = "memory";
           reg = < 0x0 0x0 0x0 0x80000000> , < 0x0 0xA0000000 0x0 0x40000>, < 0x00000008 0x00000000 0x0 0x80000000>;
           };
           reserved-memory {
           ranges;
           reserved {
           reg = <0x0 0xa0000000 0x0 0x40000>;
           };
           };

           };
           &axi_bram_ctrl_1 {
           status = "disabled";
           };

           &axi_cdma_0 {
           status = "disabled";
           };

步骤 5:

petalinux-config -c kernel

然后,按如下方式操作:

Kernel hacking  --->[ ] Filter access to /dev/mem  --> Save & exit 

步骤 6:

petalinux-build

步骤 7:

petalinux-package --boot --fsbl images/linux/zynqmp_fsbl.elf --pmufw images/linux/pmufw.elf --fpga images/linux/system.bit  --u-boot  images/linux/u-boot.elf --force

步骤 8:

将 BOOT.bin 和 image.ub 文件与测试应用二进制文件一起复制到 SD 卡。

步骤 9:

启动评估板,并运行随附的应用 (axicmda.c)。

运行设计

要运行设计,请首先连接到 ZCU111 评估板并从 SD 卡启动镜像,然后运行二进制应用文件。

控制台输出

/dev/mem opened.
BRAM Memory mapped at address 0x7fb5339000.
PSDDR Memory mapped at address 0x7fb5192000.
CDMA Memory mapped at address 0x7fb5336000.
Input : value in PSDDR 0 : value in BRAM 1179403647
Input : value in PSDDR 1 : value in BRAM 65794
Input : value in PSDDR 2 : value in BRAM 0
Input : value in PSDDR 3 : value in BRAM 0
Input : value in PSDDR 4 : value in BRAM 11993091
Input : value in PSDDR 5 : value in BRAM 1
Input : value in PSDDR 6 : value in BRAM 13128
Input : value in PSDDR 7 : value in BRAM 0
Input : value in PSDDR 8 : value in BRAM 64
Input : value in PSDDR 9 : value in BRAM 0
Input : value in PSDDR 10 : value in BRAM 44872
Input : value in PSDDR 11 : value in BRAM 0
Input : value in PSDDR 12 : value in BRAM 0
Input : value in PSDDR 13 : value in BRAM 3670080
Input : value in PSDDR 14 : value in BRAM 4194313
Input : value in PSDDR 15 : value in BRAM 1638426
Input : value in PSDDR 16 : value in BRAM 6
Input : value in PSDDR 17 : value in BRAM 4
Input : value in PSDDR 18 : value in BRAM 64
Input : value in PSDDR 19 : value in BRAM 0
Input : value in PSDDR 20 : value in BRAM 64
Input : value in PSDDR 21 : value in BRAM 0
Input : value in PSDDR 22 : value in BRAM 64
Input : value in PSDDR 23 : value in BRAM 0
Input : value in PSDDR 24 : value in BRAM 504
Input : value in PSDDR 25 : value in BRAM 0
Input : value in PSDDR 26 : value in BRAM 504
Input : value in PSDDR 27 : value in BRAM 0
Input : value in PSDDR 28 : value in BRAM 8
Input : value in PSDDR 29 : value in BRAM 0
Input : value in PSDDR 30 : value in BRAM 3
Input : value in PSDDR 31 : value in BRAM 4
Input : value in PSDDR 32 : value in BRAM 568
Input : value in PSDDR 33 : value in BRAM 0
Input : value in PSDDR 34 : value in BRAM 568
Input : value in PSDDR 35 : value in BRAM 0
Input : value in PSDDR 36 : value in BRAM 568
Input : value in PSDDR 37 : value in BRAM 0
Input : value in PSDDR 38 : value in BRAM 27
Input : value in PSDDR 39 : value in BRAM 0
Input : value in PSDDR 40 : value in BRAM 27
Input : value in PSDDR 41 : value in BRAM 0
Input : value in PSDDR 42 : value in BRAM 1
Input : value in PSDDR 43 : value in BRAM 0
Input : value in PSDDR 44 : value in BRAM 1
Input : value in PSDDR 45 : value in BRAM 5
Input : value in PSDDR 46 : value in BRAM 0
Input : value in PSDDR 47 : value in BRAM 0
Input : value in PSDDR 48 : value in BRAM 0
Input : value in PSDDR 49 : value in BRAM 0
Input : value in PSDDR 50 : value in BRAM 0
Input : value in PSDDR 51 : value in BRAM 0
Input : value in PSDDR 52 : value in BRAM 37116
Input : value in PSDDR 53 : value in BRAM 0
Input : value in PSDDR 54 : value in BRAM 37116
Input : value in PSDDR 55 : value in BRAM 0
Input : value in PSDDR 56 : value in BRAM 65536
Input : value in PSDDR 57 : value in BRAM 0
Input : value in PSDDR 58 : value in BRAM 1
Input : value in PSDDR 59 : value in BRAM 6
Input : value in PSDDR 60 : value in BRAM 39544
Input : value in PSDDR 61 : value in BRAM 0
Input : value in PSDDR 62 : value in BRAM 105080
Input : value in PSDDR 63 : value in BRAM 0
Input : value in PSDDR 64 : value in BRAM 105080
Input : value in PSDDR 65 : value in BRAM 0
Input : value in PSDDR 66 : value in BRAM 5072
Input : value in PSDDR 67 : value in BRAM 0
Input : value in PSDDR 68 : value in BRAM 6168
Input : value in PSDDR 69 : value in BRAM 0
Input : value in PSDDR 70 : value in BRAM 65536
Input : value in PSDDR 71 : value in BRAM 0
Input : value in PSDDR 72 : value in BRAM 2
Input : value in PSDDR 73 : value in BRAM 6
Input : value in PSDDR 74 : value in BRAM 39560
Input : value in PSDDR 75 : value in BRAM 0
Input : value in PSDDR 76 : value in BRAM 105096
Input : value in PSDDR 77 : value in BRAM 0
Input : value in PSDDR 78 : value in BRAM 105096
Input : value in PSDDR 79 : value in BRAM 0
Input : value in PSDDR 80 : value in BRAM 512
Input : value in PSDDR 81 : value in BRAM 0
Input : value in PSDDR 82 : value in BRAM 512
Input : value in PSDDR 83 : value in BRAM 0
Input : value in PSDDR 84 : value in BRAM 8
Input : value in PSDDR 85 : value in BRAM 0
Input : value in PSDDR 86 : value in BRAM 4
Input : value in PSDDR 87 : value in BRAM 4
Input : value in PSDDR 88 : value in BRAM 596
Input : value in PSDDR 89 : value in BRAM 0
Input : value in PSDDR 90 : value in BRAM 596
Input : value in PSDDR 91 : value in BRAM 0
Input : value in PSDDR 92 : value in BRAM 596
Input : value in PSDDR 93 : value in BRAM 0
Input : value in PSDDR 94 : value in BRAM 68
Input : value in PSDDR 95 : value in BRAM 0
Input : value in PSDDR 96 : value in BRAM 68
Input : value in PSDDR 97 : value in BRAM 0
Input : value in PSDDR 98 : value in BRAM 4
Input : value in PSDDR 99 : value in BRAM 0
control reg:0x00000000
status reg:0x00000002
all interrupts masked...
control reg:0x00005000
status reg:0x00000002
Writing source address
Source addr reg:0x04000000
status reg:0x00000002
Writing destination address
Dest addr reg:0xa0000000
status reg:0x00000002
Writing transfer length...
DMA transfer is completed
length reg:0x00000190
status reg:0x00001002
Output : value in PSDDR 0 : value in BRAM 0
Output : value in PSDDR 1 : value in BRAM 1
Output : value in PSDDR 2 : value in BRAM 2
Output : value in PSDDR 3 : value in BRAM 3
Output : value in PSDDR 4 : value in BRAM 4
Output : value in PSDDR 5 : value in BRAM 5
Output : value in PSDDR 6 : value in BRAM 6
Output : value in PSDDR 7 : value in BRAM 7
Output : value in PSDDR 8 : value in BRAM 8
Output : value in PSDDR 9 : value in BRAM 9
Output : value in PSDDR 10 : value in BRAM 10
Output : value in PSDDR 11 : value in BRAM 11
Output : value in PSDDR 12 : value in BRAM 12
Output : value in PSDDR 13 : value in BRAM 13
Output : value in PSDDR 14 : value in BRAM 14
Output : value in PSDDR 15 : value in BRAM 15
Output : value in PSDDR 16 : value in BRAM 16
Output : value in PSDDR 17 : value in BRAM 17
Output : value in PSDDR 18 : value in BRAM 18
Output : value in PSDDR 19 : value in BRAM 19
Output : value in PSDDR 20 : value in BRAM 20
Output : value in PSDDR 21 : value in BRAM 21
Output : value in PSDDR 22 : value in BRAM 22
Output : value in PSDDR 23 : value in BRAM 23
Output : value in PSDDR 24 : value in BRAM 24
Output : value in PSDDR 25 : value in BRAM 25
Output : value in PSDDR 26 : value in BRAM 26
Output : value in PSDDR 27 : value in BRAM 27
Output : value in PSDDR 28 : value in BRAM 28
Output : value in PSDDR 29 : value in BRAM 29
Output : value in PSDDR 30 : value in BRAM 30
Output : value in PSDDR 31 : value in BRAM 31
Output : value in PSDDR 32 : value in BRAM 32
Output : value in PSDDR 33 : value in BRAM 33
Output : value in PSDDR 34 : value in BRAM 34
Output : value in PSDDR 35 : value in BRAM 35
Output : value in PSDDR 36 : value in BRAM 36
Output : value in PSDDR 37 : value in BRAM 37
Output : value in PSDDR 38 : value in BRAM 38
Output : value in PSDDR 39 : value in BRAM 39
Output : value in PSDDR 40 : value in BRAM 40
Output : value in PSDDR 41 : value in BRAM 41
Output : value in PSDDR 42 : value in BRAM 42
Output : value in PSDDR 43 : value in BRAM 43
Output : value in PSDDR 44 : value in BRAM 44
Output : value in PSDDR 45 : value in BRAM 45
Output : value in PSDDR 46 : value in BRAM 46
Output : value in PSDDR 47 : value in BRAM 47
Output : value in PSDDR 48 : value in BRAM 48
Output : value in PSDDR 49 : value in BRAM 49
Output : value in PSDDR 50 : value in BRAM 50
Output : value in PSDDR 51 : value in BRAM 51
Output : value in PSDDR 52 : value in BRAM 52
Output : value in PSDDR 53 : value in BRAM 53
Output : value in PSDDR 54 : value in BRAM 54
Output : value in PSDDR 55 : value in BRAM 55
Output : value in PSDDR 56 : value in BRAM 56
Output : value in PSDDR 57 : value in BRAM 57
Output : value in PSDDR 58 : value in BRAM 58
Output : value in PSDDR 59 : value in BRAM 59
Output : value in PSDDR 60 : value in BRAM 60
Output : value in PSDDR 61 : value in BRAM 61
Output : value in PSDDR 62 : value in BRAM 62
Output : value in PSDDR 63 : value in BRAM 63
Output : value in PSDDR 64 : value in BRAM 64
Output : value in PSDDR 65 : value in BRAM 65
Output : value in PSDDR 66 : value in BRAM 66
Output : value in PSDDR 67 : value in BRAM 67
Output : value in PSDDR 68 : value in BRAM 68
Output : value in PSDDR 69 : value in BRAM 69
Output : value in PSDDR 70 : value in BRAM 70
Output : value in PSDDR 71 : value in BRAM 71
Output : value in PSDDR 72 : value in BRAM 72
Output : value in PSDDR 73 : value in BRAM 73
Output : value in PSDDR 74 : value in BRAM 74
Output : value in PSDDR 75 : value in BRAM 75
Output : value in PSDDR 76 : value in BRAM 76
Output : value in PSDDR 77 : value in BRAM 77
Output : value in PSDDR 78 : value in BRAM 78
Output : value in PSDDR 79 : value in BRAM 79
Output : value in PSDDR 80 : value in BRAM 80
Output : value in PSDDR 81 : value in BRAM 81
Output : value in PSDDR 82 : value in BRAM 82
Output : value in PSDDR 83 : value in BRAM 83
Output : value in PSDDR 84 : value in BRAM 84
Output : value in PSDDR 85 : value in BRAM 85
Output : value in PSDDR 86 : value in BRAM 86
Output : value in PSDDR 87 : value in BRAM 87
Output : value in PSDDR 88 : value in BRAM 88
Output : value in PSDDR 89 : value in BRAM 89
Output : value in PSDDR 90 : value in BRAM 90
Output : value in PSDDR 91 : value in BRAM 91
Output : value in PSDDR 92 : value in BRAM 92
Output : value in PSDDR 93 : value in BRAM 93
Output : value in PSDDR 94 : value in BRAM 94
Output : value in PSDDR 95 : value in BRAM 95
Output : value in PSDDR 96 : value in BRAM 96
Output : value in PSDDR 97 : value in BRAM 97
Output : value in PSDDR 98 : value in BRAM 98
Output : value in PSDDR 99 : value in BRAM 99
Transmitted Data successfully
root@cdma_proj:~#

输出截屏

参考资料:

https://china.xilinx.com/support/documentation/ip_documentation/axi_cdma...

https://china.xilinx.com/support/documentation/sw_manuals/xilinx2019_2/u...

推荐阅读