relatively new to working with Xilinx and zynq. Right now I can control an co-processor using the axi dma, but it works only for with defined addresses as seen below.
#ifndef DDR_BASE_ADDR
#warning CHECK FOR THE VALID DDR ADDRESS IN XPARAMETERS.H, \
DEFAULT SET TO 0x01000000
#define MEM_BASE_ADDR 0x01000000
#else
#define MEM_BASE_ADDR (DDR_BASE_ADDR + 0x1000000)
#endif
#define TX_BUFFER_BASE (MEM_BASE_ADDR + 0x00100000)
#define RX_BUFFER_BASE (MEM_BASE_ADDR + 0x00300000)
#define RX_BUFFER_HIGH (MEM_BASE_ADDR + 0x004FFFFF)
TxBufferPtr = (u8 *)TX_BUFFER_BASE;
RxBufferPtr = (u8 *)RX_BUFFER_BASE;
Status = XAxiDma_SimpleTransfer(&AxiDma,(UINTPTR) RxBufferPtr,
MAX_PKT_LEN, XAXIDMA_DEVICE_TO_DMA);
if (Status != XST_SUCCESS) {
return XST_FAILURE;
}
Status = XAxiDma_SimpleTransfer(&AxiDma,(UINTPTR) TxBufferPtr,
MAX_PKT_LEN, XAXIDMA_DMA_TO_DEVICE);
if (Status != XST_SUCCESS) {
return XST_FAILURE;
}
Is it possible to control the axi dma using normal array declerations as seen below, if so is it a setting in hardware design or in software?
float input_R_IM[N_samples*2];
float output_R_IM[N_samples*2];
int error=-1;
XAxiDma dma0_pointer;
XAxiDma_Config *dma0_Config;
/**********************DMA initialization***************************/
dma0_Config=XAxiDma_LookupConfig(XPAR_AXIDMA_0_DEVICE_ID);
error=XAxiDma_CfgInitialize(&dma0_pointer,dma0_Config);
float d = 2 * (float)M_PI / N_samples;
size_t i=NULL;
for (i = 0; i < N_samples; i++)
{
input_R_IM[i*2]=sin(0 + d*i);
input_R_IM[i*2+1]=0;
}
error=-1;
error = XAxiDma_SimpleTransfer(&dma0_pointer,(u32)input_R_IM,2*N_samples*sizeof(float),XAXIDMA_DMA_TO_DEVICE);
/***********************COPY BACK THE RESULTS************************/
// error=-1;
error = XAxiDma_SimpleTransfer(&dma0_pointer,(u32)output_R_IM,2*N_samples*sizeof(float),XAXIDMA_DEVICE_TO_DMA);
for (i = 0; i < N_samples; i++)
{
printf("i: %d real=> %f --imag==> %f \n" ,i, output_R_IM[i*2], output_R_IM[i*2+1]);
}
return 0;
}
Question
Rickdegier
Hey guys I am
relatively new to working with Xilinx and zynq. Right now I can control an co-processor using the axi dma, but it works only for with defined addresses as seen below.
#ifndef DDR_BASE_ADDR #warning CHECK FOR THE VALID DDR ADDRESS IN XPARAMETERS.H, \ DEFAULT SET TO 0x01000000 #define MEM_BASE_ADDR 0x01000000 #else #define MEM_BASE_ADDR (DDR_BASE_ADDR + 0x1000000) #endif #define TX_BUFFER_BASE (MEM_BASE_ADDR + 0x00100000) #define RX_BUFFER_BASE (MEM_BASE_ADDR + 0x00300000) #define RX_BUFFER_HIGH (MEM_BASE_ADDR + 0x004FFFFF) TxBufferPtr = (u8 *)TX_BUFFER_BASE; RxBufferPtr = (u8 *)RX_BUFFER_BASE; Status = XAxiDma_SimpleTransfer(&AxiDma,(UINTPTR) RxBufferPtr, MAX_PKT_LEN, XAXIDMA_DEVICE_TO_DMA); if (Status != XST_SUCCESS) { return XST_FAILURE; } Status = XAxiDma_SimpleTransfer(&AxiDma,(UINTPTR) TxBufferPtr, MAX_PKT_LEN, XAXIDMA_DMA_TO_DEVICE); if (Status != XST_SUCCESS) { return XST_FAILURE; }
Is it possible to control the axi dma using normal array declerations as seen below, if so is it a setting in hardware design or in software?
float input_R_IM[N_samples*2]; float output_R_IM[N_samples*2]; int error=-1; XAxiDma dma0_pointer; XAxiDma_Config *dma0_Config; /**********************DMA initialization***************************/ dma0_Config=XAxiDma_LookupConfig(XPAR_AXIDMA_0_DEVICE_ID); error=XAxiDma_CfgInitialize(&dma0_pointer,dma0_Config); float d = 2 * (float)M_PI / N_samples; size_t i=NULL; for (i = 0; i < N_samples; i++) { input_R_IM[i*2]=sin(0 + d*i); input_R_IM[i*2+1]=0; } error=-1; error = XAxiDma_SimpleTransfer(&dma0_pointer,(u32)input_R_IM,2*N_samples*sizeof(float),XAXIDMA_DMA_TO_DEVICE); /***********************COPY BACK THE RESULTS************************/ // error=-1; error = XAxiDma_SimpleTransfer(&dma0_pointer,(u32)output_R_IM,2*N_samples*sizeof(float),XAXIDMA_DEVICE_TO_DMA); for (i = 0; i < N_samples; i++) { printf("i: %d real=> %f --imag==> %f \n" ,i, output_R_IM[i*2], output_R_IM[i*2+1]); } return 0; }
Link to comment
Share on other sites
1 answer to this question
Recommended Posts
Archived
This topic is now archived and is closed to further replies.