XilinxProcessorIPLib/drivers/emaclite/examples/xemaclite_intr_example.c
static int EmacLiteRecvFrame(u32 PayloadSize)
{
	u8 *FramePtr;

	/*
	 * This assumes MAC does not strip padding or CRC.
	 */
	if (RecvFrameLength != 0) {
		int Index;

		/*
		 * Verify length, which should be the payload size.
		 */
		if ((RecvFrameLength- (XEL_HEADER_SIZE + XEL_FCS_SIZE)) !=
				PayloadSize) {
			return XST_LOOPBACK_ERROR;
		}

		/*
		 * Verify the contents of the Received Frame.
		 */
		FramePtr = (u8 *)RxFrame;
		FramePtr += XEL_HEADER_SIZE;	/* Get past the header */

		for (Index = 0; Index < PayloadSize; Index++) {
			if (*FramePtr++ != (u8)Index) {
				return XST_LOOPBACK_ERROR;
			}
		}
	}

	return XST_SUCCESS;
}
/******************************************************************************/
/**
*
* This function receives a frame of given size. This function assumes interrupt
* mode, receives the frame and verifies its contents.
*
* @param	PayloadSize is the size of the frame to receive.
*		The size only reflects the payload size, it does not include the
*		Ethernet header size (14 bytes) nor the Ethernet CRC size (4
*		bytes).
*
* @return	XST_SUCCESS if successful, a driver-specific return code if not.
*
* @note		None.
*
******************************************************************************/
This function receives a frame of given size. This function assumes interrupt
mode, receives the frame and verifies its contents.
This function receives a frame of given size . This function assumes interrupt mode receives the frame and verifies its contents .
static int EmacLiteRecvFrame(u32 PayloadSize)
{
	u8 *FramePtr;
	if (RecvFrameLength != 0) {
		int Index;
		if ((RecvFrameLength- (XEL_HEADER_SIZE + XEL_FCS_SIZE)) !=
				PayloadSize) {
			return XST_LOOPBACK_ERROR;
		}
		FramePtr = (u8 *)RxFrame;
		FramePtr += XEL_HEADER_SIZE;	
		for (Index = 0; Index < PayloadSize; Index++) {
			if (*FramePtr++ != (u8)Index) {
				return XST_LOOPBACK_ERROR;
			}
		}
	}
	return XST_SUCCESS;
}
static int EmacLiteRecvFrame ( u32 PayloadSize ) { u8 * FramePtr ; if ( RecvFrameLength != 0 ) { int Index ; if ( ( RecvFrameLength - ( XEL_HEADER_SIZE + XEL_FCS_SIZE ) ) != PayloadSize ) { return XST_LOOPBACK_ERROR ; } FramePtr = ( u8 * ) RxFrame ; FramePtr += XEL_HEADER_SIZE ; for ( Index = 0 ; Index < PayloadSize ; Index ++ ) { if ( * FramePtr ++ != ( u8 ) Index ) { return XST_LOOPBACK_ERROR ; } } } return XST_SUCCESS ; }
This function receives a frame of given size.
This function receives a frame of given size .
/*
	 * This assumes MAC does not strip padding or CRC.
	 */ /*
		 * Verify length, which should be the payload size.
		 */ /*
		 * Verify the contents of the Received Frame.
		 */ /* Get past the header */