XilinxProcessorIPLib/drivers/axiethernet/examples/xaxiethernet_mcdma_ping_req_example.c
static u16 CheckSumCalculation(u16 *RxFramePtr, int StartLoc, int Length)
{
	u32 Sum = 0;
	u16 CheckSum = 0;
	int Index;

	/*
	 * Add all the 16 bit data.
	 */
	Index = StartLoc;
	while (Index < (StartLoc + Length)) {
		Sum = Sum + Xil_Htons(*(RxFramePtr + Index));
		Index++;
	}

	/*
	 * Add upper 16 bits to lower 16 bits.
	 */
	CheckSum = Sum;
	Sum = Sum>>16;
	CheckSum = Sum + CheckSum;
	return CheckSum;
}
/*****************************************************************************/
/**
*
* This function calculates the checksum and returns a 16 bit result.
*
* @param 	RxFramePtr is a 16 bit pointer for the data to which checksum
* 		is to be calculated.
* @param	StartLoc is the starting location of the data from which the
*		checksum has to be calculated.
* @param	Length is the number of halfwords(16 bits) to which checksum is
* 		to be calculated.
*
* @return	It returns a 16 bit checksum value.
*
* @note		This can also be used for calculating checksum. The ones
* 		complement of this return value will give the final checksum.
*
******************************************************************************/
This function calculates the checksum and returns a 16 bit result.
This function calculates the checksum and returns a 16 bit result .
static u16 CheckSumCalculation(u16 *RxFramePtr, int StartLoc, int Length)
{
	u32 Sum = 0;
	u16 CheckSum = 0;
	int Index;
	Index = StartLoc;
	while (Index < (StartLoc + Length)) {
		Sum = Sum + Xil_Htons(*(RxFramePtr + Index));
		Index++;
	}
	CheckSum = Sum;
	Sum = Sum>>16;
	CheckSum = Sum + CheckSum;
	return CheckSum;
}
static u16 CheckSumCalculation ( u16 * RxFramePtr , int StartLoc , int Length ) { u32 Sum = 0 ; u16 CheckSum = 0 ; int Index ; Index = StartLoc ; while ( Index < ( StartLoc + Length ) ) { Sum = Sum + Xil_Htons ( * ( RxFramePtr + Index ) ) ; Index ++ ; } CheckSum = Sum ; Sum = Sum >> 16 ; CheckSum = Sum + CheckSum ; return CheckSum ; }
This function calculates the checksum and returns a 16 bit result.
This function calculates the checksum and returns a 16 bit result .
/*
	 * Add all the 16 bit data.
	 */ /*
	 * Add upper 16 bits to lower 16 bits.
	 */