chinese直男口爆体育生外卖, 99久久er热在这里只有精品99, 又色又爽又黄18禁美女裸身无遮挡, gogogo高清免费观看日本电视,私密按摩师高清版在线,人妻视频毛茸茸,91论坛 兴趣闲谈,欧美 亚洲 精品 8区,国产精品久久久久精品免费

0
  • 聊天消息
  • 系統(tǒng)消息
  • 評(píng)論與回復(fù)
登錄后你可以
  • 下載海量資料
  • 學(xué)習(xí)在線課程
  • 觀看技術(shù)視頻
  • 寫文章/發(fā)帖/加入社區(qū)
會(huì)員中心
創(chuàng)作中心

完善資料讓更多小伙伴認(rèn)識(shí)你,還能領(lǐng)取20積分哦,立即完善>

3天內(nèi)不再提示

Petalinux2020.01 內(nèi)核DMA驅(qū)動(dòng)調(diào)試說(shuō)明

C29F_xilinx_inc ? 來(lái)源:用戶發(fā)布 ? 作者:用戶發(fā)布 ? 2022-02-16 16:21 ? 次閱讀
加入交流群
微信小助手二維碼

掃碼添加小助手

加入工程師交流群

1、在用戶設(shè)備樹中 pl-custom中

/delete-node/ &axi_dma_0;
/ {
axi_dma_0: dma@a0000000 {
#dma-cells = ;
clock-names = "s_axi_lite_aclk", "m_axi_mm2s_aclk", "m_axi_s2mm_aclk";
clocks = , , ;
compatible = "xlnx,axi-dma-7.1", "xlnx,axi-dma-1.00.a";
interrupt-names = "mm2s_introut", "s2mm_introut";
interrupt-parent = ;
interrupts = ;
reg = ;
xlnx,addrwidth = ;
xlnx,sg-length-width = ;
dma-channel@a0000000 {
compatible = "xlnx,axi-dma-mm2s-channel";
dma-channels = ;
interrupts = ;
xlnx,datawidth = ;
xlnx,device-id = ;
xlnx,include-dre ;
};
dma-channel@a0000030 {
compatible = "xlnx,axi-dma-s2mm-channel";
dma-channels = ;
interrupts = ;
xlnx,datawidth = ;
xlnx,device-id = ;
xlnx,include-dre ;
};
};
};

2 、在用戶system-user中

/include/ "system-conf.dtsi"
/include/ "pl-custom.dtsi"
/ {
axidma_chrdev: axidma_chrdev@0 {
compatible = "xlnx,axidma-chrdev";
dmas = ;
dma-names = "tx_channel", "rx_channel";
};
};

&axi_dma_0 {
dma-coherent;
status = "okay";
};

3、device-tree.bbappend

SRC_URI += "file://system-user.dtsi"
SRC_URI += "file://pl-custom.dtsi"

4 、teminal

petalinux-create -t modules -n xilinx-axidma --enable

5 、github上下載dma驅(qū)動(dòng),xilinx_axidma-master.zip 并解壓,由于內(nèi)核的改變,對(duì)下列部分文件做出改變。
(1) makefile

DRIVER_NAME = xilinx-axidma
$(DRIVER_NAME)-objs = axi_dma.o axidma_chrdev.o axidma_dma.o axidma_of.o
obj-m := $(DRIVER_NAME).o

(2)xilinx-axidma.bb

SRC_URI = "file://Makefile \
file://axi_dma.c \
file://axidma_chrdev.c \
file://axidma_dma.c \
file://axidma_of.c \
file://axidma.h \
file://axidma_ioctl.h \
file://COPYING \

(3)axi_dma.c

#include
// new

(4)axidma_chrdev.c
linux 內(nèi)核4.x到5.x,參數(shù)減少,查看內(nèi)核函數(shù),無(wú)影響
https://elixir.bootlin.com/linux/v4.9.251/source/include/linux/of_device.h
https://elixir.bootlin.com/linux/v4.9.251/source/include/linux/uaccess.h

在 static bool axidma_access_ok(const void __user *arg, size_t size, bool readonly)函數(shù)中

