欢迎点赞收藏,欢迎私下讨论技术,分享技术
硬件平台 :NXP LS1046 + XILINX FPGA
软件平台:LINUX 4.19.68 + buildroot
LS1046 PEX3 接 XILINX FPGA,linux使用designware的PCI主控制器。下载XILINX DMA驱动,解压得到如下目录。对XDM目录的内核模块进行交叉编译,生成XDMA.KO
XILINX FPGA固件加载成功后,插入模块,打印如下信息
insmod xdma.ko interrupt_mode=2
[ 198.899790] xdma:xdma_mod_init: Xilinx XDMA Reference Driver xdma v2020.2.2
[ 198.906766] xdma:xdma_mod_init: desc_blen_max: 0xfffffff/268435455, timeout: h2c 10 c2h 10 sec.
[ 198.915557] xdma:xdma_device_open: xdma device 0000:01:00.0, 0x0000000022c20e20.
[ 198.922961] xdma:alloc_dev_instance: xdev = 0x0000000095d3f79f
[ 198.928792] xdma:xdev_list_add: dev 0000:01:00.0, xdev 0x0000000095d3f79f, xdma idx 0.
[ 198.936722] xdma 0000:01:00.0: enabling device (0000 -> 0002)
[ 198.942522] xdma:request_regions: pci_request_regions()
[ 198.947752] xdma:map_single_bar: BAR0: 65536 bytes to be mapped.
[ 198.953758] xdma:map_single_bar: BAR0 at 0x5046000000 mapped at 0x00000000c7e934e8, length=65536(/65536)
[ 198.963243] xdma:is_config_bar: BAR 0 is NOT the XDMA config BAR: 0xffffffff, 0xffffffff.
[ 198.971416] xdma:map_single_bar: BAR1: 65536 bytes to be mapped.
[ 198.977422] xdma:map_single_bar: BAR1 at 0x5046010000 mapped at 0x0000000075b63bca, length=65536(/65536)
[ 198.986902] xdma:is_config_bar: BAR 1 is the XDMA config BAR
[ 198.992560] xdma:map_bars: config bar 1, pos 1.
[ 198.997085] xdma:identify_bars: xdev 0x0000000095d3f79f, bars 2, config at 1.
[ 199.004219] xdma:identify_bars: 2 BARs: config 1, user 0, bypass -1.
[ 199.010569] xdma:set_dma_mask: sizeof(dma_addr_t) == 8
[ 199.015703] xdma:set_dma_mask: set_dma_mask(64)
[ 199.020228] xdma:set_dma_mask: Using a 64-bit DMA mask.
[ 199.025458] xdma:__write_register: channel_interrupts_disable: w reg 0x2000(0x00000000b56f1839), 0xffffffff.
[ 199.035286] xdma:__write_register: user_interrupts_disable: w reg 0x2000(0x0000000044b7236a), 0xffffffff.
[ 199.044854] xdma:read_interrupts: ioread32(0x000000007825a756) returned 0x00000000 (user_int_request).
[ 199.054158] xdma:read_interrupts: ioread32(0x00000000e2b474be) returned 0x00000000 (channel_int_request)
[ 199.063640] xdma:probe_for_engine: found AXI H2C 0 engine, reg. off 0x0, id 0x1fc0,0x0.
[ 199.071641] xdma:engine_init: channel 0
驱动运行成功后,在/dev目录下产生如下设备