UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Explorer
Explorer
1,631 Views
Registered: ‎07-24-2011

Problem with reading from xps_ll_fifo

I have a peculiar problem concerning reading frames from LocalLink FIFO. After I finish reading the whole frame I check the XLlFifo_RxOccupancy() and it reports that there are no words left to read, but when I check XLlFifo_IsRxEmpty() it returns FALSE, even though I have read the whole frame. But if I check XLlFifo_RxGetLen() before  XLlFifo_IsRxEmpty() than it returns TRUE. It's not really that troublesome but I would like to know if I'm doing something wrong.

 

I'm using EDK 12.3, microblaze system with xps_ll_temac and xps_ll_fifo and a custom IP core connected through FSL (I push the payload from the LL FIFO to FSL). Here is my code:

 

while(XLlFifo_RxOccupancy(FifoInstance)) {
		// check frame length
		RxFrameLength = XLlFifo_RxGetLen(FifoInstance);
		// read addresses
		XLlFifo_Read(FifoInstance, RxAddr, XTE_MAC_ADDR_SIZE);
		// check destination address
		// not necessary - TEMAC filters addresses
		AddrType =  check_addr(RxAddr);
		switch(AddrType)	{
		case 0:
			debug_disp("Wrong destination addr");
			break;

		case 1:
			debug_disp("Destination address ok");
			break;

		case 2:
			debug_disp("Broadcast address");
			break;
		}
		// source address
		XLlFifo_Read(FifoInstance, RxAddr, XTE_MAC_ADDR_SIZE);
		// length
		XLlFifo_Read(FifoInstance, &Length, 2);
		// sanity check
		// (Frame length - header length) should
		// equal length field value
		// TEMAC does not pass padding
		if(!(RxFrameLength - 14 == Length))		{
			debug_disp("Payload length error");
		}
		// receive data and pass it to SHA-1
		while(Length > 4)	{
			debug_disp("Sending 32bits");
			XLlFifo_Read(FifoInstance, &buffer, 4);
			//xil_printf("%X",buffer);
			putfslx(buffer,0,FSL_DEFAULT);
			Length = Length - 4;
		}
		// read last bytes
		XLlFifo_Read(FifoInstance, &buffer, Length);
		//xil_printf("%X\r\n",buffer);
		putfslx(buffer,0,FSL_DEFAULT);
		// write last_bytes value to FSL
		Length = Length - 1;
		//xil_printf("%x\r\n",Length);
		putfslx(Length,0,FSL_CONTROL);

		// FIFO should be empty
		if(XLlFifo_RxOccupancy(FifoInstance))	{
			debug_disp("Rx FIFO not empty");
		}
		// this has to be run or XLlFifo_IsRxEmpty
		// will not return TRUE
		if(XLlFifo_RxGetLen(FifoInstance))	{
			debug_disp("Rx FIFO not empty");
		}
		if(!XLlFifo_IsRxEmpty(FifoInstance))	{
			debug_disp("Rx FIFO not empty");
		}

 

 Any suggestions? Thanks in advance.

 

 

0 Kudos