lib/sw_apps/zynqmp_dram_test/src/xmt_main.c
static void XMt_MemtestAll(XMt_CfgData *XMtPtr, u64 TestStart, u64 TestSize,
			   u8 BusWidth)
{
	u8 Mode;
	u32 Index;
	u32 InvMaskInd;
	u64 Pattern[2][128];

	if (BusWidth == XMT_DDR_CONFIG_64BIT_WIDTH) {
		for (Index = 0U; Index < 128U; Index++) {
			InvMaskInd = (Index >> 4) & 0x07;
			Pattern[0][Index] = Pattern64Bit[Index & 15];
			Pattern[1][Index] = Pattern64Bit[Index & 15] ^
					InvertMask64Bit[InvMaskInd];
		}
	} else if (BusWidth == XMT_DDR_CONFIG_32BIT_WIDTH) {
		for (Index = 0U; Index < 128U; Index++) {
			InvMaskInd = (Index >> 4) & 0x07;
			Pattern[0][Index] = Pattern32Bit[Index & 15];
			Pattern[1][Index] = Pattern32Bit[Index & 15] ^
					InvertMask32Bit[InvMaskInd];
		}
	} else {
		for (Index = 0U; Index < 128U; Index++) {
			InvMaskInd = (Index >> 4) & 0x07;
			Pattern[0][Index] = Pattern16Bit[Index & 15];
			Pattern[1][Index] = Pattern16Bit[Index & 15] ^
					InvertMask16Bit[InvMaskInd];
		}
	}

	XMt_PrintMemTestHeader(XMtPtr);

	for (Mode = 0U; Mode < XMT_MAX_MODE_NUM; Mode++) {
		if ((Mode == 0U) || (Mode > 10U)) {
			XMt_Memtest(XMtPtr, TestStart, TestSize, Mode, NULL);
		} else if (Mode <= 8U) {
			if (BusWidth == XMT_DDR_CONFIG_64BIT_WIDTH) {
				XMt_Memtest(XMtPtr, TestStart, TestSize, Mode,
					    TestPattern[Mode]);
			} else if (BusWidth == XMT_DDR_CONFIG_32BIT_WIDTH) {
				XMt_Memtest(XMtPtr, TestStart, TestSize, Mode,
					    TestPattern[Mode + 2]);
			} else {
				XMt_Memtest(XMtPtr, TestStart, TestSize, Mode,
					    TestPattern[Mode + 4]);
			}
		} else {
			XMt_Memtest(XMtPtr, TestStart, TestSize,  Mode,
				    &Pattern[Mode - 9][0]);
		}
	}
}
/*****************************************************************************/
/**
 * This function does all the memory Read/Write tests
 *
 * @param XMtPtr is the pointer to the Memtest Data Structure
 * @param TestStart is the starting Address
 * @param TestSize is the Size of the memory to be Tested
 * @param BusWidth is the Width of the DRAM Bus
 *
 * @return none
 *
 * @note none
 *****************************************************************************/
This function does all the memory Read/Write tests
@param XMtPtr is the pointer to the Memtest Data Structure
@param TestStart is the starting Address
@param TestSize is the Size of the memory to be Tested
@param BusWidth is the Width of the DRAM Bus

@return none

