欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Xilinx xdma Linux平台使用

程序员文章站 2022-07-12 11:29:19
...

作者

QQ群:852283276
微信:arm80x86
微信公众号:青儿创客基地
B站:主页 https://space.bilibili.com/208826118

方法

官网下载驱动,我下载2017.4版本的,当时还有18.2版本,由于vivado是17.4,实测发现windows下,18.2版本的驱动无法操作17.4的FPGA,切换到老版本即可。ubuntu 16.04.4编译17.4驱动需要修改代码,

#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,12,0)
		dbg_init("Enabling MSI-X\n");
		rc = pci_alloc_irq_vectors(pdev, req_nvec, req_nvec,
					PCI_IRQ_MSIX);
#else
		int i;
	<span class="token function">dbg_init</span><span class="token punctuation">(</span><span class="token string">"Enabling MSI-X\n"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
	<span class="token keyword">for</span> <span class="token punctuation">(</span>i <span class="token operator">=</span> <span class="token number">0</span><span class="token punctuation">;</span> i <span class="token operator">&lt;</span> req_nvec<span class="token punctuation">;</span> i<span class="token operator">++</span><span class="token punctuation">)</span>
		xdev<span class="token operator">-&gt;</span>entry<span class="token punctuation">[</span>i<span class="token punctuation">]</span><span class="token punctuation">.</span>entry <span class="token operator">=</span> i<span class="token punctuation">;</span>

	rc <span class="token operator">=</span> <span class="token function">pci_enable_msix</span><span class="token punctuation">(</span>pdev<span class="token punctuation">,</span> xdev<span class="token operator">-&gt;</span>entry<span class="token punctuation">,</span> req_nvec<span class="token punctuation">)</span><span class="token punctuation">;</span>

#endif

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13

测试,PCIe2.0x4,带宽位1.5GB/s,达到满速状态,

[email protected]:~/xdma/tests$ sudo ./dma_to_device -d /dev/xdma0_h2c_0 -a 0 -s 0x400000 -c 16 -v
sscanf() = 1, value = 0x00000000
sscanf() = 1, value = 0x00400000
sscanf() = 1, value = 0x00000010
device = /dev/xdma0_h2c_0, address = 0x00000000, size = 0x00400000, offset = 0x00000000, count = 16
host memory buffer = 0x7f03545a4000
CLOCK_MONOTONIC reports 0.002827977 seconds (total) for last transfer of 4194304 bytes
[email protected]:~/xdma/tests$ sudo ./dma_from_device -d /dev/xdma0_c2h_0 -a 0 -s 0x400000 -c 16 -v
sscanf() = 1, value = 0x00000000
sscanf() = 1, value = 0x00400000
sscanf() = 1, value = 0x00000010
device = /dev/xdma0_c2h_0, address = 0x00000000, size = 0x00400000, offset = 0x00000000, count = 16
host memory buffer = 0x7f8b21ff7000
CLOCK_MONOTONIC reports 0.003003013 seconds (total) for last transfer of 4194304 bytes

 
 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14

Linux

下载Xilinx_Answer_65444_Linux_Files_rel20180420.zip,修改xdma/libxdma.c,添加,

#include <linux/slab.h> /*add by zc*/

 
 
  • 1

编译,

$ cd xdma
$ make

 
 
  • 1
  • 2

测试,

xdma:xdma_mod_init: desc_blen_max: 0xfffffff/268435455, sgdma_timeout: 10 sec.
xdma:xdma_device_open: xdma device 0000:07:00.0, 0xc00000007e309000.
xdma:map_single_bar: BAR0 at 0xc44000000 mapped at 0x8000080090ac0000, length=65536(/65536)
xdma:map_bars: config bar 0, pos 0.
xdma:identify_bars: 1 BARs: config 0, user -1, bypass -1.
xdma:check_nonzero_interrupt_status: 0000:07:00.0 xdma0 user_int_pending = 0x00000001
xdma:probe_one: 0000:07:00.0 xdma0, pdev 0xc00000007e309000, xdev 0xc00000007c2de000, 0xc00000007e278000, usr 16, ch 1,1.

 
 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7

x86

2017.4版本,打开调试,开机打印,

[email protected]:~/x86-static-16.04.4/bin$ dmesg -c
[  181.916322] xdma v2017.0.45
[  181.916323] xdma_init():xdma init()
[  181.916353] probe():probe(pdev = 0xffff934e1a6dd000, pci_id = 0xffffffffc08a03c0)
[  181.916354] alloc_dev_instance():probe() lro = 0xffff934e18918000
[  181.916426] probe():pci_set_master()
[  181.916435] probe_scan_for_msi():pci_enable_msi()
[  181.916462] request_regions():pci_request_regions()
[  181.916467] map_single_bar():BAR0: 65536 bytes to be mapped.
[  181.916491] map_single_bar():BAR0 at 0xf7d00000 mapped at 0xffffa2fbc1780000, length=65536(/65536)
[  181.916494] is_config_bar():BAR 0 is the XDMA config BAR
[  181.916495] map_single_bar():BAR #1 is not present - skipping
[  181.916496] map_single_bar():BAR #2 is not present - skipping
[  181.916497] map_single_bar():BAR #3 is not present - skipping
[  181.916498] map_single_bar():BAR #4 is not present - skipping
[  181.916498] map_single_bar():BAR #5 is not present - skipping
[  181.916500] set_dma_mask():sizeof(dma_addr_t) == 8
[  181.916501] set_dma_mask():Could not set 64-bit DMA mask.
[  181.916502] set_dma_mask():Using a 32-bit DMA mask.
[  181.916514] irq_setup():Using IRQ#30 with 0xffff934e18918000
[  181.916516] probe_for_engine():Probing for H2C 0 engine at ffffa2fbc1780000
[  181.916519] probe_for_engine():engine ID = 0x1fc0
[  181.916519] probe_for_engine():engine channel ID = 0x0
[  181.916521] probe_for_engine():Found H2C 0 AXI engine at ffffa2fbc1780000
[  181.916523] engine_create():engine ffff934d335aca00 name H2C irq_bitmask=0x00000001
[  181.916525] engine_alignments():engine ffff934d335aca00 name H2C alignments=0x00010140
[  181.916526] engine_alignments():align_bytes = 1
[  181.916527] engine_alignments():granularity_bytes = 1
[  181.916527] engine_alignments():address_bits = 64
[  181.916529] probe_for_engine():Probing for H2C 1 engine at ffffa2fbc1780100
[  181.916531] probe_for_engine():engine ID = 0x0
[  181.916532] probe_for_engine():engine channel ID = 0x0
[  181.916533] probe_for_engine():Incorrect engine ID - skipping
[  181.916534] probe_for_engine():Probing for H2C 2 engine at ffffa2fbc1780200
[  181.916536] probe_for_engine():engine ID = 0x0
[  181.916537] probe_for_engine():engine channel ID = 0x0
[  181.916538] probe_for_engine():Incorrect engine ID - skipping
[  181.916538] probe_for_engine():Probing for H2C 3 engine at ffffa2fbc1780300
[  181.916541] probe_for_engine():engine ID = 0x0
[  181.916542] probe_for_engine():engine channel ID = 0x0
[  181.916542] probe_for_engine():Incorrect engine ID - skipping
[  181.916543] probe_for_engine():Probing for C2C 0 engine at ffffa2fbc1781000
[  181.916546] probe_for_engine():engine ID = 0x1fc1
[  181.916547] probe_for_engine():engine channel ID = 0x0
[  181.916548] probe_for_engine():Found C2H 0 AXI engine at ffffa2fbc1781000
[  181.916550] engine_create():engine ffff934d335ace00 name C2H irq_bitmask=0x00000002
[  181.916552] engine_alignments():engine ffff934d335ace00 name C2H alignments=0x00010140
[  181.916552] engine_alignments():align_bytes = 1
[  181.916553] engine_alignments():granularity_bytes = 1
[  181.916554] engine_alignments():address_bits = 64
[  181.916555] probe_for_engine():Probing for C2C 1 engine at ffffa2fbc1781100
[  181.916557] probe_for_engine():engine ID = 0x0
[  181.916558] probe_for_engine():engine channel ID = 0x0
[  181.916559] probe_for_engine():Incorrect engine ID - skipping
[  181.916560] probe_for_engine():Probing for C2C 2 engine at ffffa2fbc1781200
[  181.916562] probe_for_engine():engine ID = 0x0
[  181.916563] probe_for_engine():engine channel ID = 0x0
[  181.916564] probe_for_engine():Incorrect engine ID - skipping
[  181.916565] probe_for_engine():Probing for C2C 3 engine at ffffa2fbc1781300
[  181.916567] probe_for_engine():engine ID = 0x0
[  181.916568] probe_for_engine():engine channel ID = 0x0
[  181.916569] probe_for_engine():Incorrect engine ID - skipping
[  181.916570] create_interfaces():No user logic BAR detected - skip device setup
[  181.916571] create_sg_char():xdma(lro = 0xffff934e18918000, engine = 0x          (null))
[  181.916573] gen_dev_major():Dynamic allocated major=244, rc=0
[  181.917746] create_sg_char():xdma(lro = 0xffff934e18918000, engine = 0x          (null))
[  181.917954] create_sg_char():xdma(lro = 0xffff934e18918000, engine = 0x          (null))
[  181.918502] create_sg_char():xdma(lro = 0xffff934e18918000, engine = 0x          (null))
[  181.918537] create_sg_char():xdma(lro = 0xffff934e18918000, engine = 0x          (null))
[  181.918559] create_sg_char():xdma(lro = 0xffff934e18918000, engine = 0x          (null))
[  181.918582] create_sg_char():xdma(lro = 0xffff934e18918000, engine = 0x          (null))
[  181.918604] create_sg_char():xdma(lro = 0xffff934e18918000, engine = 0x          (null))
[  181.918627] create_sg_char():xdma(lro = 0xffff934e18918000, engine = 0x          (null))
[  181.918650] create_sg_char():xdma(lro = 0xffff934e18918000, engine = 0x          (null))
[  181.918811] create_sg_char():xdma(lro = 0xffff934e18918000, engine = 0x          (null))
[  181.918840] create_sg_char():xdma(lro = 0xffff934e18918000, engine = 0x          (null))
[  181.918862] create_sg_char():xdma(lro = 0xffff934e18918000, engine = 0x          (null))
[  181.918885] create_sg_char():xdma(lro = 0xffff934e18918000, engine = 0x          (null))
[  181.918905] create_sg_char():xdma(lro = 0xffff934e18918000, engine = 0x          (null))
[  181.918945] create_sg_char():xdma(lro = 0xffff934e18918000, engine = 0x          (null))
[  181.919522] create_sg_char():xdma(lro = 0xffff934e18918000, engine = 0x          (null))
[  181.919557] create_sg_char():xdma(lro = 0xffff934e18918000, engine = 0xffff934d335aca00)
[  181.919581] create_sg_char():xdma(lro = 0xffff934e18918000, engine = 0xffff934d335ace00)
[  181.919604] create_interfaces():No bypass BAR detected - skip device setup
[  181.919607] read_interrupts():ioread32(0xffffa2fbc1782040) returned 0x00000000 (user_int_request).
[  181.919608] read_interrupts():ioread32(0xffffa2fbc1782044) returned 0x00000000 (channel_int_request)
[  181.919609] Create device attribute file for major =244, instance = 0
[  181.919611] Device file created successfully

 
 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88

发送数据到板卡,板卡读,

[email protected]:~/x86-static-16.04.4/bin$ sudo ./dma_to_device -d /dev/xdma0_h2c_0 -a 0x1000000000 -s 4096 -v
sscanf() = 1, value = 0x00001000
device = /dev/xdma0_h2c_0, address = 0x1000000000, size = 0x00001000, offset = 0x00000000, count = 1
host memory buffer = 0xeaf000
CLOCK_MONOTONIC reports 0.000169817 seconds (total) for last transfer of 4096 bytes
[email protected]:~/x86-static-16.04.4/bin$ dmesg -c
[  250.317286] char_sgdma_open(): H2C0: char_sgdma_open(0xffff934e14becb68, 0xffff934dbdca5b00)
[  250.317290] char_sgdma_llseek():char_sgdma_llseek: pos=68719476736
[  250.317299] char_sgdma_read_write(): H2C0: seq:0 file=0xffff934dbdca5b00, buf=0x0000000000eaf000, count=4096, pos=68719476736
[  250.317301] char_sgdma_read_write(): H2C0: seq:0 dir_to_dev=1 write request
[  250.317302] char_sgdma_read_write(): H2C0: H2C engine channel 0 (engine num 0)= 0xffff934d335aca00
[  250.317303] char_sgdma_read_write(): H2C0: lro = 0xffff934e18918000
[  250.317305] char_sgdma_read_write(): H2C0: res = 0, remaining = 4096
[  250.317306] transfer_create():transfer_create()
[  250.317309] transfer_create():mapped_pages=1.
[  250.317310] transfer_create():sgl = 0xffff934dd3025180.
[  250.317313] transfer_create():hwnents=1.
[  250.317314] transfer_create():sg_page(&sgl[0])=0xffffc9c0c445b640.
[  250.317315] transfer_create():sg_dma_address(&sgl[0])=0x00000000d46b2000.
[  250.317316] transfer_create():sg_dma_len(&sgl[0])=0x00001000.
[  250.317318] transfer_create():transfer_create():
[  250.317319] transfer_create():transfer->desc_bus = 0xbdc59000.
[  250.317320] transfer_build():SGLE    0: addr=0x00000000d46b2000 length=0x00001000
[  250.317322] transfer_build():DESC    0: cont_addr=0xd46b2000 cont_len=0x00001000 ep_addr=0x1000000000
[  250.317323] transfer_create():transfer 0xffff934e14c2ca00 has 1 descriptors
[  250.317324] transfer_data(): H2C0: seq:0 transfer=0xffff934e14c2ca00.
[  250.317325] transfer_dump():Descriptor Entry (Pre-Transfer)
[  250.317327] dump_desc():0xffff934dbdc59000/0x00: 0xad4b0013 0xad4b0013 magic|extra_adjacent|control
[  250.317328] dump_desc():0xffff934dbdc59004/0x04: 0x00001000 0x00001000 bytes
[  250.317330] dump_desc():0xffff934dbdc59008/0x08: 0xd46b2000 0xd46b2000 src_addr_lo
[  250.317331] dump_desc():0xffff934dbdc5900c/0x0c: 0x00000000 0x00000000 src_addr_hi
[  250.317332] dump_desc():0xffff934dbdc59010/0x00: 0x00000000 0x00000000 dst_addr_lo
[  250.317334] dump_desc():0xffff934dbdc59014/0x04: 0x00000010 0x00000010 dst_addr_hi
[  250.317335] dump_desc():0xffff934dbdc59018/0x08: 0x00000000 0x00000000 next_addr
[  250.317336] dump_desc():0xffff934dbdc5901c/0x0c: 0x00000000 0x00000000 next_addr_pad
[  250.317337] dump_desc():
[  250.317339] transfer_queue(): H2C0: transfer_queue(transfer=0xffff934e14c2ca00).
[  250.317340] transfer_queue(): H2C0: transfer_queue(): starting H2C engine.
[  250.317341] engine_start(): H2C0: engine_start(H2C): transfer=0xffff934e14c2ca00.
[  250.317342] engine_start(): H2C0: iowrite32(0xbdc59000 to 0xffffa2fbc1784080) (first_desc_lo)
[  250.317344] engine_start(): H2C0: iowrite32(0x00000000 to 0xffffa2fbc1784084) (first_desc_hi)
[  250.317345] engine_start(): H2C0: iowrite32(0x00000000 to 0xffffa2fbc1784088) (first_desc_adjacent)
[  250.317346] engine_start(): H2C0: ioread32(0xffffa2fbc1780040) (dummy read flushes writes).
[  250.317347] engine_start_mode_config(): H2C0: iowrite32(0x00f83e1f to 0xffffa2fbc1780004) (control)
[  250.317350] engine_start_mode_config(): H2C0: ioread32(0xffffa2fbc1780040) = 0x00000001 (dummy read flushes writes).
[  250.317351] engine_reg_dump(): H2C0: ioread32(0xffffa2fbc1780000).
[  250.317353] engine_reg_dump(): H2C0: ioread32(0xffffa2fbc1780000) returned 0x1fc00006.
[  250.317363] xdma_isr():(irq=30) <<<< INTERRUPT SERVICE ROUTINE
[  250.317365] xdma_isr():ch_irq = 0x00000001
[  250.317366] xdma_isr():user_irq = 0x00000000
[  250.317367] xdma_isr(): H2C0: schedule_work(engine=ffff934d335aca00)
[  250.317373] engine_reg_dump(): H2C0: ioread32(0xffffa2fbc1780040) returned 0x00000006 (status).
[  250.317375] engine_reg_dump(): H2C0: ioread32(0xffffa2fbc1780004) returned 0x00f83e1f (control)
[  250.317377] engine_reg_dump(): H2C0: ioread32(0xffffa2fbc1784080) returned 0xbdc59000 (first_desc_lo)
[  250.317378] engine_reg_dump(): H2C0: ioread32(0xffffa2fbc1784084) returned 0x00000000 (first_desc_hi)
[  250.317380] engine_reg_dump(): H2C0: ioread32(0xffffa2fbc1784088) returned 0x00000000 (first_desc_adjacent).
[  250.317382] engine_reg_dump(): H2C0: ioread32(0xffffa2fbc1780048) returned 0x00000001 (completed_desc_count).
[  250.317384] engine_reg_dump(): H2C0: ioread32(0xffffa2fbc1780090) returned 0x00f83e1e (interrupt_enable_mask)
[  250.317385] engine_status_read(): H2C0: Status of SG DMA H2C engine:
[  250.317386] engine_status_read(): H2C0: ioread32(0xffffa2fbc1780040).
[  250.317389] engine_status_read(): H2C0: status = 0x00000006: IDLE DESC_STOPPED DESC_COMPLETED 
[  250.317390] engine_start(): H2C0: H2C engine 0xffff934d335aca00 now running
[  250.317391] transfer_queue(): H2C0: transfer=0xffff934e14c2ca00 started H2C engine with transfer 0xffff934e14c2ca00.
[  250.317392] transfer_queue(): H2C0: engine->running = 1
[  250.317396] engine_service_work(): H2C0: engine_service() for H2C engine ffff934d335aca00
[  250.317398] engine_reg_dump(): H2C0: ioread32(0xffffa2fbc1780000).
[  250.317399] engine_reg_dump(): H2C0: ioread32(0xffffa2fbc1780000) returned 0x1fc00006.
[  250.317401] engine_reg_dump(): H2C0: ioread32(0xffffa2fbc1780040) returned 0x00000006 (status).
[  250.317403] engine_reg_dump(): H2C0: ioread32(0xffffa2fbc1780004) returned 0x00f83e1f (control)
[  250.317405] engine_reg_dump(): H2C0: ioread32(0xffffa2fbc1784080) returned 0xbdc59000 (first_desc_lo)
[  250.317407] engine_reg_dump(): H2C0: ioread32(0xffffa2fbc1784084) returned 0x00000000 (first_desc_hi)
[  250.317409] engine_reg_dump(): H2C0: ioread32(0xffffa2fbc1784088) returned 0x00000000 (first_desc_adjacent).
[  250.317411] engine_reg_dump(): H2C0: ioread32(0xffffa2fbc1780048) returned 0x00000001 (completed_desc_count).
[  250.317413] engine_reg_dump(): H2C0: ioread32(0xffffa2fbc1780090) returned 0x00f83e1e (interrupt_enable_mask)
[  250.317414] engine_status_read(): H2C0: Status of SG DMA H2C engine:
[  250.317415] engine_status_read(): H2C0: ioread32(0xffffa2fbc1780040).
[  250.317417] engine_status_read(): H2C0: status = 0x00000006: IDLE DESC_STOPPED DESC_COMPLETED 
[  250.317418] engine_service_shutdown(): H2C0: engine just went idle, resetting RUN_STOP.
[  250.317419] xdma_engine_stop(): H2C0: xdma_engine_stop(engine=ffff934d335aca00)
[  250.317421] xdma_engine_stop(): H2C0: Stopping SG DMA H2C engine; writing 0x00f83e1e to 0xffffa2fbc1780004.
[  250.317422] xdma_engine_stop(): H2C0: xdma_engine_stop(H2C) done
[  250.317423] engine_service(): H2C0: desc_count = 1
[  250.317425] engine_service(): H2C0: head of queue transfer 0xffff934e14c2ca00 has 1 descriptors
[  250.317426] engine_service(): H2C0: Engine completed 1 desc, 1 not yet dequeued
[  250.317428] engine_service_final_transfer(): H2C0: engine H2C completed transfer
[  250.317429] engine_service_final_transfer(): H2C0: Completed transfer ID = 0xffff934e14c2ca00
[  250.317430] engine_service_final_transfer(): H2C0: *pdesc_completed=1, transfer->desc_num=1
[  250.317432] engine_service_resume(): H2C0: no pending transfers, H2C engine stays idle.
[  250.317447] transfer_data(): H2C0: transfer ffff934e14c2ca00 completed
[  250.317451] transfer_data(): H2C0: remain=0, done=4096
[  250.317453] char_sgdma_read_write(): H2C0: seq:0 char_sgdma_read_write() return=4096.
[  250.317454] interrupt_status():reg = ffffa2fbc1782000
[  250.317455] interrupt_status():&reg->user_int_enable = ffffa2fbc1782004
[  250.317457] interrupt_status():user_int_enable = 0x00000001
[  250.317458] interrupt_status():channel_int_enable = 0x00000003
[  250.317460] interrupt_status():user_int_request = 0x00000000
[  250.317462] interrupt_status():channel_int_request = 0x00000000
[  250.317463] interrupt_status():user_int_pending = 0x00000000
[  250.317465] interrupt_status():channel_int_pending = 0x00000000
[  250.317481] char_sgdma_close(): H2C0: char_sgdma_close(0xffff934e14becb68, 0xffff934dbdca5b00)

 
 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100

接收数据,板卡写,

[email protected]:~/x86-static-16.04.4/bin$ sudo ./dma_from_device -d /dev/xdma0_c2h_0 -a 0x1000000000 -s 4096 -v
sscanf() = 1, value = 0x00001000
device = /dev/xdma0_c2h_0, address = 0x1000000000, size = 0x00001000, offset = 0x00000000, count = 1
host memory buffer = 0x12d9000
CLOCK_MONOTONIC reports 0.000137324 seconds (total) for last transfer of 4096 bytes
[email protected]:~/x86-static-16.04.4/bin$ dmesg -c
[  333.802040] char_sgdma_open(): C2H0: char_sgdma_open(0xffff934e14bee428, 0xffff934e146e3b00)
[  333.802046] char_sgdma_llseek():char_sgdma_llseek: pos=68719476736
[  333.802055] char_sgdma_read_write(): C2H0: seq:1 file=0xffff934e146e3b00, buf=0x00000000012d9000, count=4096, pos=68719476736
[  333.802057] char_sgdma_read_write(): C2H0: seq:1 dir_to_dev=0 read request
[  333.802058] char_sgdma_read_write(): C2H0: C2H engine channel 0 (engine num 1)= 0xffff934d335ace00
[  333.802059] char_sgdma_read_write(): C2H0: lro = 0xffff934e18918000
[  333.802060] char_sgdma_read_write(): C2H0: res = 0, remaining = 4096
[  333.802062] transfer_create():transfer_create()
[  333.802064] transfer_create():mapped_pages=1.
[  333.802065] transfer_create():sgl = 0xffff934d34c71060.
[  333.802066] transfer_create():hwnents=1.
[  333.802067] transfer_create():sg_page(&sgl[0])=0xffffc9c0c2c563c0.
[  333.802068] transfer_create():sg_dma_address(&sgl[0])=0x00000000b158f000.
[  333.802069] transfer_create():sg_dma_len(&sgl[0])=0x00001000.
[  333.802071] transfer_create():transfer_create():
[  333.802071] transfer_create():transfer->desc_bus = 0xc0bfd000.
[  333.802073] transfer_build():SGLE    0: addr=0x00000000b158f000 length=0x00001000
[  333.802074] transfer_build():DESC    0: cont_addr=0xb158f000 cont_len=0x00001000 ep_addr=0x1000000000
[  333.802075] transfer_create():transfer 0xffff934e14c2cb00 has 1 descriptors
[  333.802077] transfer_data(): C2H0: seq:1 transfer=0xffff934e14c2cb00.
[  333.802078] transfer_dump():Descriptor Entry (Pre-Transfer)
[  333.802079] dump_desc():0xffff934dc0bfd000/0x00: 0xad4b0013 0xad4b0013 magic|extra_adjacent|control
[  333.802081] dump_desc():0xffff934dc0bfd004/0x04: 0x00001000 0x00001000 bytes
[  333.802082] dump_desc():0xffff934dc0bfd008/0x08: 0x00000000 0x00000000 src_addr_lo
[  333.802083] dump_desc():0xffff934dc0bfd00c/0x0c: 0x00000010 0x00000010 src_addr_hi
[  333.802085] dump_desc():0xffff934dc0bfd010/0x00: 0xb158f000 0xb158f000 dst_addr_lo
[  333.802086] dump_desc():0xffff934dc0bfd014/0x04: 0x00000000 0x00000000 dst_addr_hi
[  333.802087] dump_desc():0xffff934dc0bfd018/0x08: 0x00000000 0x00000000 next_addr
[  333.802089] dump_desc():0xffff934dc0bfd01c/0x0c: 0x00000000 0x00000000 next_addr_pad
[  333.802089] dump_desc():
[  333.802091] transfer_queue(): C2H0: transfer_queue(transfer=0xffff934e14c2cb00).
[  333.802092] transfer_queue(): C2H0: transfer_queue(): starting C2H engine.
[  333.802093] engine_start(): C2H0: engine_start(C2H): transfer=0xffff934e14c2cb00.
[  333.802095] engine_start(): C2H0: iowrite32(0xc0bfd000 to 0xffffa2fbc1785080) (first_desc_lo)
[  333.802096] engine_start(): C2H0: iowrite32(0x00000000 to 0xffffa2fbc1785084) (first_desc_hi)
[  333.802097] engine_start(): C2H0: iowrite32(0x00000000 to 0xffffa2fbc1785088) (first_desc_adjacent)
[  333.802098] engine_start(): C2H0: ioread32(0xffffa2fbc1781040) (dummy read flushes writes).
[  333.802100] engine_start_mode_config(): C2H0: iowrite32(0x00f83e1f to 0xffffa2fbc1781004) (control)
[  333.802102] engine_start_mode_config(): C2H0: ioread32(0xffffa2fbc1781040) = 0x00000001 (dummy read flushes writes).
[  333.802103] engine_reg_dump(): C2H0: ioread32(0xffffa2fbc1781000).
[  333.802105] engine_reg_dump(): C2H0: ioread32(0xffffa2fbc1781000) returned 0x1fc10006.
[  333.802107] engine_reg_dump(): C2H0: ioread32(0xffffa2fbc1781040) returned 0x00000006 (status).
[  333.802109] engine_reg_dump(): C2H0: ioread32(0xffffa2fbc1781004) returned 0x00f83e1f (control)
[  333.802111] engine_reg_dump(): C2H0: ioread32(0xffffa2fbc1785080) returned 0xc0bfd000 (first_desc_lo)
[  333.802113] engine_reg_dump(): C2H0: ioread32(0xffffa2fbc1785084) returned 0x00000000 (first_desc_hi)
[  333.802114] engine_reg_dump(): C2H0: ioread32(0xffffa2fbc1785088) returned 0x00000000 (first_desc_adjacent).
[  333.802116] engine_reg_dump(): C2H0: ioread32(0xffffa2fbc1781048) returned 0x00000001 (completed_desc_count).
[  333.802118] engine_reg_dump(): C2H0: ioread32(0xffffa2fbc1781090) returned 0x00f83e1e (interrupt_enable_mask)
[  333.802119] xdma_isr():(irq=30) <<<< INTERRUPT SERVICE ROUTINE
[  333.802121] xdma_isr():ch_irq = 0x00000002
[  333.802123] engine_status_read(): C2H0: Status of SG DMA C2H engine:
[  333.802124] engine_status_read(): C2H0: ioread32(0xffffa2fbc1781040).
[  333.802126] engine_status_read(): C2H0: status = 0x00000006: IDLE DESC_STOPPED DESC_COMPLETED 
[  333.802126] xdma_isr():user_irq = 0x00000000
[  333.802128] xdma_isr(): C2H0: schedule_work(engine=ffff934d335ace00)
[  333.802130] engine_start(): C2H0: C2H engine 0xffff934d335ace00 now running
[  333.802131] transfer_queue(): C2H0: transfer=0xffff934e14c2cb00 started C2H engine with transfer 0xffff934e14c2cb00.
[  333.802132] transfer_queue(): C2H0: engine->running = 1
[  333.802134] engine_service_work(): C2H0: engine_service() for C2H engine ffff934d335ace00
[  333.802135] engine_reg_dump(): C2H0: ioread32(0xffffa2fbc1781000).
[  333.802137] engine_reg_dump(): C2H0: ioread32(0xffffa2fbc1781000) returned 0x1fc10006.
[  333.802139] engine_reg_dump(): C2H0: ioread32(0xffffa2fbc1781040) returned 0x00000006 (status).
[  333.802141] engine_reg_dump(): C2H0: ioread32(0xffffa2fbc1781004) returned 0x00f83e1f (control)
[  333.802143] engine_reg_dump(): C2H0: ioread32(0xffffa2fbc1785080) returned 0xc0bfd000 (first_desc_lo)
[  333.802145] engine_reg_dump(): C2H0: ioread32(0xffffa2fbc1785084) returned 0x00000000 (first_desc_hi)
[  333.802147] engine_reg_dump(): C2H0: ioread32(0xffffa2fbc1785088) returned 0x00000000 (first_desc_adjacent).
[  333.802149] engine_reg_dump(): C2H0: ioread32(0xffffa2fbc1781048) returned 0x00000001 (completed_desc_count).
[  333.802150] engine_reg_dump(): C2H0: ioread32(0xffffa2fbc1781090) returned 0x00f83e1e (interrupt_enable_mask)
[  333.802151] engine_status_read(): C2H0: Status of SG DMA C2H engine:
[  333.802153] engine_status_read(): C2H0: ioread32(0xffffa2fbc1781040).
[  333.802155] engine_status_read(): C2H0: status = 0x00000006: IDLE DESC_STOPPED DESC_COMPLETED 
[  333.802156] engine_service_shutdown(): C2H0: engine just went idle, resetting RUN_STOP.
[  333.802157] xdma_engine_stop(): C2H0: xdma_engine_stop(engine=ffff934d335ace00)
[  333.802159] xdma_engine_stop(): C2H0: Stopping SG DMA C2H engine; writing 0x00f83e1e to 0xffffa2fbc1781004.
[  333.802160] xdma_engine_stop(): C2H0: xdma_engine_stop(C2H) done
[  333.802162] engine_service(): C2H0: desc_count = 1
[  333.802163] engine_service(): C2H0: head of queue transfer 0xffff934e14c2cb00 has 1 descriptors
[  333.802164] engine_service(): C2H0: Engine completed 1 desc, 1 not yet dequeued
[  333.802165] engine_service_final_transfer(): C2H0: engine C2H completed transfer
[  333.802166] engine_service_final_transfer(): C2H0: Completed transfer ID = 0xffff934e14c2cb00
[  333.802168] engine_service_final_transfer(): C2H0: *pdesc_completed=1, transfer->desc_num=1
[  333.802171] engine_service_resume(): C2H0: no pending transfers, C2H engine stays idle.
[  333.802173] transfer_data(): C2H0: transfer ffff934e14c2cb00 completed
[  333.802176] transfer_data(): C2H0: remain=0, done=4096
[  333.802177] char_sgdma_read_write(): C2H0: seq:1 char_sgdma_read_write() return=4096.
[  333.802178] interrupt_status():reg = ffffa2fbc1782000
[  333.802179] interrupt_status():&reg->user_int_enable = ffffa2fbc1782004
[  333.802181] interrupt_status():user_int_enable = 0x00000001
[  333.802182] interrupt_status():channel_int_enable = 0x00000003
[  333.802184] interrupt_status():user_int_request = 0x00000000
[  333.802186] interrupt_status():channel_int_request = 0x00000000
[  333.802187] interrupt_status():user_int_pending = 0x00000000
[  333.802189] interrupt_status():channel_int_pending = 0x00000000
[  333.802196] char_sgdma_close(): C2H0: char_sgdma_close(0xffff934e14bee428, 0xffff934e146e3b00)

 
 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
相关标签: zynq