Showing results for 
Search instead for 
Did you mean: 
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");

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

		case 2:
			debug_disp("Broadcast address");
		// 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);
			Length = Length - 4;
		// read last bytes
		XLlFifo_Read(FifoInstance, &buffer, Length);
		// write last_bytes value to FSL
		Length = Length - 1;

		// 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