XilinxProcessorIPLib/drivers/axiethernet/examples/xaxiethernet_mcdma_ping_req_example.c
void SendArpReqFrame(XAxiEthernet *AxiEthernetInstancePtr,
		     XMcdma *DmaInstancePtr, u8 ChanId)
{
	u16 *TempPtr;
	u16 *TxFramePtr;
	UINTPTR BufAddr;
	int Index, i;

	FramesTx = 0;
	TxFramePtr = (u16 *)(UINTPTR)GetBufAddr();
	BufAddr = (UINTPTR) TxFramePtr;

	if (Padding) {
		for (i = 0 ; i < 4; i++)
			*TxFramePtr++ = 0;
	}

	/*
	 * Add broadcast address.
	 */
	Index = MAC_ADDR_LEN;
	while (Index--) {
		*TxFramePtr++ = BROADCAST_ADDR;
	}

	/*
	 * Add local MAC address.
	 */
	Index = 0;
	TempPtr = (u16 *)LocalMacAddr;
	while (Index < MAC_ADDR_LEN) {
		*TxFramePtr++ = *(TempPtr + Index);
		Index++;
	}

	/*
	 * Add
	 * 	- Ethernet proto type.
	 *	- Hardware Type
	 *	- Protocol IP Type
	 *	- IP version (IPv6/IPv4)
	 *	- ARP Request
	 */
	*TxFramePtr++ = Xil_Htons(XAE_ETHER_PROTO_TYPE_ARP);
	*TxFramePtr++ = Xil_Htons(HW_TYPE);
	*TxFramePtr++ = Xil_Htons(XAE_ETHER_PROTO_TYPE_IP);
	*TxFramePtr++ = Xil_Htons(IP_VERSION);
	*TxFramePtr++ = Xil_Htons(ARP_REQUEST);

	/*
	 * Add local MAC address.
	 */
	Index = 0;
	TempPtr = (u16 *)LocalMacAddr;
	while (Index < MAC_ADDR_LEN) {
		*TxFramePtr++ = *(TempPtr + Index);
		Index++;
	}

	/*
	 * Add local IP address.
	 */
	Index = 0;
	TempPtr = (u16 *)LocalIpAddress;
	while (Index < IP_ADDR_LEN) {
		*TxFramePtr++ = *(TempPtr + Index);
		Index++;
	}

	/*
	 * Fills 6 bytes of information with zeros as per protocol.
	 */
	Index = 0;
	while (Index < 3) {
		*TxFramePtr++ = 0x0000;
		Index++;
	}

	/*
	 * Add Destination IP address.
	 */
	Index = 0;
	TempPtr = (u16 *)DestIpAddress;
	while (Index < IP_ADDR_LEN) {
		*TxFramePtr++ = *(TempPtr + Index);
		Index++;
	}

	/*
	 * Transmit the Frame.
	 */
	XAxienet_Send(AxiEthernetInstancePtr, DmaInstancePtr, ChanId, BufAddr, ARP_REQ_PKT_SIZE);
	while (1) {
		CheckTxDmaResult(DmaInstancePtr);
		if (FramesTx)
			break;
	}

}
/*****************************************************************************/
/**
*
* This function will send a ARP request packet.
*
* @param	AxiEthernetInstancePtr is a pointer to the instance of the
*		Axi Ethernet component.
* @param	DmaInstancePtr is a pointer to the instance of the Dma
*		component.
* @param	ChanId is the MCDMA Channel number to be operate on.
*
* @return	None.
*
* @note		None.
*
******************************************************************************/
This function will send a ARP request packet.
This function will send a ARP request packet .
void SendArpReqFrame(XAxiEthernet *AxiEthernetInstancePtr,
		     XMcdma *DmaInstancePtr, u8 ChanId)
{
	u16 *TempPtr;
	u16 *TxFramePtr;
	UINTPTR BufAddr;
	int Index, i;
	FramesTx = 0;
	TxFramePtr = (u16 *)(UINTPTR)GetBufAddr();
	BufAddr = (UINTPTR) TxFramePtr;
	if (Padding) {
		for (i = 0 ; i < 4; i++)
			*TxFramePtr++ = 0;
	}
	Index = MAC_ADDR_LEN;
	while (Index--) {
		*TxFramePtr++ = BROADCAST_ADDR;
	}
	Index = 0;
	TempPtr = (u16 *)LocalMacAddr;
	while (Index < MAC_ADDR_LEN) {
		*TxFramePtr++ = *(TempPtr + Index);
		Index++;
	}
	*TxFramePtr++ = Xil_Htons(XAE_ETHER_PROTO_TYPE_ARP);
	*TxFramePtr++ = Xil_Htons(HW_TYPE);
	*TxFramePtr++ = Xil_Htons(XAE_ETHER_PROTO_TYPE_IP);
	*TxFramePtr++ = Xil_Htons(IP_VERSION);
	*TxFramePtr++ = Xil_Htons(ARP_REQUEST);
	Index = 0;
	TempPtr = (u16 *)LocalMacAddr;
	while (Index < MAC_ADDR_LEN) {
		*TxFramePtr++ = *(TempPtr + Index);
		Index++;
	}
	Index = 0;
	TempPtr = (u16 *)LocalIpAddress;
	while (Index < IP_ADDR_LEN) {
		*TxFramePtr++ = *(TempPtr + Index);
		Index++;
	}
	Index = 0;
	while (Index < 3) {
		*TxFramePtr++ = 0x0000;
		Index++;
	}
	Index = 0;
	TempPtr = (u16 *)DestIpAddress;
	while (Index < IP_ADDR_LEN) {
		*TxFramePtr++ = *(TempPtr + Index);
		Index++;
	}
	XAxienet_Send(AxiEthernetInstancePtr, DmaInstancePtr, ChanId, BufAddr, ARP_REQ_PKT_SIZE);
	while (1) {
		CheckTxDmaResult(DmaInstancePtr);
		if (FramesTx)
			break;
	}
}
void SendArpReqFrame ( XAxiEthernet * AxiEthernetInstancePtr , XMcdma * DmaInstancePtr , u8 ChanId ) { u16 * TempPtr ; u16 * TxFramePtr ; UINTPTR BufAddr ; int Index , i ; FramesTx = 0 ; TxFramePtr = ( u16 * ) ( UINTPTR ) GetBufAddr ( ) ; BufAddr = ( UINTPTR ) TxFramePtr ; if ( Padding ) { for ( i = 0 ; i < 4 ; i ++ ) * TxFramePtr ++ = 0 ; } Index = MAC_ADDR_LEN ; while ( Index -- ) { * TxFramePtr ++ = BROADCAST_ADDR ; } Index = 0 ; TempPtr = ( u16 * ) LocalMacAddr ; while ( Index < MAC_ADDR_LEN ) { * TxFramePtr ++ = * ( TempPtr + Index ) ; Index ++ ; } * TxFramePtr ++ = Xil_Htons ( XAE_ETHER_PROTO_TYPE_ARP ) ; * TxFramePtr ++ = Xil_Htons ( HW_TYPE ) ; * TxFramePtr ++ = Xil_Htons ( XAE_ETHER_PROTO_TYPE_IP ) ; * TxFramePtr ++ = Xil_Htons ( IP_VERSION ) ; * TxFramePtr ++ = Xil_Htons ( ARP_REQUEST ) ; Index = 0 ; TempPtr = ( u16 * ) LocalMacAddr ; while ( Index < MAC_ADDR_LEN ) { * TxFramePtr ++ = * ( TempPtr + Index ) ; Index ++ ; } Index = 0 ; TempPtr = ( u16 * ) LocalIpAddress ; while ( Index < IP_ADDR_LEN ) { * TxFramePtr ++ = * ( TempPtr + Index ) ; Index ++ ; } Index = 0 ; while ( Index < 3 ) { * TxFramePtr ++ = 0x0000 ; Index ++ ; } Index = 0 ; TempPtr = ( u16 * ) DestIpAddress ; while ( Index < IP_ADDR_LEN ) { * TxFramePtr ++ = * ( TempPtr + Index ) ; Index ++ ; } XAxienet_Send ( AxiEthernetInstancePtr , DmaInstancePtr , ChanId , BufAddr , ARP_REQ_PKT_SIZE ) ; while ( 1 ) { CheckTxDmaResult ( DmaInstancePtr ) ; if ( FramesTx ) break ; } }
This function will send a ARP request packet.
This function will send a ARP request packet .
/*
	 * Add broadcast address.
	 */ /*
	 * Add local MAC address.
	 */ /*
	 * Add
	 * 	- Ethernet proto type.
	 *	- Hardware Type
	 *	- Protocol IP Type
	 *	- IP version (IPv6/IPv4)
	 *	- ARP Request
	 */ /*
	 * Add local MAC address.
	 */ /*
	 * Add local IP address.
	 */ /*
	 * Fills 6 bytes of information with zeros as per protocol.
	 */ /*
	 * Add Destination IP address.
	 */ /*
	 * Transmit the Frame.
	 */