XilinxProcessorIPLib/drivers/emaclite/examples/xemaclite_intr_example.c
static int EmacLiteSendFrame(XEmacLite *EmacLiteInstPtr,  u32 PayloadSize)
{
	int Status;
	u8 *FramePtr;
	u32 Index;

	/*
	 * Set the Complete flag to false.
	 */
	TransmitComplete = FALSE;

	/*
	 * Assemble the frame with a destination address and the source address.
	 */
	FramePtr = (u8 *)TxFrame;

	/*
	 * Set up the destination address as the local address for
	 * Phy Loopback and Internal loopback.
	 */
	if (XEmacLite_IsMdioConfigured(EmacLiteInstPtr) ||
		XEmacLite_IsLoopbackConfigured(EmacLiteInstPtr)) {

		*FramePtr++ = LocalAddress[0];
		*FramePtr++ = LocalAddress[1];
		*FramePtr++ = LocalAddress[2];
		*FramePtr++ = LocalAddress[3];
		*FramePtr++ = LocalAddress[4];
		*FramePtr++ = LocalAddress[5];
	} else {
		/*
		 * Fill in the valid Destination MAC address if
		 * the Loopback is not enabled.
		 */
		*FramePtr++ = RemoteAddress[0];
		*FramePtr++ = RemoteAddress[1];
		*FramePtr++ = RemoteAddress[2];
		*FramePtr++ = RemoteAddress[3];
		*FramePtr++ = RemoteAddress[4];
		*FramePtr++ = RemoteAddress[5];
	}

	/*
	 * Fill in the source MAC address.
	 */
	*FramePtr++ = LocalAddress[0];
	*FramePtr++ = LocalAddress[1];
	*FramePtr++ = LocalAddress[2];
	*FramePtr++ = LocalAddress[3];
	*FramePtr++ = LocalAddress[4];
	*FramePtr++ = LocalAddress[5];

	/*
	 * Set up the type/length field - be sure its in network order.
	 */
    *((u16 *)FramePtr) = Xil_Htons(PayloadSize);
    FramePtr++;
	FramePtr++;

	/*
	 * Now fill in the data field with known values so we can verify them.
	 */
	for (Index = 0; Index < PayloadSize; Index++) {
		*FramePtr++ = (u8)Index;
	}

	/*
	 * Now send the frame.
	 */
	Status = XEmacLite_Send(EmacLiteInstPtr, (u8 *)TxFrame,
				PayloadSize + XEL_HEADER_SIZE);
	if (Status != XST_SUCCESS) {
		return XST_FAILURE;
	}

	return XST_SUCCESS;
}
/******************************************************************************/
/**
*
* This function sends a frame of given size. This function assumes interrupt
* mode and sends the frame.
*
* @param	EmacLiteInstPtr is a pointer to the EmacLite instance.
* @param	PayloadSize is the size of the frame to create. 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, else XST_FAILURE.
*
* @note		None.
*
******************************************************************************/
This function sends a frame of given size. This function assumes interrupt
mode and sends the frame.
This function sends a frame of given size . This function assumes interrupt mode and sends the frame .
static int EmacLiteSendFrame(XEmacLite *EmacLiteInstPtr,  u32 PayloadSize)
{
	int Status;
	u8 *FramePtr;
	u32 Index;
	TransmitComplete = FALSE;
	FramePtr = (u8 *)TxFrame;
	if (XEmacLite_IsMdioConfigured(EmacLiteInstPtr) ||
		XEmacLite_IsLoopbackConfigured(EmacLiteInstPtr)) {
		*FramePtr++ = LocalAddress[0];
		*FramePtr++ = LocalAddress[1];
		*FramePtr++ = LocalAddress[2];
		*FramePtr++ = LocalAddress[3];
		*FramePtr++ = LocalAddress[4];
		*FramePtr++ = LocalAddress[5];
	} else {
		*FramePtr++ = RemoteAddress[0];
		*FramePtr++ = RemoteAddress[1];
		*FramePtr++ = RemoteAddress[2];
		*FramePtr++ = RemoteAddress[3];
		*FramePtr++ = RemoteAddress[4];
		*FramePtr++ = RemoteAddress[5];
	}
	*FramePtr++ = LocalAddress[0];
	*FramePtr++ = LocalAddress[1];
	*FramePtr++ = LocalAddress[2];
	*FramePtr++ = LocalAddress[3];
	*FramePtr++ = LocalAddress[4];
	*FramePtr++ = LocalAddress[5];
    *((u16 *)FramePtr) = Xil_Htons(PayloadSize);
    FramePtr++;
	FramePtr++;
	for (Index = 0; Index < PayloadSize; Index++) {
		*FramePtr++ = (u8)Index;
	}
	Status = XEmacLite_Send(EmacLiteInstPtr, (u8 *)TxFrame,
				PayloadSize + XEL_HEADER_SIZE);
	if (Status != XST_SUCCESS) {
		return XST_FAILURE;
	}
	return XST_SUCCESS;
}
static int EmacLiteSendFrame ( XEmacLite * EmacLiteInstPtr , u32 PayloadSize ) { int Status ; u8 * FramePtr ; u32 Index ; TransmitComplete = FALSE ; FramePtr = ( u8 * ) TxFrame ; if ( XEmacLite_IsMdioConfigured ( EmacLiteInstPtr ) || XEmacLite_IsLoopbackConfigured ( EmacLiteInstPtr ) ) { * FramePtr ++ = LocalAddress [ 0 ] ; * FramePtr ++ = LocalAddress [ 1 ] ; * FramePtr ++ = LocalAddress [ 2 ] ; * FramePtr ++ = LocalAddress [ 3 ] ; * FramePtr ++ = LocalAddress [ 4 ] ; * FramePtr ++ = LocalAddress [ 5 ] ; } else { * FramePtr ++ = RemoteAddress [ 0 ] ; * FramePtr ++ = RemoteAddress [ 1 ] ; * FramePtr ++ = RemoteAddress [ 2 ] ; * FramePtr ++ = RemoteAddress [ 3 ] ; * FramePtr ++ = RemoteAddress [ 4 ] ; * FramePtr ++ = RemoteAddress [ 5 ] ; } * FramePtr ++ = LocalAddress [ 0 ] ; * FramePtr ++ = LocalAddress [ 1 ] ; * FramePtr ++ = LocalAddress [ 2 ] ; * FramePtr ++ = LocalAddress [ 3 ] ; * FramePtr ++ = LocalAddress [ 4 ] ; * FramePtr ++ = LocalAddress [ 5 ] ; * ( ( u16 * ) FramePtr ) = Xil_Htons ( PayloadSize ) ; FramePtr ++ ; FramePtr ++ ; for ( Index = 0 ; Index < PayloadSize ; Index ++ ) { * FramePtr ++ = ( u8 ) Index ; } Status = XEmacLite_Send ( EmacLiteInstPtr , ( u8 * ) TxFrame , PayloadSize + XEL_HEADER_SIZE ) ; if ( Status != XST_SUCCESS ) { return XST_FAILURE ; } return XST_SUCCESS ; }
This function sends a frame of given size.
This function sends a frame of given size .
/*
	 * Set the Complete flag to false.
	 */ /*
	 * Assemble the frame with a destination address and the source address.
	 */ /*
	 * Set up the destination address as the local address for
	 * Phy Loopback and Internal loopback.
	 */ /*
		 * Fill in the valid Destination MAC address if
		 * the Loopback is not enabled.
		 */ /*
	 * Fill in the source MAC address.
	 */ /*
	 * Set up the type/length field - be sure its in network order.
	 */ /*
	 * Now fill in the data field with known values so we can verify them.
	 */ /*
	 * Now send the frame.
	 */