@note none
This function does all the memory Read / Write tests @param XMtPtr is the pointer to the Memtest Data Structure @param TestStart is the starting Address @param TestSize is the Size of the memory to be Tested @param BusWidth is the Width of the DRAM Bus @return none @note none
static void XMt_MemtestAll(XMt_CfgData *XMtPtr, u64 TestStart, u64 TestSize,
			   u8 BusWidth)
{
	u8 Mode;
	u32 Index;
	u32 InvMaskInd;
	u64 Pattern[2][128];
	if (BusWidth == XMT_DDR_CONFIG_64BIT_WIDTH) {
		for (Index = 0U; Index < 128U; Index++) {
			InvMaskInd = (Index >> 4) & 0x07;
			Pattern[0][Index] = Pattern64Bit[Index & 15];
			Pattern[1][Index] = Pattern64Bit[Index & 15] ^
					InvertMask64Bit[InvMaskInd];
		}
	} else if (BusWidth == XMT_DDR_CONFIG_32BIT_WIDTH) {
		for (Index = 0U; Index < 128U; Index++) {
			InvMaskInd = (Index >> 4) & 0x07;
			Pattern[0][Index] = Pattern32Bit[Index & 15];
			Pattern[1][Index] = Pattern32Bit[Index & 15] ^
					InvertMask32Bit[InvMaskInd];
		}
	} else {
		for (Index = 0U; Index < 128U; Index++) {
			InvMaskInd = (Index >> 4) & 0x07;
			Pattern[0][Index] = Pattern16Bit[Index & 15];
			Pattern[1][Index] = Pattern16Bit[Index & 15] ^
					InvertMask16Bit[InvMaskInd];
		}
	}
	XMt_PrintMemTestHeader(XMtPtr);
	for (Mode = 0U; Mode < XMT_MAX_MODE_NUM; Mode++) {
		if ((Mode == 0U) || (Mode > 10U)) {
			XMt_Memtest(XMtPtr, TestStart, TestSize, Mode, NULL);
		} else if (Mode <= 8U) {
			if (BusWidth == XMT_DDR_CONFIG_64BIT_WIDTH) {
				XMt_Memtest(XMtPtr, TestStart, TestSize, Mode,
					    TestPattern[Mode]);
			} else if (BusWidth == XMT_DDR_CONFIG_32BIT_WIDTH) {
				XMt_Memtest(XMtPtr, TestStart, TestSize, Mode,
					    TestPattern[Mode + 2]);
			} else {
				XMt_Memtest(XMtPtr, TestStart, TestSize, Mode,
					    TestPattern[Mode + 4]);
			}
		} else {
			XMt_Memtest(XMtPtr, TestStart, TestSize,  Mode,
				    &Pattern[Mode - 9][0]);
		}
	}
}
static void XMt_MemtestAll ( XMt_CfgData * XMtPtr , u64 TestStart , u64 TestSize , u8 BusWidth ) { u8 Mode ; u32 Index ; u32 InvMaskInd ; u64 Pattern [ 2 ] [ 128 ] ; if ( BusWidth == XMT_DDR_CONFIG_64BIT_WIDTH ) { for ( Index = 0U ; Index < 128U ; Index ++ ) { InvMaskInd = ( Index >> 4 ) & 0x07 ; Pattern [ 0 ] [ Index ] = Pattern64Bit [ Index & 15 ] ; Pattern [ 1 ] [ Index ] = Pattern64Bit [ Index & 15 ] ^ InvertMask64Bit [ InvMaskInd ] ; } } else if ( BusWidth == XMT_DDR_CONFIG_32BIT_WIDTH ) { for ( Index = 0U ; Index < 128U ; Index ++ ) { InvMaskInd = ( Index >> 4 ) & 0x07 ; Pattern [ 0 ] [ Index ] = Pattern32Bit [ Index & 15 ] ; Pattern [ 1 ] [ Index ] = Pattern32Bit [ Index & 15 ] ^ InvertMask32Bit [ InvMaskInd ] ; } } else { for ( Index = 0U ; Index < 128U ; Index ++ ) { InvMaskInd = ( Index >> 4 ) & 0x07 ; Pattern [ 0 ] [ Index ] = Pattern16Bit [ Index & 15 ] ; Pattern [ 1 ] [ Index ] = Pattern16Bit [ Index & 15 ] ^ InvertMask16Bit [ InvMaskInd ] ; } } XMt_PrintMemTestHeader ( XMtPtr ) ; for ( Mode = 0U ; Mode < XMT_MAX_MODE_NUM ; Mode ++ ) { if ( ( Mode == 0U ) || ( Mode > 10U ) ) { XMt_Memtest ( XMtPtr , TestStart , TestSize , Mode , NULL ) ; } else if ( Mode <= 8U ) { if ( BusWidth == XMT_DDR_CONFIG_64BIT_WIDTH ) { XMt_Memtest ( XMtPtr , TestStart , TestSize , Mode , TestPattern [ Mode ] ) ; } else if ( BusWidth == XMT_DDR_CONFIG_32BIT_WIDTH ) { XMt_Memtest ( XMtPtr , TestStart , TestSize , Mode , TestPattern [ Mode + 2 ] ) ; } else { XMt_Memtest ( XMtPtr , TestStart , TestSize , Mode , TestPattern [ Mode + 4 ] ) ; } } else { XMt_Memtest ( XMtPtr , TestStart , TestSize , Mode , & Pattern [ Mode - 9 ] [ 0 ] ) ; } } }
This function does all the memory Read/Write tests
 @param XMtPtr is the pointer to the Memtest Data Structure
 @param TestStart is the starting Address
 @param TestSize is the Size of the memory to be Tested
 @param BusWidth is the Width of the DRAM Bus
This function does all the memory Read / Write tests @param XMtPtr is the pointer to the Memtest Data Structure @param TestStart is the starting Address @param TestSize is the Size of the memory to be Tested @param BusWidth is the Width of the DRAM Bus