petalinux axidma驱动使用

petalinux axidma驱动使用

block design设计

petalinux axidma驱动使用_第1张图片

注意中断需要连接,注意发送和接收连接顺序

petalinux axidma驱动使用_第2张图片
dma的设计,注意地址位宽为40bits,设备数也需要改成相应的0x28(40)

PS侧没啥需要注意的,有一个PCIE可关可不关,都是可以正常启动的,在led部分不关PCIE会无法启动

设备树文件 system-user.dtsi

设备树主要注意几点:

  • 需要定义DESIGN_RV_MIN来启动dma中断控制器
  • 中断的设计一定要注意
  • dma的地址就是和block designer一样的
#include "zcu102/zcu102-rev1.0.dtsi"
#include "zcu102/pcw.dtsi"
/ {
};

#define DESIGN_RV_MIN

#include "zcu102/system-conf.dtsi"
#include "base_trd/pl.dtsi"

/* Define design */
#define DESIGN_BASE_TRD


/{
	axidma_chrdev: axidma_chrdev@0 {
		compatible = "xlnx,axidma-chrdev";
		dmas = <&axi_dma_0 0 &axi_dma_0 1>;
		dma-names = "tx_channel", "rx_channel";
	};
};

&amba {

	axi_dma_0: axidma0@a0000000 {
		#dma-cells = <1>;
		clock-names = "s_axi_lite_aclk", "m_axi_sg_aclk", "m_axi_mm2s_aclk", "m_axi_s2mm_aclk";
		clocks = <&axi_lite_clk>, <&axi_lite_clk>, <&axi_lite_clk>, <&axi_lite_clk>;
		compatible = "xlnx,axi-dma", "xlnx,axi-dma-6.03.a", "xlnx,axi-dma-1.00.a";
		interrupt-names = "mm2s_introut", "s2mm_introut";
		interrupt-parent = <&gic>;
		interrupts = <0 89 4 0 90 4>;
		reg =  <0x0 0xa0000000 0x0 0x1000>;
		xlnx,include-sg;
		xlnx,addrwidth = <0x28>;

		dma-mm2s-channel@a0000000 {
			compatible = "xlnx,axi-dma-mm2s-channel";
			dma-channels = <0x1>;
			xlnx,datawidth = <0x20>;
			xlnx,device-id = <0x0>;
			interrupt-names = "mm2s_introut";
			interrupts = <0 89 4>;
		};
		
		dma-s2mm-channel@a0000030 {
			compatible = "xlnx,axi-dma-s2mm-channel";
			dma-channels = <0x1>;
			xlnx,datawidth = <0x20>;
			xlnx,device-id = <0x1>;
			interrupt-names = "s2mm_introut";
			interrupts = <0 90 4>;
		};
	};
};

你可能感兴趣的:(linux)