/** * * Main function * * This function is the main entry of the tests on DMA core. It sets up * DMA engine to be ready to receive and send packets, then a packet is * transmitted and will be verified after it is received via the DMA loopback * widget. * * @param None * * @return * - XST_SUCCESS if test passes * - XST_FAILURE if test fails. * * @note None. * ******************************************************************************/ int main(void) { int Status; XAxiDma_Config *Config; init_platform(); xil_printf("\r\n--- Entering main() --- \r\n"); Config = XAxiDma_LookupConfig(DMA_DEV_ID); if (!Config) { xil_printf("No config found for %d\r\n", DMA_DEV_ID); return XST_FAILURE; } /* Initialize DMA engine */ Status = XAxiDma_CfgInitialize(&AxiDma, Config); if (Status != XST_SUCCESS) { xil_printf("Initialization failed %d\r\n", Status); return XST_FAILURE; } if(!XAxiDma_HasSg(&AxiDma)) { xil_printf("Device configured as Simple mode \r\n"); return XST_FAILURE; } Status = TxSetup(&AxiDma); if (Status != XST_SUCCESS) { return XST_FAILURE; } Status = RxSetup(&AxiDma); if (Status != XST_SUCCESS) { return XST_FAILURE; } /* Send a packet */ Status = SendPacket(&AxiDma); if (Status != XST_SUCCESS) { return XST_FAILURE; } /* Check DMA transfer result */ Status = CheckDmaResult(&AxiDma); xil_printf("AXI DMA SG Polling Test %s\r\n", (Status == XST_SUCCESS)? "passed":"failed"); xil_printf("--- Exiting main() --- \r\n"); if (Status != XST_SUCCESS) { return XST_FAILURE; } return XST_SUCCESS; }
/** * * Main function * * This function is the main entry of the tests on DMA core. It sets up * DMA engine to be ready to receive and send packets, then a packet is * transmitted and will be verified after it is received via the loopback on the * Local Link interface of the DMA. * * @return 0 if tests pass, 1 otherwise. * * @note None. * ******************************************************************************/ int main(void) { int Status; XAxiDma_Config *Config; #if defined(XPAR_UARTNS550_0_BASEADDR) Uart550_Setup(); #endif xil_printf("\r\n--- Entering main() --- \r\n"); Config = XAxiDma_LookupConfig(DMA_DEV_ID); if (!Config) { xdbg_printf(XDBG_DEBUG_ERROR, "No config found for %d\r\n", DMA_DEV_ID); return 1; } /* Initialize DMA engine */ Status = XAxiDma_CfgInitialize(&AxiDma, Config); if (Status != XST_SUCCESS) { xil_printf("Initialization failed %d\r\n", Status); return 1; } Status = TxSetup(&AxiDma); if (Status != XST_SUCCESS) { return 1; } Status = RxSetup(&AxiDma); if (Status != XST_SUCCESS) { return 1; } /* Send a packet */ Status = SendPacket(&AxiDma); if (Status != XST_SUCCESS) { return 1; } /* Check DMA transfer result */ Status = CheckDmaResult(&AxiDma); xil_printf("Test %s\r\n", (Status == XST_SUCCESS)? "passed":"failed"); xil_printf("--- Exiting main() --- \r\n"); if (Status != XST_SUCCESS) { return XST_FAILURE; } return 0; }
/** * * Main function * * This function is the main entry of the tests on DMA core. It sets up * DMA engine to be ready to receive and send packets, then a packet is * transmitted and will be verified after it is received via the DMA loopback * widget. * * @param None * * @return * - XST_SUCCESS if test passes * - XST_FAILURE if test fails. * * @note None. * ******************************************************************************/ int main(void) { xil_printf("Roundsss %d\n",count); count++; //cplx_data_t* stim_buf;// Array //cplx_data_t* result_buf; int Status; XAxiDma_Config *Config; init_platform(); // stim_bguf = (cplx_data_t*) malloc(sizeof(cplx_data_t)*FFT_MAX_NUM_PTS); // if (stim_buf == NULL) // { // xil_printf("ERROR! Failed to allocate memory for the stimulus buffer.\n\r"); // return -1; // } // // result_buf = (cplx_data_t*) malloc(sizeof(cplx_data_t)*FFT_MAX_NUM_PTS); // if (result_buf == NULL) // { // xil_printf("ERROR! Failed to allocate memory for the result buffer.\n\r"); // return -1; // } // Fill stimulus buffer with some signal memcpy(stim_buf, sig_two_sine_waves, sizeof(cplx_data_t)*FFT_MAX_NUM_PTS); xil_printf("\r\n--- Entering main() --- \r\n"); Config = XAxiDma_LookupConfig(DMA_DEV_ID); if (!Config) { xil_printf("No config found for %d\r\n", DMA_DEV_ID); return XST_FAILURE; } /* Initialize DMA engine */ Status = XAxiDma_CfgInitialize(&AxiDma, Config); if (Status != XST_SUCCESS) { xil_printf("Initialization failed %d\r\n", Status); return XST_FAILURE; } if(!XAxiDma_HasSg(&AxiDma)) { xil_printf("Device configured as Simple mode \r\n"); return XST_FAILURE; } Status = TxSetup(&AxiDma); if (Status != XST_SUCCESS) { return XST_FAILURE; } Status = RxSetup(&AxiDma); if (Status != XST_SUCCESS) { return XST_FAILURE; } //xil_printf("checkpoint 1"); /* Send a packet */ int sendC =0; for (sendC = 0; sendC < 1; sendC++) { SendPacket(&AxiDma,sendC); if (Status != XST_SUCCESS) { return XST_FAILURE; } } // xil_printf("checkpoint 2 %d",XPAR_AXI_GPIO_0_DEVICE_ID); // XGpio_Initialize(gpio_inst, 2); // if (Status != XST_SUCCESS) // { // xil_printf("ERROR! Initialization of AXI GPIO instance failed.\n\r"); // // } // int reg= 1; // xil_printf("checkpoint 3"); // XGpio_DiscreteWrite(gpio_inst, 1, reg); // //XGpio_DiscreteWrite() xil_printf("\nfinish!!!!!!!"); //Status = SendPacket(&AxiDma); /* Check DMA transfer result */ Status = CheckDmaResult(&AxiDma); xil_printf("AXI DMA SG Polling Test %s\r\n", (Status == XST_SUCCESS)? "passed":"failed"); xil_printf("--- Exiting main() --- \r\n"); if (Status != XST_SUCCESS) { return XST_FAILURE; } return XST_SUCCESS; }