你好我最近在调试双DMA,用的是ultrascale+系列的zynq芯片,然后按照你的方法是可以加载进去dma驱动的
s://img-mid.csdnimg.cn/release/static/image/mid/ask/842371512386173.png "#left")
加载打印信息如下
[ 297.179714] axidma: axidma_dma.c: axidma_dma_init: 718: DMA: Found 2 transmit channels and 2 receive channels.
[ 297.189716] axidma: axidma_dma.c: axidma_dma_init: 720: VDMA: Found 0 transmit channels and 0 receive channels.
然后我C语言代码如下 运行的时候会报下面这个错误
xilinx-vdma 80001000.dma: Channel ffffffc87ae7c418 has errors 10, cdr 0 tdr 0
xilinx-vdma 80000000.dma: Channel ffffffc87ae7c818 has errors 10, cdr 0 tdr 0
请问这个该如何解决,并且在vivado中将dma的地址也设置了40bit
或者可以有偿求一份你的工程学习下吗
// dma
#include <stdlib.h>
#include <stdio.h>
#include <stdbool.h>
#include <string.h> // Strlen function
#include <fcntl.h> // Flags for open()
#include <sys/stat.h> // Open() system call
#include <sys/types.h> // Types for open()
#include <sys/mman.h> // Mmap system call
#include <sys/ioctl.h> // IOCTL system call
#include <unistd.h> // Close() system call
#include <sys/time.h> // Timing functions and definitions
#include <getopt.h> // Option parsing
#include <errno.h> // Error codes
#include "libaxidma.h" // Interface to the AXI DMA
#include "util.h" // Miscellaneous utilities
#include "conversion.h" // Miscellaneous conversion utilities
// user mabo
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <pthread.h>
#include <time.h>
#include <semaphore.h>
// =========================================================================================
#include <dirent.h>
// =====================================================================================================
/*----------------------------------------------------------------------------
* Internal Definitons
*----------------------------------------------------------------------------*/
// dma
// The size of data to send per transfer (1080p image, 7.24 MiB)
//#define IMAGE_SIZE (1920 * 1080)
#define TRANSFER_NUM 1024
#define DEFAULT_TRANSFER_SIZE ((size_t)(TRANSFER_NUM * sizeof(int))) // sizeof(int) = 4
char file1[100] = "test1.dat";
char file2[100] = "test2.dat";
int main()
{
// axi dma
axidma_dev_t axidma_dev;
FILE *fil1 = NULL;
FILE *fil2 = NULL;
int rx_channel1;
int rx_channel2;
int i = 0;
int j = 0;
unsigned *rx_buf1;
unsigned *rx_buf2;
size_t rx_size;
const array_t *rx_chans;
//tx_size = DEFAULT_TRANSFER_SIZE;
rx_size = DEFAULT_TRANSFER_SIZE;
// 初始化
// 初始化DMA
axidma_dev = axidma_init();
if (axidma_dev == NULL) {
fprintf(stderr, "Failed to initialize the AXI DMA device.\n");
return 0;
}
// rx channels
rx_chans = axidma_get_dma_rx(axidma_dev);
printf("rx_chans->len is [%d].\n",rx_chans->len);
printf("===========================================\n");
if(rx_chans->len < 1)
{
printf("Error: no rx channels found\n");
return 0;
}
rx_channel1 = rx_chans->data[0];
rx_channel2 = rx_chans->data[1];
printf("rx_chans->data[0] is [%d].\n",rx_chans->data[0]);
printf("rx_chans->data[1] is [%d].\n",rx_chans->data[1]);
printf("===========================================\n");
rx_buf1 = axidma_malloc(axidma_dev, rx_size);
if (rx_buf1 == NULL) {
perror("Unable to allocate receive buffer from the AXI DMA device");
return 0;
}
rx_buf2 = axidma_malloc(axidma_dev, rx_size);
if (rx_buf2 == NULL) {
perror("Unable to allocate receive buffer from the AXI DMA device");
return 0;
}
fil1 = fopen(file1, "a+");
fil2 = fopen(file2, "a+");
for(i = 0; i++; i < 10)
{
// 第一路
axidma_oneway_transfer(axidma_dev, rx_channel1, rx_buf1, rx_size, false);
for(j = 0; j < DEFAULT_TRANSFER_SIZE ; j = j + 4) // 1024 * 4Byte
{
fprintf(fil1,"%x ",rx_buf1[i/4]);
}
fprintf(fil1,";\n");
// 第二路
axidma_oneway_transfer(axidma_dev, rx_channel2, rx_buf2, rx_size, false);
for(j = 0; j < DEFAULT_TRANSFER_SIZE ; j = j + 4) // 1024 * 4Byte
{
fprintf(fil2,"%x ",rx_buf2[i/4]);
}
fprintf(fil2,";\n");
}
fclose(fil1);
fclose(fil2);
axidma_free(axidma_dev, rx_buf1, rx_size);
axidma_free(axidma_dev, rx_buf2, rx_size);
printf("axidma_free rx_buf successful\n");
axidma_destroy(axidma_dev);
printf("axidma_destroy successful\n");
return 0;
}
去GitHub、Stack Overflow找找吧