XilinxProcessorIPLib/drivers/emaclite/examples/xemaclite_ping_reply_example.c
int EmacLitePingReplyExample(u16 DeviceId)
{
	int Status;
	XEmacLite *EmacLiteInstPtr = &EmacLiteInstance;
	XEmacLite_Config *ConfigPtr;
	NumOfPingReplies = 0;

	/*
	 * Initialize the EmacLite device.
	 */
	ConfigPtr = XEmacLite_LookupConfig(DeviceId);
	if (ConfigPtr == NULL) {
		return XST_FAILURE;
	}

	Status = XEmacLite_CfgInitialize(EmacLiteInstPtr,
					ConfigPtr,
					ConfigPtr->BaseAddress);
	if (Status != XST_SUCCESS) {
		return XST_FAILURE;
	}

	/*
	 * Set the MAC address.
	 */
	XEmacLite_SetMacAddress(EmacLiteInstPtr, LocalMacAddr);

	/*
	 * Empty any existing receive frames.
	 */
	XEmacLite_FlushReceive(EmacLiteInstPtr);

	while (1) {

		/*
		 * Wait for a Receive packet.
		 */
		while (RecvFrameLength == 0) {
			RecvFrameLength = XEmacLite_Recv(EmacLiteInstPtr,
								(u8 *)RxFrame);
		}

		/*
		 * Process the Receive frame.
		 */
		ProcessRecvFrame(EmacLiteInstPtr);
		RecvFrameLength = 0;

		/*
		 * If the number of ping replies sent is equal to that
		 * specified by the user then exit out of this loop.
		 */
		if (NumOfPingReplies == MAX_PING_REPLIES) {

			return XST_SUCCESS;
		}

	}
}
/*****************************************************************************/
/**
*
* The entry point for the EmacLite Ping reply example in polled mode.
*
* @param	DeviceId is device ID of the XEmacLite Device.
*
* @return	XST_FAILURE to indicate failure, otherwise XST_SUCCESS is
*		returned.
*
* @note		This is in a continuous loop generating a specified number of
*		ping replies as defined by MAX_PING_REPLIES.
*
******************************************************************************/
The entry point for the EmacLite Ping reply example in polled mode.
The entry point for the EmacLite Ping reply example in polled mode .
int EmacLitePingReplyExample(u16 DeviceId)
{
	int Status;
	XEmacLite *EmacLiteInstPtr = &EmacLiteInstance;
	XEmacLite_Config *ConfigPtr;
	NumOfPingReplies = 0;
	ConfigPtr = XEmacLite_LookupConfig(DeviceId);
	if (ConfigPtr == NULL) {
		return XST_FAILURE;
	}
	Status = XEmacLite_CfgInitialize(EmacLiteInstPtr,
					ConfigPtr,
					ConfigPtr->BaseAddress);
	if (Status != XST_SUCCESS) {
		return XST_FAILURE;
	}
	XEmacLite_SetMacAddress(EmacLiteInstPtr, LocalMacAddr);
	XEmacLite_FlushReceive(EmacLiteInstPtr);
	while (1) {
		while (RecvFrameLength == 0) {
			RecvFrameLength = XEmacLite_Recv(EmacLiteInstPtr,
								(u8 *)RxFrame);
		}
		ProcessRecvFrame(EmacLiteInstPtr);
		RecvFrameLength = 0;
		if (NumOfPingReplies == MAX_PING_REPLIES) {
			return XST_SUCCESS;
		}
	}
}
int EmacLitePingReplyExample ( u16 DeviceId ) { int Status ; XEmacLite * EmacLiteInstPtr = & EmacLiteInstance ; XEmacLite_Config * ConfigPtr ; NumOfPingReplies = 0 ; ConfigPtr = XEmacLite_LookupConfig ( DeviceId ) ; if ( ConfigPtr == NULL ) { return XST_FAILURE ; } Status = XEmacLite_CfgInitialize ( EmacLiteInstPtr , ConfigPtr , ConfigPtr -> BaseAddress ) ; if ( Status != XST_SUCCESS ) { return XST_FAILURE ; } XEmacLite_SetMacAddress ( EmacLiteInstPtr , LocalMacAddr ) ; XEmacLite_FlushReceive ( EmacLiteInstPtr ) ; while ( 1 ) { while ( RecvFrameLength == 0 ) { RecvFrameLength = XEmacLite_Recv ( EmacLiteInstPtr , ( u8 * ) RxFrame ) ; } ProcessRecvFrame ( EmacLiteInstPtr ) ; RecvFrameLength = 0 ; if ( NumOfPingReplies == MAX_PING_REPLIES ) { return XST_SUCCESS ; } } }
The entry point for the EmacLite Ping reply example in polled mode.
The entry point for the EmacLite Ping reply example in polled mode .
/*
	 * Initialize the EmacLite device.
	 */ /*
	 * Set the MAC address.
	 */ /*
	 * Empty any existing receive frames.
	 */ /*
		 * Wait for a Receive packet.
		 */ /*
		 * Process the Receive frame.
		 */ /*
		 * If the number of ping replies sent is equal to that
		 * specified by the user then exit out of this loop.
		 */