Forum Discussion
Altera_Forum
Honored Contributor
12 years agoTSE MAC and SGDMA
Hi there, I am using TSE MAC and SGDMA to capture a network frame,i am facing a issue related to receive frame. Let me first clear my receive flow. 1)open the SGDMA by "alt_avalon_sgdma_ope...
Altera_Forum
Honored Contributor
12 years agoThanks,
I think i am free the allocated buffer as shown below, do { printf("Starting up the SGDMA Receive engines\n"); if(alt_avalon_sgdma_do_async_transfer(receive_DMA, &receive_descriptors[0]) != 0) { printf("Writing the head of the receive descriptor list to the DMA failed\n"); return 1; } /************************************************************** * Blocking until the SGDMA interrupts fire * ************************************************************/ while(rx_done == 0) {} printf("The receive SGDMA has completed\n"); /************************************************************** * Verify the returned data and free up the data buffers * ************************************************************/ success_code = validate_results_rx(receive_descriptors, NUMBER_OF_BUFFERS ); printf("validate_result_rx_success_code %d\n",success_code); //0 for valid frame and 1 for other frame which i don't want. if(success_code == 1) { /* Make sure SGDMA controller is not busy from a former command */ //In short we chech ready busy flag over here. while ((IORD_ALTERA_AVALON_SGDMA_STATUS(SGDMA_ST_TO_MM_BASE) & ALTERA_AVALON_SGDMA_STATUS_BUSY_MSK)) { } printf("Its time to check another frame :) \n"); free(receive_descriptors_copy);//here i free my aloocated buffer } else { printf("You catch the correct frame\n"); } } while(success_code==1);