// if (!readonly && !access_ok(VERIFY_WRITE, arg, size)) {
if (!readonly && !access_ok(arg, size)) {

// } else if (!access_ok(VERIFY_READ, arg, size)) {
} else if (!access_ok(arg, size)) {

//of_dma_configure(struct device->dev, NULL);
of_dma_configure(struct device->dev, NULL,true);

(5)axidma_dma.c

#include
// new

static void axidma_dma_callback(void *data)
struct kernel_siginfo sig_info;

6、petalinux-build petalinux-build --sdk petalinux-package --sysroot

7、配置qt的環(huán)境。

8 qt 將example中的axidma_benchmark.c復(fù)制到qt,并添加其他所需文件。

(1)**.pro
SOURCES += \
gpio.cpp \
libaxidma.c \
main.cpp \
util.c

HEADERS += \
axidma_ioctl.h \
conversion.h \
gpio.h \
libaxidma.h \
util.h

(2)main.cpp() 由于是將C文件改為c++文件,所以此文件中這個(gè)函數(shù)需要做改變((void *)和(char *)相同)

static int single_transfer_test(axidma_dev_t dev, int tx_channel, void *tx_buf,
int tx_size, struct axidma_video_frame *tx_frame, int rx_channel,
void *rx_buf, int rx_size, struct axidma_video_frame *rx_frame)
{
int rc;

// Initialize the buffer region we're going to transmit
init_data((char *)tx_buf, (char *)rx_buf, tx_size, rx_size);

// Perform the DMA transaction
rc = axidma_twoway_transfer(dev, tx_channel, (char *)tx_buf, tx_size, tx_frame,
rx_channel, (char *)rx_buf, rx_size, rx_frame, true);
if (rc return rc;
}

// Verify that the data in the buffer changed
return verify_data((char *)tx_buf, (char *)rx_buf, tx_size, rx_size);
}

(3)在所有的 **.h中,為了使用QT的類功能,盡量用C++編程,對(duì)C文件的頭文件做如下改變。

#ifdef __cplusplus
extern "C"{
#endif

......

#endif /* UTIL_H_ */

#ifdef __cplusplus
}
#endif

9、加載驅(qū)動(dòng)

root@u3_save:/lib/modules/5.4.0-xilinx-v2020.1/extra# insmod xilinx-axidma.ko
[ 1637.846215] axidma: axidma_dma.c: axidma_dma_init: 725: DMA: Found 1 transmit channels and 1 receive channels.
[ 1637.856240] axidma: axidma_dma.c: axidma_dma_init: 727: VDMA: Found 0 transmit channels and 0 receive channels.

10、測(cè)試 因?yàn)閐ma的輸入輸出并沒有還起來(lái),所以只能看到發(fā)出去,看不到接收的

root@u3_save:/mnt# ./u3_dma_save
AXI DMA Benchmark Parameters:
Transmit Buffer Size: 7.91 MiB
R[ 1661.465441] axidma axidma: DMA mask not set
eceive Buffer Size: 7.91 MiB
Number of DMA Transfers: 1000 transfers

Using transmit channel 0 and receive channel 1.
[ 1671.710879] axidma: axidma_dma.c: axidma_start_transfer: 309: DMA receive transaction timed out.
[ 1672.719678] xilinx-vdma a0000000.dma: Cannot stop channel 00000000145aa465: 0
Failed to perform the AXI DMA read-write transfer: Timer expired

11、當(dāng)使用環(huán)回時(shí)

root@u3_dma_test:/# ./mnt/u3_dma_save
AXI DMA Benchmark Parameters:
Transmit Buffer Size: 7.91 MiB
Receive Buffer Size: 7.91 MiB
Number of DMA Transfers: 1000 transfers

Using transmit channel 0 and receive channel 1.
Single transfer test successfully completed!
Beginning performance analysis of the DMA engine.

DMA Timing Statistics:
Elapsed Time: 41.49 s
Transmit Throughput: 190.66 MiB/s
Receive Throughput: 190.66 MiB/s
Total Throughput: 381.32 MiB/s
root@u3_dma_test:/#

13、qt and opencv 的配置
(1)安裝sdk.sh
(2)在qt的pro中添加

INCLUDEPATH += /home/lcl/Soft/Sdk/sysroots/aarch64-xilinx-linux/usr/include

LIBS += \
-lopencv_imgcodecs \
-lopencv_highgui \
-lopencv_imgproc \
-lopencv_core \

即可。

14、接口改為128

root@u3_dma_test:/# ./mnt/u3_dma_save
AXI DMA Benchmark Parameters:
Transmit Buffer Size: 16.00 MiB
Receive Buffer Size: 16.00 MiB
Number of DMA Transfers: 1000 transfers

