diff --git a/Draw.c b/Draw.c index 543d87e..c1cf84e 100644 --- a/Draw.c +++ b/Draw.c @@ -28,64 +28,157 @@ static inline uint32_t f32u(const float f) } void -drawRect( const SstRegs * const sst, +drawRect( const SstRegs * const sstregs, + const unsigned char ucNumTMU, const int16_t x, const int16_t y, const int16_t tSizeX, const int16_t tSizeY) { - ISET(sst->sARGB,0xFFFFFFFF); - ISET(sst->sOowfbi,f32u(1.0f)); - ISET(sst->sVx, f32u((float)x)); - ISET(sst->sVy, f32u((float)y)); - ISET(sst->sSow0,f32u(0.0f)); - ISET(sst->sTow0,f32u(0.0f)); + ISET(sstregs->sSetupMode, 0x0020); + ISET(SST_TREX(sstregs,ucNumTMU)->sARGB,0xFFFFFFFF); + ISET(SST_TREX(sstregs,ucNumTMU)->sVx, f32u((float)x)); + ISET(SST_TREX(sstregs,ucNumTMU)->sVy, f32u((float)y)); + ISET(SST_TREX(sstregs,ucNumTMU)->sOowfbi,f32u(1.0f)); + ISET(SST_TREX(sstregs,ucNumTMU)->sSow0,f32u(0.0f)); + ISET(SST_TREX(sstregs,ucNumTMU)->sTow0,f32u(0.0f)); /* 0b10 0000 (Update only S0/T0), doc page 76 */ - ISET(sst->sSetupMode, 0x0020); - ISET(sst->sBeginTriCMD, 1); + ISET(sstregs->sBeginTriCMD, 1); - ISET(sst->sVx, f32u((float)(x+tSizeX))); - ISET(sst->sVy, f32u((float)y)); - ISET(sst->sSow0,f32u((float)tSizeX)); - ISET(sst->sTow0,f32u(0.0f)); - ISET(sst->sDrawTriCMD, 1); + ISET(SST_TREX(sstregs,ucNumTMU)->sVx, f32u((float)(x+tSizeX))); + ISET(SST_TREX(sstregs,ucNumTMU)->sVy, f32u((float)y)); + ISET(SST_TREX(sstregs,ucNumTMU)->sSow0,f32u((float)tSizeX)); + ISET(SST_TREX(sstregs,ucNumTMU)->sTow0,f32u(0.0f)); + ISET(SST_TREX(sstregs,ucNumTMU)->sDrawTriCMD, 1); - ISET(sst->sVx, f32u((float)x)); - ISET(sst->sVy, f32u((float)y+tSizeY)); - ISET(sst->sSow0,f32u(0.0f)); - ISET(sst->sTow0,f32u((float)tSizeY)); - ISET(sst->sDrawTriCMD, 1); + ISET(SST_TREX(sstregs,ucNumTMU)->sVx, f32u((float)x)); + ISET(SST_TREX(sstregs,ucNumTMU)->sVy, f32u((float)y+tSizeY)); + ISET(SST_TREX(sstregs,ucNumTMU)->sSow0,f32u(0.0f)); + ISET(SST_TREX(sstregs,ucNumTMU)->sTow0,f32u((float)tSizeY)); + ISET(SST_TREX(sstregs,ucNumTMU)->sDrawTriCMD, 1); - ISET(sst->sVx, f32u((float)x+tSizeX)); - ISET(sst->sVy, f32u((float)y+tSizeY)); - ISET(sst->sSow0,f32u((float)tSizeX)); - ISET(sst->sTow0,f32u((float)tSizeY)); - ISET(sst->sDrawTriCMD, 1); + ISET(SST_TREX(sstregs,ucNumTMU)->sVx, f32u((float)x+tSizeX)); + ISET(SST_TREX(sstregs,ucNumTMU)->sVy, f32u((float)y+tSizeY)); + ISET(SST_TREX(sstregs,ucNumTMU)->sSow0,f32u((float)tSizeX)); + ISET(SST_TREX(sstregs,ucNumTMU)->sTow0,f32u((float)tSizeY)); + ISET(SST_TREX(sstregs,ucNumTMU)->sDrawTriCMD, 1); - ISET(sst->nopCMD, 0x1); + ISET(sstregs->nopCMD, 0x1); +} + +void +drawRect2( const SstRegs * const sstregs, + const unsigned char ucNumTMU, + const int16_t x, + const int16_t y, + const int16_t tSizeX, + const int16_t tSizeY) +{ + ISET(sstregs->sSetupMode, 0x0020); + //ISET(SST_TREX(sstregs,ucNumTMU)->sARGB,0xFF55AA55); + ISET(SST_TREX(sstregs,ucNumTMU)->sOowfbi, f32u(1.0f)); + ISET(SST_TREX(sstregs,ucNumTMU)->sVx, f32u((float)x)); + ISET(SST_TREX(sstregs,ucNumTMU)->sVy, f32u((float)y)); + ISET(SST_TREX(sstregs,ucNumTMU)->sSow0, f32u(0.0f)); + ISET(SST_TREX(sstregs,ucNumTMU)->sTow0, f32u(0.0f)); + /* 0b10 0000 (Update only S0/T0), doc page 76 */ + ISET(sstregs->sBeginTriCMD, 1); + + ISET(SST_TREX(sstregs,ucNumTMU)->sVx, f32u((float)(x+tSizeX))); + ISET(SST_TREX(sstregs,ucNumTMU)->sVy, f32u((float)y)); + ISET(SST_TREX(sstregs,ucNumTMU)->sSow0, f32u((float)tSizeX)); + ISET(SST_TREX(sstregs,ucNumTMU)->sTow0, f32u(0.0f)); + ISET(SST_TREX(sstregs,ucNumTMU)->sDrawTriCMD, 1); + + ISET(SST_TREX(sstregs,ucNumTMU)->sVx, f32u((float)x)); + ISET(SST_TREX(sstregs,ucNumTMU)->sVy, f32u((float)y+tSizeY)); + ISET(SST_TREX(sstregs,ucNumTMU)->sSow0, f32u(0.0f)); + ISET(SST_TREX(sstregs,ucNumTMU)->sTow0, f32u((float)tSizeY)); + ISET(SST_TREX(sstregs,ucNumTMU)->sDrawTriCMD, 1); + + ISET(SST_TREX(sstregs,ucNumTMU)->sVx, f32u((float)x+tSizeX)); + ISET(SST_TREX(sstregs,ucNumTMU)->sVy, f32u((float)y+tSizeY)); + ISET(SST_TREX(sstregs,ucNumTMU)->sSow0, f32u((float)tSizeX)); + ISET(SST_TREX(sstregs,ucNumTMU)->sTow0, f32u((float)tSizeY)); + ISET(SST_TREX(sstregs,ucNumTMU)->sDrawTriCMD, 1); + + ISET(sstregs->nopCMD, 0x1); } void -clearScreen( const SstRegs * const sst, +clearScreen( const SstRegs * const sstregs, const uint32_t u32Color, const int16_t u16SizeX, const int16_t u16SizeY) { - ISET(sst->clipLeftRight, u16SizeX); - ISET(sst->clipBottomTop, u16SizeY); - ISET(sst->zaColor, u32Color); - //ISET(sst->zaColor, 0x0000); + ISET(sstregs->clipLeftRight, u16SizeX); + ISET(sstregs->clipBottomTop, u16SizeY); + ISET(sstregs->zaColor, u32Color); + //ISET(sstregs->zaColor, 0x0000); - const uint32_t fbz_saved = IGET(sst->fbzMode); - ISET(sst->c1,u32Color); - ISET(sst->c0,0x0); - ISET(sst->zaColor,0x0); - ISET(sst->fbzMode, SST_RGBWRMASK | SST_ZAWRMASK); - ISET(sst->fastfillCMD, 0); - ISET(sst->nopCMD, 0x1); - ISET(sst->fbzMode, fbz_saved); + const uint32_t fbz_saved = IGET(sstregs->fbzMode); + ISET(sstregs->c1,u32Color); + ISET(sstregs->c0,0x0); + ISET(sstregs->zaColor,0x0F); + ISET(sstregs->fbzMode, SST_RGBWRMASK | SST_ZAWRMASK); + ISET(sstregs->fastfillCMD, 0); + ISET(sstregs->nopCMD, 0x1); + ISET(sstregs->fbzMode, fbz_saved); +} + +#define XY_ONE (1<vA.x,x*XY_ONE); + ISET(SST_TREX(sstregs,ucNumTMU)->vA.y,y*XY_ONE); + + ISET(SST_TREX(sstregs,ucNumTMU)->vB.x,(x+2)*XY_ONE); + ISET(SST_TREX(sstregs,ucNumTMU)->vB.y,y*XY_ONE); + + ISET(SST_TREX(sstregs,ucNumTMU)->vC.x,x*XY_ONE); + ISET(SST_TREX(sstregs,ucNumTMU)->vC.y,(y+1)*XY_ONE); + + ISET(SST_TREX(sstregs,ucNumTMU)->triangleCMD,0); +} + +void +drawTriangle( const SstRegs * const sstregs, + const unsigned char ucNumTMU, + const int16_t x, + const int16_t y, + const int16_t tSizeX, + const int16_t tSizeY) +{ + ISET(sstregs->sSetupMode, 0x0020); + //ISET(SST_TREX(sstregs,ucNumTMU)->sARGB,0xFF55AA55); + ISET(SST_TREX(sstregs,ucNumTMU)->sOowfbi, f32u(1.0f)); + ISET(SST_TREX(sstregs,ucNumTMU)->sVx, f32u((float)x)); + ISET(SST_TREX(sstregs,ucNumTMU)->sVy, f32u((float)y)); + ISET(SST_TREX(sstregs,ucNumTMU)->sSow0, f32u(0.0f)); + ISET(SST_TREX(sstregs,ucNumTMU)->sTow0, f32u(0.0f)); + /* 0b10 0000 (Update only S0/T0), doc page 76 */ + ISET(sstregs->sBeginTriCMD, 1); + + ISET(SST_TREX(sstregs,ucNumTMU)->sVx, f32u((float)(x+tSizeX))); + ISET(SST_TREX(sstregs,ucNumTMU)->sVy, f32u((float)y)); + ISET(SST_TREX(sstregs,ucNumTMU)->sSow0, f32u((float)tSizeX)); + ISET(SST_TREX(sstregs,ucNumTMU)->sTow0, f32u(0.0f)); + ISET(SST_TREX(sstregs,ucNumTMU)->sDrawTriCMD, 1); + + ISET(SST_TREX(sstregs,ucNumTMU)->sVx, f32u((float)x)); + ISET(SST_TREX(sstregs,ucNumTMU)->sVy, f32u((float)y+tSizeY)); + ISET(SST_TREX(sstregs,ucNumTMU)->sSow0, f32u(0.0f)); + ISET(SST_TREX(sstregs,ucNumTMU)->sTow0, f32u((float)tSizeY)); + ISET(SST_TREX(sstregs,ucNumTMU)->sDrawTriCMD, 1); + + ISET(sstregs->nopCMD, 0x1); } diff --git a/Draw.h b/Draw.h index a20eb2a..2d782dc 100644 --- a/Draw.h +++ b/Draw.h @@ -21,23 +21,47 @@ #include void -drawRect( const SstRegs * const sst, +drawRect( const SstRegs * const sstregs, + const unsigned char ucNumTMU, + const int16_t x, + const int16_t y, + const int16_t tSizeX, + const int16_t tSizeY); + +void +drawRect2( const SstRegs * const sstregs, + const unsigned char ucNumTMU, const int16_t x, const int16_t y, const int16_t tSizeX, const int16_t tSizeY); +void +drawTriangle( const SstRegs * const sstregs, + const unsigned char ucNumTMU, + const int16_t x, + const int16_t y, + const int16_t tSizeX, + const int16_t tSizeY); + +void +drawPixel( const SstRegs *sstregs, + const unsigned char ucNumTMU, + const int x, + const int y); + static inline void -drawSquare( const SstRegs * const sst, +drawSquare( const SstRegs * const sstregs, + const unsigned char ucNumTMU, const int16_t x, const int16_t y, const int16_t tSize) { - drawRect(sst, x, y, tSize, tSize); + drawRect(sstregs,ucNumTMU, x, y, tSize, tSize); } void -clearScreen( const SstRegs * const sst, +clearScreen( const SstRegs * const sstregs, const uint32_t u32Color, const int16_t u16SizeX, const int16_t u16SizeY); diff --git a/FaultSources.c b/FaultSources.c index d10daa3..f1916ca 100644 --- a/FaultSources.c +++ b/FaultSources.c @@ -63,14 +63,7 @@ FaultSource_addScore( def_sFaultSourceScoreRec* const pCtx, do { dScore /= dDivider; - pCtx[eFaultSource].dScore += dScore; - /* - if(dDivider==1.0) - printf("Add score to %s : %02.3f\n", - pCtx[eFaultSource].szName, - dScore); - */ eFaultSource = pCtx[eFaultSource].eParrentFaultSource; dDivider *= 5; }while(eFaultSource != _INVALID_FAULT_SOURCE_); @@ -126,7 +119,7 @@ FaultSource_getSorted( def_sFaultSourceScoreRec* const pDst, ++idx ) pDst[idx].dScore *= pDst[idx].dWeight; - // shaker sort + // shaker sort FixMe: use qsort() while(bSwapped) { bSwapped = 0; @@ -225,9 +218,36 @@ FaultSource_display(const def_sFaultSourceScoreRec* const pCtx) } } +void +ByteBitFaultSet( def_sFaultSourceScoreRec* const pCtx, + const uint8_t ErrorMark, + const double dScore, + const def_eFaultSource eFaultSource) +{ + + for(unsigned char bitPos = 0; bitPos <= 7 ; ++bitPos) + if(ErrorMark & (1u << bitPos)) + { + FaultSource_addScore(pCtx, eFaultSource + bitPos, dScore); + } +} void WordBitFaultSet( def_sFaultSourceScoreRec* const pCtx, + const uint16_t ErrorMark, + const double dScore, + const def_eFaultSource eFaultSource) +{ + + for(unsigned char bitPos = 0; bitPos <= 15 ; ++bitPos) + if(ErrorMark & (1u << bitPos)) + { + FaultSource_addScore(pCtx, eFaultSource + bitPos, dScore); + } +} + +void +LWordBitFaultSet( def_sFaultSourceScoreRec* const pCtx, const uint32_t ErrorMark, const double dScore, const def_eFaultSource eFaultSourceL, diff --git a/FaultSources.h b/FaultSources.h index c55a749..b2739bc 100644 --- a/FaultSources.h +++ b/FaultSources.h @@ -23,6 +23,38 @@ #define FAULT_SOURCES(ACTION) \ ACTION(U3_FBI, "U3/FBI (front middle big Chip)" ,VOODOO_BOARD, 1.0)\ + ACTION(U3_FBI_FT_DATA_0, "pin 179" ,U3_FBI, 1.0)/*Offset: 1*/\ + ACTION(U3_FBI_FT_DATA_1, "pin 178" ,U3_FBI, 1.0)\ + ACTION(U3_FBI_FT_DATA_2, "pin 176" ,U3_FBI, 1.0)\ + ACTION(U3_FBI_FT_DATA_3, "pin 174" ,U3_FBI, 1.0)\ + ACTION(U3_FBI_FT_DATA_4, "pin 173" ,U3_FBI, 1.0)\ + ACTION(U3_FBI_FT_DATA_5, "pin 172" ,U3_FBI, 1.0)\ + ACTION(U3_FBI_FT_DATA_6, "pin 171" ,U3_FBI, 1.0)\ + ACTION(U3_FBI_FT_DATA_7, "pin 168" ,U3_FBI, 1.0)\ + ACTION(U3_FBI_FT_DATA_8, "pin 167" ,U3_FBI, 1.0)\ + ACTION(U3_FBI_FT_DATA_9, "pin 166" ,U3_FBI, 1.0)\ + ACTION(U3_FBI_FT_DATA_10, "pin 165" ,U3_FBI, 1.0)\ + ACTION(U3_FBI_FT_DATA_11, "pin 164" ,U3_FBI, 1.0)\ + ACTION(U3_FBI_FT_DATA_12, "pin 162" ,U3_FBI, 1.0)\ + ACTION(U3_FBI_FT_DATA_13, "pin 161" ,U3_FBI, 1.0)\ + ACTION(U3_FBI_FT_DATA_14, "pin 160" ,U3_FBI, 1.0)\ + ACTION(U3_FBI_FT_DATA_15, "pin 159" ,U3_FBI, 1.0)\ + ACTION(U3_FBI_TF_DATA_0, "pin 155" ,U3_FBI, 1.0)/*Offset: 17*/\ + ACTION(U3_FBI_TF_DATA_1, "pin 153" ,U3_FBI, 1.0)\ + ACTION(U3_FBI_TF_DATA_2, "pin 152" ,U3_FBI, 1.0)\ + ACTION(U3_FBI_TF_DATA_3, "pin 151" ,U3_FBI, 1.0)\ + ACTION(U3_FBI_TF_DATA_4, "pin 150" ,U3_FBI, 1.0)\ + ACTION(U3_FBI_TF_DATA_5, "pin 148" ,U3_FBI, 1.0)\ + ACTION(U3_FBI_TF_DATA_6, "pin 147" ,U3_FBI, 1.0)\ + ACTION(U3_FBI_TF_DATA_7, "pin 146" ,U3_FBI, 1.0)\ + ACTION(U3_FBI_TF_DATA_8, "pin 142" ,U3_FBI, 1.0)\ + ACTION(U3_FBI_TF_DATA_9, "pin 141" ,U3_FBI, 1.0)\ + ACTION(U3_FBI_TF_DATA_10, "pin 140" ,U3_FBI, 1.0)\ + ACTION(U3_FBI_TF_DATA_11, "pin 139" ,U3_FBI, 1.0)\ + ACTION(U3_FBI_TF_DATA_12, "pin 138" ,U3_FBI, 1.0)\ + ACTION(U3_FBI_TF_DATA_13, "pin 137" ,U3_FBI, 1.0)\ + ACTION(U3_FBI_TF_DATA_14, "pin 136" ,U3_FBI, 1.0)\ + ACTION(U3_FBI_TF_DATA_15, "pin 135" ,U3_FBI, 1.0)\ ACTION(U9_TMU0, "U9/TMU0 (front right big Chip)" ,VOODOO_BOARD, 1.0)\ /* /!\ Keep in-order, only appEND new fields */ \ ACTION(U9_TMU0_TEXDATA_0_0, "pin 52" ,U9_TMU0, 1.0)/*Offset: 1*/\ @@ -1028,13 +1060,24 @@ FaultSource_getLoc( const def_sFaultSourceScoreRec* const pCtx, void FaultSource_display(const def_sFaultSourceScoreRec* const pCtx); - void FaultSource_divideAll( def_sFaultSourceScoreRec* const pCtx, const double dDivider); +void +ByteBitFaultSet( def_sFaultSourceScoreRec* const pCtx, + const uint8_t ErrorMark, + const double dScore, + const def_eFaultSource eFaultSource); + void WordBitFaultSet( def_sFaultSourceScoreRec* const pCtx, + const uint16_t ErrorMark, + const double dScore, + const def_eFaultSource eFaultSource); + +void +LWordBitFaultSet( def_sFaultSourceScoreRec* const pCtx, const uint32_t ErrorMark, const double dScore, const def_eFaultSource eFaultSourceL, @@ -1055,7 +1098,7 @@ MemChipDQFaultSet( def_sFaultSourceScoreRec* const pCtx, const def_eFaultSource eFaultSourceH) { - WordBitFaultSet(pCtx,ErrorMark, dScore, eFaultSourceL + 1, eFaultSourceH + 1); + LWordBitFaultSet(pCtx,ErrorMark, dScore, eFaultSourceL + 1, eFaultSourceH + 1); } static inline void @@ -1065,8 +1108,8 @@ TMUTexDataFaultSet( def_sFaultSourceScoreRec* const pCtx, const double dScore, const def_eFaultSource eTMUFaultSource) { - WordBitFaultSet(pCtx,ErrorMark_w0w1, dScore, eTMUFaultSource + 0 + 1, eTMUFaultSource + 16 + 1); - WordBitFaultSet(pCtx,ErrorMark_w2w3, dScore, eTMUFaultSource + 32 + 1, eTMUFaultSource + 48 + 1); + LWordBitFaultSet(pCtx,ErrorMark_w0w1, dScore, eTMUFaultSource + 0 + 1, eTMUFaultSource + 16 + 1); + LWordBitFaultSet(pCtx,ErrorMark_w2w3, dScore, eTMUFaultSource + 32 + 1, eTMUFaultSource + 48 + 1); } diff --git a/Makefile b/Makefile index 23663b3..2c8687d 100644 --- a/Makefile +++ b/Makefile @@ -13,8 +13,11 @@ OBJ=OBJs/main.o \ OBJs/Utils.o \ OBJs/Draw.o \ OBJs/Test_Common.o \ + OBJs/Test_Control.o \ OBJs/Test_Address.o \ OBJs/Test_Data.o \ + OBJs/Test_Data_NoMem_TestPatterns.o \ + OBJs/Test_Data_NoMem.o \ OBJs/Test_Data_Huge.o HEADERS := $(notdir $(wildcard *.h)) diff --git a/Test_Address.c b/Test_Address.c index 1424d2f..f133eb2 100644 --- a/Test_Address.c +++ b/Test_Address.c @@ -14,13 +14,17 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ + #include +#include #include "cvg.h" #include #include "sst1init.h" #include "fxpci.h" +#include "Utils.h" +#include "V2MemTest.h" #include "FaultSources.h" #include "Utils.h" #include "Draw.h" @@ -35,9 +39,9 @@ typedef struct _def_sTestAddress { }def_sTestAddress; unsigned long -RenderTestAddress( sst1DeviceInfoStruct* devInfo, - FxU32* sst, - SstRegs *sstregs, +RenderTestAddress( sst1DeviceInfoStruct * const devInfo, + FxU32 * const sst, + SstRegs * const sstregs, const char ucNumTMU, const unsigned char RamSizeMB, def_sFaultSourceScoreRec* const pFaultSrcCtx) @@ -64,24 +68,24 @@ RenderTestAddress( sst1DeviceInfoStruct* devInfo, {0x000004,0,0,0,0} */ {0x000008,0,1,0}, - /* {target pin}, { + previous adjacent pin} */ - {0x000010,0,2,0}, {0x000018,0,2,0}, - {0x000020,0,3,0}, {0x000030,0,3,0}, - {0x000040,0,4,0}, {0x000060,0,4,0}, - {0x000080,0,5,0}, {0x0000C0,0,5,0}, - {0x000100,0,6,0}, {0x000180,0,6,0}, - {0x000200,0,7,0}, {0x000300,0,7,0}, - {0x000400,0,8,0}, {0x000600,0,8,0}, - {0x000800,0,9,0}, {0x000C00,0,9,0}, - {0x001000,0,0,1}, {0x001800,0,0,1}, - {0x002000,0,0,2}, {0x003000,0,0,2}, - {0x004000,0,0,3}, {0x006000,0,0,3}, - {0x008000,0,0,4}, {0x00C000,0,0,4}, - {0x010000,0,0,5}, {0x018000,0,0,5}, - {0x020000,0,0,6}, {0x030000,0,0,6}, - {0x040000,0,0,7}, {0x060000,0,0,7}, - {0x080000,0,0,8}, {0x0C0000,0,0,8}, - {0x100000,0,0,9}, {0x180000,0,0,9}, + /* {target pin} */ + {0x000010,0,2,0}, + {0x000020,0,3,0}, + {0x000040,0,4,0}, + {0x000080,0,5,0}, + {0x000100,0,6,0}, + {0x000200,0,7,0}, + {0x000400,0,8,0}, + {0x000800,0,9,0}, + {0x001000,0,0,1}, + {0x002000,0,0,2}, + {0x004000,0,0,3}, + {0x008000,0,0,4}, + {0x010000,0,0,5}, + {0x020000,0,0,6}, + {0x040000,0,0,7}, + {0x080000,0,0,8}, + {0x100000,0,0,9}, /* Bank1 */ {0x200000,1,0,0}, @@ -91,26 +95,27 @@ RenderTestAddress( sst1DeviceInfoStruct* devInfo, {0x200004,1,0,0,0} */ {0x200008,1,1,0}, - /* {target pin}, { + previous adjacent pin} */ - {0x200010,1,2,0}, {0x200018,1,2,0}, - {0x200020,1,3,0}, {0x200030,1,3,0}, - {0x200040,1,4,0}, {0x200060,1,4,0}, - {0x200080,1,5,0}, {0x2000C0,1,5,0}, - {0x200100,1,6,0}, {0x200180,1,6,0}, - {0x200200,1,7,0}, {0x200300,1,7,0}, - {0x200400,1,8,0}, {0x200600,1,8,0}, - {0x200800,1,9,0}, {0x200C00,1,9,0}, - {0x201000,1,0,1}, {0x201800,1,0,1}, - {0x202000,1,0,2}, {0x203000,1,0,2}, - {0x204000,1,0,3}, {0x206000,1,0,3}, - {0x208000,1,0,4}, {0x20C000,1,0,4}, - {0x210000,1,0,5}, {0x218000,1,0,5}, - {0x220000,1,0,6}, {0x230000,1,0,6}, - {0x240000,1,0,7}, {0x260000,1,0,7}, - {0x280000,1,0,8}, {0x2C0000,1,0,8}, - {0x300000,1,0,9}, {0x380000,1,0,9}, + /* {target pin} */ + {0x200010,1,2,0}, + {0x200020,1,3,0}, + {0x200040,1,4,0}, + {0x200080,1,5,0}, + {0x200100,1,6,0}, + {0x200200,1,7,0}, + {0x200400,1,8,0}, + {0x200800,1,9,0}, + {0x201000,1,0,1}, + {0x202000,1,0,2}, + {0x204000,1,0,3}, + {0x208000,1,0,4}, + {0x210000,1,0,5}, + {0x220000,1,0,6}, + {0x240000,1,0,7}, + {0x280000,1,0,8}, + {0x300000,1,0,9}, }; + logD("testing %d MB of memory\n",RamSizeMB); for(unsigned char idx=0; idx < (sizeof(add_list)/sizeof(def_sTestAddress)); idx++) @@ -120,10 +125,40 @@ RenderTestAddress( sst1DeviceInfoStruct* devInfo, if(RamSizeMB<3 && add_list[idx].u32Addr >= 0x200000) continue; if(RamSizeMB<2 && add_list[idx].u32Addr >= 0x100000) continue; + logT("idx = %d\n",idx); + logT("u32Addr = 0x%08X\n",add_list[idx].u32Addr); + const uint32_t TestVal1 = get_notnull_random_balanced_mByte(); - const uint32_t TestVal2 = get_notnull_random_balanced_mByte(); - const uint32_t TestValBlank1 = get_notnull_random_balanced_mByte(); - const uint32_t TestValBlank2 = get_notnull_random_balanced_mByte(); + logT("TestVal1 = %08X\n",TestVal1); + + uint32_t TestVal2 = 0; + do + { + TestVal2 = get_notnull_random_balanced_mByte(); + } + while((count_bit32((TestVal2 ^ TestVal1)) < 12)); + logT("TestVal2 = %08X\n",TestVal2); + + uint32_t TestValBlank1 = 0; + do + { + TestValBlank1 = get_notnull_random_balanced_mByte(); + } + while( (count_bit32((TestValBlank1 ^ TestVal1) & 0x0000FFFF) < 6) + || (count_bit32((TestValBlank1 ^ TestVal1) & 0xFFFF0000) < 6) + || (count_bit32((TestValBlank1 ^ TestVal2)) < 12)); + logT("TestValBlank1 = %08X\n",TestValBlank1); + + uint32_t TestValBlank2 = 0; + do + { + TestValBlank2 = get_notnull_random_balanced_mByte(); + } + while( (count_bit32((TestValBlank2 ^ TestVal2) & 0x0000FFFF) < 6) + || (count_bit32((TestValBlank2 ^ TestVal2) & 0xFFFF0000) < 6) + || (count_bit32((TestValBlank2 ^ TestValBlank1)) < 12) + || (count_bit32((TestValBlank2 ^ TestVal1)) < 12)); + logT("TestValBlank2 = %08X\n",TestValBlank2); /* Clearing memory targets */ for(unsigned char idxclr=0; @@ -136,7 +171,7 @@ RenderTestAddress( sst1DeviceInfoStruct* devInfo, if(RamSizeMB<2 && add_list[idxclr].u32Addr >= 0x100000) continue; /* set base mem @ */ - ISET(sstregs->texBaseAddr, (add_list[idxclr].u32Addr>>3)); + ISET(SST_TREX(sstregs,ucNumTMU)->texBaseAddr, (add_list[idxclr].u32Addr>>3)); /* set @ to first line, using bits 00..31*/ volatile const FxU32 *texAddrBlank @@ -157,7 +192,7 @@ RenderTestAddress( sst1DeviceInfoStruct* devInfo, } /* set base mem @ */ - ISET(sstregs->texBaseAddr, (add_list[idx].u32Addr>>3)); + ISET(SST_TREX(sstregs,ucNumTMU)->texBaseAddr, (add_list[idx].u32Addr>>3)); /* set @ to first line, using bits 00..31*/ volatile const FxU32 *texAddr @@ -184,18 +219,18 @@ RenderTestAddress( sst1DeviceInfoStruct* devInfo, if(RamSizeMB<4 && add_list[idxdraw].u32Addr >= 0x300000) continue; if(RamSizeMB<3 && add_list[idxdraw].u32Addr >= 0x200000) continue; if(RamSizeMB<2 && add_list[idxdraw].u32Addr >= 0x100000) continue; + + logT("idxdraw = %d, row = %d; col = %d\n",idxdraw,add_list[idxdraw].nRowBit,add_list[idxdraw].nColBit); - /* testing copy beyond tested bit is useless & can raise - false positive */ - if(idxdraw > idx) break; + //if(idxdraw > idx) break; clearScreen(sstregs,0x00000000,2,2); /* set to mem addr */ - ISET(sstregs->texBaseAddr, (add_list[idxdraw].u32Addr >> 3)); + ISET(SST_TREX(sstregs,ucNumTMU)->texBaseAddr, (add_list[idxdraw].u32Addr >> 3)); /* draw a 2x2 square */ - drawSquare(sstregs, 0, 0, 2); + drawSquare(sstregs, ucNumTMU, 0, 0, 2); sst1InitIdle(sst); /* first line, to use bits 00..31 */ @@ -206,93 +241,33 @@ RenderTestAddress( sst1DeviceInfoStruct* devInfo, const uint32_t ErrorMark_L1 = (idxdraw == idx) ? (L1 ^ TestVal1) : (L1 ^ TestValBlank1); const uint32_t ErrorMark_L2 = (idxdraw == idx) ? (L2 ^ TestVal2) : (L2 ^ TestValBlank2); - const uint32_t ErrorMarkBlank_L1 = (idxdraw == idx) ? (L1 ^ TestValBlank1) : (L1 ^ TestVal1); - const uint32_t ErrorMarkBlank_L2 = (idxdraw == idx) ? (L2 ^ TestValBlank2) : (L2 ^ TestVal2) ; - + const uint32_t ErrorMarkOther_L1 = (idxdraw == idx) ? (L1 ^ TestValBlank1) : (L1 ^ TestVal1); + const uint32_t ErrorMarkOther_L2 = (idxdraw == idx) ? (L2 ^ TestValBlank2) : (L2 ^ TestVal2); + if(ErrorMark_L1 || ErrorMark_L2) { - const def_eFaultSource TMUTexADDR_0_0 = (ucNumTMU == 0) ? U9_TMU0_TEX_ADDR_0_0 : U8_TMU1_TEX_ADDR_0_0; - const def_eFaultSource TMUTexADDR_1_0 = (ucNumTMU == 0) ? U9_TMU0_TEX_ADDR_1_0 : U8_TMU1_TEX_ADDR_1_0; - const def_eFaultSource TMUTexADDR_2_0 = (ucNumTMU == 0) ? U9_TMU0_TEX_ADDR_2_0 : U8_TMU1_TEX_ADDR_2_0; - const def_eFaultSource TMUTexADDR_3_0 = (ucNumTMU == 0) ? U9_TMU0_TEX_ADDR_3_0 : U8_TMU1_TEX_ADDR_3_0; - const def_eFaultSource TMUTexWE = (ucNumTMU == 0) ? U9_TMU0_TEX_WE : U8_TMU1_TEX_WE; - const def_eFaultSource TMUTexCAS0 = (ucNumTMU == 0) ? U9_TMU0_TEX_CAS0 : U8_TMU1_TEX_CAS0; - const def_eFaultSource TMUTexCAS1 = (ucNumTMU == 0) ? U9_TMU0_TEX_CAS1 : U8_TMU1_TEX_CAS1; - const def_eFaultSource TMUTexCAS2 = (ucNumTMU == 0) ? U9_TMU0_TEX_CAS2 : U8_TMU1_TEX_CAS2; - const def_eFaultSource TMUTexCAS3 = (ucNumTMU == 0) ? U9_TMU0_TEX_CAS3 : U8_TMU1_TEX_CAS3; - const def_eFaultSource _TMUTexRAS0 = (ucNumTMU == 0) ? U9_TMU0_TEX_RAS0 : U8_TMU1_TEX_RAS0; - const def_eFaultSource _TMUTexRAS1 = (ucNumTMU == 0) ? U9_TMU0_TEX_RAS1 : U8_TMU1_TEX_RAS1; - const def_eFaultSource TMUTexRASCurrent = (add_list[idxdraw].nBank == 0) ? _TMUTexRAS0 : _TMUTexRAS1; - const def_eFaultSource _MEMChip_B0_0_A0 = (ucNumTMU == 0) ? U14_A0 : U13_A0; - const def_eFaultSource _MEMChip_B0_1_A0 = (ucNumTMU == 0) ? U12_A0 : U11_A0; - const def_eFaultSource _MEMChip_B0_2_A0 = (ucNumTMU == 0) ? U18_A0 : U16_A0; - const def_eFaultSource _MEMChip_B0_3_A0 = (ucNumTMU == 0) ? U17_A0 : U15_A0; - const def_eFaultSource _MEMChip_B1_0_A0 = (ucNumTMU == 0) ? U23_A0 : U27_A0; - const def_eFaultSource _MEMChip_B1_1_A0 = (ucNumTMU == 0) ? U24_A0 : U28_A0; - const def_eFaultSource _MEMChip_B1_2_A0 = (ucNumTMU == 0) ? U25_A0 : U29_A0; - const def_eFaultSource _MEMChip_B1_3_A0 = (ucNumTMU == 0) ? U26_A0 : U30_A0; + const def_eFaultSource TMUTexADDR_0_0 = (ucNumTMU == 0) ? U9_TMU0_TEX_ADDR_0_0 : U8_TMU1_TEX_ADDR_0_0; + const def_eFaultSource TMUTexADDR_1_0 = (ucNumTMU == 0) ? U9_TMU0_TEX_ADDR_1_0 : U8_TMU1_TEX_ADDR_1_0; + const def_eFaultSource TMUTexADDR_2_0 = (ucNumTMU == 0) ? U9_TMU0_TEX_ADDR_2_0 : U8_TMU1_TEX_ADDR_2_0; + const def_eFaultSource TMUTexADDR_3_0 = (ucNumTMU == 0) ? U9_TMU0_TEX_ADDR_3_0 : U8_TMU1_TEX_ADDR_3_0; + const def_eFaultSource _MEMChip_B0_0_A0 = (ucNumTMU == 0) ? U14_A0 : U13_A0; + const def_eFaultSource _MEMChip_B0_1_A0 = (ucNumTMU == 0) ? U12_A0 : U11_A0; + const def_eFaultSource _MEMChip_B0_2_A0 = (ucNumTMU == 0) ? U18_A0 : U16_A0; + const def_eFaultSource _MEMChip_B0_3_A0 = (ucNumTMU == 0) ? U17_A0 : U15_A0; + const def_eFaultSource _MEMChip_B1_0_A0 = (ucNumTMU == 0) ? U23_A0 : U27_A0; + const def_eFaultSource _MEMChip_B1_1_A0 = (ucNumTMU == 0) ? U24_A0 : U28_A0; + const def_eFaultSource _MEMChip_B1_2_A0 = (ucNumTMU == 0) ? U25_A0 : U29_A0; + const def_eFaultSource _MEMChip_B1_3_A0 = (ucNumTMU == 0) ? U26_A0 : U30_A0; const def_eFaultSource MEMChip_0_A0 = (add_list[idxdraw].nBank == 0) ? _MEMChip_B0_0_A0 : _MEMChip_B1_0_A0; - const def_eFaultSource MEMChip_1_A0 = (add_list[idxdraw].nBank == 0) ? _MEMChip_B0_1_A0 : _MEMChip_B1_1_A0; - const def_eFaultSource MEMChip_2_A0 = (add_list[idxdraw].nBank == 0) ? _MEMChip_B0_2_A0 : _MEMChip_B1_2_A0; - const def_eFaultSource MEMChip_3_A0 = (add_list[idxdraw].nBank == 0) ? _MEMChip_B0_3_A0 : _MEMChip_B1_3_A0; + const def_eFaultSource MEMChip_1_A0 = (add_list[idxdraw].nBank == 0) ? _MEMChip_B0_1_A0 : _MEMChip_B1_1_A0; + const def_eFaultSource MEMChip_2_A0 = (add_list[idxdraw].nBank == 0) ? _MEMChip_B0_2_A0 : _MEMChip_B1_2_A0; + const def_eFaultSource MEMChip_3_A0 = (add_list[idxdraw].nBank == 0) ? _MEMChip_B0_3_A0 : _MEMChip_B1_3_A0; - const def_eFaultSource _MEMChip_B0_0_CASL = (ucNumTMU == 0) ? U14_CASL : U13_CASL; - const def_eFaultSource _MEMChip_B0_1_CASL = (ucNumTMU == 0) ? U12_CASL : U11_CASL; - const def_eFaultSource _MEMChip_B0_2_CASL = (ucNumTMU == 0) ? U18_CASL : U16_CASL; - const def_eFaultSource _MEMChip_B0_3_CASL = (ucNumTMU == 0) ? U17_CASL : U15_CASL; - const def_eFaultSource _MEMChip_B1_0_CASL = (ucNumTMU == 0) ? U23_CASL : U27_CASL; - const def_eFaultSource _MEMChip_B1_1_CASL = (ucNumTMU == 0) ? U24_CASL : U28_CASL; - const def_eFaultSource _MEMChip_B1_2_CASL = (ucNumTMU == 0) ? U25_CASL : U29_CASL; - const def_eFaultSource _MEMChip_B1_3_CASL = (ucNumTMU == 0) ? U26_CASL : U30_CASL; - const def_eFaultSource MEMChip_0_CASL = (add_list[idxdraw].nBank == 0) ? _MEMChip_B0_0_CASL : _MEMChip_B1_0_CASL; - const def_eFaultSource MEMChip_1_CASL = (add_list[idxdraw].nBank == 0) ? _MEMChip_B0_1_CASL : _MEMChip_B1_1_CASL; - const def_eFaultSource MEMChip_2_CASL = (add_list[idxdraw].nBank == 0) ? _MEMChip_B0_2_CASL : _MEMChip_B1_2_CASL; - const def_eFaultSource MEMChip_3_CASL = (add_list[idxdraw].nBank == 0) ? _MEMChip_B0_3_CASL : _MEMChip_B1_3_CASL; - const def_eFaultSource _MEMChip_B0_0_CASH = (ucNumTMU == 0) ? U14_CASH : U13_CASH; - const def_eFaultSource _MEMChip_B0_1_CASH = (ucNumTMU == 0) ? U12_CASH : U11_CASH; - const def_eFaultSource _MEMChip_B0_2_CASH = (ucNumTMU == 0) ? U18_CASH : U16_CASH; - const def_eFaultSource _MEMChip_B0_3_CASH = (ucNumTMU == 0) ? U17_CASH : U15_CASH; - const def_eFaultSource _MEMChip_B1_0_CASH = (ucNumTMU == 0) ? U23_CASH : U27_CASH; - const def_eFaultSource _MEMChip_B1_1_CASH = (ucNumTMU == 0) ? U24_CASH : U28_CASH; - const def_eFaultSource _MEMChip_B1_2_CASH = (ucNumTMU == 0) ? U25_CASH : U29_CASH; - const def_eFaultSource _MEMChip_B1_3_CASH = (ucNumTMU == 0) ? U26_CASH : U30_CASH; - const def_eFaultSource MEMChip_0_CASH = (add_list[idxdraw].nBank == 0) ? _MEMChip_B0_0_CASH : _MEMChip_B1_0_CASH; - const def_eFaultSource MEMChip_1_CASH = (add_list[idxdraw].nBank == 0) ? _MEMChip_B0_1_CASH : _MEMChip_B1_1_CASH; - const def_eFaultSource MEMChip_2_CASH = (add_list[idxdraw].nBank == 0) ? _MEMChip_B0_2_CASH : _MEMChip_B1_2_CASH; - const def_eFaultSource MEMChip_3_CASH = (add_list[idxdraw].nBank == 0) ? _MEMChip_B0_3_CASH : _MEMChip_B1_3_CASH; - - const def_eFaultSource _MEMChip_B0_0_RAS = (ucNumTMU == 0) ? U14_RAS : U13_RAS; - const def_eFaultSource _MEMChip_B0_1_RAS = (ucNumTMU == 0) ? U12_RAS : U11_RAS; - const def_eFaultSource _MEMChip_B0_2_RAS = (ucNumTMU == 0) ? U18_RAS : U16_RAS; - const def_eFaultSource _MEMChip_B0_3_RAS = (ucNumTMU == 0) ? U17_RAS : U15_RAS; - const def_eFaultSource _MEMChip_B1_0_RAS = (ucNumTMU == 0) ? U23_RAS : U27_RAS; - const def_eFaultSource _MEMChip_B1_1_RAS = (ucNumTMU == 0) ? U24_RAS : U28_RAS; - const def_eFaultSource _MEMChip_B1_2_RAS = (ucNumTMU == 0) ? U25_RAS : U29_RAS; - const def_eFaultSource _MEMChip_B1_3_RAS = (ucNumTMU == 0) ? U26_RAS : U30_RAS; - const def_eFaultSource MEMChip_0_RAS = (add_list[idxdraw].nBank == 0) ? _MEMChip_B0_0_RAS : _MEMChip_B1_0_RAS; - const def_eFaultSource MEMChip_1_RAS = (add_list[idxdraw].nBank == 0) ? _MEMChip_B0_1_RAS : _MEMChip_B1_1_RAS; - const def_eFaultSource MEMChip_2_RAS = (add_list[idxdraw].nBank == 0) ? _MEMChip_B0_2_RAS : _MEMChip_B1_2_RAS; - const def_eFaultSource MEMChip_3_RAS = (add_list[idxdraw].nBank == 0) ? _MEMChip_B0_3_RAS : _MEMChip_B1_3_RAS; - - const def_eFaultSource _MEMChip_B0_0_WE = (ucNumTMU == 0) ? U14_WE : U13_WE; - const def_eFaultSource _MEMChip_B0_1_WE = (ucNumTMU == 0) ? U12_WE : U11_WE; - const def_eFaultSource _MEMChip_B0_2_WE = (ucNumTMU == 0) ? U18_WE : U16_WE; - const def_eFaultSource _MEMChip_B0_3_WE = (ucNumTMU == 0) ? U17_WE : U15_WE; - const def_eFaultSource _MEMChip_B1_0_WE = (ucNumTMU == 0) ? U23_WE : U27_WE; - const def_eFaultSource _MEMChip_B1_1_WE = (ucNumTMU == 0) ? U24_WE : U28_WE; - const def_eFaultSource _MEMChip_B1_2_WE = (ucNumTMU == 0) ? U25_WE : U29_WE; - const def_eFaultSource _MEMChip_B1_3_WE = (ucNumTMU == 0) ? U26_WE : U30_WE; - const def_eFaultSource MEMChip_0_WE = (add_list[idxdraw].nBank == 0) ? _MEMChip_B0_0_WE : _MEMChip_B1_0_WE; - const def_eFaultSource MEMChip_1_WE = (add_list[idxdraw].nBank == 0) ? _MEMChip_B0_1_WE : _MEMChip_B1_1_WE; - const def_eFaultSource MEMChip_2_WE = (add_list[idxdraw].nBank == 0) ? _MEMChip_B0_2_WE : _MEMChip_B1_2_WE; - const def_eFaultSource MEMChip_3_WE = (add_list[idxdraw].nBank == 0) ? _MEMChip_B0_3_WE : _MEMChip_B1_3_WE; - - const def_eFaultSource _RES_RAS0 = (ucNumTMU == 0) ? R118 : R115; - const def_eFaultSource _RES_RAS1 = (ucNumTMU == 0) ? R149 : R150; - const def_eFaultSource RES_RAS = (add_list[idxdraw].nBank == 0) ? _RES_RAS0 : _RES_RAS1; - const def_eFaultSource RES_CAS = (ucNumTMU == 0) ? RA36 : RA32; - const def_eFaultSource RES_WE = (ucNumTMU == 0) ? R117 : R114; + const def_eFaultSource MEMChip_0_A0_Other = (add_list[idxdraw].nBank == 1) ? _MEMChip_B0_0_A0 : _MEMChip_B1_0_A0; + const def_eFaultSource MEMChip_1_A0_Other = (add_list[idxdraw].nBank == 1) ? _MEMChip_B0_1_A0 : _MEMChip_B1_1_A0; + const def_eFaultSource MEMChip_2_A0_Other = (add_list[idxdraw].nBank == 1) ? _MEMChip_B0_2_A0 : _MEMChip_B1_2_A0; + const def_eFaultSource MEMChip_3_A0_Other = (add_list[idxdraw].nBank == 1) ? _MEMChip_B0_3_A0 : _MEMChip_B1_3_A0; const def_eFaultSource RES_TEXADDR_0_L = (ucNumTMU == 0) ? RA35 : RA31; const def_eFaultSource RES_TEXADDR_0_H = (ucNumTMU == 0) ? RA34 : RA30; @@ -306,240 +281,166 @@ RenderTestAddress( sst1DeviceInfoStruct* devInfo, const def_eFaultSource RES_TEXADDR_3_L = (ucNumTMU == 0) ? RA22 : RA20; const def_eFaultSource RES_TEXADDR_3_H = (ucNumTMU == 0) ? RA21 : RA19; const def_eFaultSource RES_TEXADDR_3_8 = (ucNumTMU == 0) ? R98 : R97; - - if(count_bit32(ErrorMark_L1 & 0x0000FFFF) > 2) - { - NbErr++; - - if((idxdraw == idx) && count_bit32(ErrorMark_L1 & 0x0000FFFF) > 6) - { - FaultSource_addScore(pFaultSrcCtx, TMUTexWE, 1.0/4); - FaultSource_addScore(pFaultSrcCtx, RES_WE, 1.0/4); - FaultSource_addScore(pFaultSrcCtx, MEMChip_0_WE, 1.0/1); - } - - if(count_bit32(ErrorMarkBlank_L1 & 0x0000FFFF) < 3) - { - if(add_list[idx].nColBit!=0) - { - FaultSource_addScore(pFaultSrcCtx, MEMChip_0_A0 + add_list[idx].nColBit, 1.0/1); - FaultSource_addScore(pFaultSrcCtx, TMUTexADDR_0_0 + add_list[idx].nColBit, 1.0/1); - if(add_list[idx].nColBit < 4) - FaultSource_addScore(pFaultSrcCtx, RES_TEXADDR_0_L + add_list[idx].nColBit + 1, 1.0/2); - else if(add_list[idx].nColBit < 8) - FaultSource_addScore(pFaultSrcCtx, RES_TEXADDR_0_H + add_list[idx].nColBit + 1, 1.0/2); - else - FaultSource_addScore(pFaultSrcCtx, RES_TEXADDR_0_8 + 1, 1.0/2); - } - - if(add_list[idx].nRowBit!=0) - { - FaultSource_addScore(pFaultSrcCtx, MEMChip_0_A0 + add_list[idx].nRowBit, 1.0/1); - FaultSource_addScore(pFaultSrcCtx, TMUTexADDR_0_0 + add_list[idx].nRowBit, 1.0/1); - if(add_list[idx].nRowBit < 4) - FaultSource_addScore(pFaultSrcCtx, RES_TEXADDR_0_L + add_list[idx].nRowBit + 1, 1.0/2); - else if(add_list[idx].nRowBit < 8) - FaultSource_addScore(pFaultSrcCtx, RES_TEXADDR_0_H + add_list[idx].nRowBit + 1, 1.0/2); - else - FaultSource_addScore(pFaultSrcCtx, RES_TEXADDR_0_8 + 1, 1.0/2); - } - } - else - { - FaultSource_addScore(pFaultSrcCtx, TMUTexRASCurrent, 1.0/8); - FaultSource_addScore(pFaultSrcCtx, RES_RAS, 1.0/8); - FaultSource_addScore(pFaultSrcCtx, MEMChip_0_RAS, 1.0/4); - - if(ErrorMark_L1 & 0x000000FF) - { - FaultSource_addScore(pFaultSrcCtx, TMUTexCAS0, 1.0/16); - FaultSource_addScore(pFaultSrcCtx, RES_CAS+1, 1.0/16); - FaultSource_addScore(pFaultSrcCtx, MEMChip_0_CASL, 1.0/8); - } - if(ErrorMark_L1 & 0x0000FF00) - { - FaultSource_addScore(pFaultSrcCtx, TMUTexCAS1, 1.0/16);; - FaultSource_addScore(pFaultSrcCtx, RES_CAS+2, 1.0/16); - FaultSource_addScore(pFaultSrcCtx, MEMChip_0_CASH, 1.0/8); - } - } - } - /* considering error only if more than 6 over 16 bits + /* This test is simpler than I wanteed it to be. It focuses + * only on address lines. I thought that reading a totally + * unknown value can mean we have a control line issue but it + * is more complex. In case of 2 addresses lines shorted, + * the value we will get wont necessary be the one we wrote, + * at any place. I am not 100% sure why, but it might be + * because of EDO Ram Page mode... Or maybe lines are also used + * internally by the TMU.. or maybe I just missed something ! + * + * Anyway, this test should do the job for @ lines (including + * shorted). And the Control lines will be tested in a different + * Module where @ lines wont change. + */ + + + /* Considering error only if more than 3 over 16 bits * are wrong, because we are only testing addresses * lines here */ - if(count_bit32(ErrorMark_L1 & 0xFFFF0000) > 2) + if(count_bit32(ErrorMark_L1 & 0x0000FFFF) > 3) { NbErr++; - - if((idxdraw == idx) && count_bit32(ErrorMark_L1 & 0xFFFF0000) > 6) - { - FaultSource_addScore(pFaultSrcCtx, TMUTexWE, 1.0/4); - FaultSource_addScore(pFaultSrcCtx, RES_WE, 1.0/4); - FaultSource_addScore(pFaultSrcCtx, MEMChip_1_WE, 1.0/1); - } - if(count_bit32(ErrorMarkBlank_L1 & 0xFFFF0000) < 3) + + /* If it matches the Other value with less than + * 3 error bits */ + if(count_bit32(ErrorMarkOther_L1 & 0x0000FFFF) < 3) { if(add_list[idx].nColBit!=0) { - FaultSource_addScore(pFaultSrcCtx, MEMChip_1_A0 + add_list[idx].nColBit, 1.0/1); - FaultSource_addScore(pFaultSrcCtx, TMUTexADDR_1_0 + add_list[idx].nColBit, 1.0/1); + FaultSource_addScore(pFaultSrcCtx, MEMChip_0_A0 + add_list[idx].nColBit - 1, 1.0 / 1); + if(RamSizeMB>=2) + FaultSource_addScore(pFaultSrcCtx, MEMChip_0_A0_Other + add_list[idx].nColBit - 1, 1.0 / 2); + FaultSource_addScore(pFaultSrcCtx, TMUTexADDR_0_0 + add_list[idx].nColBit - 1, 1.0 / 2); if(add_list[idx].nColBit < 4) - FaultSource_addScore(pFaultSrcCtx, RES_TEXADDR_1_L + add_list[idx].nColBit + 1, 1.0/2); + FaultSource_addScore(pFaultSrcCtx, RES_TEXADDR_0_L + add_list[idx].nColBit - 2, 1.0 / 2); else if(add_list[idx].nColBit < 8) - FaultSource_addScore(pFaultSrcCtx, RES_TEXADDR_1_H + add_list[idx].nColBit + 1, 1.0/2); + FaultSource_addScore(pFaultSrcCtx, RES_TEXADDR_0_H + add_list[idx].nColBit - 6, 1.0 / 2); else - FaultSource_addScore(pFaultSrcCtx, RES_TEXADDR_1_8 + 1, 1.0/2); + FaultSource_addScore(pFaultSrcCtx, RES_TEXADDR_0_8, 1.0 / 2); } if(add_list[idx].nRowBit!=0) { - FaultSource_addScore(pFaultSrcCtx, MEMChip_1_A0 + add_list[idx].nRowBit, 1.0/1); - FaultSource_addScore(pFaultSrcCtx, TMUTexADDR_1_0 + add_list[idx].nRowBit, 1.0/1); + FaultSource_addScore(pFaultSrcCtx, MEMChip_0_A0 + add_list[idx].nRowBit - 1, 1.0 / 1); + if(RamSizeMB>=2) + FaultSource_addScore(pFaultSrcCtx, MEMChip_0_A0_Other + add_list[idx].nRowBit - 1, 1.0 / 2); + FaultSource_addScore(pFaultSrcCtx, TMUTexADDR_0_0 + add_list[idx].nRowBit - 1, 1.0 / 2); if(add_list[idx].nRowBit < 4) - FaultSource_addScore(pFaultSrcCtx, RES_TEXADDR_1_L + add_list[idx].nRowBit + 1, 1.0/2); + FaultSource_addScore(pFaultSrcCtx, RES_TEXADDR_0_L + add_list[idx].nRowBit - 2, 1.0 / 2); else if(add_list[idx].nRowBit < 8) - FaultSource_addScore(pFaultSrcCtx, RES_TEXADDR_1_H + add_list[idx].nRowBit + 1, 1.0/2); + FaultSource_addScore(pFaultSrcCtx, RES_TEXADDR_0_H + add_list[idx].nRowBit - 6, 1.0 / 2); else - FaultSource_addScore(pFaultSrcCtx, RES_TEXADDR_1_8 + 1, 1.0/2); - } - } - else - { - FaultSource_addScore(pFaultSrcCtx, TMUTexRASCurrent, 1.0/8); - FaultSource_addScore(pFaultSrcCtx, RES_RAS, 1.0/8); - FaultSource_addScore(pFaultSrcCtx, MEMChip_1_RAS, 1.0/4); - - if(ErrorMark_L1 & 0x00FF0000) - { - FaultSource_addScore(pFaultSrcCtx, TMUTexCAS0, 1.0/16); - FaultSource_addScore(pFaultSrcCtx, RES_CAS+1, 1.0/16); - FaultSource_addScore(pFaultSrcCtx, MEMChip_1_CASL, 1.0/8); - } - - if(ErrorMark_L1 & 0xFF000000) - { - FaultSource_addScore(pFaultSrcCtx, TMUTexCAS1, 1.0/16); - FaultSource_addScore(pFaultSrcCtx, RES_CAS+2, 1.0/16); - FaultSource_addScore(pFaultSrcCtx, MEMChip_1_CASH, 1.0/8); + FaultSource_addScore(pFaultSrcCtx, RES_TEXADDR_0_8, 1.0 / 2); } } } - if(count_bit32(ErrorMark_L2 & 0x0000FFFF) > 2) + if(count_bit32(ErrorMark_L1 & 0xFFFF0000) > 3) { NbErr++; - if((idxdraw == idx) && count_bit32(ErrorMark_L2 & 0x0000FFFF) > 6) - { - FaultSource_addScore(pFaultSrcCtx, TMUTexWE, 1.0/4); - FaultSource_addScore(pFaultSrcCtx, RES_WE, 1.0/4); - FaultSource_addScore(pFaultSrcCtx, MEMChip_2_WE, 1.0); - } - - if(count_bit32(ErrorMarkBlank_L2 & 0x0000FFFF) < 3) + if(count_bit32(ErrorMarkOther_L1 & 0xFFFF0000) < 3) { if(add_list[idx].nColBit!=0) { - FaultSource_addScore(pFaultSrcCtx, MEMChip_2_A0 + add_list[idx].nColBit, 1.0/1); - FaultSource_addScore(pFaultSrcCtx, TMUTexADDR_2_0 + add_list[idx].nColBit, 1.0/1); + FaultSource_addScore(pFaultSrcCtx, MEMChip_1_A0 + add_list[idx].nColBit - 1, 1.0 / 1); + if(RamSizeMB>=2) + FaultSource_addScore(pFaultSrcCtx, MEMChip_1_A0_Other + add_list[idx].nColBit - 1, 1.0 / 2); + FaultSource_addScore(pFaultSrcCtx, TMUTexADDR_1_0 + add_list[idx].nColBit - 1, 1.0 / 2); if(add_list[idx].nColBit < 4) - FaultSource_addScore(pFaultSrcCtx, RES_TEXADDR_2_L + add_list[idx].nColBit + 1, 1.0/2); + FaultSource_addScore(pFaultSrcCtx, RES_TEXADDR_1_L + add_list[idx].nColBit - 2, 1.0 / 2); else if(add_list[idx].nColBit < 8) - FaultSource_addScore(pFaultSrcCtx, RES_TEXADDR_2_H + add_list[idx].nColBit + 1, 1.0/2); + FaultSource_addScore(pFaultSrcCtx, RES_TEXADDR_1_H + add_list[idx].nColBit - 6, 1.0 / 2); else - FaultSource_addScore(pFaultSrcCtx, RES_TEXADDR_2_8 + 1, 1.0/2); + FaultSource_addScore(pFaultSrcCtx, RES_TEXADDR_1_8, 1.0 / 2); } if(add_list[idx].nRowBit!=0) { - FaultSource_addScore(pFaultSrcCtx, MEMChip_2_A0 + add_list[idx].nRowBit, 1.0/1); - FaultSource_addScore(pFaultSrcCtx, TMUTexADDR_2_0 + add_list[idx].nRowBit, 1.0/1); + FaultSource_addScore(pFaultSrcCtx, MEMChip_1_A0 + add_list[idx].nRowBit - 1, 1.0 / 1); + if(RamSizeMB>=2) + FaultSource_addScore(pFaultSrcCtx, MEMChip_1_A0_Other + add_list[idx].nRowBit - 1, 1.0 / 2); + FaultSource_addScore(pFaultSrcCtx, TMUTexADDR_1_0 + add_list[idx].nRowBit - 1, 1.0 / 2); if(add_list[idx].nRowBit < 4) - FaultSource_addScore(pFaultSrcCtx, RES_TEXADDR_2_L + add_list[idx].nRowBit + 1, 1.0/2); + FaultSource_addScore(pFaultSrcCtx, RES_TEXADDR_1_L + add_list[idx].nRowBit - 2, 1.0 / 2); else if(add_list[idx].nRowBit < 8) - FaultSource_addScore(pFaultSrcCtx, RES_TEXADDR_2_H + add_list[idx].nRowBit + 1, 1.0/2); + FaultSource_addScore(pFaultSrcCtx, RES_TEXADDR_1_H + add_list[idx].nRowBit - 6, 1.0 / 2); else - FaultSource_addScore(pFaultSrcCtx, RES_TEXADDR_2_8 + 1, 1.0/2); - } - } - else - { - FaultSource_addScore(pFaultSrcCtx, TMUTexRASCurrent, 1.0/8); - FaultSource_addScore(pFaultSrcCtx, RES_RAS, 1.0/8); - FaultSource_addScore(pFaultSrcCtx, MEMChip_2_RAS, 1.0/4); - - if(ErrorMark_L2 & 0x000000FF) - { - FaultSource_addScore(pFaultSrcCtx, TMUTexCAS2, 1.0/16); - FaultSource_addScore(pFaultSrcCtx, RES_CAS+3, 1.0/16); - FaultSource_addScore(pFaultSrcCtx, MEMChip_2_CASL, 1.0/8); - } - - if(ErrorMark_L2 & 0x0000FF00) - { - FaultSource_addScore(pFaultSrcCtx, TMUTexCAS3, 1.0/16); - FaultSource_addScore(pFaultSrcCtx, RES_CAS+4, 1.0/16); - FaultSource_addScore(pFaultSrcCtx, MEMChip_2_CASH, 1.0/8); + FaultSource_addScore(pFaultSrcCtx, RES_TEXADDR_1_8, 1.0 / 2); } } } - if(count_bit32(ErrorMark_L2 & 0xFFFF0000) > 2) + if(count_bit32(ErrorMark_L2 & 0x0000FFFF) > 3) { NbErr++; - - if((idxdraw == idx) && count_bit32(ErrorMark_L2 & 0xFFFF0000) > 6) - { - FaultSource_addScore(pFaultSrcCtx, TMUTexWE, 1.0/4); - FaultSource_addScore(pFaultSrcCtx, RES_WE, 1.0/4); - FaultSource_addScore(pFaultSrcCtx, MEMChip_3_WE, 1.0); - } - - if(count_bit32(ErrorMarkBlank_L2 & 0xFFFF0000) < 3) + if(count_bit32(ErrorMarkOther_L2 & 0x0000FFFF) < 3) { if(add_list[idx].nColBit!=0) { - FaultSource_addScore(pFaultSrcCtx, MEMChip_3_A0 + add_list[idx].nColBit, 1.0/1); - FaultSource_addScore(pFaultSrcCtx, TMUTexADDR_3_0 + add_list[idx].nColBit, 1.0/1); + FaultSource_addScore(pFaultSrcCtx, MEMChip_2_A0 + add_list[idx].nColBit - 1, 1.0 / 1); + if(RamSizeMB>=2) + FaultSource_addScore(pFaultSrcCtx, MEMChip_2_A0_Other + add_list[idx].nColBit - 1, 1.0 / 2); + FaultSource_addScore(pFaultSrcCtx, TMUTexADDR_2_0 + add_list[idx].nColBit - 1, 1.0 / 2); if(add_list[idx].nColBit < 4) - FaultSource_addScore(pFaultSrcCtx, RES_TEXADDR_3_L + add_list[idx].nColBit + 1, 1.0/2); + FaultSource_addScore(pFaultSrcCtx, RES_TEXADDR_2_L + add_list[idx].nColBit - 2, 1.0 / 2); else if(add_list[idx].nColBit < 8) - FaultSource_addScore(pFaultSrcCtx, RES_TEXADDR_3_H + add_list[idx].nColBit + 1, 1.0/2); + FaultSource_addScore(pFaultSrcCtx, RES_TEXADDR_2_H + add_list[idx].nColBit - 6, 1.0 / 2); else - FaultSource_addScore(pFaultSrcCtx, RES_TEXADDR_3_8 + 1, 1.0/2); + FaultSource_addScore(pFaultSrcCtx, RES_TEXADDR_2_8, 1.0 / 2); } if(add_list[idx].nRowBit!=0) { - FaultSource_addScore(pFaultSrcCtx, MEMChip_3_A0 + add_list[idx].nRowBit, 1.0/1); - FaultSource_addScore(pFaultSrcCtx, TMUTexADDR_3_0 + add_list[idx].nRowBit, 1.0/1); + FaultSource_addScore(pFaultSrcCtx, MEMChip_2_A0 + add_list[idx].nRowBit - 1, 1.0 / 1); + if(RamSizeMB>=2) + FaultSource_addScore(pFaultSrcCtx, MEMChip_2_A0_Other + add_list[idx].nRowBit - 1, 1.0 / 2); + FaultSource_addScore(pFaultSrcCtx, TMUTexADDR_2_0 + add_list[idx].nRowBit - 1, 1.0 / 2); if(add_list[idx].nRowBit < 4) - FaultSource_addScore(pFaultSrcCtx, RES_TEXADDR_3_L + add_list[idx].nRowBit + 1, 1.0/2); + FaultSource_addScore(pFaultSrcCtx, RES_TEXADDR_2_L + add_list[idx].nRowBit - 2, 1.0 / 2); else if(add_list[idx].nRowBit < 8) - FaultSource_addScore(pFaultSrcCtx, RES_TEXADDR_3_H + add_list[idx].nRowBit + 1, 1.0/2); + FaultSource_addScore(pFaultSrcCtx, RES_TEXADDR_2_H + add_list[idx].nRowBit - 6, 1.0 / 2); else - FaultSource_addScore(pFaultSrcCtx, RES_TEXADDR_3_8 + 1, 1.0/2); + FaultSource_addScore(pFaultSrcCtx, RES_TEXADDR_2_8, 1.0 / 2); } } - else + } + + if(count_bit32(ErrorMark_L2 & 0xFFFF0000) > 3) + { + NbErr++; + + if(count_bit32(ErrorMarkOther_L2 & 0xFFFF0000) < 3) { - FaultSource_addScore(pFaultSrcCtx, TMUTexRASCurrent, 1.0/8); - FaultSource_addScore(pFaultSrcCtx, RES_RAS, 1.0/8); - FaultSource_addScore(pFaultSrcCtx, MEMChip_3_RAS, 1.0/4); - - if(ErrorMark_L2 & 0x00FF0000) + if(add_list[idx].nColBit!=0) { - FaultSource_addScore(pFaultSrcCtx, TMUTexCAS2, 1.0/16); - FaultSource_addScore(pFaultSrcCtx, RES_CAS+3, 1.0/16); - FaultSource_addScore(pFaultSrcCtx, MEMChip_3_CASL, 1.0/8); + FaultSource_addScore(pFaultSrcCtx, MEMChip_3_A0 + add_list[idx].nColBit - 1, 1.0 / 1); + if(RamSizeMB>=2) + FaultSource_addScore(pFaultSrcCtx, MEMChip_3_A0_Other + add_list[idx].nColBit - 1, 1.0 / 2); + FaultSource_addScore(pFaultSrcCtx, TMUTexADDR_3_0 + add_list[idx].nColBit - 1, 1.0 / 2); + if(add_list[idx].nColBit < 4) + FaultSource_addScore(pFaultSrcCtx, RES_TEXADDR_3_L + add_list[idx].nColBit - 2, 1.0 / 2); + else if(add_list[idx].nColBit < 8) + FaultSource_addScore(pFaultSrcCtx, RES_TEXADDR_3_H + add_list[idx].nColBit - 6, 1.0 / 2); + else + FaultSource_addScore(pFaultSrcCtx, RES_TEXADDR_3_8, 1.0 / 2); } - if(ErrorMark_L2 & 0xFF000000) + if(add_list[idx].nRowBit!=0) { - FaultSource_addScore(pFaultSrcCtx, TMUTexCAS3, 1.0/16); - FaultSource_addScore(pFaultSrcCtx, RES_CAS+4, 1.0/16); - FaultSource_addScore(pFaultSrcCtx, MEMChip_3_CASH, 1.0/8); + FaultSource_addScore(pFaultSrcCtx, MEMChip_3_A0 + add_list[idx].nRowBit - 1, 1.0 / 1); + if(RamSizeMB>=2) + FaultSource_addScore(pFaultSrcCtx, MEMChip_3_A0_Other + add_list[idx].nRowBit - 1, 1.0 / 2); + FaultSource_addScore(pFaultSrcCtx, TMUTexADDR_3_0 + add_list[idx].nRowBit - 1, 1.0 / 2); + if(add_list[idx].nRowBit < 4) + FaultSource_addScore(pFaultSrcCtx, RES_TEXADDR_3_L + add_list[idx].nRowBit - 2, 1.0 / 2); + else if(add_list[idx].nRowBit < 8) + FaultSource_addScore(pFaultSrcCtx, RES_TEXADDR_3_H + add_list[idx].nRowBit - 6, 1.0 / 2); + else + FaultSource_addScore(pFaultSrcCtx, RES_TEXADDR_3_8, 1.0 / 2); } } } diff --git a/Test_Address.h b/Test_Address.h index c24f66c..0345ef2 100644 --- a/Test_Address.h +++ b/Test_Address.h @@ -19,9 +19,9 @@ #define _DEF_TEST_ADDRESS_H_ unsigned long -RenderTestAddress( sst1DeviceInfoStruct* devInfo, - FxU32* sst, - SstRegs *sstregs, +RenderTestAddress( sst1DeviceInfoStruct * const devInfo, + FxU32 * const sst, + SstRegs * const sstregs, const char ucNumTMU, const unsigned char RamSizeMB, def_sFaultSourceScoreRec* const pFaultSrcCtx); diff --git a/Test_Common.c b/Test_Common.c index 40778b9..55e291f 100644 --- a/Test_Common.c +++ b/Test_Common.c @@ -35,9 +35,9 @@ #define _DEF_PREHEAT_NB_PIXEL_COL 256 void -HeatMemAndTMU( sst1DeviceInfoStruct* devInfo, - FxU32* sst, - SstRegs *sstregs, +HeatMemAndTMU( sst1DeviceInfoStruct * const devInfo, + FxU32 * const sst, + SstRegs * const sstregs, const char ucNumTMU, const FxU32 mem) { @@ -75,7 +75,7 @@ HeatMemAndTMU( sst1DeviceInfoStruct* devInfo, if(((sst1InitReturnStatus(sst) & SST_FIFOLEVEL)) >= 0x20) { /* draw a 256x256 square */ - drawSquare(sstregs, 0, 0, 256); + drawSquare(sstregs, ucNumTMU, 0, 0, 256); } } while(((double)(clock() - begin)/CLOCKS_PER_SEC) < _DEF_PREHEAT_TIME_S ); diff --git a/Test_Common.h b/Test_Common.h index 0331306..931bb0e 100644 --- a/Test_Common.h +++ b/Test_Common.h @@ -19,9 +19,9 @@ #define _DEF_TEST_COMMON_H_ void -HeatMemAndTMU( sst1DeviceInfoStruct* devInfo, - FxU32* sst, - SstRegs *sstregs, +HeatMemAndTMU( sst1DeviceInfoStruct * const devInfo, + FxU32 * const sst, + SstRegs * const sstregs, const char ucNumTMU, const FxU32 mem); diff --git a/Test_Control.c b/Test_Control.c new file mode 100644 index 0000000..301f2bf --- /dev/null +++ b/Test_Control.c @@ -0,0 +1,457 @@ +/* V2MemTest - A CLI Tool to test & fix Voodoo² TMU System +* Copyright (C) 2026 ChaCha +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see . +*/ +#include +#include + +#include "cvg.h" +#include +#include "sst1init.h" +#include "fxpci.h" + +#include "Utils.h" +#include "V2MemTest.h" +#include "FaultSources.h" +#include "Utils.h" +#include "Draw.h" + +#include "Test_Control.h" + +static void +WriteTex( FxU32 * const sst, + SstRegs * const sstregs, + const uint32_t baseAddr, + const char ucNumTMU, + const uint32_t Val1, + const uint32_t Val2) +{ + /* set base mem @ */ + ISET(SST_TREX(sstregs,ucNumTMU)->texBaseAddr, (baseAddr>>3)); + /* set @ to first line, using bits 00..31*/ + volatile const FxU32 *texAddrBlank + = (ucNumTMU<<(21-2)) + + (((FxU32)0)<<(17-2)) /*LOD0*/ + + (FxU32 *)SST_TEX_ADDRESS(sst); + /* write the value */ + ISET(texAddrBlank[0], Val1); + /* set @ to second line, to use bits 32..63*/ + volatile const FxU32 *texAddrBlank2 + = (ucNumTMU<<(21-2)) + + (((FxU32)0)<<(17-2)) /*LOD0*/ + + (1<<(9-2)) + + (FxU32 *)SST_TEX_ADDRESS(sst); + /* write the value */ + ISET(texAddrBlank2[0], Val2); +} + +unsigned long +CheckRead( FxU32 * const sst, + SstRegs * const sstregs, + const uint32_t baseAddr, + const char ucNumTMU, + const unsigned char bNominal, + const uint32_t Val1, + const uint32_t Val2, + const uint32_t ValOther1, + const uint32_t ValOther2, + def_sFaultSourceScoreRec* const pFaultSrcCtx) +{ + unsigned long NbErr=0; + const unsigned char nBank = (baseAddr<0x200000) ? 0 : 1; + + const def_eFaultSource TMUTexWE = (ucNumTMU == 0) ? U9_TMU0_TEX_WE : U8_TMU1_TEX_WE; + const def_eFaultSource TMUTexCAS0 = (ucNumTMU == 0) ? U9_TMU0_TEX_CAS0 : U8_TMU1_TEX_CAS0; + const def_eFaultSource TMUTexCAS1 = (ucNumTMU == 0) ? U9_TMU0_TEX_CAS1 : U8_TMU1_TEX_CAS1; + const def_eFaultSource TMUTexCAS2 = (ucNumTMU == 0) ? U9_TMU0_TEX_CAS2 : U8_TMU1_TEX_CAS2; + const def_eFaultSource TMUTexCAS3 = (ucNumTMU == 0) ? U9_TMU0_TEX_CAS3 : U8_TMU1_TEX_CAS3; + const def_eFaultSource _TMUTexRAS0 = (ucNumTMU == 0) ? U9_TMU0_TEX_RAS0 : U8_TMU1_TEX_RAS0; + const def_eFaultSource _TMUTexRAS1 = (ucNumTMU == 0) ? U9_TMU0_TEX_RAS1 : U8_TMU1_TEX_RAS1; + const def_eFaultSource TMUTexRASCurrent = (nBank == 0) ? _TMUTexRAS0 : _TMUTexRAS1; + const def_eFaultSource _MEMChip_B0_0_CASL = (ucNumTMU == 0) ? U14_CASL : U13_CASL; + const def_eFaultSource _MEMChip_B0_1_CASL = (ucNumTMU == 0) ? U12_CASL : U11_CASL; + const def_eFaultSource _MEMChip_B0_2_CASL = (ucNumTMU == 0) ? U18_CASL : U16_CASL; + const def_eFaultSource _MEMChip_B0_3_CASL = (ucNumTMU == 0) ? U17_CASL : U15_CASL; + const def_eFaultSource _MEMChip_B1_0_CASL = (ucNumTMU == 0) ? U23_CASL : U27_CASL; + const def_eFaultSource _MEMChip_B1_1_CASL = (ucNumTMU == 0) ? U24_CASL : U28_CASL; + const def_eFaultSource _MEMChip_B1_2_CASL = (ucNumTMU == 0) ? U25_CASL : U29_CASL; + const def_eFaultSource _MEMChip_B1_3_CASL = (ucNumTMU == 0) ? U26_CASL : U30_CASL; + const def_eFaultSource MEMChip_0_CASL = (nBank == 0) ? _MEMChip_B0_0_CASL : _MEMChip_B1_0_CASL; + const def_eFaultSource MEMChip_1_CASL = (nBank == 0) ? _MEMChip_B0_1_CASL : _MEMChip_B1_1_CASL; + const def_eFaultSource MEMChip_2_CASL = (nBank == 0) ? _MEMChip_B0_2_CASL : _MEMChip_B1_2_CASL; + const def_eFaultSource MEMChip_3_CASL = (nBank == 0) ? _MEMChip_B0_3_CASL : _MEMChip_B1_3_CASL; + + const def_eFaultSource _MEMChip_B0_0_CASH = (ucNumTMU == 0) ? U14_CASH : U13_CASH; + const def_eFaultSource _MEMChip_B0_1_CASH = (ucNumTMU == 0) ? U12_CASH : U11_CASH; + const def_eFaultSource _MEMChip_B0_2_CASH = (ucNumTMU == 0) ? U18_CASH : U16_CASH; + const def_eFaultSource _MEMChip_B0_3_CASH = (ucNumTMU == 0) ? U17_CASH : U15_CASH; + const def_eFaultSource _MEMChip_B1_0_CASH = (ucNumTMU == 0) ? U23_CASH : U27_CASH; + const def_eFaultSource _MEMChip_B1_1_CASH = (ucNumTMU == 0) ? U24_CASH : U28_CASH; + const def_eFaultSource _MEMChip_B1_2_CASH = (ucNumTMU == 0) ? U25_CASH : U29_CASH; + const def_eFaultSource _MEMChip_B1_3_CASH = (ucNumTMU == 0) ? U26_CASH : U30_CASH; + const def_eFaultSource MEMChip_0_CASH = (nBank == 0) ? _MEMChip_B0_0_CASH : _MEMChip_B1_0_CASH; + const def_eFaultSource MEMChip_1_CASH = (nBank == 0) ? _MEMChip_B0_1_CASH : _MEMChip_B1_1_CASH; + const def_eFaultSource MEMChip_2_CASH = (nBank == 0) ? _MEMChip_B0_2_CASH : _MEMChip_B1_2_CASH; + const def_eFaultSource MEMChip_3_CASH = (nBank == 0) ? _MEMChip_B0_3_CASH : _MEMChip_B1_3_CASH; + + const def_eFaultSource _MEMChip_B0_0_RAS = (ucNumTMU == 0) ? U14_RAS : U13_RAS; + const def_eFaultSource _MEMChip_B0_1_RAS = (ucNumTMU == 0) ? U12_RAS : U11_RAS; + const def_eFaultSource _MEMChip_B0_2_RAS = (ucNumTMU == 0) ? U18_RAS : U16_RAS; + const def_eFaultSource _MEMChip_B0_3_RAS = (ucNumTMU == 0) ? U17_RAS : U15_RAS; + const def_eFaultSource _MEMChip_B1_0_RAS = (ucNumTMU == 0) ? U23_RAS : U27_RAS; + const def_eFaultSource _MEMChip_B1_1_RAS = (ucNumTMU == 0) ? U24_RAS : U28_RAS; + const def_eFaultSource _MEMChip_B1_2_RAS = (ucNumTMU == 0) ? U25_RAS : U29_RAS; + const def_eFaultSource _MEMChip_B1_3_RAS = (ucNumTMU == 0) ? U26_RAS : U30_RAS; + const def_eFaultSource MEMChip_0_RAS = (nBank == 0) ? _MEMChip_B0_0_RAS : _MEMChip_B1_0_RAS; + const def_eFaultSource MEMChip_1_RAS = (nBank == 0) ? _MEMChip_B0_1_RAS : _MEMChip_B1_1_RAS; + const def_eFaultSource MEMChip_2_RAS = (nBank == 0) ? _MEMChip_B0_2_RAS : _MEMChip_B1_2_RAS; + const def_eFaultSource MEMChip_3_RAS = (nBank == 0) ? _MEMChip_B0_3_RAS : _MEMChip_B1_3_RAS; + + const def_eFaultSource _MEMChip_B0_0_WE = (ucNumTMU == 0) ? U14_WE : U13_WE; + const def_eFaultSource _MEMChip_B0_1_WE = (ucNumTMU == 0) ? U12_WE : U11_WE; + const def_eFaultSource _MEMChip_B0_2_WE = (ucNumTMU == 0) ? U18_WE : U16_WE; + const def_eFaultSource _MEMChip_B0_3_WE = (ucNumTMU == 0) ? U17_WE : U15_WE; + const def_eFaultSource _MEMChip_B1_0_WE = (ucNumTMU == 0) ? U23_WE : U27_WE; + const def_eFaultSource _MEMChip_B1_1_WE = (ucNumTMU == 0) ? U24_WE : U28_WE; + const def_eFaultSource _MEMChip_B1_2_WE = (ucNumTMU == 0) ? U25_WE : U29_WE; + const def_eFaultSource _MEMChip_B1_3_WE = (ucNumTMU == 0) ? U26_WE : U30_WE; + const def_eFaultSource MEMChip_0_WE = (nBank == 0) ? _MEMChip_B0_0_WE : _MEMChip_B1_0_WE; + const def_eFaultSource MEMChip_1_WE = (nBank == 0) ? _MEMChip_B0_1_WE : _MEMChip_B1_1_WE; + const def_eFaultSource MEMChip_2_WE = (nBank == 0) ? _MEMChip_B0_2_WE : _MEMChip_B1_2_WE; + const def_eFaultSource MEMChip_3_WE = (nBank == 0) ? _MEMChip_B0_3_WE : _MEMChip_B1_3_WE; + + const def_eFaultSource _RES_RAS0 = (ucNumTMU == 0) ? R118 : R115; + const def_eFaultSource _RES_RAS1 = (ucNumTMU == 0) ? R149 : R150; + const def_eFaultSource RES_RAS = (nBank == 0) ? _RES_RAS0 : _RES_RAS1; + const def_eFaultSource RES_CAS = (ucNumTMU == 0) ? RA36 : RA32; + const def_eFaultSource RES_WE = (ucNumTMU == 0) ? R117 : R114; + + clearScreen(sstregs,0x00000000,2,2); + /* set to mem addr */ + ISET(SST_TREX(sstregs,ucNumTMU)->texBaseAddr, (baseAddr >> 3)); + /* draw a 2x2 square */ + drawSquare(sstregs, ucNumTMU, 0, 0, 2); + sst1InitIdle(sst); + + /* first line, to use bits 00..31 */ + const uint32_t L1 = IGET(sst[(SST_LFB_ADDR>>2) + 0]); + /* second line, to use bits 32..63 */ + const uint32_t L2 = IGET(sst[(SST_LFB_ADDR>>2) + (2048>>2) + 0]); + + const uint32_t ErrorMark_L1 = (L1 ^ Val1); + const uint32_t ErrorMark_L2 = (L2 ^ Val2); + + const uint32_t ErrorMark_L1_Other = (L1 ^ ValOther1); + const uint32_t ErrorMark_L2_Other = (L2 ^ ValOther2); + + if(count_bit32(ErrorMark_L1 & 0x0000FFFF) > 4) + { + NbErr++; + + /* If we are reading the value of the other Bank + * then it has to be a bank select problem*/ + if(!bNominal && count_bit32(ErrorMark_L1_Other & 0x0000FFFF) < 4) + { + FaultSource_addScore(pFaultSrcCtx, TMUTexRASCurrent, 1.0/2); + FaultSource_addScore(pFaultSrcCtx, RES_RAS, 1.0/2); + FaultSource_addScore(pFaultSrcCtx, MEMChip_0_RAS, 2.0); + } + else + { + /* WE can fail only in case of plain failure */ + if(count_bit32(ErrorMark_L1 & 0x0000FFFF) > 8) + { + /*WE are shared accross all memory chips so + * we divide the weight by 4.*/ + FaultSource_addScore(pFaultSrcCtx, TMUTexWE, 1.0/4); + FaultSource_addScore(pFaultSrcCtx, RES_WE, 1.0/4); + FaultSource_addScore(pFaultSrcCtx, MEMChip_0_WE, 1.0); + } + + unsigned char bLSBFailed = false; + unsigned char bMSBFailed = false; + if(count_bit32(ErrorMark_L1 & 0x000000FF) > 2) + { + /*CAS are shared accross multiple memory chips so + * we divide the weight by 2.*/ + FaultSource_addScore(pFaultSrcCtx, TMUTexCAS0, 1.0/2); + FaultSource_addScore(pFaultSrcCtx, RES_CAS+1, 1.0/2); + FaultSource_addScore(pFaultSrcCtx, MEMChip_0_CASL, 1.0); + bLSBFailed = true; + } + + if(count_bit32(ErrorMark_L1 & 0x0000FF00) > 2) + { + FaultSource_addScore(pFaultSrcCtx, TMUTexCAS1, 1.0/2);; + FaultSource_addScore(pFaultSrcCtx, RES_CAS+2, 1.0/2); + FaultSource_addScore(pFaultSrcCtx, MEMChip_0_CASH, 1.0); + bMSBFailed = true; + } + + /* RAS is declared failed only if both CAS failed */ + if(bLSBFailed && bMSBFailed) + { + FaultSource_addScore(pFaultSrcCtx, TMUTexRASCurrent, 1.0); + FaultSource_addScore(pFaultSrcCtx, RES_RAS, 1.0); + FaultSource_addScore(pFaultSrcCtx, MEMChip_0_RAS, 4.0); + } + } + } + + if(count_bit32(ErrorMark_L1 & 0xFFFF0000) > 4) + { + NbErr++; + + if(!bNominal && count_bit32(ErrorMark_L1_Other & 0xFFFF0000) < 4) + { + FaultSource_addScore(pFaultSrcCtx, TMUTexRASCurrent, 1.0/2); + FaultSource_addScore(pFaultSrcCtx, RES_RAS, 1.0/2); + FaultSource_addScore(pFaultSrcCtx, MEMChip_1_RAS, 2.0); + } + else + { + if(count_bit32(ErrorMark_L1 & 0xFFFF0000) > 8) + { + FaultSource_addScore(pFaultSrcCtx, TMUTexWE, 1.0/4); + FaultSource_addScore(pFaultSrcCtx, RES_WE, 1.0/4); + FaultSource_addScore(pFaultSrcCtx, MEMChip_1_WE, 1.0); + } + + unsigned char bLSBFailed = false; + unsigned char bMSBFailed = false; + if(count_bit32(ErrorMark_L1 & 0x00FF0000) > 2) + { + FaultSource_addScore(pFaultSrcCtx, TMUTexCAS0, 1.0/2); + FaultSource_addScore(pFaultSrcCtx, RES_CAS+1, 1.0/2); + FaultSource_addScore(pFaultSrcCtx, MEMChip_1_CASL, 1.0); + bLSBFailed = true; + } + + if(count_bit32(ErrorMark_L1 & 0xFF000000) > 2) + { + FaultSource_addScore(pFaultSrcCtx, TMUTexCAS1, 1.0/2);; + FaultSource_addScore(pFaultSrcCtx, RES_CAS+2, 1.0/2); + FaultSource_addScore(pFaultSrcCtx, MEMChip_1_CASH, 1.0); + bMSBFailed = true; + } + + if(bLSBFailed && bMSBFailed) + { + FaultSource_addScore(pFaultSrcCtx, TMUTexRASCurrent, 1.0); + FaultSource_addScore(pFaultSrcCtx, RES_RAS, 1.0); + FaultSource_addScore(pFaultSrcCtx, MEMChip_1_RAS, 4.0); + } + } + } + + if(count_bit32(ErrorMark_L2 & 0x0000FFFF) > 4) + { + NbErr++; + + if(!bNominal && count_bit32(ErrorMark_L2_Other & 0x0000FFFF) < 4) + { + FaultSource_addScore(pFaultSrcCtx, TMUTexRASCurrent, 1.0/2); + FaultSource_addScore(pFaultSrcCtx, RES_RAS, 1.0/2); + FaultSource_addScore(pFaultSrcCtx, MEMChip_2_RAS, 2.0); + } + else + { + if(count_bit32(ErrorMark_L2 & 0x0000FFFF) > 8) + { + FaultSource_addScore(pFaultSrcCtx, TMUTexWE, 1.0/4); + FaultSource_addScore(pFaultSrcCtx, RES_WE, 1.0/4); + FaultSource_addScore(pFaultSrcCtx, MEMChip_2_WE, 1.0); + } + + unsigned char bLSBFailed = false; + unsigned char bMSBFailed = false; + if(count_bit32(ErrorMark_L2 & 0x000000FF) > 2) + { + FaultSource_addScore(pFaultSrcCtx, TMUTexCAS2, 1.0/2); + FaultSource_addScore(pFaultSrcCtx, RES_CAS+3, 1.0/2); + FaultSource_addScore(pFaultSrcCtx, MEMChip_2_CASL, 1.0); + bLSBFailed = true; + } + + if(count_bit32(ErrorMark_L2 & 0x0000FF00) > 2) + { + FaultSource_addScore(pFaultSrcCtx, TMUTexCAS3, 1.0/2);; + FaultSource_addScore(pFaultSrcCtx, RES_CAS+4, 1.0/2); + FaultSource_addScore(pFaultSrcCtx, MEMChip_2_CASH, 1.0); + bMSBFailed = true; + } + + if(bLSBFailed && bMSBFailed) + { + FaultSource_addScore(pFaultSrcCtx, TMUTexRASCurrent, 1.0); + FaultSource_addScore(pFaultSrcCtx, RES_RAS, 1.0); + FaultSource_addScore(pFaultSrcCtx, MEMChip_2_RAS, 4.0); + } + } + } + + if(count_bit32(ErrorMark_L2 & 0xFFFF0000) > 4) + { + NbErr++; + + if(!bNominal && count_bit32(ErrorMark_L2_Other & 0xFFFF0000) < 4) + { + FaultSource_addScore(pFaultSrcCtx, TMUTexRASCurrent, 1.0/2); + FaultSource_addScore(pFaultSrcCtx, RES_RAS, 1.0/2); + FaultSource_addScore(pFaultSrcCtx, MEMChip_3_RAS, 2.0); + } + else + { + if(count_bit32(ErrorMark_L2 & 0xFFFF0000) > 8) + { + FaultSource_addScore(pFaultSrcCtx, TMUTexWE, 1.0/4); + FaultSource_addScore(pFaultSrcCtx, RES_WE, 1.0/4); + FaultSource_addScore(pFaultSrcCtx, MEMChip_3_WE, 1.0); + } + + unsigned char bLSBFailed = false; + unsigned char bMSBFailed = false; + if(count_bit32(ErrorMark_L2 & 0x00FF0000) > 2) + { + FaultSource_addScore(pFaultSrcCtx, TMUTexCAS2, 1.0/2); + FaultSource_addScore(pFaultSrcCtx, RES_CAS+3, 1.0/2); + FaultSource_addScore(pFaultSrcCtx, MEMChip_3_CASL, 1.0); + bLSBFailed = true; + } + + if(count_bit32(ErrorMark_L2 & 0xFF000000) > 2) + { + FaultSource_addScore(pFaultSrcCtx, TMUTexCAS3, 1.0/2);; + FaultSource_addScore(pFaultSrcCtx, RES_CAS+4, 1.0/2); + FaultSource_addScore(pFaultSrcCtx, MEMChip_3_CASH, 1.0); + bMSBFailed = true; + } + + if(bLSBFailed && bMSBFailed) + { + FaultSource_addScore(pFaultSrcCtx, TMUTexRASCurrent, 1.0); + FaultSource_addScore(pFaultSrcCtx, RES_RAS, 1.0); + FaultSource_addScore(pFaultSrcCtx, MEMChip_3_RAS, 4.0); + } + } + } + + return NbErr; +} + +unsigned long +TestControl( sst1DeviceInfoStruct * const devInfo, + FxU32 * const sst, + SstRegs * const sstregs, + const char ucNumTMU, + const unsigned char RamSizeMB, + def_sFaultSourceScoreRec * const pFaultSrcCtx) +{ + unsigned long NbErr=0; + + sst1InitIdle(sst); + unsigned long _trexInit0 = IGET(SST_TREX(sstregs,ucNumTMU)->trexInit0); + devInfo->tmuInit0[(int)ucNumTMU] = SST_TREXINIT0_DEFAULT ; + ISET(SST_TREX(sstregs,ucNumTMU)->trexInit0, devInfo->tmuInit0[(int)ucNumTMU]); + sst1InitIdle(sst); + + /* set downstream TMUs to passthrough */ + for (int i=0; itextureMode, SST_TC_PASS | SST_TCA_PASS); + + const uint32_t TestVal1 = get_notnull_random_balanced_mByte(); + logT("TestVal1 = %08X\n",TestVal1); + + uint32_t TestVal2 = 0; + do + { + TestVal2 = get_notnull_random_balanced_mByte(); + } + while((count_bit32((TestVal2 ^ TestVal1)) < 12)); + logT("TestVal2 = %08X\n",TestVal2); + + uint32_t TestValBlank1 = 0; + do + { + TestValBlank1 = get_notnull_random_balanced_mByte(); + } + while( (count_bit32((TestValBlank1 ^ TestVal1) & 0x0000FFFF) < 6) + || (count_bit32((TestValBlank1 ^ TestVal1) & 0xFFFF0000) < 6) + || (count_bit32((TestValBlank1 ^ TestVal2)) < 12)); + logT("TestValBlank1 = %08X\n", TestValBlank1); + + uint32_t TestValBlank2 = 0; + do + { + TestValBlank2 = get_notnull_random_balanced_mByte(); + } + while( (count_bit32((TestValBlank2 ^ TestVal2) & 0x0000FFFF) < 6) + || (count_bit32((TestValBlank2 ^ TestVal2) & 0xFFFF0000) < 6) + || (count_bit32((TestValBlank2 ^ TestValBlank1)) < 12) + || (count_bit32((TestValBlank2 ^ TestVal1)) < 12)); + logT("TestValBlank2 = %08X\n", TestValBlank2); + + /* write initial Values */ + /* Bank 0*/ + WriteTex(sst, sstregs, 0x000000, ucNumTMU, TestValBlank1, TestValBlank2); + /* Bank 1*/ + if(RamSizeMB>2) + { + WriteTex(sst, sstregs, 0x200000, ucNumTMU, TestValBlank1, TestValBlank2); + } + + /* write to Bank 0 */ + WriteTex(sst, sstregs, 0x000000, ucNumTMU, TestVal1, TestVal2); + + /* read and check Bank 0 (nominal check)*/ + NbErr += CheckRead(sst, sstregs, 0x000000, ucNumTMU, + true, TestVal1, TestVal2, TestValBlank1, TestValBlank2, pFaultSrcCtx); + /* if Bank 1 available*/ + if(RamSizeMB>2) + { + /* read and check Bank 1(no modification check)*/ + NbErr += CheckRead(sst, sstregs, 0x200000, ucNumTMU, + false, TestValBlank1, TestValBlank2, TestVal1, TestVal2, pFaultSrcCtx); + + /* write initial Values */ + /* Bank 0*/ + WriteTex(sst, sstregs, 0x000000, ucNumTMU, TestValBlank1, TestValBlank2); + /* Bank 1*/ + if(RamSizeMB>2) + { + WriteTex(sst, sstregs, 0x200000, ucNumTMU, TestValBlank1, TestValBlank2); + } + + /* write to Bank 1 */ + WriteTex(sst, sstregs, 0x200000, ucNumTMU, TestVal1, TestVal2); + + /* read and check Bank 1 (nominal check)*/ + NbErr += CheckRead(sst, sstregs, 0x200000, ucNumTMU, + true, TestVal1, TestVal2, TestValBlank1, TestValBlank2, pFaultSrcCtx); + + /* read and check Bank 0 (no modification check)*/ + NbErr += CheckRead(sst, sstregs, 0x000000, ucNumTMU, + false, TestValBlank1, TestValBlank2, TestVal1, TestVal2, pFaultSrcCtx); + } + + clearScreen(sstregs,0x00000000,2,2); + + sst1InitIdle(sst); + devInfo->tmuInit0[(int)ucNumTMU] = _trexInit0; + ISET(SST_TREX(sst,ucNumTMU)->trexInit0, devInfo->tmuInit0[(int)ucNumTMU]); + sst1InitIdle(sst); + + return NbErr; +} diff --git a/Test_Control.h b/Test_Control.h new file mode 100644 index 0000000..7176c57 --- /dev/null +++ b/Test_Control.h @@ -0,0 +1,29 @@ +/* V2MemTest - A CLI Tool to test & fix Voodoo² TMU System +* Copyright (C) 2026 ChaCha +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see . +*/ + +#ifndef _DEF_TEST_CONTROL_H_ +#define _DEF_TEST_CONTROL_H_ + +unsigned long +TestControl(sst1DeviceInfoStruct * const devInfo, + FxU32 * const sst, + SstRegs * const sstregs, + const char ucNumTMU, + const unsigned char RamSizeMB, + def_sFaultSourceScoreRec * const pFaultSrcCtx); + +#endif //_DEF_TEST_CONTROL_H_ diff --git a/Test_Data.c b/Test_Data.c index 39ec4da..e70ae93 100644 --- a/Test_Data.c +++ b/Test_Data.c @@ -14,6 +14,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ + #define _BSD_SOURCE 1 #include #include @@ -33,13 +34,14 @@ #include "Test_Data.h" static unsigned long long -RenderTest( sst1DeviceInfoStruct* devInfo, - FxU32* sst, - SstRegs *sstregs, +RenderTest( sst1DeviceInfoStruct * const devInfo, + FxU32 * const sst, + SstRegs * const sstregs, const char ucNumTMU, const FxU32 mem, const FxU32 value1, const FxU32 value2, + const unsigned char RamSizeMB, def_sFaultSourceScoreRec* const pFaultSrcCtx) { unsigned long long NbErr = 0; @@ -51,7 +53,7 @@ RenderTest( sst1DeviceInfoStruct* devInfo, ISET(SST_TREX(sstregs,ucNumTMU)->trexInit0, devInfo->tmuInit0[(int)ucNumTMU]); sst1InitIdle(sst); - ISET(sstregs->texBaseAddr, mem>>3); + ISET(SST_TREX(sstregs,ucNumTMU)->texBaseAddr, mem>>3); /* Writing to first texture line, to use RAM bits 0..31 */ volatile FxU32 *texAddr @@ -68,7 +70,7 @@ RenderTest( sst1DeviceInfoStruct* devInfo, clearScreen(sstregs,0x00000000,8,2); /* draw a 2x2 rectangle */ - drawRect(sstregs,0,0,2,2); + drawRect(sstregs, ucNumTMU, 0, 0, 2, 2); sst1InitIdle(sst); /* reading back first line pixels addresses */ @@ -89,8 +91,9 @@ RenderTest( sst1DeviceInfoStruct* devInfo, logD("===========================================================\n"); logD( "# fault on 1st line, value : 0x%04X [expected 0x%04X] !\n", value1, L1_1); - - WordBitFaultSet(pFaultSrcCtx, ErrorMark_L1, 1.0 / 16, U9_TMU0_TF_DATA_0, U9_TMU0_TF_DATA_0); + + LWordBitFaultSet(pFaultSrcCtx, ErrorMark_L1, 1.0 / 16, U9_TMU0_TF_DATA_0, U9_TMU0_TF_DATA_0); + LWordBitFaultSet(pFaultSrcCtx, ErrorMark_L1, 1.0 / 16, U3_FBI_TF_DATA_0, U3_FBI_TF_DATA_0); QuartetBitFaultSet(pFaultSrcCtx, ErrorMark_L1 >> 0, 1.0 / 16, RA10_1); QuartetBitFaultSet(pFaultSrcCtx, ErrorMark_L1 >> 4, 1.0 / 16, RA11_1); QuartetBitFaultSet(pFaultSrcCtx, ErrorMark_L1 >> 8, 1.0 / 16, RA12_1); @@ -102,50 +105,29 @@ RenderTest( sst1DeviceInfoStruct* devInfo, if(ucNumTMU == 0) { - WordBitFaultSet(pFaultSrcCtx, ErrorMark_L1, 1.0 / 16, U9_TMU0_FT_DATA_0, U9_TMU0_FT_DATA_0); + LWordBitFaultSet(pFaultSrcCtx, ErrorMark_L1, 1.0 / 16, U9_TMU0_FT_DATA_0, U9_TMU0_FT_DATA_0); MemChipDQFaultSet(pFaultSrcCtx, ErrorMark_L1, dScoreFront, U14, U12); - MemChipDQFaultSet(pFaultSrcCtx, ErrorMark_L1, dScoreBack, U23, U24); - WordBitFaultSet(pFaultSrcCtx,ErrorMark_L1, 1.0 / 4, U9_TMU0 + 1, U9_TMU0 + 16 + 1); - - TMUTexDataCtrlFaultSet( pFaultSrcCtx, - ErrorMark_L1, - 1.0 / 8, - U9_TMU0_TEX_CAS0, - U9_TMU0_TEX_CAS1, - mem < 0x200000 ? - U9_TMU0_TEX_RAS0 - : U9_TMU0_TEX_RAS1, - U9_TMU0_TEX_WE); + if(RamSizeMB>2) + MemChipDQFaultSet(pFaultSrcCtx, ErrorMark_L1, dScoreBack, U23, U24); + LWordBitFaultSet(pFaultSrcCtx,ErrorMark_L1, 1.0 / 4, U9_TMU0 + 1, U9_TMU0 + 16 + 1); } else { /* during TMU1 test, TMU0 doesnt receive any textures => ignoring these - WordBitFaultSet(pFaultSrcCtx, ErrorMark_L1, 1.0 / 2, U9_TMU0_FT_DATA_0, U9_TMU0_FT_DATA_0); + LWordBitFaultSet(pFaultSrcCtx, ErrorMark_L1, 1.0 / 2, U9_TMU0_FT_DATA_0, U9_TMU0_FT_DATA_0); */ /* U9_TMU0_TT_DATA_x is only tested when using TMU1 */ - WordBitFaultSet(pFaultSrcCtx, ErrorMark_L1, 1.0 / 16, U9_TMU0_TT_DATA_0, U9_TMU0_TT_DATA_0); - WordBitFaultSet(pFaultSrcCtx, ErrorMark_L1, 1.0 / 16, TT_TDATA_R131, TT_TDATA_R131); - WordBitFaultSet(pFaultSrcCtx, ErrorMark_L1, 1.0 / 16, U8_TMU1_TF_DATA_0, U8_TMU1_TF_DATA_0); - WordBitFaultSet(pFaultSrcCtx, ErrorMark_L1, 1.0 / 16, U8_TMU1_FT_DATA_0, U8_TMU1_FT_DATA_0); + LWordBitFaultSet(pFaultSrcCtx, ErrorMark_L1, 1.0 / 16, U9_TMU0_TT_DATA_0, U9_TMU0_TT_DATA_0); + LWordBitFaultSet(pFaultSrcCtx, ErrorMark_L1, 1.0 / 16, TT_TDATA_R131, TT_TDATA_R131); + LWordBitFaultSet(pFaultSrcCtx, ErrorMark_L1, 1.0 / 16, U8_TMU1_TF_DATA_0, U8_TMU1_TF_DATA_0); + LWordBitFaultSet(pFaultSrcCtx, ErrorMark_L1, 1.0 / 16, U8_TMU1_FT_DATA_0, U8_TMU1_FT_DATA_0); MemChipDQFaultSet(pFaultSrcCtx, ErrorMark_L1, dScoreFront, U13, U11); - MemChipDQFaultSet(pFaultSrcCtx, ErrorMark_L1, dScoreBack, U27, U28); - WordBitFaultSet(pFaultSrcCtx,ErrorMark_L1, 1.0 / 4, U8_TMU1 + 1, U8_TMU1 + 16 + 1); - - - TMUTexDataCtrlFaultSet( pFaultSrcCtx, - ErrorMark_L1, - 1.0 / 8, - U8_TMU1_TEX_CAS0, - U8_TMU1_TEX_CAS1, - mem < 0x200000 ? - U8_TMU1_TEX_RAS0 - : U8_TMU1_TEX_RAS1, - U8_TMU1_TEX_WE); + if(RamSizeMB>2) + MemChipDQFaultSet(pFaultSrcCtx, ErrorMark_L1, dScoreBack, U27, U28); + LWordBitFaultSet(pFaultSrcCtx,ErrorMark_L1, 1.0 / 4, U8_TMU1 + 1, U8_TMU1 + 16 + 1); } - - logD("## overall fault LW bit-map : \n"); if(sOptions.eLogLevel >= E_LOGLEVEL__DEBUG) { @@ -160,8 +142,9 @@ RenderTest( sst1DeviceInfoStruct* devInfo, logD("===========================================================\n"); logD( "# fault on 2nd line, value : 0x%04X [expected 0x%04X] !\n", value2, L2_1); - - WordBitFaultSet(pFaultSrcCtx, ErrorMark_L2, 1.0 / 16, U9_TMU0_TF_DATA_0, U9_TMU0_TF_DATA_0); + + LWordBitFaultSet(pFaultSrcCtx, ErrorMark_L2, 1.0 / 16, U9_TMU0_TF_DATA_0, U9_TMU0_TF_DATA_0); + LWordBitFaultSet(pFaultSrcCtx, ErrorMark_L1, 1.0 / 16, U3_FBI_TF_DATA_0, U3_FBI_TF_DATA_0); QuartetBitFaultSet(pFaultSrcCtx, ErrorMark_L2 >> 0, 1.0 / 16, RA10_1); QuartetBitFaultSet(pFaultSrcCtx, ErrorMark_L2 >> 4, 1.0 / 16, RA11_1); QuartetBitFaultSet(pFaultSrcCtx, ErrorMark_L2 >> 8, 1.0 / 16, RA12_1); @@ -173,43 +156,27 @@ RenderTest( sst1DeviceInfoStruct* devInfo, if(ucNumTMU == 0) { - WordBitFaultSet(pFaultSrcCtx, ErrorMark_L2, 1.0 / 16, U9_TMU0_FT_DATA_0, U9_TMU0_FT_DATA_0); + LWordBitFaultSet(pFaultSrcCtx, ErrorMark_L2, 1.0 / 16, U9_TMU0_FT_DATA_0, U9_TMU0_FT_DATA_0); MemChipDQFaultSet(pFaultSrcCtx, ErrorMark_L2, dScoreFront, U18, U17); - MemChipDQFaultSet(pFaultSrcCtx, ErrorMark_L2, dScoreBack, U25, U26); - WordBitFaultSet(pFaultSrcCtx,ErrorMark_L2, 1.0 / 4, U9_TMU0 + 32 + 1, U9_TMU0 + 48 + 1); - - TMUTexDataCtrlFaultSet( pFaultSrcCtx, - ErrorMark_L2, - 1.0 / 8, - U9_TMU0_TEX_CAS2, - U9_TMU0_TEX_CAS3, - mem < 0x200000 ? U9_TMU0_TEX_RAS0 : U9_TMU0_TEX_RAS1, - U9_TMU0_TEX_WE); + if(RamSizeMB>2) + MemChipDQFaultSet(pFaultSrcCtx, ErrorMark_L2, dScoreBack, U25, U26); + LWordBitFaultSet(pFaultSrcCtx,ErrorMark_L2, 1.0 / 4, U9_TMU0 + 32 + 1, U9_TMU0 + 48 + 1); } else { /* during TMU1 test, TMU0 doesnt receive any textures => ignoring these - WordBitFaultSet(pFaultSrcCtx, ErrorMark_L2, 1.0 / 2, U9_TMU0_FT_DATA_0, U9_TMU0_FT_DATA_0); + LWordBitFaultSet(pFaultSrcCtx, ErrorMark_L2, 1.0 / 2, U9_TMU0_FT_DATA_0, U9_TMU0_FT_DATA_0); */ /* U9_TMU0_TT_DATA_x is only tested when using TMU1 */ - WordBitFaultSet(pFaultSrcCtx, ErrorMark_L2, 1.0 / 16, U9_TMU0_TT_DATA_0, U9_TMU0_TT_DATA_0); - WordBitFaultSet(pFaultSrcCtx, ErrorMark_L2, 1.0 / 16, TT_TDATA_R131, TT_TDATA_R131); - WordBitFaultSet(pFaultSrcCtx, ErrorMark_L2, 1.0 / 16, U8_TMU1_TF_DATA_0, U8_TMU1_TF_DATA_0); - WordBitFaultSet(pFaultSrcCtx, ErrorMark_L2, 1.0 / 16, U8_TMU1_FT_DATA_0, U8_TMU1_FT_DATA_0); + LWordBitFaultSet(pFaultSrcCtx, ErrorMark_L2, 1.0 / 16, U9_TMU0_TT_DATA_0, U9_TMU0_TT_DATA_0); + LWordBitFaultSet(pFaultSrcCtx, ErrorMark_L2, 1.0 / 16, TT_TDATA_R131, TT_TDATA_R131); + LWordBitFaultSet(pFaultSrcCtx, ErrorMark_L2, 1.0 / 16, U8_TMU1_TF_DATA_0, U8_TMU1_TF_DATA_0); + LWordBitFaultSet(pFaultSrcCtx, ErrorMark_L2, 1.0 / 16, U8_TMU1_FT_DATA_0, U8_TMU1_FT_DATA_0); MemChipDQFaultSet(pFaultSrcCtx, ErrorMark_L2, dScoreFront, U16, U15); - MemChipDQFaultSet(pFaultSrcCtx, ErrorMark_L2, dScoreBack, U29, U30); - WordBitFaultSet(pFaultSrcCtx,ErrorMark_L2, 1.0 / 4, U8_TMU1 + 32 + 1, U8_TMU1 + 48 + 1); - - TMUTexDataCtrlFaultSet( pFaultSrcCtx, - ErrorMark_L2, - 1.0 / 8, - U8_TMU1_TEX_CAS2, - U8_TMU1_TEX_CAS3, - mem < 0x200000 ? - U8_TMU1_TEX_RAS0 - : U8_TMU1_TEX_RAS1, - U8_TMU1_TEX_WE); + if(RamSizeMB>2) + MemChipDQFaultSet(pFaultSrcCtx, ErrorMark_L2, dScoreBack, U29, U30); + LWordBitFaultSet(pFaultSrcCtx,ErrorMark_L2, 1.0 / 4, U8_TMU1 + 32 + 1, U8_TMU1 + 48 + 1); } logD("## overall fault LW bit-map : \n"); if(sOptions.eLogLevel >= E_LOGLEVEL__DEBUG) @@ -231,9 +198,9 @@ RenderTest( sst1DeviceInfoStruct* devInfo, } unsigned long long -test_TMU_datalines( sst1DeviceInfoStruct* devInfo, - FxU32* sst, - SstRegs *sstregs, +test_TMU_datalines( sst1DeviceInfoStruct * const devInfo, + FxU32 * const sst, + SstRegs * const sstregs, const unsigned char ucNumTMU, const unsigned char bRandom, const unsigned char RamSizeMB, @@ -298,12 +265,13 @@ test_TMU_datalines( sst1DeviceInfoStruct* devInfo, addrTest, bitTest, bitTest2, + RamSizeMB, pFaultSrcCtx); ullNbErrorAll += ulNbError; if((bRandom && (nloop > 64)) || bitTest == 0) break; - + bitTest = bRandom ? get_notnull_random_balanced_mByte() : (bitTest << 1); diff --git a/Test_Data.h b/Test_Data.h index af8b960..e4f9e33 100644 --- a/Test_Data.h +++ b/Test_Data.h @@ -19,9 +19,9 @@ #define _DEF_TEST_DATA_H_ unsigned long long -test_TMU_datalines( sst1DeviceInfoStruct* devInfo, - FxU32* sst, - SstRegs *sstregs, +test_TMU_datalines( sst1DeviceInfoStruct * const devInfo, + FxU32 * const sst, + SstRegs * const sstregs, const unsigned char ucNumTMU, const unsigned char bRandom, const unsigned char RamSizeMB, diff --git a/Test_Data_Huge.c b/Test_Data_Huge.c index d43b1a9..bb90314 100644 --- a/Test_Data_Huge.c +++ b/Test_Data_Huge.c @@ -110,14 +110,17 @@ static const def_sFaultSheet sFaultSheet[MAX_TMU][2] = }; static void -AssignFault(const def_sFaultSheet* psCurFaultSheet, +AssignFault(const def_sFaultSheet * const + psCurFaultSheet, const FxU32 mem, const unsigned char bitIdx, const unsigned char _relbitIdx, const unsigned char _relbitIdxWord, const unsigned char _relbitIdxQuartet, const unsigned char WordIdx, - def_sFaultSourceScoreRec* const pFaultSrcCtx) + const unsigned char RamSizeMB, + def_sFaultSourceScoreRec * const + pFaultSrcCtx) { //const unsigned char relbitIdxQuartet= bitIdx%4; const unsigned char relbitIdxQuartet = _relbitIdxQuartet; @@ -156,6 +159,12 @@ AssignFault(const def_sFaultSheet* psCurFaultSheet, + 97 //U9_TMU0_TF_DATA_x + relbitIdxWord, 1.0/4); + + FaultSource_addScore( pFaultSrcCtx, + U3_FBI_TF_DATA_0 + + relbitIdxWord, + 1.0/4); + switch(WordIdx) { case 0: @@ -234,11 +243,12 @@ AssignFault(const def_sFaultSheet* psCurFaultSheet, + 1 + relbitIdxWord, 1.0/2); //ok - FaultSource_addScore( pFaultSrcCtx, - psCurFaultSheet->Ux_MEMChip_AltMSB - + 1 - + relbitIdxWord, - 1.0/4); + if(RamSizeMB>2) + FaultSource_addScore( pFaultSrcCtx, + psCurFaultSheet->Ux_MEMChip_AltMSB + + 1 + + relbitIdxWord, + 1.0/4); } else { @@ -251,11 +261,12 @@ AssignFault(const def_sFaultSheet* psCurFaultSheet, + 1 + relbitIdxWord, 1.0/2); - FaultSource_addScore( pFaultSrcCtx, - psCurFaultSheet->Ux_MEMChip_AltLSB - + 1 - + relbitIdxWord, - 1.0/4); + if(RamSizeMB>2) + FaultSource_addScore( pFaultSrcCtx, + psCurFaultSheet->Ux_MEMChip_AltLSB + + 1 + + relbitIdxWord, + 1.0/4); } logD( "- TMUx_TEXDATA_x_x : %s\n", @@ -306,12 +317,15 @@ AssignFault(const def_sFaultSheet* psCurFaultSheet, } static unsigned long long -RenderTest( sst1DeviceInfoStruct* devInfo, - FxU32* sst, - SstRegs *sstregs, - const char ucNumTMU, - const FxU32 mem, - def_sFaultSourceScoreRec* const pFaultSrcCtx) +RenderTest( sst1DeviceInfoStruct * const + devInfo, + FxU32 * const sst, + SstRegs * const sstregs, + const char ucNumTMU, + const FxU32 mem, + const unsigned char RamSizeMB, + def_sFaultSourceScoreRec * const + pFaultSrcCtx) { unsigned long long NbErr = 0; static char szBuff[1024]; @@ -340,7 +354,7 @@ RenderTest( sst1DeviceInfoStruct* devInfo, /* Setting texture base address window for both CPU and TMU */ - ISET(sstregs->texBaseAddr, (mem>>3)); + ISET(SST_TREX(sstregs,ucNumTMU)->texBaseAddr, (mem>>3)); /* Setting texture base address (to access it from CPU). * We wont draw anything bigger than the texture so we can just use LOD0 @@ -389,7 +403,7 @@ RenderTest( sst1DeviceInfoStruct* devInfo, #endif /* draw a 256x256 square */ - drawSquare(sstregs, 0, 0, 256); + drawSquare(sstregs, ucNumTMU, 0, 0, 256); sst1InitIdle(sst); #ifdef _PROFILING @@ -479,34 +493,34 @@ RenderTest( sst1DeviceInfoStruct* devInfo, if(ErrorMark_Lx & 0x0000000Fu) { /*All calls have a lot of pre-computed const values to fast things up.*/ - if(ErrorMark_Lx & 0x00000001u) AssignFault(psCurFaultSheet,mem,0,0,0,0,0,pFaultSrcCtx); - if(ErrorMark_Lx & 0x00000002u) AssignFault(psCurFaultSheet,mem,1,1,1,1,0,pFaultSrcCtx); - if(ErrorMark_Lx & 0x00000004u) AssignFault(psCurFaultSheet,mem,2,2,2,2,0,pFaultSrcCtx); - if(ErrorMark_Lx & 0x00000008u) AssignFault(psCurFaultSheet,mem,3,3,3,3,0,pFaultSrcCtx); + if(ErrorMark_Lx & 0x00000001u) AssignFault(psCurFaultSheet,mem,0,0,0,0,0,RamSizeMB,pFaultSrcCtx); + if(ErrorMark_Lx & 0x00000002u) AssignFault(psCurFaultSheet,mem,1,1,1,1,0,RamSizeMB,pFaultSrcCtx); + if(ErrorMark_Lx & 0x00000004u) AssignFault(psCurFaultSheet,mem,2,2,2,2,0,RamSizeMB,pFaultSrcCtx); + if(ErrorMark_Lx & 0x00000008u) AssignFault(psCurFaultSheet,mem,3,3,3,3,0,RamSizeMB,pFaultSrcCtx); } if(ErrorMark_Lx & 0x000000F0u) { - if(ErrorMark_Lx & 0x00000010u) AssignFault(psCurFaultSheet,mem,4,4,4,0,0,pFaultSrcCtx); - if(ErrorMark_Lx & 0x00000020u) AssignFault(psCurFaultSheet,mem,5,5,5,1,0,pFaultSrcCtx); - if(ErrorMark_Lx & 0x00000040u) AssignFault(psCurFaultSheet,mem,6,6,6,2,0,pFaultSrcCtx); - if(ErrorMark_Lx & 0x00000080u) AssignFault(psCurFaultSheet,mem,7,7,7,3,0,pFaultSrcCtx); + if(ErrorMark_Lx & 0x00000010u) AssignFault(psCurFaultSheet,mem,4,4,4,0,0,RamSizeMB,pFaultSrcCtx); + if(ErrorMark_Lx & 0x00000020u) AssignFault(psCurFaultSheet,mem,5,5,5,1,0,RamSizeMB,pFaultSrcCtx); + if(ErrorMark_Lx & 0x00000040u) AssignFault(psCurFaultSheet,mem,6,6,6,2,0,RamSizeMB,pFaultSrcCtx); + if(ErrorMark_Lx & 0x00000080u) AssignFault(psCurFaultSheet,mem,7,7,7,3,0,RamSizeMB,pFaultSrcCtx); } } if(ErrorMark_Lx & 0x0000FF00u) { if(ErrorMark_Lx & 0x00000F00u) { - if(ErrorMark_Lx & 0x00000100u) AssignFault(psCurFaultSheet,mem,8,0, 8, 0,1,pFaultSrcCtx); - if(ErrorMark_Lx & 0x00000200u) AssignFault(psCurFaultSheet,mem,9,1, 9, 1,1,pFaultSrcCtx); - if(ErrorMark_Lx & 0x00000400u) AssignFault(psCurFaultSheet,mem,10,2,10,2,1,pFaultSrcCtx); - if(ErrorMark_Lx & 0x00000800u) AssignFault(psCurFaultSheet,mem,11,3,11,3,1,pFaultSrcCtx); + if(ErrorMark_Lx & 0x00000100u) AssignFault(psCurFaultSheet,mem,8,0, 8, 0,1,RamSizeMB,pFaultSrcCtx); + if(ErrorMark_Lx & 0x00000200u) AssignFault(psCurFaultSheet,mem,9,1, 9, 1,1,RamSizeMB,pFaultSrcCtx); + if(ErrorMark_Lx & 0x00000400u) AssignFault(psCurFaultSheet,mem,10,2,10,2,1,RamSizeMB,pFaultSrcCtx); + if(ErrorMark_Lx & 0x00000800u) AssignFault(psCurFaultSheet,mem,11,3,11,3,1,RamSizeMB,pFaultSrcCtx); } if(ErrorMark_Lx & 0x0000F000u) { - if(ErrorMark_Lx & 0x00001000u) AssignFault(psCurFaultSheet,mem,12,4,12,0,1,pFaultSrcCtx); - if(ErrorMark_Lx & 0x00002000u) AssignFault(psCurFaultSheet,mem,13,5,13,1,1,pFaultSrcCtx); - if(ErrorMark_Lx & 0x00004000u) AssignFault(psCurFaultSheet,mem,14,6,14,2,1,pFaultSrcCtx); - if(ErrorMark_Lx & 0x00008000u) AssignFault(psCurFaultSheet,mem,15,7,15,3,1,pFaultSrcCtx); + if(ErrorMark_Lx & 0x00001000u) AssignFault(psCurFaultSheet,mem,12,4,12,0,1,RamSizeMB,pFaultSrcCtx); + if(ErrorMark_Lx & 0x00002000u) AssignFault(psCurFaultSheet,mem,13,5,13,1,1,RamSizeMB,pFaultSrcCtx); + if(ErrorMark_Lx & 0x00004000u) AssignFault(psCurFaultSheet,mem,14,6,14,2,1,RamSizeMB,pFaultSrcCtx); + if(ErrorMark_Lx & 0x00008000u) AssignFault(psCurFaultSheet,mem,15,7,15,3,1,RamSizeMB,pFaultSrcCtx); } } } @@ -521,34 +535,34 @@ RenderTest( sst1DeviceInfoStruct* devInfo, { if(ErrorMark_Lx & 0x000F0000u) { - if(ErrorMark_Lx & 0x00010000u) AssignFault(psCurFaultSheet,mem,16,0,0,0,2,pFaultSrcCtx); - if(ErrorMark_Lx & 0x00020000u) AssignFault(psCurFaultSheet,mem,17,1,1,1,2,pFaultSrcCtx); - if(ErrorMark_Lx & 0x00040000u) AssignFault(psCurFaultSheet,mem,18,2,2,2,2,pFaultSrcCtx); - if(ErrorMark_Lx & 0x00080000u) AssignFault(psCurFaultSheet,mem,19,3,3,3,2,pFaultSrcCtx); + if(ErrorMark_Lx & 0x00010000u) AssignFault(psCurFaultSheet,mem,16,0,0,0,2,RamSizeMB,pFaultSrcCtx); + if(ErrorMark_Lx & 0x00020000u) AssignFault(psCurFaultSheet,mem,17,1,1,1,2,RamSizeMB,pFaultSrcCtx); + if(ErrorMark_Lx & 0x00040000u) AssignFault(psCurFaultSheet,mem,18,2,2,2,2,RamSizeMB,pFaultSrcCtx); + if(ErrorMark_Lx & 0x00080000u) AssignFault(psCurFaultSheet,mem,19,3,3,3,2,RamSizeMB,pFaultSrcCtx); } if(ErrorMark_Lx & 0x00F00000u) { - if(ErrorMark_Lx & 0x00100000u) AssignFault(psCurFaultSheet,mem,20,4,4,0,2,pFaultSrcCtx); - if(ErrorMark_Lx & 0x00200000u) AssignFault(psCurFaultSheet,mem,21,5,5,1,2,pFaultSrcCtx); - if(ErrorMark_Lx & 0x00400000u) AssignFault(psCurFaultSheet,mem,22,6,6,2,2,pFaultSrcCtx); - if(ErrorMark_Lx & 0x00800000u) AssignFault(psCurFaultSheet,mem,23,7,7,3,2,pFaultSrcCtx); + if(ErrorMark_Lx & 0x00100000u) AssignFault(psCurFaultSheet,mem,20,4,4,0,2,RamSizeMB,pFaultSrcCtx); + if(ErrorMark_Lx & 0x00200000u) AssignFault(psCurFaultSheet,mem,21,5,5,1,2,RamSizeMB,pFaultSrcCtx); + if(ErrorMark_Lx & 0x00400000u) AssignFault(psCurFaultSheet,mem,22,6,6,2,2,RamSizeMB,pFaultSrcCtx); + if(ErrorMark_Lx & 0x00800000u) AssignFault(psCurFaultSheet,mem,23,7,7,3,2,RamSizeMB,pFaultSrcCtx); } } if(ErrorMark_Lx & 0xFF000000u) { if(ErrorMark_Lx & 0x0F000000u) { - if(ErrorMark_Lx & 0x01000000u) AssignFault(psCurFaultSheet,mem,24,0,8, 0,3,pFaultSrcCtx); - if(ErrorMark_Lx & 0x02000000u) AssignFault(psCurFaultSheet,mem,25,1,9, 1,3,pFaultSrcCtx); - if(ErrorMark_Lx & 0x04000000u) AssignFault(psCurFaultSheet,mem,26,2,10,2,3,pFaultSrcCtx); - if(ErrorMark_Lx & 0x08000000u) AssignFault(psCurFaultSheet,mem,27,3,11,3,3,pFaultSrcCtx); + if(ErrorMark_Lx & 0x01000000u) AssignFault(psCurFaultSheet,mem,24,0,8, 0,3,RamSizeMB,pFaultSrcCtx); + if(ErrorMark_Lx & 0x02000000u) AssignFault(psCurFaultSheet,mem,25,1,9, 1,3,RamSizeMB,pFaultSrcCtx); + if(ErrorMark_Lx & 0x04000000u) AssignFault(psCurFaultSheet,mem,26,2,10,2,3,RamSizeMB,pFaultSrcCtx); + if(ErrorMark_Lx & 0x08000000u) AssignFault(psCurFaultSheet,mem,27,3,11,3,3,RamSizeMB,pFaultSrcCtx); } if(ErrorMark_Lx & 0xF0000000u) { - if(ErrorMark_Lx & 0x10000000u) AssignFault(psCurFaultSheet,mem,28,4,12,0,3,pFaultSrcCtx); - if(ErrorMark_Lx & 0x20000000u) AssignFault(psCurFaultSheet,mem,29,5,13,1,3,pFaultSrcCtx); - if(ErrorMark_Lx & 0x40000000u) AssignFault(psCurFaultSheet,mem,30,6,14,2,3,pFaultSrcCtx); - if(ErrorMark_Lx & 0x80000000u) AssignFault(psCurFaultSheet,mem,31,7,15,3,3,pFaultSrcCtx); + if(ErrorMark_Lx & 0x10000000u) AssignFault(psCurFaultSheet,mem,28,4,12,0,3,RamSizeMB,pFaultSrcCtx); + if(ErrorMark_Lx & 0x20000000u) AssignFault(psCurFaultSheet,mem,29,5,13,1,3,RamSizeMB,pFaultSrcCtx); + if(ErrorMark_Lx & 0x40000000u) AssignFault(psCurFaultSheet,mem,30,6,14,2,3,RamSizeMB,pFaultSrcCtx); + if(ErrorMark_Lx & 0x80000000u) AssignFault(psCurFaultSheet,mem,31,7,15,3,3,RamSizeMB,pFaultSrcCtx); } } } @@ -584,12 +598,14 @@ RenderTest( sst1DeviceInfoStruct* devInfo, } unsigned long long -test_TMU_datalines_Huge( sst1DeviceInfoStruct* devInfo, - FxU32* sst, - SstRegs *sstregs, +test_TMU_datalines_Huge( sst1DeviceInfoStruct * const + devInfo, + FxU32 * const sst, + SstRegs * const sstregs, const unsigned char ucNumTMU, const unsigned char RamSizeMB, - def_sFaultSourceScoreRec* const pFaultSrcCtx) + def_sFaultSourceScoreRec * const + pFaultSrcCtx) { typedef struct _def_sMemBlock{ uint32_t ulAddStart; @@ -645,6 +661,7 @@ test_TMU_datalines_Huge( sst1DeviceInfoStruct* devInfo, sstregs, ucNumTMU, addrTest, + RamSizeMB, pFaultSrcCtx); ullNbErrorAll += ullNbError; if(ullNbError) diff --git a/Test_Data_Huge.h b/Test_Data_Huge.h index 0d5f6f4..ebb8523 100644 --- a/Test_Data_Huge.h +++ b/Test_Data_Huge.h @@ -19,9 +19,9 @@ #define _DEF_TEST_DATA_HUGE_H_ unsigned long long -test_TMU_datalines_Huge( sst1DeviceInfoStruct* devInfo, - FxU32* sst, - SstRegs *sstregs, +test_TMU_datalines_Huge( sst1DeviceInfoStruct * const devInfo, + FxU32 * const sst, + SstRegs * const sstregs, const unsigned char ucNumTMU, const unsigned char RamSizeMB, def_sFaultSourceScoreRec* const pFaultSrcCtx); diff --git a/Test_Data_NoMem.c b/Test_Data_NoMem.c new file mode 100644 index 0000000..c276e22 --- /dev/null +++ b/Test_Data_NoMem.c @@ -0,0 +1,653 @@ +/* V2MemTest - A CLI Tool to test & fix Voodoo² TMU System +* Copyright (C) 2026 ChaCha +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see . +*/ + +#define _BSD_SOURCE 1 +#include +#include +#include +#include +#include +#include + +#include "cvg.h" +#include +#include "sst1init.h" +#include "fxpci.h" + +#include "FaultSources.h" +#include "Utils.h" +#include "Draw.h" + +#include "Test_Common.h" +#include "Test_Data_Huge.h" +#include "Test_Data_NoMem.h" + +extern const def_sTestPattern ar_sExpectedPattern_Test3[]; +extern const unsigned int uNbPattern_Test3; + +extern const def_sTestPattern ar_sExpectedPattern_Test3_Dither[]; +extern const unsigned int uNbPattern_Test3_Dither; + +extern const def_sFaultSourceLineMap ar_sFaultSourceLineMap[]; + +void DisplayPattern(const def_sTestPattern * const pREF) +{ + printf("==========================\n"); + printf("RGB: %04X %04X %04X %04X\n", + pREF->data.access.u16Pix[0][0], + pREF->data.access.u16Pix[0][1], + pREF->data.access.u16Pix[0][2], + pREF->data.access.u16Pix[0][3]); + printf("RGB: %04X %04X %04X %04X\n", + pREF->data.access.u16Pix[1][0], + pREF->data.access.u16Pix[1][1], + pREF->data.access.u16Pix[1][2], + pREF->data.access.u16Pix[1][3]); + printf("RGB: %04X %04X %04X %04X\n", + pREF->data.access.u16Pix[2][0], + pREF->data.access.u16Pix[2][1], + pREF->data.access.u16Pix[2][2], + pREF->data.access.u16Pix[2][3]); + printf("RGB: %04X %04X %04X %04X\n", + pREF->data.access.u16Pix[3][0], + pREF->data.access.u16Pix[3][1], + pREF->data.access.u16Pix[3][2], + pREF->data.access.u16Pix[3][3]); + + printf("Alpha: %02X %02X %02X %02X\n", + pREF->data.access.u8APix[0][0], + pREF->data.access.u8APix[0][1], + pREF->data.access.u8APix[0][2], + pREF->data.access.u8APix[0][3]); + printf("Alpha: %02X %02X %02X %02X\n", + pREF->data.access.u8APix[1][0], + pREF->data.access.u8APix[1][1], + pREF->data.access.u8APix[1][2], + pREF->data.access.u8APix[1][3]); + printf("Alpha: %02X %02X %02X %02X\n", + pREF->data.access.u8APix[2][0], + pREF->data.access.u8APix[2][1], + pREF->data.access.u8APix[2][2], + pREF->data.access.u8APix[2][3]); + printf("Alpha: %02X %02X %02X %02X\n", + pREF->data.access.u8APix[3][0], + pREF->data.access.u8APix[3][1], + pREF->data.access.u8APix[3][2], + pREF->data.access.u8APix[3][3]); +} + +// Returns the distance between A & B, normalized between 0 and 1. +// 0 means they are perfectly identicals. +// 1 means they are entirely diferents. +double ComputePatternDistance( const def_sTestPattern * const pA, + const def_sTestPattern * const pB) +{ + double dDistance = 0; + logT("========================\n"); + logT("Compare A|B:\n"); + for (unsigned int i = 0; i <12; i=i+4) + { + logT("%08X\t%08X\n",pA->data.raw[i],pB->data.raw[i]); + logT("%08X\t%08X\n",pA->data.raw[i+1],pB->data.raw[i+1]); + logT("%08X\t%08X\n",pA->data.raw[i+2],pB->data.raw[i+2]); + logT("%08X\t%08X\n",pA->data.raw[i+3],pB->data.raw[i+3]); + dDistance += dComputeDistance32(pA->data.raw[i], pB->data.raw[i]); + dDistance += dComputeDistance32(pA->data.raw[i+1],pB->data.raw[i+1]); + dDistance += dComputeDistance32(pA->data.raw[i+2],pB->data.raw[i+2]); + dDistance += dComputeDistance32(pA->data.raw[i+3],pB->data.raw[i+3]); + } + dDistance /= 12*4*32; + return dDistance; +} + +typedef struct _def_sScoreSet{ + double dScore; + const def_sTestPattern * pREF; +}def_sScoreSet; + +int scoreSetCmp(const void * const first, const void * const second) +{ + const double scoreFirst = ((def_sScoreSet*)first)->dScore; + const double scoreSecond = ((def_sScoreSet*)second)->dScore; + return scoreFirst > scoreSecond ? -1 : + (scoreFirst < scoreSecond ? 1 : 0); +} + +double inline ScaleScore(const double dIn,const double dK) +{ + return (1.0-exp(-dK*dIn))/(1.0-exp(-dK)); + //return log(1.0+(dK*dIn))/log(1.0+dK); +} + +/* returns a def_sScoreSet array, containing ordered reference to testPattern + * plus the corresponding score. +*/ +void GetNearestIndexes( const def_sTestPattern * const pREF, + const def_sTestPattern * const pSet, + def_sScoreSet * const ScoreSet, + const unsigned int uNbPattern) +{ + for (unsigned int i = 0; i < uNbPattern; i++) + { + ScoreSet[i].pREF = &pSet[i]; + ScoreSet[i].dScore = (1 - ScaleScore(ComputePatternDistance(pREF,pSet+i),100)); + } + + qsort(ScoreSet,uNbPattern,sizeof(def_sScoreSet),scoreSetCmp); + + double dFirstScore = -INFINITY; + + for (unsigned int i = 0; i < uNbPattern; i++) + { + if(i==0) + dFirstScore = ScoreSet[i].dScore; + ScoreSet[i].dScore = (ScoreSet[i].dScore / dFirstScore) * 100; + } +} + +unsigned char DistributeFaults( const def_sTestPattern * const pREF, + const def_sTestPattern * const pREFPatterns, + const unsigned int uNbREFPatterns, + const unsigned char ucNumTMU, + def_sFaultSourceScoreRec* const pFaultSrcCtx) +{ + def_sScoreSet * const ScoreSet + = (def_sScoreSet*)malloc(uNbREFPatterns*sizeof(def_sScoreSet)); + + if(ScoreSet==NULL) + { + logE("Cannot allocate memory..."); + return 1; + } + + GetNearestIndexes(pREF,pREFPatterns,ScoreSet,uNbREFPatterns); + + for( int i =0; ibReferenceSet && ScoreSet[i].dScore==100) + { + //logD("No Fault found\n"); + return 0; + } + } + if( sOptions.eLogLevel >= E_LOGLEVEL__DEBUG) + { + DisplayPattern(pREF); + logD("==========================\n"); + for( int i =0; ibReferenceSet) && (ScoreSet[i].dScore>=80)) + { + logD( "%d Score = %f\n", + ScoreSet[i].pREF->u8FaultLineIdx,ScoreSet[i].dScore); + FaultSource_addScore( pFaultSrcCtx, + ar_sFaultSourceLineMap + [ScoreSet[i].pREF->u8FaultLineIdx] + .eTMUFaultSource_TMU0_RES, + ScoreSet[i].dScore); + /*FaultSource_addScore( pFaultSrcCtx, + ar_sFaultSourceLineMap + [ScoreSet[i].pREF->u8FaultLineIdx] + .eTMUFaultSource_FBI, + ScoreSet[i].dScore);*/ + FaultSource_addScore( pFaultSrcCtx, + ar_sFaultSourceLineMap + [ScoreSet[i].pREF->u8FaultLineIdx] + .eTMUFaultSource_TMU0_FBI, + ScoreSet[i].dScore); + if(ucNumTMU==1) + { + FaultSource_addScore( pFaultSrcCtx, + ar_sFaultSourceLineMap + [ScoreSet[i].pREF->u8FaultLineIdx] + .eTMUFaultSource_TMU0_TMU1, + ScoreSet[i].dScore); + FaultSource_addScore( pFaultSrcCtx, + ar_sFaultSourceLineMap + [ScoreSet[i].pREF->u8FaultLineIdx] + .eTMUFaultSource_TMU1, + ScoreSet[i].dScore); + } + } + } + } + + free(ScoreSet); + + return 1; +} + +void TestStep_NoMem(FxU32 * const sst, + SstRegs * const sstregs, + const unsigned char ucNumTMU, + const uint8_t bEnableRGB, + const uint8_t bEnbleAlpha, + const uint8_t bEnableDitherValues, + def_sTestPattern * const psResultPattern) +{ + + ISET(SST_TREX(sstregs,ucNumTMU)->texBaseAddr, (0x000000>>3)); + volatile const FxU32 * const pLFB1 = sst + (SST_LFB_ADDR>>2); + volatile const FxU32 * const pLFB2 = pLFB1 +((2048)>>2) ; + volatile const FxU32 * const pLFB3 = pLFB2 +((2048)>>2) ; + volatile const FxU32 * const pLFB4 = pLFB3 +((2048)>>2) ; + + ISET( SST_TREX(sstregs,ucNumTMU)->textureMode, + SST_RGB565 + | (bEnableRGB ? SST_TC_ONE : SST_TC_ZERO) + | (bEnbleAlpha ? SST_TCA_ONE :SST_TCA_ZERO)); + + if(bEnableDitherValues) + { + /* We are using dithering to detect lsb Faults. + * We need a non-zero original LFB value for dithering to happen. + * Drawing a triangle make detection easier.*/ + clearScreen(sstregs,(1 << 11) | (0<<5) |(1),8,8); + drawTriangle(sstregs, ucNumTMU, 0, 0, 3, 4); + } + else + { + clearScreen(sstregs,0x00000000,8,8); + drawRect2(sstregs, ucNumTMU, 0, 0, 4, 4); + } + sst1InitIdle(sst); + + mmio_fastread32((uint32_t*)psResultPattern->data.access.u16Pix[0], pLFB1, 2); + mmio_fastread32((uint32_t*)psResultPattern->data.access.u16Pix[1], pLFB2, 2); + mmio_fastread32((uint32_t*)psResultPattern->data.access.u16Pix[2], pLFB3, 2); + mmio_fastread32((uint32_t*)psResultPattern->data.access.u16Pix[3], pLFB4, 2); + + const uint32_t OldlfbMode = IGET(sstregs->lfbMode); + ISET(sstregs->lfbMode, (OldlfbMode & ~SST_LFB_READFRONTBUFFER) //SST_LFB_READBACKBUFFER + | SST_LFB_READDEPTHABUFFER); + + psResultPattern->data.access.u8APix[0][0] = pLFB1[0] & 0xFF; + psResultPattern->data.access.u8APix[0][1] = (pLFB1[0]>>16) & 0xFF; + psResultPattern->data.access.u8APix[0][2] = pLFB1[1] & 0xFF; + psResultPattern->data.access.u8APix[0][3] = (pLFB1[1]>>16) & 0xFF; + + psResultPattern->data.access.u8APix[1][0] = pLFB2[0] & 0xFF; + psResultPattern->data.access.u8APix[1][1] = (pLFB2[0]>>16) & 0xFF; + psResultPattern->data.access.u8APix[1][2] = pLFB2[1] & 0xFF; + psResultPattern->data.access.u8APix[1][3] = (pLFB2[1]>>16) & 0xFF; + + psResultPattern->data.access.u8APix[2][0] = pLFB3[0] & 0xFF; + psResultPattern->data.access.u8APix[2][1] = (pLFB3[0]>>16) & 0xFF; + psResultPattern->data.access.u8APix[2][2] = pLFB3[1] & 0xFF; + psResultPattern->data.access.u8APix[2][3] = (pLFB3[1]>>16) & 0xFF; + + psResultPattern->data.access.u8APix[3][0] = pLFB4[0] & 0xFF; + psResultPattern->data.access.u8APix[3][1] = (pLFB4[0]>>16) & 0xFF; + psResultPattern->data.access.u8APix[3][2] = pLFB4[1] & 0xFF; + psResultPattern->data.access.u8APix[3][3] = (pLFB4[1]>>16) & 0xFF; + + ISET(sstregs->lfbMode, OldlfbMode); + ISET( SST_TREX(sstregs,ucNumTMU)->textureMode, + SST_RGB565 | SST_TC_REPLACE | SST_TCA_REPLACE); +} + +#define N_LOOP_TEST 20 +unsigned long long +test_TMU_datalines_NoMem( sst1DeviceInfoStruct * const devInfo, + FxU32 * const sst, + SstRegs * const sstregs, + const unsigned char ucNumTMU, + def_sFaultSourceScoreRec* const pFaultSrcCtx) +{ + unsigned long long ullNbErrorAll = 0; + + static def_sTestPattern ar_ResultPattern[N_LOOP_TEST][8]; + + sst1InitIdle(sst); + + const uint32_t OldlfbMode = IGET(sstregs->lfbMode);//SST_LFB_READBACKBUFFER + ISET(sstregs->lfbMode, SST_LFB_565 | SST_LFB_READFRONTBUFFER | SST_LFB_RGBALANES_ARGB); + + const uint32_t OldfbzMode = IGET(sstregs->fbzMode); + ISET(sstregs->fbzMode, + // SST_DRAWBUFFER_BACK + SST_DRAWBUFFER_FRONT + | SST_RGBWRMASK + | SST_ZAWRMASK + | SST_ENALPHABUFFER // <-for NoMEM test ?? Not needed + | SST_ENALPHAMASK); // <-for NoMEM test; Needed + + const uint32_t OldtrexInit0 = IGET(SST_TREX(sstregs,ucNumTMU)->trexInit0); + devInfo->tmuInit0[(int)ucNumTMU] = SST_TREXINIT0_DEFAULT ; + ISET(SST_TREX(sstregs,ucNumTMU)->trexInit0, devInfo->tmuInit0[(int)ucNumTMU]); + sst1InitIdle(sst); + + /* set downstream TMUs to passthrough */ + for (int i=0; i< ucNumTMU; i++) + { + ISET(SST_TREX(sstregs,i)->textureMode, SST_RGB565 | SST_TC_PASS | SST_TCA_PASS); + } + + /* Testing several time to exclude instabilities */ + for(unsigned int i = 0; i < N_LOOP_TEST ; i++) + { + /* this test is using the only feature I found that can + * control TMUs output without using TMU's RAM. Using + * textureMode we can force a TMU to output RGB value to + * 0xFFFFFF or 0x000000 (only), and A(lpha) to 0xFF or 0x00 (Only). + * So we will try these 4 pattern and check what we get on the LFB. + * Then eventually we can make "smart" Fault recognition... + * + * To make things harder, the physical data bus is 16Bit (DDR?). + * So [AR] and [GB] or superposed. + * */ + + /***************/ + /* RGB: 0, A: 0*/ + /***************/ + /* Not implemented because the "all on" test should be enough for now + TestStep_NoMem( sst, sstregs, ucNumTMU, 0 ,0, 1, + &ar_ResultPattern[i][0]);*/ + + /***************/ + /* RGB: 1, A: 0*/ + /***************/ + /* Not implemented because the "all on" test should be enough for now + TestStep_NoMem( sst, sstregs, ucNumTMU, 1, 0, 1, + &ar_ResultPattern[i][1]);*/ + + /***************/ + /* RGB: 1, A: 1*/ + /***************/ + TestStep_NoMem( sst, sstregs, ucNumTMU, 1, 1 , 1, + &ar_ResultPattern[i][2]); + + /***************/ + /* RGB: 0, A: 1*/ + /***************/ + /* Not implemented because the "all on" test should be enough for now + TestStep_NoMem( sst, sstregs, ucNumTMU, 0, 1 , 1, + &ar_ResultPattern[i][3]);*/ + } + + /* Same test but with dithering enabled to get bit 0-1 values */ + ISET(sstregs->fbzMode, + // SST_DRAWBUFFER_BACK + SST_DRAWBUFFER_FRONT + | SST_ENDITHER // <- enabling Dithering for this test + | SST_RGBWRMASK + | SST_ZAWRMASK + | SST_ENALPHABUFFER + | SST_ENALPHAMASK); + + for(unsigned int i = 0; i < N_LOOP_TEST ; i++) + { + /* this test is using the only feature I found that can + * control TMUs output without using TMU's RAM. Using + * textureMode we can force a TMU to output RGB value to + * 0xFFFFFF or 0x000000 (only), and A(lpha) to 0xFF or 0x00 (Only). + * So we will try these 4 pattern and check what we get on the LFB. + * Then eventually we can make "smart" Fault recognition... + * + * To make things harder, the physical data bus is 16Bit (DDR?). + * So [AR] and [GB] or superposed. + * */ + + /***************/ + /* RGB: 0, A: 0*/ + /***************/ + /* Not implemented because the "all on" test should be enough for now + TestStep_NoMem( sst, sstregs, ucNumTMU, 0 ,0, 1, + &ar_ResultPattern[i][4]);*/ + + /***************/ + /* RGB: 1, A: 0*/ + /***************/ + /* Not implemented because the "all on" test should be enough for now + TestStep_NoMem( sst, sstregs, ucNumTMU, 1, 0, 1, + &ar_ResultPattern[i][5]);*/ + + /***************/ + /* RGB: 1, A: 1*/ + /***************/ + TestStep_NoMem( sst, sstregs, ucNumTMU, 1, 1 , 1, + &ar_ResultPattern[i][6]); + + /***************/ + /* RGB: 0, A: 1*/ + /***************/ + /* Not implemented because the "all on" test should be enough for now + TestStep_NoMem( sst, sstregs, ucNumTMU, 0, 1 , 1, + &ar_ResultPattern[i][7]);*/ + } + /* Post processing test results */ + for(unsigned int i = 0; i < N_LOOP_TEST ; i++) + { /* Not implemented because the "all on" test should be enough for now + ullNbErrorAll += + DistributeFaults( &ar_ResultPattern[i][0], + ar_sExpectedPattern_Test1, + uNbPattern_Test1, + ucNumTMU, + pFaultSrcCtx);*/ + + /* Not implemented because the "all on" test should be enough for now + ullNbErrorAll += + DistributeFaults( &ar_ResultPattern[i][1], + ar_sExpectedPattern_Test2, + uNbPattern_Test2, + ucNumTMU, + pFaultSrcCtx);*/ + + ullNbErrorAll += + DistributeFaults( &ar_ResultPattern[i][2], + ar_sExpectedPattern_Test3, + uNbPattern_Test3, + ucNumTMU, + pFaultSrcCtx); + + /* Not implemented because the "all on" test should be enough for now + ullNbErrorAll += + DistributeFaults( &ar_ResultPattern[i][3], + ar_sExpectedPattern_Test4, + uNbPattern_Test4, + ucNumTMU, + pFaultSrcCtx);*/ + + /* Not implemented because the "all on" test should be enough for now + ullNbErrorAll += + DistributeFaults( &ar_ResultPattern[i][4], + ar_sExpectedPattern_Test1_Dither, + uNbPattern_Test1_Dither, + ucNumTMU, + pFaultSrcCtx);*/ + + /* Not implemented because the "all on" test should be enough for now + ullNbErrorAll += + DistributeFaults( &ar_ResultPattern[i][5], + ar_sExpectedPattern_Test2_Dither, + uNbPattern_Test2_Dither, + ucNumTMU, + pFaultSrcCtx);*/ + + ullNbErrorAll += + DistributeFaults( &ar_ResultPattern[i][6], + ar_sExpectedPattern_Test3_Dither, + uNbPattern_Test3_Dither, + ucNumTMU, + pFaultSrcCtx); + + /* Not implemented because the "all on" test should be enough for now + ullNbErrorAll += + DistributeFaults( &ar_ResultPattern[i][7], + ar_sExpectedPattern_Test4_Dither, + uNbPattern_Test4_Dither, + ucNumTMU, + pFaultSrcCtx);*/ + } + + /* reset the Init0 register back to its previous value */ + ISET(sstregs->lfbMode,OldlfbMode); + ISET(sstregs->fbzMode, OldfbzMode); + sst1InitIdle(sst); + devInfo->tmuInit0[(int)ucNumTMU] = OldtrexInit0; + ISET(SST_TREX(sstregs,ucNumTMU)->trexInit0, devInfo->tmuInit0[(int)ucNumTMU]); + sst1InitIdle(sst); + + return ullNbErrorAll; +} + + +/* This is an attempt to simulate TMU->FBI->LFB values exchange and + * computation. It partially works for normal mode (no dithering, alpha buffer + * enabled), with two exception: Alpha bit XX seems to have a special behaviour + * that just zeros the output. And the colour mixing hasnt been reverse + * enginered. The dithering algorithm hasnt been reversed either. + * Then, because we are using pattern distance matching, this function is not + * used anymore. I let it here in case one day we want/need to implement a more + * accurate test + * +int simuFault_step( uint8_t bRGB, + uint8_t bA, + uint16_t u16CurrentPixel, + uint8_t u8CurrentAPixel, + uint16_t * const pu16RenderedPixel, + uint8_t * const pu8RenderedAPixel, + uint16_t u16BUSFaultMap ) +{ + // TMU Output force set + const uint8_t u8TMU_r8 = bRGB ? 0xFF : 0; + const uint8_t u8TMU_g8 = bRGB ? 0xFF : 0; + const uint8_t u8TMU_b8 = bRGB ? 0xFF : 0; + const uint8_t u8TMU_a8 = bA ? 0xFF : 0; + + // TMU Output values packing (useless as its only all 0 or 1, but for brain model..) + const uint16_t u16Sent_W1 = (u8TMU_g8<<8) + u8TMU_b8; + const uint16_t u16Sent_W2 = (u8TMU_a8<<8) + u8TMU_r8; + + // FBI receiving + Error aplication + const uint16_t u16received_W1 = u16Sent_W1 & ~u16BUSFaultMap; + const uint16_t u16received_W2 = u16Sent_W2 & ~u16BUSFaultMap; + + // FBI received colours unpacking (!!! to be checked) + uint16_t u16FBI_Input_r8 = (u16received_W2 & 0xFF); + uint16_t u16FBI_Input_g8 = (u16received_W1 >> 8); + uint16_t u16FBI_Input_b8 = (u16received_W1 & 0xFF); + uint16_t u16FBI_Input_a8 = (u16received_W2 >> 8); + + // FBI LFB current colours unpacking + const uint16_t u16FBI_Current_r8 = ((u16CurrentPixel>>11) & 0x1F) << 3; + const uint16_t u16FBI_Current_g8 = ((u16CurrentPixel>>5) & 0x3F) << 2; + const uint16_t u16FBI_Current_b8 = ((u16CurrentPixel>>0) & 0x1F) << 3; + const uint16_t u16FBI_Current_a8 = u8CurrentAPixel; + + // Mixing current and new colours + //u16FBI_Input_r8 *= u16FBI_Input_a8; + // This does not work + //u16FBI_Input_r8 += u16FBI_Current_r8 * (255-u16FBI_Input_a8); + //u16FBI_Input_r8 >>=8; + + //u16FBI_Input_g8 *= u16FBI_Input_a8; + //u16FBI_Input_g8 += u16FBI_Current_g8 * (255-u16FBI_Input_a8); + //u16FBI_Input_g8 >>=8; + + //u16FBI_Input_b8 *= u16FBI_Input_a8; + //u16FBI_Input_b8 += u16FBI_Current_b8 * (255-u16FBI_Input_a8); + //u16FBI_Input_b8 >>=8; + + //u16FBI_Input_a8 *= u16FBI_Input_a8; + //u16FBI_Input_a8 += u16FBI_Current_a8*(255-u16FBI_Input_a8); + //u16FBI_Input_a8 >>=8; + + const uint16_t u16LFB_R5G6B5_r5 = (u16FBI_Input_r8>>3) & 0x1F; + const uint16_t u16LFB_R5G6B5_g6 = (u16FBI_Input_g8>>2) & 0x3F; + const uint16_t u16LFB_R5G6B5_b5 = (u16FBI_Input_b8>>3) & 0x1F; + const uint16_t u8LFB_R5G6B5_a8 = (u16FBI_Input_a8>>0) & 0xFF; + + const uint16_t u16LBF_R5G6B5_Pixel = (u16LFB_R5G6B5_r5 <<11) + + (u16LFB_R5G6B5_g6<<5) + + (u16LFB_R5G6B5_b5); + const uint8_t u8LBF_R5G6B5_APixel = u8LFB_R5G6B5_a8; + + *pu16RenderedPixel = u16LBF_R5G6B5_Pixel; + *pu8RenderedAPixel = u8LBF_R5G6B5_APixel; + + return 0; +} +*/ + +/* In conjonction to the previous function, the idea here was to precompute all + * the possible fault pattern and use them as a comparison to find the actual + * one using real measurement. It is now deprecated in favor of the pattern + * distance matching. + * +void simuFault( uint8_t bRGB, + uint8_t bA ) +{ + uint16_t u16RenderedPixel; + uint8_t u8RenderedAPixel; + uint32_t u16PreviousPixel = 0; + uint16_t u8PreviousAPixel = 0; + //for(char bitPos1 = -1; bitPos1 <= 15 ; ++bitPos1) + //for(u8PreviousAPixel= 0; u8PreviousAPixel <= 0xFF ; ++u8PreviousAPixel) + { + //for(u16PreviousPixel= 0; u16PreviousPixel <= 0xFFFF ; ++u16PreviousPixel) + { + //u16PreviousPixel += (bitPos1 ==-1) ? 0 : (1u << bitPos1); + uint16_t Pattern_OK; + uint16_t APattern_OK; + for(char bitPos = -1; bitPos <= 15 ; ++bitPos) + { + const uint16_t u16FaultMap = (bitPos ==-1) ? 0 : (1u << bitPos); + simuFault_step( bRGB, + bA, + u16PreviousPixel, + u8PreviousAPixel, + &u16RenderedPixel, + &u8RenderedAPixel, + u16FaultMap); + + //if(u16FaultMap==0) + //{ + // Pattern_OK = u16RenderedPixel; + // APattern_OK = u8RenderedAPixel; + //} + //else if(u16FaultMap==0x100) + //{ + // if((u16RenderedPixel!=Pattern_OK) && (u8RenderedAPixel!=APattern_OK)) + // { + // printf("bRGB %d\n",bRGB); + // printf("bA, %d\n",bA); + // printf("u16PreviousPixel %04X\n",u16PreviousPixel); + // printf("u8PreviousAPixel %02X\n",u8PreviousAPixel); + // printf("SIMU: %04X\n",u16FaultMap); + // printf("\t0x%04X | 0x%02X %c\n", + // u16RenderedPixel, + // u8RenderedAPixel, + // (u16RenderedPixel==0xFFFF) + // && (u8RenderedAPixel==0xFF) ? '!' : ' '); + // } + //} + printf("bRGB %d\n",bRGB); + printf("bA, %d\n",bA); + printf("u16PreviousPixel %04X\n",u16PreviousPixel); + printf("u8PreviousAPixel %02X\n",u8PreviousAPixel); + printf("SIMU: %04X\n",u16FaultMap); + printf("\t0x%04X | 0x%02X %c\n", + u16RenderedPixel, + u8RenderedAPixel, + (u16RenderedPixel==0xFFFF) + && (u8RenderedAPixel==0xFF) ? '!' : ' '); + } + } + } +} +*/ diff --git a/Test_Data_NoMem.h b/Test_Data_NoMem.h new file mode 100644 index 0000000..f520dca --- /dev/null +++ b/Test_Data_NoMem.h @@ -0,0 +1,56 @@ +/* V2MemTest - A CLI Tool to test & fix Voodoo² TMU System +* Copyright (C) 2026 ChaCha +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see . +*/ + +#ifndef _DEF_TEST_DATA_NOMEM_H_ +#define _DEF_TEST_DATA_NOMEM_H_ + +#include +#include "cvg.h" +#include "FaultSources.h" + +typedef union _def_uTestPatternData{ + struct { + uint16_t u16Pix[4][4]; //value in LFB after Blend + uint8_t u8APix[4][4]; //value in LFB after Blend + }access; + uint32_t raw[8+4]; +}def_uTestPatternData; + +typedef struct _def_sFaultSourceLineMap +{ + def_eFaultSource eTMUFaultSource_FBI; + def_eFaultSource eTMUFaultSource_TMU0_RES; + def_eFaultSource eTMUFaultSource_TMU0_FBI; + def_eFaultSource eTMUFaultSource_TMU0_TMU1; + def_eFaultSource eTMUFaultSource_TMU1; +}def_sFaultSourceLineMap; + +typedef struct _def_sTestPattern +{ + uint8_t bReferenceSet; + uint8_t u8FaultLineIdx; + def_uTestPatternData data; // expected value in LFB after Blend +}def_sTestPattern; + +unsigned long long +test_TMU_datalines_NoMem( sst1DeviceInfoStruct * const devInfo, + FxU32 * const sst, + SstRegs * const sstregs, + const unsigned char ucNumTMU, + def_sFaultSourceScoreRec* const pFaultSrcCtx); + +#endif //_DEF_TEST_DATA_NOMEM_H_ diff --git a/Test_Data_NoMem_TestPatterns.c b/Test_Data_NoMem_TestPatterns.c new file mode 100644 index 0000000..95d9363 --- /dev/null +++ b/Test_Data_NoMem_TestPatterns.c @@ -0,0 +1,761 @@ +/* V2MemTest - A CLI Tool to test & fix Voodoo² TMU System +* Copyright (C) 2026 ChaCha +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see . +*/ + +#include "Test_Data_NoMem.h" + +const def_sFaultSourceLineMap ar_sFaultSourceLineMap[] = +{ + { + .eTMUFaultSource_FBI = U3_FBI_TF_DATA_0, + .eTMUFaultSource_TMU0_RES = RA10_1, + .eTMUFaultSource_TMU0_FBI = U9_TMU0_TF_DATA_0, + .eTMUFaultSource_TMU0_TMU1 = U9_TMU0_FT_DATA_0, + .eTMUFaultSource_TMU1 = U8_TMU1_TF_DATA_0, + }, + { + .eTMUFaultSource_FBI = U3_FBI_TF_DATA_1, + .eTMUFaultSource_TMU0_RES = RA10_2, + .eTMUFaultSource_TMU0_FBI = U9_TMU0_TF_DATA_1, + .eTMUFaultSource_TMU0_TMU1 = U9_TMU0_FT_DATA_1, + .eTMUFaultSource_TMU1 = U8_TMU1_TF_DATA_1, + }, + { + .eTMUFaultSource_FBI = U3_FBI_TF_DATA_2, + .eTMUFaultSource_TMU0_RES = RA10_3, + .eTMUFaultSource_TMU0_FBI = U9_TMU0_TF_DATA_2, + .eTMUFaultSource_TMU0_TMU1 = U9_TMU0_FT_DATA_2, + .eTMUFaultSource_TMU1 = U8_TMU1_TF_DATA_2, + }, + { + .eTMUFaultSource_FBI = U3_FBI_TF_DATA_3, + .eTMUFaultSource_TMU0_RES = RA10_4, + .eTMUFaultSource_TMU0_FBI = U9_TMU0_TF_DATA_3, + .eTMUFaultSource_TMU0_TMU1 = U9_TMU0_FT_DATA_3, + .eTMUFaultSource_TMU1 = U8_TMU1_TF_DATA_3, + }, + { + .eTMUFaultSource_FBI = U3_FBI_TF_DATA_4, + .eTMUFaultSource_TMU0_RES = RA11_1, + .eTMUFaultSource_TMU0_FBI = U9_TMU0_TF_DATA_4, + .eTMUFaultSource_TMU0_TMU1 = U9_TMU0_FT_DATA_4, + .eTMUFaultSource_TMU1 = U8_TMU1_TF_DATA_4, + }, + { + .eTMUFaultSource_FBI = U3_FBI_TF_DATA_5, + .eTMUFaultSource_TMU0_RES = RA11_2, + .eTMUFaultSource_TMU0_FBI = U9_TMU0_TF_DATA_5, + .eTMUFaultSource_TMU0_TMU1 = U9_TMU0_FT_DATA_5, + .eTMUFaultSource_TMU1 = U8_TMU1_TF_DATA_5, + }, + { + .eTMUFaultSource_FBI = U3_FBI_TF_DATA_6, + .eTMUFaultSource_TMU0_RES = RA11_3, + .eTMUFaultSource_TMU0_FBI = U9_TMU0_TF_DATA_6, + .eTMUFaultSource_TMU0_TMU1 = U9_TMU0_FT_DATA_6, + .eTMUFaultSource_TMU1 = U8_TMU1_TF_DATA_6, + }, + { + .eTMUFaultSource_FBI = U3_FBI_TF_DATA_7, + .eTMUFaultSource_TMU0_RES = RA11_4, + .eTMUFaultSource_TMU0_FBI = U9_TMU0_TF_DATA_7, + .eTMUFaultSource_TMU0_TMU1 = U9_TMU0_FT_DATA_7, + .eTMUFaultSource_TMU1 = U8_TMU1_TF_DATA_7, + }, + { + .eTMUFaultSource_FBI = U3_FBI_TF_DATA_8, + .eTMUFaultSource_TMU0_RES = RA12_1, + .eTMUFaultSource_TMU0_FBI = U9_TMU0_TF_DATA_8, + .eTMUFaultSource_TMU0_TMU1 = U9_TMU0_FT_DATA_8, + .eTMUFaultSource_TMU1 = U8_TMU1_TF_DATA_8, + }, + { + .eTMUFaultSource_FBI = U3_FBI_TF_DATA_9, + .eTMUFaultSource_TMU0_RES = RA12_2, + .eTMUFaultSource_TMU0_FBI = U9_TMU0_TF_DATA_9, + .eTMUFaultSource_TMU0_TMU1 = U9_TMU0_FT_DATA_9, + .eTMUFaultSource_TMU1 = U8_TMU1_TF_DATA_9, + }, + { + .eTMUFaultSource_FBI = U3_FBI_TF_DATA_10, + .eTMUFaultSource_TMU0_RES = RA12_3, + .eTMUFaultSource_TMU0_FBI = U9_TMU0_TF_DATA_10, + .eTMUFaultSource_TMU0_TMU1 = U9_TMU0_FT_DATA_10, + .eTMUFaultSource_TMU1 = U8_TMU1_TF_DATA_10, + }, + { + .eTMUFaultSource_FBI = U3_FBI_TF_DATA_11, + .eTMUFaultSource_TMU0_RES = RA12_4, + .eTMUFaultSource_TMU0_FBI = U9_TMU0_TF_DATA_11, + .eTMUFaultSource_TMU0_TMU1 = U9_TMU0_FT_DATA_11, + .eTMUFaultSource_TMU1 = U8_TMU1_TF_DATA_11, + }, +{ + .eTMUFaultSource_FBI = U3_FBI_TF_DATA_12, + .eTMUFaultSource_TMU0_RES = RA13_1, + .eTMUFaultSource_TMU0_FBI = U9_TMU0_TF_DATA_12, + .eTMUFaultSource_TMU0_TMU1 = U9_TMU0_FT_DATA_12, + .eTMUFaultSource_TMU1 = U8_TMU1_TF_DATA_12, + }, + { + .eTMUFaultSource_FBI = U3_FBI_TF_DATA_13, + .eTMUFaultSource_TMU0_RES = RA13_2, + .eTMUFaultSource_TMU0_FBI = U9_TMU0_TF_DATA_13, + .eTMUFaultSource_TMU0_TMU1 = U9_TMU0_FT_DATA_13, + .eTMUFaultSource_TMU1 = U8_TMU1_TF_DATA_13, + }, + { + .eTMUFaultSource_FBI = U3_FBI_TF_DATA_14, + .eTMUFaultSource_TMU0_RES = RA13_3, + .eTMUFaultSource_TMU0_FBI = U9_TMU0_TF_DATA_14, + .eTMUFaultSource_TMU0_TMU1 = U9_TMU0_FT_DATA_14, + .eTMUFaultSource_TMU1 = U8_TMU1_TF_DATA_14, + }, + { + .eTMUFaultSource_FBI = U3_FBI_TF_DATA_15, + .eTMUFaultSource_TMU0_RES = RA13_4, + .eTMUFaultSource_TMU0_FBI = U9_TMU0_TF_DATA_15, + .eTMUFaultSource_TMU0_TMU1 = U9_TMU0_FT_DATA_15, + .eTMUFaultSource_TMU1 = U8_TMU1_TF_DATA_15, + }, +}; + + +const def_sTestPattern ar_sExpectedPattern_Test3[] = +{ + { + .bReferenceSet = true, // Nominal set + .u8FaultLineIdx = 0, + .data = { + .access = { + .u16Pix = { {0xFFFF,0xFFFF,0xFFFF,0xFFFF}, + {0xFFFF,0xFFFF,0xFFFF,0xFFFF}, + {0xFFFF,0xFFFF,0xFFFF,0xFFFF}, + {0xFFFF,0xFFFF,0xFFFF,0xFFFF} + }, + .u8APix = { {0xFF,0xFF,0xFF,0xFF}, + {0xFF,0xFF,0xFF,0xFF}, + {0xFF,0xFF,0xFF,0xFF}, + {0xFF,0xFF,0xFF,0xFF} + }, + } + } + }, + { //OK + .bReferenceSet = false, + .u8FaultLineIdx = 0, + .data = { + .access = { + .u16Pix = { {0xFFFF,0xFFFF,0xFFFF,0xFFFF}, + {0xFFFF,0xFFFF,0xFFFF,0xFFFF}, + {0xFFFF,0xFFFF,0xFFFF,0xFFFF}, + {0xFFFF,0xFFFF,0xFFFF,0xFFFF} + }, + .u8APix = { {0xFF,0xFF,0xFF,0xFF}, + {0xFF,0xFF,0xFF,0xFF}, + {0xFF,0xFF,0xFF,0xFF}, + {0xFF,0xFF,0xFF,0xFF} + }, + } + } + }, + { //OK + .bReferenceSet = false, + .u8FaultLineIdx = 1, + .data = { + .access = { + .u16Pix = { {0xFFFF,0xFFFF,0xFFFF,0xFFFF}, + {0xFFFF,0xFFFF,0xFFFF,0xFFFF}, + {0xFFFF,0xFFFF,0xFFFF,0xFFFF}, + {0xFFFF,0xFFFF,0xFFFF,0xFFFF} + }, + .u8APix = { {0xFF,0xFF,0xFF,0xFF}, + {0xFF,0xFF,0xFF,0xFF}, + {0xFF,0xFF,0xFF,0xFF}, + {0xFF,0xFF,0xFF,0xFF} + }, + } + } + }, + { //OK + .bReferenceSet = false, + .u8FaultLineIdx = 2, + .data = { + .access = { + .u16Pix = { {0xFFFF,0xFFFF,0xFFFF,0xFFFF}, + {0xFFFF,0xFFFF,0xFFFF,0xFFFF}, + {0xFFFF,0xFFFF,0xFFFF,0xFFFF}, + {0xFFFF,0xFFFF,0xFFFF,0xFFFF} + }, + .u8APix = { {0xFF,0xFF,0xFF,0xFF}, + {0xFF,0xFF,0xFF,0xFF}, + {0xFF,0xFF,0xFF,0xFF}, + {0xFF,0xFF,0xFF,0xFF} + }, + } + } + }, + { //OK + .bReferenceSet = false, + .u8FaultLineIdx = 3, + .data = { + .access = { + .u16Pix = { {0xF7FE,0xF7FF,0xFFFF,0xFFFF}, + {0xF7FE,0xF7FE,0xF7FF,0xFFFF}, + {0xF7FE,0xF7FE,0xF7FE,0xF7FE}, + {0xF7FE,0xF7FE,0xF7FE,0xF7FE} + }, + .u8APix = { {0xFF,0xFF,0xFF,0xFF}, + {0xFF,0xFF,0xFF,0xFF}, + {0xFF,0xFF,0xFF,0xFF}, + {0xFF,0xFF,0xFF,0xFF} + }, + } + } + }, + { //OK + .bReferenceSet = false, + .u8FaultLineIdx = 4, + .data = { + .access = { + .u16Pix = { {0xEFFD,0xEFFF,0xFFFF,0xFFFF}, + {0xEFFD,0xEFFD,0xEFFF,0xFFFF}, + {0xEFFD,0xEFFD,0xEFFD,0xEFFD}, + {0xEFFD,0xEFFD,0xEFFD,0xEFFD} + }, + .u8APix = { {0xFF,0xFF,0xFF,0xFF}, + {0xFF,0xFF,0xFF,0xFF}, + {0xFF,0xFF,0xFF,0xFF}, + {0xFF,0xFF,0xFF,0xFF} + }, + } + } + }, + { //OK + .bReferenceSet = false, + .u8FaultLineIdx = 5, + .data = { + .access = { + .u16Pix = { {0xDFFB,0xDFFF,0xFFFF,0xFFFF}, + {0xDFFB,0xDFFB,0xDFFF,0xFFFF}, + {0xDFFB,0xDFFB,0xDFFB,0xDFFB}, + {0xDFFB,0xDFFB,0xDFFB,0xDFFB} + }, + .u8APix = { {0xFF,0xFF,0xFF,0xFF}, + {0xFF,0xFF,0xFF,0xFF}, + {0xFF,0xFF,0xFF,0xFF}, + {0xFF,0xFF,0xFF,0xFF} + }, + } + } + }, + { //OK + .bReferenceSet = false, + .u8FaultLineIdx = 6, + .data = { + .access = { + .u16Pix = { {0xBFF7,0xBFFF,0xFFFF,0xFFFF}, + {0xBFF7,0xBFF7,0xBFFF,0xFFFF}, + {0xBFF7,0xBFF7,0xBFF7,0xBFF7}, + {0xBFF7,0xBFF7,0xBFF7,0xBFF7} + }, + .u8APix = { {0xFF,0xFF,0xFF,0xFF}, + {0xFF,0xFF,0xFF,0xFF}, + {0xFF,0xFF,0xFF,0xFF}, + {0xFF,0xFF,0xFF,0xFF} + }, + } + } + }, + { //OK + .bReferenceSet = false, + .u8FaultLineIdx = 7, + .data = { + .access = { + .u16Pix = { {0x7FEF,0x7FFF,0xFFFF,0xFFFF}, + {0x7FEF,0x7FEF,0x7FFF,0xFFFF}, + {0x7FEF,0x7FEF,0x7FEF,0x7FEF}, + {0x7FEF,0x7FEF,0x7FEF,0x7FEF} + }, + .u8APix = { {0xFF,0xFF,0xFF,0xFF}, + {0xFF,0xFF,0xFF,0xFF}, + {0xFF,0xFF,0xFF,0xFF}, + {0xFF,0xFF,0xFF,0xFF} + }, + } + } + }, + { //OK + .bReferenceSet = false, + .u8FaultLineIdx = 8, + .data = { + .access = { + .u16Pix = { {0x0000,0x0000,0xFFFF,0xFFFF}, + {0x0000,0x0000,0x0000,0xFFFF}, + {0x0000,0x0000,0x0000,0x0000}, + {0x0000,0x0000,0x0000,0x0000} + }, + .u8APix = { {0x00,0x00,0xFF,0xFF}, + {0x00,0x00,0x00,0xFF}, + {0x00,0x00,0x00,0x00}, + {0x00,0x00,0x00,0x00} + }, + } + } + }, + { //OK + .bReferenceSet = false, + .u8FaultLineIdx = 9, + .data = { + .access = { + .u16Pix = { {0xFFFF,0xFFFF,0xFFFF,0xFFFF}, + {0xFFFF,0xFFFF,0xFFFF,0xFFFF}, + {0xFFFF,0xFFFF,0xFFFF,0xFFFF}, + {0xFFFF,0xFFFF,0xFFFF,0xFFFF} + }, + .u8APix = { {0xFD,0xFD,0xFF,0xFF}, + {0xFD,0xFD,0xFD,0xFF}, + {0xFD,0xFD,0xFD,0xFD}, + {0xFD,0xFD,0xFD,0xFD} + }, + } + } + }, + { //OK + .bReferenceSet = false, + .u8FaultLineIdx = 10, + .data = { + .access = { + .u16Pix = { {0xFFDF,0xFFFF,0xFFFF,0xFFFF}, + {0xFFDF,0xFFDF,0xFFFF,0xFFFF}, + {0xFFDF,0xFFDF,0xFFDF,0xFFFF}, + {0xFFDF,0xFFDF,0xFFDF,0xFFDF} + }, + .u8APix = { {0xFB,0xFB,0xFB,0xFB}, + {0xFB,0xFB,0xFB,0xFB}, + {0xFB,0xFB,0xFB,0xFB}, + {0xFB,0xFB,0xFB,0xFB} + }, + } + } + }, + { //OK + .bReferenceSet = false, + .u8FaultLineIdx = 11, + .data = { + .access = { + .u16Pix = { {0xFFBF,0xFFFF,0xFFFF,0xFFFF}, + {0xFFBF,0xFFBF,0xFFFF,0xFFFF}, + {0xFFBF,0xFFBF,0xFFBF,0xFFBF}, + {0xFFBF,0xFFBF,0xFFBF,0xFFBF} + }, + .u8APix = { {0xF7,0xF7,0xFF,0xFF}, + {0xF7,0xF7,0xF7,0xFF}, + {0xF7,0xF7,0xF7,0xF7}, + {0xF7,0xF7,0xF7,0xF7} + }, + } + } + }, + { //OK + .bReferenceSet = false, + .u8FaultLineIdx = 12, + .data = { + .access = { + .u16Pix = { {0xFF7F,0xFFFF,0xFFFF,0xFFFF}, + {0xFF7F,0xFF7F,0xFFFF,0xFFFF}, + {0xFF7F,0xFF7F,0xFF7F,0xFF7F}, + {0xFF7F,0xFF7F,0xFF7F,0xFF7F} + }, + .u8APix = { {0xEF,0xEF,0xFF,0xFF}, + {0xEF,0xEF,0xEF,0xFF}, + {0xEF,0xEF,0xEF,0xEF}, + {0xEF,0xEF,0xEF,0xEF} + }, + } + } + }, + { //OK + .bReferenceSet = false, + .u8FaultLineIdx = 13, + .data = { + .access = { + .u16Pix = { {0xFEFF,0xFFFF,0xFFFF,0xFFFF}, + {0xFEFF,0xFEFF,0xFFFF,0xFFFF}, + {0xFEFF,0xFEFF,0xFEFF,0xFEFF}, + {0xFEFF,0xFEFF,0xFEFF,0xFEFF} + }, + .u8APix = { {0xDF,0xDF,0xFF,0xFF}, + {0xDF,0xDF,0xDF,0xFF}, + {0xDF,0xDF,0xDF,0xDF}, + {0xDF,0xDF,0xDF,0xDF} + }, + } + } + }, + { //OK + .bReferenceSet = false, + .u8FaultLineIdx = 14, + .data = { + .access = { + .u16Pix = { {0xFDFF,0xFFFF,0xFFFF,0xFFFF}, + {0xFDFF,0xFDFF,0xFFFF,0xFFFF}, + {0xFDFF,0xFDFF,0xFDFF,0xFDFF}, + {0xFDFF,0xFDFF,0xFDFF,0xFDFF} + }, + .u8APix = { {0xBF,0xBF,0xFF,0xFF}, + {0xBF,0xBF,0xBF,0xFF}, + {0xBF,0xBF,0xBF,0xBF}, + {0xBF,0xBF,0xBF,0xBF} + }, + } + } + }, + {//OK + .bReferenceSet = false, + .u8FaultLineIdx = 15, + .data = { + .access = { + .u16Pix = { {0xFBFF,0xFFFF,0xFFFF,0xFFFF}, + {0xFBFF,0xFBFF,0xFFFF,0xFFFF}, + {0xFBFF,0xFBFF,0xFBFF,0xFBFF}, + {0xFBFF,0xFBFF,0xFBFF,0xFBFF} + }, + .u8APix = { {0x7F,0x7F,0xFF,0xFF}, + {0x7F,0x7F,0x7F,0xFF}, + {0x7F,0x7F,0x7F,0x7F}, + {0x7F,0x7F,0x7F,0x7F} + }, + } + } + }, +}; + +const unsigned int uNbPattern_Test3 = +sizeof(ar_sExpectedPattern_Test3)/sizeof(def_sTestPattern); + +const def_sTestPattern ar_sExpectedPattern_Test3_Dither[] = +{ + { + .bReferenceSet = true, // Nominal set + .u8FaultLineIdx = 0, + .data = { + .access = { + .u16Pix = { {0xFFFF,0xFFFF,0xFFFF,0x0040}, + {0xFFFF,0xFFFF,0x0040,0x0040}, + {0xFFFF,0x0040,0x0040,0x0040}, + {0x0040,0x0040,0x0040,0x0040} + }, + .u8APix = { {0xFF,0xFF,0xFF,0x0F}, + {0xFF,0xFF,0x0F,0x0F}, + {0xFF,0x0F,0x0F,0x0F}, + {0x0F,0x0F,0x0F,0x0F} + }, + } + } + }, + { //OK ! + .bReferenceSet = false, + .u8FaultLineIdx = 0, + .data = { + .access = { + .u16Pix = { {0xF7FE,0xFFFF,0xFFFF,0x0040}, + {0xFFFF,0xFFFF,0x0040,0x0040}, + {0xFFFF,0x0040,0x0040,0x0040}, + {0x0040,0x0040,0x0040,0x0040} + }, + .u8APix = { {0xFF,0xFF,0xFF,0x0F}, + {0xFF,0xFF,0x0F,0x0F}, + {0xFF,0x0F,0x0F,0x0F}, + {0x0F,0x0F,0x0F,0x0F} + }, + } + } + }, + { //OK ! + .bReferenceSet = false, + .u8FaultLineIdx = 1, + .data = { + .access = { + .u16Pix = { {0xF7FE,0xFFFF,0xFFFF,0x0040}, + {0xFFFF,0xFFFF,0x0040,0x0040}, + {0xF7FE,0x0040,0x0040,0x0040}, + {0x0040,0x0040,0x0040,0x0040} + }, + .u8APix = { {0xFF,0xFF,0xFF,0x0F}, + {0xFF,0xFF,0x0F,0x0F}, + {0xFF,0x0F,0x0F,0x0F}, + {0x0F,0x0F,0x0F,0x0F} + }, + } + } + }, + { //OK ! + .bReferenceSet = false, + .u8FaultLineIdx = 2, + .data = { + .access = { + .u16Pix = { {0xF7FE,0xFFFF,0xFFFF,0x0040}, + {0xFFFF,0xF7FE,0x0040,0x0040}, + {0xF7FE,0x0040,0x0040,0x0040}, + {0x0040,0x0040,0x0040,0x0040} + }, + .u8APix = { {0xFF,0xFF,0xFF,0x0F}, + {0xFF,0xFF,0x0F,0x0F}, + {0xFF,0x0F,0x0F,0x0F}, + {0x0F,0x0F,0x0F,0x0F} + }, + } + } + }, + { //OK ! + .bReferenceSet = false, + .u8FaultLineIdx = 3, + .data = { + .access = { + .u16Pix = { {0xF7FE,0xF7FF,0xFFFF,0x0040}, + {0xF7FE,0xF7FE,0x0040,0x0040}, + {0xF7FE,0x0040,0x0040,0x0040}, + {0x0040,0x0040,0x0040,0x0040} + }, + .u8APix = { {0xFF,0xFF,0xFF,0x0F}, + {0xFF,0xFF,0x0F,0x0F}, + {0xFF,0x0F,0x0F,0x0F}, + {0x0F,0x0F,0x0F,0x0F} + }, + } + } + }, + { //OK ! + .bReferenceSet = false, + .u8FaultLineIdx = 4, + .data = { + .access = { + .u16Pix = { {0xEFFD,0xEFFF,0xFFFF,0x0040}, + {0xEFFD,0xEFFD,0x0040,0x0040}, + {0xEFFD,0x0040,0x0040,0x0040}, + {0x0040,0x0040,0x0040,0x0040} + }, + .u8APix = { {0xFF,0xFF,0xFF,0x0F}, + {0xFF,0xFF,0x0F,0x0F}, + {0xFF,0x0F,0x0F,0x0F}, + {0x0F,0x0F,0x0F,0x0F} + }, + } + } + }, + { //OK ! + .bReferenceSet = false, + .u8FaultLineIdx = 5, + .data = { + .access = { + .u16Pix = { {0xDFFB,0xDFFF,0xFFFF,0x0040}, + {0xDFFB,0xDFFB,0x0040,0x0040}, + {0xDFFB,0x0040,0x0040,0x0040}, + {0x0040,0x0040,0x0040,0x0040} + }, + .u8APix = { {0xFF,0xFF,0xFF,0x0F}, + {0xFF,0xFF,0x0F,0x0F}, + {0xFF,0x0F,0x0F,0x0F}, + {0x0F,0x0F,0x0F,0x0F} + }, + } + } + }, + { //OK ! + .bReferenceSet = false, + .u8FaultLineIdx = 6, + .data = { + .access = { + .u16Pix = { {0xBFF7,0xBFFF,0xFFFF,0x0040}, + {0xC7F8,0xBFF7,0x0040,0x0040}, + {0xBFF7,0x0040,0x0040,0x0040}, + {0x0040,0x0040,0x0040,0x0040} + }, + .u8APix = { {0xFF,0xFF,0xFF,0x0F}, + {0xFF,0xFF,0x0F,0x0F}, + {0xFF,0x0F,0x0F,0x0F}, + {0x0F,0x0F,0x0F,0x0F} + }, + } + } + }, + { //OK ! + .bReferenceSet = false, + .u8FaultLineIdx = 7, + .data = { + .access = { + .u16Pix = { {0x7FEF,0x7FEF,0xFFFF,0x0040}, + {0x87F0,0x7FEF,0x0040,0x0040}, + {0x7FEF,0x0040,0x0040,0x0040}, + {0x0040,0x0040,0x0040,0x0040} + }, + .u8APix = { {0xFF,0xFF,0xFF,0x0F}, + {0xFF,0xFF,0x0F,0x0F}, + {0xFF,0x0F,0x0F,0x0F}, + {0x0F,0x0F,0x0F,0x0F} + }, + } + } + }, + { //OK ! + .bReferenceSet = false, + .u8FaultLineIdx = 8, + .data = { + .access = { + .u16Pix = { {0x0040,0x0040,0xFFFF,0x0040}, + {0x0040,0x0040,0x0040,0x0040}, + {0x0040,0x0040,0x0040,0x0040}, + {0x0040,0x0040,0x0040,0x0040} + }, + .u8APix = { {0x0F,0x0F,0xFF,0x0F}, + {0x0F,0x0F,0x0F,0x0F}, + {0x0F,0x0F,0x0F,0x0F}, + {0x0F,0x0F,0x0F,0x0F} + }, + } + } + }, + { //OK ! + .bReferenceSet = false, + .u8FaultLineIdx = 9, + .data = { + .access = { + .u16Pix = { {0xFFDF,0xFFFF,0xFFFF,0x0040}, + {0xFFFF,0xFFDF,0x0040,0x0040}, + {0xFFDF,0x0040,0x0040,0x0040}, + {0x0040,0x0040,0x0040,0x0040} + }, + .u8APix = { {0xFD,0xFD,0xFF,0x0F}, + {0xFD,0xFD,0x0F,0x0F}, + {0xFD,0x0F,0x0F,0x0F}, + {0x0F,0x0F,0x0F,0x0F} + }, + } + } + }, + { //OK ! + .bReferenceSet = false, + .u8FaultLineIdx = 10, + .data = { + .access = { + .u16Pix = { {0xFFDF,0xFFFF,0xFFFF,0x0040}, + {0xFFDF,0xFFDF,0x0040,0x0040}, + {0xFFDF,0x0040,0x0040,0x0040}, + {0x0040,0x0040,0x0040,0x0040} + }, + .u8APix = { {0xFB,0xFB,0xFF,0x0F}, + {0xFB,0xFB,0x0F,0x0F}, + {0xFB,0x0F,0x0F,0x0F}, + {0x0F,0x0F,0x0F,0x0F} + }, + } + } + }, + { //OK ! + .bReferenceSet = false, + .u8FaultLineIdx = 11, + .data = { + .access = { + .u16Pix = { {0xFFBF,0xFFFF,0xFFFF,0x0040}, + {0xFFBF,0xFFBF,0x0040,0x0040}, + {0xFFBF,0x0040,0x0040,0x0040}, + {0x0040,0x0040,0x0040,0x0040} + }, + .u8APix = { {0xF7,0xF7,0xFF,0x0F}, + {0xF7,0xF7,0x0F,0x0F}, + {0xF7,0x0F,0x0F,0x0F}, + {0x0F,0x0F,0x0F,0x0F} + }, + } + } + }, + { //OK ! + .bReferenceSet = false, + .u8FaultLineIdx = 12, + .data = { + .access = { + .u16Pix = { {0xFF7F,0xFFFF,0xFFFF,0x0040}, + {0xFF7F,0xFF7F,0x0040,0x0040}, + {0xFF7F,0x0040,0x0040,0x0040}, + {0x0040,0x0040,0x0040,0x0040} + }, + .u8APix = { {0xEF,0xEF,0xFF,0x0F}, + {0xEF,0xEF,0x0F,0x0F}, + {0xEF,0x0F,0x0F,0x0F}, + {0x0F,0x0F,0x0F,0x0F} + }, + } + } + }, + { //OK ! + .bReferenceSet = false, + .u8FaultLineIdx = 13, + .data = { + .access = { + .u16Pix = { {0xFEFF,0xFFFF,0xFFFF,0x0040}, + {0xFEFF,0xFEFF,0x0040,0x0040}, + {0xFEFF,0x0040,0x0040,0x0040}, + {0x0040,0x0040,0x0040,0x0040} + }, + .u8APix = { {0xDF,0xDF,0xFF,0x0F}, + {0xDF,0xDF,0x0F,0x0F}, + {0xDF,0x0F,0x0F,0x0F}, + {0x0F,0x0F,0x0F,0x0F} + }, + } + } + }, + { //OK ! + .bReferenceSet = false, + .u8FaultLineIdx = 14, + .data = { + .access = { + .u16Pix = { {0xFDFF,0xFFFF,0xFFFF,0x0040}, + {0xFDFF,0xFDFF,0x0040,0x0040}, + {0xFDFF,0x0040,0x0040,0x0040}, + {0x0040,0x0040,0x0040,0x0040} + }, + .u8APix = { {0xBF,0xBF,0xFF,0x0F}, + {0xBF,0xBF,0x0F,0x0F}, + {0xBF,0x0F,0x0F,0x0F}, + {0x0F,0x0F,0x0F,0x0F} + }, + } + } + }, + {//OK + .bReferenceSet = false, + .u8FaultLineIdx = 15, + .data = { + .access = { + .u16Pix = { {0xFBFF,0xFFFF,0xFFFF,0x0040}, + {0xFC1F,0xFBFF,0x0040,0x0040}, + {0xFBFF,0x0040,0x0040,0x0040}, + {0x0040,0x0040,0x0040,0x0040} + }, + .u8APix = { {0x7F,0xFF,0xFF,0x0F}, + {0x7F,0x7F,0x0F,0x0F}, + {0x7F,0x0F,0x0F,0x0F}, + {0x0F,0x0F,0x0F,0x0F} + }, + } + } + }, +}; + +const unsigned int uNbPattern_Test3_Dither = +sizeof(ar_sExpectedPattern_Test3_Dither)/sizeof(def_sTestPattern); diff --git a/Utils.c b/Utils.c index a62fc4f..f42bb4b 100644 --- a/Utils.c +++ b/Utils.c @@ -23,7 +23,7 @@ #include "Utils.h" void -sprintbin32( char* szBuff, +sprintbin32( char * szBuff, const uint32_t ulVal, const unsigned char bGroupByBytes) { @@ -53,7 +53,7 @@ printbin32( const uint32_t ulVal, } void -sprintbin32Info(char* szBuff, +sprintbin32Info(char * szBuff, const uint32_t ulVal, const unsigned short uhb, const unsigned short ulb) diff --git a/Utils.h b/Utils.h index 0980cb7..9466261 100644 --- a/Utils.h +++ b/Utils.h @@ -55,25 +55,31 @@ static inline unsigned char count_bit32(const uint32_t ulVal) { + /* unsigned char cpt = 0; for(uint32_t idxBit = 0x80000000u; idxBit != 0; idxBit >>= 1) if(ulVal & idxBit) cpt++; return cpt; + */ + return __builtin_popcount(ulVal); } static inline unsigned char count_bit8(const uint8_t ulVal) { + /* unsigned char cpt = 0; for(uint8_t idxBit = 0x80u; idxBit != 0; idxBit >>= 1) if(ulVal & idxBit) cpt++; return cpt; + */ + return __builtin_popcount(ulVal); } void -sprintbin32( char* szBuff, +sprintbin32( char * const szBuff, const uint32_t ulVal, const unsigned char bGroupByBytes); @@ -82,7 +88,7 @@ printbin32( const uint32_t ulVal, const unsigned char bGroupByBytes); void -sprintbin32Info(char* szBuff, +sprintbin32Info(char * const szBuff, const uint32_t ulVal, const unsigned short uhb, const unsigned short ulb); @@ -142,4 +148,9 @@ mmio_fastwrite32( volatile uint32_t * dst, } } +static inline double dComputeDistance32(const uint32_t u32A,const uint32_t u32B) +{ + return (double)__builtin_popcount( u32A ^ u32B); +} + #endif //_DEF_UTILS_H_ diff --git a/V2MemTest.h b/V2MemTest.h index 359a80e..4248c62 100644 --- a/V2MemTest.h +++ b/V2MemTest.h @@ -1,9 +1,26 @@ +/* V2MemTest - A CLI Tool to test & fix Voodoo² TMU System +* Copyright (C) 2026 ChaCha +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see . +*/ + #ifndef _DEF_V2MEMTEST_H_ #define _DEF_V2MEMTEST_H_ #define V2MEMTEST__VERSION__MAJOR 0 -#define V2MEMTEST__VERSION__MINOR 2 -#define V2MEMTEST__VERSION__PATCH 2 +#define V2MEMTEST__VERSION__MINOR 4 +#define V2MEMTEST__VERSION__PATCH 0 #include #include @@ -57,9 +74,13 @@ typedef struct _def_sOptions def_eTMURamLimit eTMU0RamLimit; int bTestTMU1; def_eTMURamLimit eTMU1RamLimit; + int bTestTMUControl; int bTestTMUAddress; int bTestTMUData; int bTestTMUDataHuge; + int bTestNoMem; + int bQuick; + int bForce; } def_sOptions; extern def_sOptions sOptions; diff --git a/main.c b/main.c index 8907a56..8af8b20 100644 --- a/main.c +++ b/main.c @@ -35,9 +35,11 @@ #include "Draw.h" #include "Test_Common.h" +#include "Test_Control.h" #include "Test_Address.h" #include "Test_Data.h" #include "Test_Data_Huge.h" +#include "Test_Data_NoMem.h" const char* szErrorMsg[] = { @@ -77,7 +79,9 @@ const char szHelp[] = " -h, --help Show this help and exit.\n" " --version Print version (MAJOR.MINOR.PATCH) and exit.\n" " -n, --num Number of loops (default: 1).\n" - " -l, --log Log file path.\n" + " -q, --quick Quicker test (no pre-heat).\n" + " -f, --force Force test (not detected TMU / RAM).\n" + /*" -l, --log Log file path.\n"*/ " --silent Silent mode (suppress normal output).\n" /*" -t, --tsv TSV output file path.\n"*/ "\n" @@ -91,6 +95,8 @@ const char szHelp[] = " --tmu1 Enable only tests for TMU1.\n" "\n" "Test selection [ all if none set ] :\n" + " --no-mem Run no-mem test.\n" + " --control Run control lines tests.\n" " --address Run address tests.\n" " --data Run data tests.\n" " --data-huge Run large/extended data tests.\n" @@ -116,22 +122,30 @@ def_sOptions sOptions = { .bTestTMU1 = false, .eTMU1RamLimit = E_TMU_RAMSIZE__AUTO, .bTestTMUAddress = false, + .bTestTMUControl = false, .bTestTMUData = false, .bTestTMUDataHuge = false, + .bTestNoMem = false, + .bQuick = false, + .bForce = false, }; static struct option long_args[] = { /* {, , , */ {"help", no_argument, NULL, 'h'}, {"num", required_argument, NULL, 'n'}, - {"log", required_argument, NULL, 'l'}, + {"force", required_argument, NULL, 'f'}, + /*{"log", required_argument, NULL, 'l'},*/ {"silent", no_argument, &sOptions.bSilent, true}, + {"quick", no_argument, NULL, 'q'}, /*{"tsv", required_argument, NULL, 't'},*/ {"tmu0", no_argument, &sOptions.bTestTMU0, true}, {"tmu1", no_argument, &sOptions.bTestTMU1, true}, + {"control", no_argument, &sOptions.bTestTMUControl, true}, {"address", no_argument, &sOptions.bTestTMUAddress, true}, {"data", no_argument, &sOptions.bTestTMUData, true}, {"data-huge", no_argument, &sOptions.bTestTMUDataHuge, true}, + {"no-mem", no_argument, &sOptions.bTestNoMem, true}, {"tmu0-ram", required_argument, NULL, 3}, {"tmu1-ram", required_argument, NULL, 1}, {"version", no_argument, NULL, 2}, @@ -146,7 +160,7 @@ ar_dFaultScores_sorted[NB_FAULT_SOURCE]; #define _DEF_TEST_TIME_PER_MB_S 5 -int main(int argc, char **argv) +int main(const int argc, char ** const argv) { int Status = 0; unsigned long long ullNbErrorAll = 0; @@ -156,7 +170,7 @@ int main(int argc, char **argv) bool bQuit = false; FxU32* sst = NULL; - while((opt=getopt_long(argc,argv,"hvn:t:l:",long_args,&option_index)) != -1) + while((opt=getopt_long(argc,argv,"hvfqn:t:l:",long_args,&option_index)) != -1) { switch(opt) { @@ -198,15 +212,22 @@ int main(int argc, char **argv) Status = E_ERROR__UNKNOWN_ARGUMENT; ErrorCheck_gotoCleanUp(); break; - + /* case 'l': strncpy(sOptions.szLogFileName, optarg, 2048); break; + */ /* case 't': strncpy(sOptions.szTSVFile, optarg, 2048); break; */ + case 'q': + sOptions.bQuick = true; + break; + case 'f': + sOptions.bForce = true; + break; case 'h': puts(szHelp); bQuit = true; @@ -244,11 +265,15 @@ int main(int argc, char **argv) if( !sOptions.bTestTMUAddress && !sOptions.bTestTMUData && - !sOptions.bTestTMUDataHuge) + !sOptions.bTestTMUDataHuge && + !sOptions.bTestTMUControl&& + !sOptions.bTestNoMem) { + sOptions.bTestTMUControl = true; sOptions.bTestTMUAddress = true; sOptions.bTestTMUData = true; sOptions.bTestTMUDataHuge = true; + sOptions.bTestNoMem = true; } sst1DeviceInfoStruct devInfo; @@ -299,6 +324,21 @@ int main(int argc, char **argv) ErrorCheck_gotoCleanUp(); } + if(devInfo.numberTmus>2) //FixMe: This case can happen if U8_TMU1_TF_DATA_9 is wrong + { + logE("Only 2 TMUs are supported\n"); + if(sOptions.bForce) + { + logW("Forcing one TMU"); + devInfo.numberTmus = 1; + } + else + { + Status = E_ERROR__NO_TMU_SELECTED; //FixMe: custom error + ErrorCheck_gotoCleanUp(); + } + } + for (int tmu = 0; tmu < devInfo.numberTmus; tmu++) logI("TMU%d detected memory:\t%ld MB\n", tmu, (unsigned long)devInfo.tmuMemSize[tmu]); @@ -315,25 +355,38 @@ int main(int argc, char **argv) if(sOptions.bTestTMU0 && devInfo.numberTmus<1) { logE("TMU0 not Found\n"); - Status = E_ERROR__TMU_NOT_FOUND; - ErrorCheck_gotoCleanUp(); + if(sOptions.bForce) + { + logW("Forcing TMU0 test"); + } + else + { + Status = E_ERROR__TMU_NOT_FOUND; + ErrorCheck_gotoCleanUp(); + } } if(sOptions.bTestTMU1 && devInfo.numberTmus<2) { logE("TMU1 not Found\n"); - Status = E_ERROR__TMU_NOT_FOUND; - ErrorCheck_gotoCleanUp(); + if(sOptions.bForce) + { + logW("Forcing TMU1 test"); + } + else + { + Status = E_ERROR__TMU_NOT_FOUND; + ErrorCheck_gotoCleanUp(); + } } - const bool bTestTMU0 = (devInfo.numberTmus > 0) - && (devInfo.tmuMemSize[0] > 0) - && sOptions.bTestTMU0; + const bool bTestTMU0 = ( (devInfo.numberTmus > 0) + || sOptions.bForce) + && sOptions.bTestTMU0; - const bool bTestTMU1 = (devInfo.numberTmus > 1) - && (devInfo.tmuMemSize[1] > 0) - && sOptions.bTestTMU1; - + const bool bTestTMU1 = ( (devInfo.numberTmus > 1) + || sOptions.bForce) + && sOptions.bTestTMU1; if(!bTestTMU0 && !bTestTMU1) { logE("no TMU selected.\n"); @@ -345,10 +398,26 @@ int main(int argc, char **argv) logW("/!\\ make sure you did test TMU0 BEFORE TMU1.\n\n"); } - ISET(sstregs->lfbMode, SST_LFB_RGBALANES_ARGB | SST_LFB_READFRONTBUFFER); - ISET(sstregs->fbzMode, SST_DRAWBUFFER_FRONT | SST_RGBWRMASK); - ISET(sstregs->fbzColorPath, SST_RGBSEL_TREXOUT | SST_CC_PASS | SST_ENTEXTUREMAP); - ISET(sstregs->textureMode, SST_RGB565 | SST_TC_REPLACE | SST_TCA_REPLACE); + ISET(sstregs->lfbMode, + SST_LFB_RGBALANES_ARGB + | SST_LFB_READFRONTBUFFER); + + ISET(sstregs->fbzMode, + SST_DRAWBUFFER_FRONT + | SST_RGBWRMASK); // <-for NoMEM test + + ISET( sstregs->fbzColorPath, + SST_RGBSEL_TMUOUT + | SST_ASEL_TMUOUT // <-for NoMEM test + | SST_ENTEXTUREMAP); + + for (int tmu = 0; tmu < devInfo.numberTmus; tmu++) + { + ISET( SST_TREX(sstregs,tmu)->textureMode, + SST_RGB565 + | SST_TC_REPLACE + | SST_TCA_REPLACE); + } ISET(sstregs->tLOD, 0); for (int tmu = 0; tmu < devInfo.numberTmus; tmu++) @@ -357,29 +426,128 @@ int main(int argc, char **argv) if((tmu == 1) && !bTestTMU1) continue; logI("## testing Board %d, TMU %d, %ldMB \n",boardNum,tmu,(unsigned long)devInfo.tmuMemSize[tmu]); - - if(sOptions.bTestTMUAddress) + + if(sOptions.bTestNoMem) { unsigned long long err=0; - logI("### pre-heating\n"); - HeatMemAndTMU(&devInfo,sst,sstregs,tmu,0x000000); + if(!sOptions.bQuick) + { + logI("### pre-heating\n"); + HeatMemAndTMU(&devInfo,sst,sstregs,tmu,0x000000); + } - logI("### address & control lines test - cumulated\n"); + logI("### data test - no mem\n"); clearScreen(sstregs,0x00000000,256,256); clock_t test_begin = clock(); do { - err = RenderTestAddress(&devInfo, + err = test_TMU_datalines_NoMem( &devInfo, + sst, + sstregs, + tmu , + ar_dFaultScores); + ullNbErrorAll += err; + logI( err ? "E" : "."); + fflush(stdout); + } + while(!err && + (((double)(clock() - test_begin)/CLOCKS_PER_SEC) + < _DEF_TEST_TIME_PER_MB_S)); + + logI("\n"); + if(err) + { + logW("error detected on TMUs tex lines (no-mem test) !\n"); + logW("skiping next tests.\n\n"); + continue; + } + } + logI("\n"); + + ISET(sstregs->lfbMode, + SST_LFB_RGBALANES_ARGB + | SST_LFB_READFRONTBUFFER); + + if(sOptions.bTestTMUControl && (devInfo.tmuMemSize[tmu]>0)) + { + unsigned long long err=0; + + if(!sOptions.bQuick) + { + logI("### pre-heating\n"); + HeatMemAndTMU(&devInfo,sst,sstregs,tmu,0x000000); + } + + logI("### control lines test - simple\n"); + clearScreen(sstregs,0x00000000,256,256); + + clock_t test_begin = clock(); + int i=0; + do + { + err = TestControl(&devInfo, sst, sstregs, tmu, devInfo.tmuMemSize[tmu], ar_dFaultScores); ullNbErrorAll += err; - logI( err ? "E" : "."); - fflush(stdout); + if(err || (((i++)%1000)==0)) + { + logI( err ? "E" : "."); + fflush(stdout); + } + } + while(!err + && (((double)(clock() - test_begin)/CLOCKS_PER_SEC) + < _DEF_TEST_TIME_PER_MB_S)); + + logI("\n"); + if(err) + { + logW("error detected on control line !\n"); + logW("skiping next tests.\n\n"); + continue; + } + } + + if(sOptions.bTestTMUAddress && (devInfo.tmuMemSize[tmu]>0)) + { + unsigned long long err=0; + + if(!sOptions.bQuick) + { + logI("### pre-heating\n"); + HeatMemAndTMU(&devInfo,sst,sstregs,tmu,0x000000); + } + + logI("### address lines test - cumulated\n"); + clearScreen(sstregs,0x00000000,256,256); + + clock_t test_begin = clock(); + int i=0; + do + { + err = 0; + for( unsigned char stepMemSize=1; + (stepMemSize <= devInfo.tmuMemSize[tmu]) && !err; + stepMemSize++) + { + err = RenderTestAddress(&devInfo, + sst, + sstregs, + tmu, + stepMemSize, + ar_dFaultScores); + ullNbErrorAll += err; + if(err || (((i++)%28)==0)) + { + logI( err ? "E" : "."); + fflush(stdout); + } + } } while(!err && (((double)(clock() - test_begin)/CLOCKS_PER_SEC) @@ -394,12 +562,15 @@ int main(int argc, char **argv) } } - if(sOptions.bTestTMUData) + if(sOptions.bTestTMUData && (devInfo.tmuMemSize[tmu]>0)) { unsigned long long err=0; - logI("### pre-heating\n"); - HeatMemAndTMU(&devInfo,sst,sstregs,tmu,0x000000); + if(!sOptions.bQuick) + { + logI("### pre-heating\n"); + HeatMemAndTMU(&devInfo,sst,sstregs,tmu,0x000000); + } logI("### data test - single bit move\n"); clearScreen(sstregs,0x00000000,256,256); @@ -429,9 +600,12 @@ int main(int argc, char **argv) logW("skiping next tests.\n\n"); continue; } - - logI("### pre-heating\n"); - HeatMemAndTMU(&devInfo,sst,sstregs,tmu,0x000000); + + if(!sOptions.bQuick) + { + logI("### pre-heating\n"); + HeatMemAndTMU(&devInfo,sst,sstregs,tmu,0x000000); + } logI("### data test - random patterns\n"); clearScreen(sstregs,0x00000000,256,256); @@ -463,12 +637,15 @@ int main(int argc, char **argv) } } - if(sOptions.bTestTMUDataHuge) + if(sOptions.bTestTMUDataHuge && (devInfo.tmuMemSize[tmu]>0)) { unsigned long long err=0; - logI("### pre-heating\n"); - HeatMemAndTMU(&devInfo,sst,sstregs,tmu,0x000000); + if(!sOptions.bQuick) + { + logI("### pre-heating\n"); + HeatMemAndTMU(&devInfo,sst,sstregs,tmu,0x000000); + } logI("### data test - huge data set\n"); clearScreen(sstregs,0x00000000,256,256); @@ -500,7 +677,7 @@ int main(int argc, char **argv) } logI("\n"); } - + sst1InitShutdown(sst); sst = NULL; }