XilinxProcessorIPLib/drivers/axiethernet/examples/xaxiethernet_example_intr_fifo.c
static void FifoErrorHandler(XLlFifo *Fifo, u32 Pending)
{
	int timeout_counter;

	if (Pending & XLLF_INT_RPURE_MASK) {
		AxiEthernetUtilErrorTrap("Fifo: Rx under-read error");
	}
	if (Pending & XLLF_INT_RPORE_MASK) {
		AxiEthernetUtilErrorTrap("Fifo: Rx over-read error");
	}
	if (Pending & XLLF_INT_RPUE_MASK) {
		AxiEthernetUtilErrorTrap("Fifo: Rx fifo empty");
	}
	if (Pending & XLLF_INT_TPOE_MASK) {
		AxiEthernetUtilErrorTrap("Fifo: Tx fifo overrun");
	}
	if (Pending & XLLF_INT_TSE_MASK) {
		AxiEthernetUtilErrorTrap("Fifo: Tx length mismatch");
	}

	/*
	 * Reset the tx or rx side of the fifo as needed
	 */
	if (Pending & XLLF_INT_RXERROR_MASK) {
		XLlFifo_IntClear(Fifo, XLLF_INT_RRC_MASK);
		XLlFifo_RxReset(Fifo);

		timeout_counter = 10000;

		while ((XLlFifo_Status(Fifo) & XLLF_INT_RRC_MASK) == 0) {
			timeout_counter--;
			if (timeout_counter == 0) {
				XLlFifo_Reset(Fifo);
			/* we've reset the whole core so just exit out */
				goto feh_exit;
			}
		}
	}

	if (Pending & XLLF_INT_TXERROR_MASK) {
		XLlFifo_IntClear(Fifo, XLLF_INT_TRC_MASK);
		XLlFifo_TxReset(Fifo);

		timeout_counter = 10000;

		while ((XLlFifo_Status(Fifo) & XLLF_INT_TRC_MASK) == 0) {
			timeout_counter--;
			if (timeout_counter == 0) {
				XLlFifo_Reset(Fifo);

			/* we've reset the whole core so just exit out */
				goto feh_exit;
			}
		}
	}

	feh_exit:
	/*
	 * Bump counter
	 */
	DeviceErrors++;
}
/*****************************************************************************/
/**
*
* This is the Error handler callback function and this function increments the
* the error counter so that the main thread knows the number of errors.
*
* @param	Fifo is a reference to the AxiEthernet device instance.
*
* @param	Pending is a bitmask of the pending interrupts.
*
* @return	None.
*
* @note		None.
*
******************************************************************************/
This is the Error handler callback function and this function increments the
the error counter so that the main thread knows the number of errors.
This is the Error handler callback function and this function increments the the error counter so that the main thread knows the number of errors .
static void FifoErrorHandler(XLlFifo *Fifo, u32 Pending)
{
	int timeout_counter;
	if (Pending & XLLF_INT_RPURE_MASK) {
		AxiEthernetUtilErrorTrap("Fifo: Rx under-read error");
	}
	if (Pending & XLLF_INT_RPORE_MASK) {
		AxiEthernetUtilErrorTrap("Fifo: Rx over-read error");
	}
	if (Pending & XLLF_INT_RPUE_MASK) {
		AxiEthernetUtilErrorTrap("Fifo: Rx fifo empty");
	}
	if (Pending & XLLF_INT_TPOE_MASK) {
		AxiEthernetUtilErrorTrap("Fifo: Tx fifo overrun");
	}
	if (Pending & XLLF_INT_TSE_MASK) {
		AxiEthernetUtilErrorTrap("Fifo: Tx length mismatch");
	}
	if (Pending & XLLF_INT_RXERROR_MASK) {
		XLlFifo_IntClear(Fifo, XLLF_INT_RRC_MASK);
		XLlFifo_RxReset(Fifo);
		timeout_counter = 10000;
		while ((XLlFifo_Status(Fifo) & XLLF_INT_RRC_MASK) == 0) {
			timeout_counter--;
			if (timeout_counter == 0) {
				XLlFifo_Reset(Fifo);
				goto feh_exit;
			}
		}
	}
	if (Pending & XLLF_INT_TXERROR_MASK) {
		XLlFifo_IntClear(Fifo, XLLF_INT_TRC_MASK);
		XLlFifo_TxReset(Fifo);
		timeout_counter = 10000;
		while ((XLlFifo_Status(Fifo) & XLLF_INT_TRC_MASK) == 0) {
			timeout_counter--;
			if (timeout_counter == 0) {
				XLlFifo_Reset(Fifo);
				goto feh_exit;
			}
		}
	}
	feh_exit:
	DeviceErrors++;
}
static void FifoErrorHandler ( XLlFifo * Fifo , u32 Pending ) { int timeout_counter ; if ( Pending & XLLF_INT_RPURE_MASK ) { AxiEthernetUtilErrorTrap ( " " ) ; } if ( Pending & XLLF_INT_RPORE_MASK ) { AxiEthernetUtilErrorTrap ( " " ) ; } if ( Pending & XLLF_INT_RPUE_MASK ) { AxiEthernetUtilErrorTrap ( " " ) ; } if ( Pending & XLLF_INT_TPOE_MASK ) { AxiEthernetUtilErrorTrap ( " " ) ; } if ( Pending & XLLF_INT_TSE_MASK ) { AxiEthernetUtilErrorTrap ( " " ) ; } if ( Pending & XLLF_INT_RXERROR_MASK ) { XLlFifo_IntClear ( Fifo , XLLF_INT_RRC_MASK ) ; XLlFifo_RxReset ( Fifo ) ; timeout_counter = 10000 ; while ( ( XLlFifo_Status ( Fifo ) & XLLF_INT_RRC_MASK ) == 0 ) { timeout_counter -- ; if ( timeout_counter == 0 ) { XLlFifo_Reset ( Fifo ) ; goto feh_exit ; } } } if ( Pending & XLLF_INT_TXERROR_MASK ) { XLlFifo_IntClear ( Fifo , XLLF_INT_TRC_MASK ) ; XLlFifo_TxReset ( Fifo ) ; timeout_counter = 10000 ; while ( ( XLlFifo_Status ( Fifo ) & XLLF_INT_TRC_MASK ) == 0 ) { timeout_counter -- ; if ( timeout_counter == 0 ) { XLlFifo_Reset ( Fifo ) ; goto feh_exit ; } } } feh_exit : DeviceErrors ++ ; }
This is the Error handler callback function and this function increments the
the error counter so that the main thread knows the number of errors.
This is the Error handler callback function and this function increments the the error counter so that the main thread knows the number of errors .
/*
	 * Reset the tx or rx side of the fifo as needed
	 */ /* we've reset the whole core so just exit out */ /* we've reset the whole core so just exit out */ /*
	 * Bump counter
	 */