Using transmit channel 0 and receive channel 1.
Elapsed Time: 0.25 s
Single transfer test successfully completed!
Beginning performance analysis of the DMA engine.

DMA Timing Statistics:
Elapsed Time: 12.39 s
Transmit Throughput: 1291.32 MiB/s
Receive Throughput: 1291.32 MiB/s
Total Throughput: 2582.65 MiB/s
root@u3_dma_test:/#

15、第一個(gè)Elapsed Time: 0.25 s是當(dāng)我把數(shù)據(jù)從緩沖區(qū)復(fù)制到其他位置消耗的時(shí)間,也就是16MB的數(shù)據(jù)需要250ms的時(shí)間,速率也就在60M左右,也驗(yàn)證以前的貼子,dma的實(shí)現(xiàn)方式(UIO或者內(nèi)核驅(qū)動(dòng))與數(shù)據(jù)從緩沖區(qū)copy到別的地方的速率是沒有關(guān)系的。

16、速度慢是緩沖區(qū)的問題 https://github.com/bperez77/xilinx_axidma/issues/69
(1)在設(shè)備樹中
/include/ "system-conf.dtsi"
/include/ "pl-custom.dtsi"
/ {

axidma_chrdev: axidma_chrdev@0 {
compatible = "xlnx,axidma-chrdev";
dmas = ;
dma-names = "tx_channel", "rx_channel";
dma-coherent;
};
&axi_dma_0 {
dma-coherent;
status = "okay";
};

在測(cè)試代碼中加速加入測(cè)速代碼
......
rc = single_transfer_test(axidma_dev, tx_channel, tx_buf, tx_size,
tx_frame, rx_channel, rx_buf, rx_size, rx_frame);
if (rc goto free_rx_buf;
}

struct timeval start_time0, end_time0;
double elapsed_time0;
// Begin timing
gettimeofday(&start_time0, NULL);
memcpy(image_mid0, rx_buf, 2048*4096*4);
gettimeofday(&end_time0, NULL);
elapsed_time0 = TVAL_TO_SEC(end_time0) - TVAL_TO_SEC(start_time0);
printf("\tElapsed Time0: %0.2f s\n", elapsed_time0);

struct timeval start_time1, end_time1;
double elapsed_time1;
// Begin timing
gettimeofday(&start_time1, NULL);
memcpy(image_mid1, image_mid0, 2048*4096*4);
gettimeofday(&end_time1, NULL);
elapsed_time1 = TVAL_TO_SEC(end_time1) - TVAL_TO_SEC(start_time1);
printf("\tElapsed Time1: %0.2f s\n", elapsed_time1);

(3)測(cè)試結(jié)果
root@u3_dma_test:/# ./mnt/u3_dma_save
AXI DMA Benchmark Parameters:
Transmit Buffer Size: 32.00 MiB
[ 84.709677] axidma axidma: DMA mask not set
Receive Buffer Size: 32.00 MiB
Number of DMA Transfers: 1000 transfers

Using transmit channel 0 and receive channel 1.
Elapsed Time0: 0.07 s
Elapsed Time1: 0.07 s
Single transfer test successfully completed!
Beginning performance analysis of the DMA engine.

DMA Timing Statistics:
Elapsed Time: 24.75 s
Transmit Throughput: 1292.82 MiB/s
Receive Throughput: 1292.82 MiB/s
Total Throughput: 2585.64 MiB/s
root@u3_dma_test:/#

最后測(cè)得速率 32MB/70ms=450MB。
17、雖然速度是提高了,但是讀寫的數(shù)據(jù)是不對(duì)的
https://forums.xilinx.com/t5/%E5%B5%8C%E5%85%A5%E5%BC%8F-%E7%A1%AC%E4%BB...
https://xilinx-wiki.atlassian.net/wiki/spaces/A/pages/18842098/Zynq+Ultr...

審核編輯:符乾江

聲明:本文內(nèi)容及配圖由入駐作者撰寫或者入駐合作網(wǎng)站授權(quán)轉(zhuǎn)載。文章觀點(diǎn)僅代表作者本人,不代表電子發(fā)燒友網(wǎng)立場(chǎng)。文章及其配圖僅供工程師學(xué)習(xí)之用,如有內(nèi)容侵權(quán)或者其他違規(guī)問題,請(qǐng)聯(lián)系本站處理。 舉報(bào)投訴
  • 驅(qū)動(dòng)
    +關(guān)注

    關(guān)注

    12

    文章

    1941

    瀏覽量

    88431
  • Linux
    +關(guān)注

    關(guān)注

    88

    文章

    11701

    瀏覽量

    218681
收藏 人收藏
加入交流群
微信小助手二維碼

掃碼添加小助手

加入工程師交流群

    評(píng)論

    相關(guān)推薦
    熱點(diǎn)推薦

    Linux內(nèi)核日志玩明白了嗎?printk調(diào)試神器全解析

    前言:做Linux驅(qū)動(dòng)開發(fā)或內(nèi)核調(diào)試的朋友,一定對(duì)printk不陌生,但你真的會(huì)用它嗎?為什么同樣是調(diào)試RK3588內(nèi)核,別人能精準(zhǔn)捕捉關(guān)鍵
    的頭像 發(fā)表于 12-19 08:32 ?777次閱讀
    Linux<b class='flag-5'>內(nèi)核</b>日志玩明白了嗎?printk<b class='flag-5'>調(diào)試</b>神器全解析

    Linux驅(qū)動(dòng)開發(fā)的必備知識(shí)

    驅(qū)動(dòng)框架進(jìn)行開發(fā)。 6、調(diào)試技能: 掌握內(nèi)核調(diào)試工具,如 KDB、KGDB、printk 等。 能夠分析內(nèi)核日志,定位
    發(fā)表于 12-04 07:58

    GCC -O0?編譯內(nèi)核調(diào)試黨的?“救命神器”,這些優(yōu)勢(shì)?90%?開發(fā)者沒吃透!

    在?Linux?內(nèi)核開發(fā)、驅(qū)動(dòng)調(diào)試內(nèi)核問題定位的場(chǎng)景中,“編譯優(yōu)化等級(jí)”?是個(gè)容易被忽略卻影響巨大的選擇。GCC?的優(yōu)化等級(jí)從?O0?到?O3、Os、Ofast?各有側(cè)重,而 O0(
    的頭像 發(fā)表于 12-03 07:05 ?315次閱讀
    GCC -O0?編譯<b class='flag-5'>內(nèi)核</b>:<b class='flag-5'>調(diào)試</b>黨的?“救命神器”,這些優(yōu)勢(shì)?90%?開發(fā)者沒吃透!

    【書籍評(píng)測(cè)活動(dòng)NO.67】成為硬核Linux開發(fā)者:《Linux 設(shè)備驅(qū)動(dòng)開發(fā)(第 2 版)》

    )。成為硬核Linux開發(fā)者Linux系統(tǒng)的設(shè)備驅(qū)動(dòng)開發(fā),一直給人門檻較高的印象,主要因內(nèi)核機(jī)制抽象、需深度理解硬件原理、開發(fā)調(diào)試難度大所致。2021年,一本講解驅(qū)動(dòng)開發(fā)的專著問世即獲
    發(fā)表于 11-17 17:52

    蜂鳥內(nèi)核DMA的硬件實(shí)現(xiàn)——寄存器配置

    DMA,Direct Memory Access,直接內(nèi)存訪問,是一種不經(jīng)過(guò)CPU而直接從內(nèi)存存取數(shù)據(jù)的數(shù)據(jù)交換模式。在DMA模式下,CPU只需要向DMA控制器下達(dá)指令(配置DMA寄存
    發(fā)表于 10-24 08:46

    L42A9A-A機(jī)芯調(diào)試說(shuō)明

    L42A9A機(jī)芯調(diào)試說(shuō)明
    發(fā)表于 08-15 16:20 ?0次下載

    FPGA利用DMA IP核實(shí)現(xiàn)ADC數(shù)據(jù)采集

    本文介紹如何利用FPGA和DMA技術(shù)處理來(lái)自AD9280和AD9708 ADC的數(shù)據(jù)。首先,探討了這兩種ADC的特點(diǎn)及其與FPGA的接口兼容性。接著,詳細(xì)說(shuō)明了使用Xilinx VIVADO環(huán)境下
    的頭像 發(fā)表于 07-29 14:12 ?5011次閱讀

    強(qiáng)實(shí)時(shí)運(yùn)動(dòng)控制內(nèi)核MotionRT750(一):驅(qū)動(dòng)安裝、內(nèi)核配置與使用

    強(qiáng)實(shí)時(shí)運(yùn)動(dòng)控制內(nèi)核MotionRT750的驅(qū)動(dòng)安裝與內(nèi)核配置
    的頭像 發(fā)表于 07-03 15:48 ?3609次閱讀
    強(qiáng)實(shí)時(shí)運(yùn)動(dòng)控制<b class='flag-5'>內(nèi)核</b>MotionRT750(一):<b class='flag-5'>驅(qū)動(dòng)</b>安裝、<b class='flag-5'>內(nèi)核</b>配置與使用

    硬件調(diào)試:JLink 驅(qū)動(dòng)配置與調(diào)試技巧

    摘要: 本文深入探討了 JLink 調(diào)試器在嵌入式系統(tǒng)硬件調(diào)試中的應(yīng)用,詳細(xì)闡述了 JLink 驅(qū)動(dòng)配置的方法以及硬件調(diào)試技巧。本文以國(guó)科安芯的AS32系列MCU芯片為例,通過(guò)分析 J
    的頭像 發(fā)表于 06-12 23:20 ?1528次閱讀
    硬件<b class='flag-5'>調(diào)試</b>:JLink <b class='flag-5'>驅(qū)動(dòng)</b>配置與<b class='flag-5'>調(diào)試</b>技巧

    mtb-example-usb-device-hid-generic在配置DMA時(shí)失敗了,為什么?

    ,如下圖所示: 觀察到了相同的失敗行為。 請(qǐng)注意,以下鏈接中標(biāo)題“CAT1A 設(shè)備的 DMA 驅(qū)動(dòng)程序”下討論的關(guān)于是否需要這最后一步的說(shuō)明在該主題上是“模棱兩可的”。 https
    發(fā)表于 05-16 07:40

    調(diào)試變頻器詳細(xì)說(shuō)明

    調(diào)試變頻器是一個(gè)復(fù)雜但至關(guān)重要的過(guò)程,它涉及多個(gè)參數(shù)的設(shè)定和調(diào)整,以確保變頻器能夠正常運(yùn)行并滿足特定應(yīng)用需求。以下是對(duì)變頻器調(diào)試的詳細(xì)說(shuō)明。 一、準(zhǔn)備工作 1. 選擇合適的電機(jī)功率:根據(jù)實(shí)際需求選擇
    的頭像 發(fā)表于 04-25 15:32 ?1832次閱讀

    在任何平臺(tái)上使用PetaLinux的先決條件

    本篇文章介紹了在任何平臺(tái)上使用 PetaLinux 的先決條件。PetaLinux 是一種嵌入式 Linux 軟件開發(fā)套件 (SDK),主要用于基于 FPGA 的系統(tǒng)級(jí)芯片 (SoC) 設(shè)計(jì)或 FPGA 設(shè)計(jì)。
    的頭像 發(fā)表于 04-24 10:40 ?1418次閱讀
    在任何平臺(tái)上使用<b class='flag-5'>PetaLinux</b>的先決條件

    IMP-3402微機(jī)發(fā)電機(jī)保護(hù)測(cè)控裝置調(diào)試說(shuō)明

    IMP-3402微機(jī)發(fā)電機(jī)保護(hù)測(cè)控裝置調(diào)試說(shuō)明書.doc
    發(fā)表于 04-22 15:46 ?0次下載

    STM32H7ZGT6使用SPI+DMA方式驅(qū)動(dòng)屏幕,使用DMA方式會(huì)花屏,為什么?

    STM32H7ZGT6使用SPI+DMA方式驅(qū)動(dòng)屏幕時(shí)候,使用阻塞式發(fā)送不會(huì)花屏幕,但是使用DMA方式會(huì)花屏。
    發(fā)表于 03-12 06:03

    北京迅為RK3568開發(fā)板OpenHarmony系統(tǒng)南向驅(qū)動(dòng)開發(fā)內(nèi)核HDF驅(qū)動(dòng)框架架構(gòu)

    北京迅為RK3568開發(fā)板OpenHarmony系統(tǒng)南向驅(qū)動(dòng)開發(fā)內(nèi)核HDF驅(qū)動(dòng)框架架構(gòu)
    的頭像 發(fā)表于 03-11 14:13 ?1737次閱讀
    北京迅為RK3568開發(fā)板OpenHarmony系統(tǒng)南向<b class='flag-5'>驅(qū)動(dòng)</b>開發(fā)<b class='flag-5'>內(nèi)核</b>HDF<b class='flag-5'>驅(qū)動(dòng)</b>框架架構(gòu)