| #include "ddr_test.h" |
| #include "BootLoader.h" |
| #include "obm2osl.h" |
| #include "tim.h" |
| |
| |
| #ifdef CONFIG_USE_DDR_ALL_PATTERN |
| static int giBitFails[32], giByteLaneFails[4], giPatternFails[22], giPatternRuns[22],giPatternNumOfFails[22]; |
| #define ANALOG 1 |
| #define CONSTANT 2 |
| #define COMPLEMENT 3 |
| #define DECREMENT 4 |
| #define INCREMENT 5 |
| #define INCREMENTB 6 |
| #define MILLER_EFFECT 7 |
| #define ZERO_ROR_INVERT 8 |
| #define ONE_ROL_INVERT 9 |
| #define ZERO_ROR 10 |
| #define ONE_ROL 11 |
| #define WALKING_ONES 12 |
| #define WALKING_ZEROS 13 |
| #define SSTAILGATE_0101XXXX 14 |
| #define SSTAILGATE_01010000 15 |
| #define SSTAILGATE_01011111 16 |
| #define SSTAILGATE_01011010 17 |
| #define MSTAILGATE 18 |
| #define FREQ_SWEEP 19 |
| #define VERT_INCREMENT 20 |
| #define HORZ_INCREMENT 21 |
| |
| #define read_data_u32(reg) (*((volatile u32 *)(reg))) |
| |
| #define WORD_SIZE (4) |
| |
| static u32 rol32_mcu(u32 val) |
| { |
| u32 msb = val >> 31; |
| |
| val = val << 1; |
| |
| msb &= 0x00000001; |
| val |= msb; |
| |
| return val; |
| } |
| |
| static u32 ror32_mcu(u32 val) |
| { |
| u32 lsb = val << 31; |
| |
| val = val >> 1; |
| |
| val &= 0x7FFFFFFF; |
| val |= lsb; |
| |
| return val; |
| } |
| |
| static int test_write_ANALOG(u32* start, int count) |
| { |
| u32* p = (u32*)start; |
| while (p < (start + count)) |
| { |
| #define DOIT1(i) p[i]=0xffffffff; |
| #define DOIT2(i) p[i]=0x0; |
| |
| DOIT1(0) DOIT2(1) DOIT1(2) DOIT2(3) DOIT1(4) DOIT2(5) DOIT1(6) DOIT2(7) |
| DOIT1(8) DOIT2(9) DOIT1(10) DOIT2(11) DOIT1(12) DOIT2(13) DOIT1(14) DOIT2(15) |
| DOIT1(16) DOIT2(17) DOIT1(18) DOIT2(19) DOIT1(20) DOIT2(21) DOIT1(22) DOIT2(23) |
| DOIT1(24) DOIT2(25) DOIT1(26) DOIT2(27) DOIT1(28) DOIT2(29) DOIT1(30) DOIT2(31) |
| p += 32; |
| |
| DOIT1(0) DOIT2(1) DOIT1(2) DOIT2(3) DOIT1(4) DOIT2(5) DOIT1(6) DOIT2(7) |
| DOIT1(8) DOIT2(9) DOIT1(10) DOIT2(11) DOIT1(12) DOIT2(13) DOIT1(14) DOIT2(15) |
| DOIT1(16) DOIT2(17) DOIT1(18) DOIT2(19) DOIT1(20) DOIT2(21) DOIT1(22) DOIT2(23) |
| DOIT1(24) DOIT2(25) DOIT1(26) DOIT2(27) DOIT1(28) DOIT2(29) DOIT1(30) DOIT2(31) |
| p += 32; |
| } |
| return 0; |
| } |
| #undef DOIT1 |
| #undef DOIT2 |
| |
| static int test_write_CONSTANT(u32* start, int count) |
| { |
| u32* p = (u32*)start; |
| while (p < (start + count)) |
| { |
| #define DOIT1(i) p[i]=0xffffffff; |
| |
| DOIT1(0) DOIT1(1) DOIT1(2) DOIT1(3) DOIT1(4) DOIT1(5) DOIT1(6) DOIT1(7) |
| DOIT1(8) DOIT1(9) DOIT1(10) DOIT1(11) DOIT1(12) DOIT1(13) DOIT1(14) DOIT1(15) |
| DOIT1(16) DOIT1(17) DOIT1(18) DOIT1(19) DOIT1(20) DOIT1(21) DOIT1(22) DOIT1(23) |
| DOIT1(24) DOIT1(25) DOIT1(26) DOIT1(27) DOIT1(28) DOIT1(29) DOIT1(30) DOIT1(31) |
| p += 32; |
| DOIT1(0) DOIT1(1) DOIT1(2) DOIT1(3) DOIT1(4) DOIT1(5) DOIT1(6) DOIT1(7) |
| DOIT1(8) DOIT1(9) DOIT1(10) DOIT1(11) DOIT1(12) DOIT1(13) DOIT1(14) DOIT1(15) |
| DOIT1(16) DOIT1(17) DOIT1(18) DOIT1(19) DOIT1(20) DOIT1(21) DOIT1(22) DOIT1(23) |
| DOIT1(24) DOIT1(25) DOIT1(26) DOIT1(27) DOIT1(28) DOIT1(29) DOIT1(30) DOIT1(31) |
| p += 32; |
| } |
| return 0; |
| } |
| #undef DOIT1 |
| |
| static int test_write_COMPLETEMENT(u32* start, int count, u32 uiStartVal) |
| { |
| u32* p = (u32*)start; |
| while (p < (start + count)) |
| { |
| #define DOIT1(i) p[i]=uiStartVal; |
| #define DOIT2(i) p[i]=(~uiStartVal); |
| |
| DOIT1(0) DOIT2(1) DOIT1(2) DOIT2(3) DOIT1(4) DOIT2(5) DOIT1(6) DOIT2(7) |
| DOIT1(8) DOIT2(9) DOIT1(10) DOIT2(11) DOIT1(12) DOIT2(13) DOIT1(14) DOIT2(15) |
| DOIT1(16) DOIT2(17) DOIT1(18) DOIT2(19) DOIT1(20) DOIT2(21) DOIT1(22) DOIT2(23) |
| DOIT1(24) DOIT2(25) DOIT1(26) DOIT2(27) DOIT1(28) DOIT2(29) DOIT1(30) DOIT2(31) |
| p += 32; |
| |
| DOIT1(0) DOIT2(1) DOIT1(2) DOIT2(3) DOIT1(4) DOIT2(5) DOIT1(6) DOIT2(7) |
| DOIT1(8) DOIT2(9) DOIT1(10) DOIT2(11) DOIT1(12) DOIT2(13) DOIT1(14) DOIT2(15) |
| DOIT1(16) DOIT2(17) DOIT1(18) DOIT2(19) DOIT1(20) DOIT2(21) DOIT1(22) DOIT2(23) |
| DOIT1(24) DOIT2(25) DOIT1(26) DOIT2(27) DOIT1(28) DOIT2(29) DOIT1(30) DOIT2(31) |
| p += 32; |
| } |
| return 0; |
| } |
| #undef DOIT1 |
| #undef DOIT2 |
| |
| static u32 allp_mcuGenerateWordPattern(unsigned long uiSourceAddress, u32 uiPattern, u32 size_in_word, u32 uiStartVal, u32 bCheck) |
| { |
| const u32 c_zero = 0x00000000; |
| u32 test_signal = 0x00000001; |
| u32 c_pattern; |
| u32 c_pattern_or_signal; |
| u32 i = 0, j = 0, k = 0, uiTemp = 0, uiFails = 0, expected; |
| u32 value = 0; |
| |
| u32* Tmp_Address32 = (u32*)(long)uiSourceAddress; |
| |
| giPatternRuns[uiPattern]++; |
| |
| switch (uiPattern) |
| { |
| |
| case ANALOG: |
| //obm_printf("Generating ANALOG Pattern\n\r"); |
| if (bCheck) |
| { |
| for (i = 0; i < size_in_word;) { |
| if (Tmp_Address32[i++] != 0xffffffff) |
| { |
| uiFails++; |
| uiTemp = Tmp_Address32[i - 1]; |
| obm_printf( "FAIL! pa%d:[@0x%08lx]=0x%08X Exp=0x%08X - Dif=0x%08X\n\r", uiPattern, (uiSourceAddress + ((i - 1) * 4)), uiTemp, 0xffffffff, (uiTemp ^ 0xffffffff)); |
| } |
| //else |
| // obm_printf("PASS - pa%d:[@0x%08lx]=0x%08X Exp=0x%08X\n\r", uiPattern, (uiSourceAddress + ((i - 1) * 4)), Tmp_Address32[i - 1], 0xffffffff); |
| |
| if (Tmp_Address32[i++] != 0) |
| { |
| uiFails++; |
| uiTemp = Tmp_Address32[i - 1]; |
| obm_printf( "FAIL! pa%d:[@0x%08lx]=0x%08X Exp=0x%08X - Dif=0x%08X\n\r", uiPattern, (uiSourceAddress + ((i - 1) * 4)), uiTemp, 0, (uiTemp ^ 0)); |
| } |
| //else |
| // obm_printf("PASS - pa%d:[@0x%08lx]=0x%08X Exp=0x%08X\n\r", uiPattern, (uiSourceAddress + ((i - 1) * 4)), Tmp_Address32[i - 1], ~(0xffffffff)); |
| } |
| } |
| else |
| { |
| test_write_ANALOG((u32*)(long)uiSourceAddress, size_in_word); |
| } |
| break; |
| |
| case CONSTANT: |
| uiStartVal = 0xffffffff; |
| //obm_printf("Generating CONSTANT Pattern 0x%X\n\r", uiStartVal); |
| if (bCheck) |
| { |
| for (i = 0; i < size_in_word;) { |
| |
| if (Tmp_Address32[i++] != uiStartVal) |
| { |
| uiFails++; |
| uiTemp = Tmp_Address32[i - 1]; |
| obm_printf( "FAIL! pa%d:[@0x%08lx]=0x%08X Exp=0x%08X - Dif=0x%08X - DB=0x%08X - DA=0x%08X\n\r", uiPattern, (uiSourceAddress + ((i - 1) * 4)), uiTemp, (uiStartVal), (uiTemp ^ uiStartVal), read_data_u32(uiSourceAddress + ((i - 1) * 4)), read_data_u32(uiSourceAddress + ((i + 1) * 4))); |
| } |
| //else |
| // obm_printf("PASS - pa%d:[@0x%08lx]=0x%08X Exp=0x%08X\n\r", uiPattern, (uiSourceAddress + ((i - 1) * 4)), Tmp_Address32[i - 1], (uiStartVal)); |
| } |
| } |
| else |
| { |
| test_write_CONSTANT((u32*)(long)uiSourceAddress, size_in_word); |
| } |
| break; |
| |
| case COMPLEMENT: |
| //obm_printf("Generating COMPLEMENT Pattern - uiStartVal=%08X\n\r", uiStartVal); |
| if (bCheck) |
| { |
| for (i = 0; i < size_in_word;) |
| { |
| if (Tmp_Address32[i++] != (uiStartVal)) |
| { |
| uiFails++; |
| uiTemp = Tmp_Address32[i - 1]; |
| obm_printf( "FAIL! pa%d:[@0x%08lx]=0x%08X Exp=0x%08X - Dif=0x%08X\n\r", uiPattern, (uiSourceAddress + ((i - 1) * 4)), uiTemp, (uiStartVal), (uiTemp ^ (uiStartVal))); |
| } |
| // else |
| // obm_printf("PASS - pa%d:[@0x%08lx]=0x%08X Exp=0x%08X\n\r", uiPattern, (uiSourceAddress + ((i - 1) * 4)), Tmp_Address32[i - 1], (uiStartVal)); |
| |
| if (Tmp_Address32[i++] != (~uiStartVal)) |
| { |
| uiFails++; |
| uiTemp = Tmp_Address32[i - 1]; |
| obm_printf( "FAIL! pa%d:[@0x%08lx]=0x%08X Exp=0x%08X - Dif=0x%08X\n\r", uiPattern, (uiSourceAddress + ((i - 1) * 4)), uiTemp, (~uiStartVal), (uiTemp ^ (~uiStartVal))); |
| |
| } |
| // else |
| // obm_printf("PASS - pa%d:[@0x%08lx]=0x%08X Exp=0x%08X\n\r", uiPattern, (uiSourceAddress + ((i - 1) * 4)), Tmp_Address32[i - 1], (~uiStartVal)); |
| } |
| } |
| else |
| { |
| test_write_COMPLETEMENT((u32*)(long)uiSourceAddress, size_in_word, uiStartVal); |
| } |
| break; |
| |
| case DECREMENT: |
| //obm_printf("Generating DECREMENT Pattern - uiStartVal=%08X\n\r", uiStartVal); |
| if (uiStartVal == 0) uiStartVal = 0xF0F0F0F0; |
| c_pattern = uiStartVal; |
| if (bCheck) |
| { |
| for (i = 0; i < size_in_word;) { |
| if (Tmp_Address32[i++] != c_pattern) |
| { |
| uiFails++; |
| uiTemp = Tmp_Address32[i - 1]; |
| obm_printf( "FAIL! pa%d:[@0x%08lx]=0x%08X Exp=0x%08X - Dif=0x%08X\n\r", uiPattern, (uiSourceAddress + ((i - 1) * 4)), uiTemp, c_pattern, (uiTemp ^ c_pattern)); |
| } |
| //else |
| // obm_printf("PASS - pa%d:[@0x%08lx]=0x%08X Exp=0x%08X\n\r", uiPattern, (uiSourceAddress + ((i - 1) * 4)), Tmp_Address32[i - 1], c_pattern); |
| |
| |
| if (Tmp_Address32[i++] != 0xFFFFFFFF) |
| { |
| uiFails++; |
| uiTemp = Tmp_Address32[i - 1]; |
| obm_printf( "FAIL! pa%d:[@0x%08lx]=0x%08X Exp=0x%08X - Dif=0x%08X\n\r", uiPattern, (uiSourceAddress + ((i - 1) * 4)), uiTemp, 0xFFFFFFFF, (uiTemp ^ 0xFFFFFFFF)); |
| } |
| //else |
| // obm_printf("PASS - pa%d:[@0x%08lx]=0x%08X Exp=0x%08X\n\r", uiPattern, (uiSourceAddress + ((i - 1) * 4)), Tmp_Address32[i - 1], 0xFFFFFFFF); |
| |
| if (c_pattern == 0) |
| c_pattern = uiStartVal; |
| else |
| c_pattern--; |
| |
| } |
| } |
| else |
| { |
| for (i = 0; i < size_in_word;) { |
| Tmp_Address32[i++] = c_pattern; |
| Tmp_Address32[i++] = 0xFFFFFFFF; |
| if (c_pattern == 0) |
| c_pattern = uiStartVal; |
| else |
| c_pattern--; |
| } |
| } |
| break; |
| |
| case INCREMENT: |
| //obm_printf("Generating INCREMENT Pattern - uiStartVal=%08X\n\r", uiStartVal); |
| if (uiStartVal == 0xFFFFFFFF) uiStartVal = 0; |
| c_pattern = uiStartVal; |
| if (bCheck) |
| { |
| for (i = 0; i < size_in_word;) { |
| if (Tmp_Address32[i++] != c_pattern) |
| { |
| uiFails++; |
| uiTemp = Tmp_Address32[i - 1]; |
| obm_printf( "FAIL! pa%d:[@0x%08lx]=0x%08X Exp=0x%08X - Dif=0x%08X\n\r", uiPattern, (uiSourceAddress + ((i - 1) * 4)), uiTemp, c_pattern, (uiTemp ^ c_pattern)); |
| } |
| // else |
| // obm_printf("PASS - pa%d:[@0x%08lx]=0x%08X Exp=0x%08X\n\r", uiPattern, (uiSourceAddress + ((i - 1) * 4)), Tmp_Address32[i - 1], c_pattern); |
| |
| if (Tmp_Address32[i++] != 0) |
| { |
| uiFails++; |
| uiTemp = Tmp_Address32[i - 1]; |
| obm_printf( "FAIL! pa%d:[@0x%08lx]=0x%08X Exp=0x%08X - Dif=0x%08X\n\r", uiPattern, (uiSourceAddress + ((i - 1) * 4)), uiTemp, 0, (uiTemp ^ 0)); |
| } |
| //else |
| // obm_printf("PASS - pa%d:[@0x%08lx]=0x%08X Exp=0x%08X\n\r", uiPattern, (uiSourceAddress + ((i - 1) * 4)), Tmp_Address32[i - 1], 0); |
| |
| if (c_pattern == 0xFFFFFFFF) |
| c_pattern = 0; |
| else |
| c_pattern++; |
| |
| } |
| } |
| else |
| { |
| for (i = 0; i < size_in_word;) { |
| Tmp_Address32[i++] = c_pattern; |
| Tmp_Address32[i++] = 0; |
| |
| |
| if (c_pattern == 0xFFFFFFFF) |
| c_pattern = 0; |
| else |
| c_pattern++; |
| } |
| } |
| |
| break; |
| |
| case INCREMENTB: |
| //obm_printf("Generating INCREMENTB Pattern - uiStartVal=%08X\n\r", c_zero); |
| c_pattern = uiStartVal; |
| if (bCheck) |
| { |
| for (i = 0; i < size_in_word;) { |
| if (Tmp_Address32[i++] != c_pattern) |
| { |
| uiFails++; |
| uiTemp = Tmp_Address32[i - 1]; |
| obm_printf( "FAIL! pa%d:[@0x%08lx]=0x%08X Exp=0x%08X - Dif=0x%08X - DB=0x%08X - DA=0x%08X\n\r", uiPattern, (uiSourceAddress + ((i - 1) * 4)), uiTemp, c_pattern, (uiTemp ^ c_pattern), read_data_u32(uiSourceAddress + ((i - 1) * 4)), read_data_u32(uiSourceAddress + ((i + 1) * 4))); |
| expected = c_pattern; |
| #if 0 |
| process_fail(expected, uiTemp); |
| #endif |
| } |
| // else |
| // obm_printf("PASS - pa%d:[@0x%08lx]=0x%08X Exp=0x%08X\n\r", uiPattern, (uiSourceAddress + ((i - 1) * 4)), Tmp_Address32[i - 1], c_pattern); |
| |
| c_pattern += 0x04040404; |
| if ((c_pattern & 0xFF) == 0) c_pattern = uiStartVal; |
| |
| } |
| } |
| else |
| { |
| for (i = 0; i < size_in_word;) { |
| Tmp_Address32[i++] = c_pattern; |
| c_pattern += 0x04040404; |
| if ((c_pattern & 0xFF) == 0) c_pattern = uiStartVal; |
| |
| } |
| } |
| break; |
| |
| case MILLER_EFFECT: |
| //obm_printf("Generating MILLER_EFFECT "); |
| c_pattern = 0x55555555; |
| //obm_printf("Generating MILLER_EFFECT Pattern - uiStartVal=%08X\n\r", c_pattern); |
| if (bCheck) |
| { |
| for (i = 0; i < size_in_word;) |
| { |
| if (Tmp_Address32[i++] != (c_pattern)) |
| { |
| uiFails++; |
| uiTemp = Tmp_Address32[i - 1]; |
| obm_printf( "FAIL! pa%d:[@0x%08lx]=0x%08X Exp=0x%08X - Dif=0x%08X\n\r", uiPattern, (uiSourceAddress + ((i - 1) * 4)), uiTemp, (c_pattern), (uiTemp ^ (c_pattern))); |
| |
| } |
| // else |
| // obm_printf("PASS - pa%d:[@0x%08lx]=0x%08X Exp=0x%08X\n\r", uiPattern, (uiSourceAddress + ((i - 1) * 4)), Tmp_Address32[i - 1], (c_pattern)); |
| |
| if (Tmp_Address32[i++] != (~c_pattern)) |
| { |
| uiFails++; |
| uiTemp = Tmp_Address32[i - 1]; |
| obm_printf( "FAIL! pa%d:[@0x%08lx]=0x%08X Exp=0x%08X - Dif=0x%08X\n\r", uiPattern, (uiSourceAddress + ((i - 1) * 4)), uiTemp, (~c_pattern), (uiTemp ^ (~c_pattern))); |
| |
| |
| } |
| //else |
| // obm_printf("PASS - pa%d:[@0x%08lx]=0x%08X Exp=0x%08X\n\r", uiPattern, (uiSourceAddress + ((i - 1) * 4)), Tmp_Address32[i - 1], (~c_pattern)); |
| } |
| } |
| else |
| { |
| for (i = 0; i < size_in_word;) { |
| Tmp_Address32[i++] = (c_pattern); |
| Tmp_Address32[i++] = (~c_pattern); |
| } |
| } |
| break; |
| |
| case ZERO_ROR_INVERT: |
| //obm_printf("Generating ZERO_ROR_INVERT Pattern\n\r"); |
| if (bCheck) |
| { |
| for (i = 0; i < size_in_word;) |
| { |
| if (Tmp_Address32[i++] != (uiStartVal)) |
| { |
| uiFails++; |
| uiTemp = Tmp_Address32[i - 1]; |
| obm_printf( "FAIL! pa%d:[@0x%08lx]=0x%08X Exp=0x%08X - Dif=0x%08X\n\r", uiPattern, (uiSourceAddress + ((i - 1) * 4)), uiTemp, (uiStartVal), (uiTemp ^ (uiStartVal))); |
| |
| } |
| // else |
| // obm_printf("PASS - pa%d:[@0x%08lx]=0x%08X Exp=0x%08X\n\r", uiPattern, (uiSourceAddress + ((i - 1) * 4)), Tmp_Address32[i - 1], (uiStartVal)); |
| |
| if (Tmp_Address32[i++] != (~uiStartVal)) |
| { |
| uiFails++; |
| uiTemp = Tmp_Address32[i - 1]; |
| obm_printf( "FAIL! pa%d:[@0x%08lx]=0x%08X Exp=0x%08X - Dif=0x%08X\n\r", uiPattern, (uiSourceAddress + ((i - 1) * 4)), uiTemp, (~uiStartVal), (uiTemp ^ (~uiStartVal))); |
| |
| |
| } |
| // else |
| // obm_printf("PASS - pa%d:[@0x%08lx]=0x%08X Exp=0x%08X\n\r", uiPattern, (uiSourceAddress + ((i - 1) * 4)), Tmp_Address32[i - 1], (~uiStartVal)); |
| |
| uiStartVal = ror32_mcu(uiStartVal); |
| } |
| } |
| else |
| { |
| for (i = 0; i < size_in_word;) { |
| Tmp_Address32[i++] = (uiStartVal); |
| Tmp_Address32[i++] = (~uiStartVal); |
| uiStartVal = ror32_mcu(uiStartVal); |
| } |
| } |
| break; |
| |
| case ONE_ROL_INVERT: |
| //obm_printf("Generating ONE_ROL_INVERT Pattern\n\r"); |
| if (bCheck) |
| { |
| for (i = 0; i < size_in_word;) |
| { |
| if (Tmp_Address32[i++] != (uiStartVal)) |
| { |
| uiFails++; |
| uiTemp = Tmp_Address32[i - 1]; |
| obm_printf( "FAIL! pa%d:[@0x%08lx]=0x%08X Exp=0x%08X - Dif=0x%08X\n\r", uiPattern, (uiSourceAddress + ((i - 1) * 4)), uiTemp, (uiStartVal), (uiTemp ^ (uiStartVal))); |
| |
| } |
| // else |
| // obm_printf("PASS - pa%d:[@0x%08lx]=0x%08X Exp=0x%08X\n\r", uiPattern, (uiSourceAddress + ((i - 1) * 4)), Tmp_Address32[i - 1], (uiStartVal)); |
| |
| if (Tmp_Address32[i++] != (~uiStartVal)) |
| { |
| uiFails++; |
| uiTemp = Tmp_Address32[i - 1]; |
| obm_printf( "FAIL! pa%d:[@0x%08lx]=0x%08X Exp=0x%08X - Dif=0x%08X\n\r", uiPattern, (uiSourceAddress + ((i - 1) * 4)), uiTemp, (~uiStartVal), (uiTemp ^ (~uiStartVal))); |
| |
| |
| } |
| // else |
| // obm_printf("PASS - pa%d:[@0x%08lx]=0x%08X Exp=0x%08X\n\r", uiPattern, (uiSourceAddress + ((i - 1) * 4)), Tmp_Address32[i - 1], (~uiStartVal)); |
| |
| uiStartVal = rol32_mcu(uiStartVal); |
| } |
| } |
| else |
| { |
| for (i = 0; i < size_in_word;) { |
| Tmp_Address32[i++] = (uiStartVal); |
| Tmp_Address32[i++] = (~uiStartVal); |
| uiStartVal = rol32_mcu(uiStartVal); |
| } |
| } |
| |
| break; |
| |
| case ZERO_ROR: |
| //obm_printf("Generating ZERO_ROR Pattern\n\r"); |
| if (bCheck) |
| { |
| for (i = 0; i < size_in_word;) { |
| if (Tmp_Address32[i++] != (uiStartVal)) |
| { |
| uiFails++; |
| uiTemp = Tmp_Address32[i - 1]; |
| obm_printf( "FAIL! pa%d:[@0x%08lx]=0x%08X Exp=0x%08X - Dif=0x%08X - DB=0x%08X - DA=0x%08X\n\r", uiPattern, (uiSourceAddress + ((i - 1) * 4)), uiTemp, (uiStartVal), (uiTemp ^ (uiStartVal)), read_data_u32(uiSourceAddress + ((i - 1) * 4)), read_data_u32(uiSourceAddress + ((i + 1) * 4))); |
| |
| } |
| // else |
| // obm_printf("PASS - pa%d:[@0x%08lx]=0x%08X Exp=0x%08X\n\r", uiPattern, (uiSourceAddress + (i * 4)), Tmp_Address32[i - 1], (uiStartVal)); |
| |
| uiStartVal = ror32_mcu(uiStartVal); |
| } |
| } |
| else |
| { |
| for (i = 0; i < size_in_word;) { |
| Tmp_Address32[i++] = (uiStartVal); |
| uiStartVal = ror32_mcu(uiStartVal); |
| } |
| } |
| break; |
| |
| case ONE_ROL: |
| //obm_printf("Generating ONE_ROL Pattern\n\r"); |
| if (bCheck) |
| { |
| for (i = 0; i < size_in_word;) { |
| if (Tmp_Address32[i++] != (uiStartVal)) |
| { |
| uiFails++; |
| uiTemp = Tmp_Address32[i - 1]; |
| obm_printf( "FAIL! pa%d:[@0x%08lx]=0x%08X Exp=0x%08X - Dif=0x%08X - DB=0x%08X - DA=0x%08X\n\r", uiPattern, (uiSourceAddress + ((i - 1) * 4)), uiTemp, (uiStartVal), (uiTemp ^ (uiStartVal)), read_data_u32(uiSourceAddress + ((i - 1) * 4)), read_data_u32(uiSourceAddress + ((i + 1) * 4))); |
| |
| } |
| // else |
| // obm_printf("PASS - pa%d:[@0x%08lx]=0x%08X Exp=0x%08X\n\r", uiPattern, (uiSourceAddress + ((i - 1) * 4)), Tmp_Address32[i - 1], (uiStartVal)); |
| |
| uiStartVal = rol32_mcu(uiStartVal); |
| } |
| } |
| else |
| { |
| for (i = 0; i < size_in_word;) { |
| Tmp_Address32[i++] = (uiStartVal); |
| uiStartVal = rol32_mcu(uiStartVal); |
| } |
| } |
| break; |
| |
| case WALKING_ONES: |
| //obm_printf("Generating WALKING_ONES Pattern\n\r"); |
| i = 0; |
| if (bCheck) |
| { |
| for (j = 0; j < size_in_word;) |
| { |
| if (Tmp_Address32[j++] != (1 << i)) |
| { |
| uiFails++; |
| uiTemp = Tmp_Address32[j - 1]; |
| obm_printf( "FAIL! pa%d:[@0x%08lx]=0x%08X Exp=0x%08X - Dif=0x%08X\n\r", uiPattern, (uiSourceAddress + ((j - 1) * 4)), uiTemp, (1 << i), (uiTemp ^ (1 << i))); |
| |
| } |
| // else |
| // obm_printf("PASS - pa%d:[@0x%08lx]=0x%08X Exp=0x%08X\n\r", uiPattern, (uiSourceAddress + ((j - 1) * 4)), Tmp_Address32[j - 1], ~(1 << i)); |
| |
| if (Tmp_Address32[j++] != 0xFFFFFFFF) |
| { |
| uiFails++; |
| uiTemp = Tmp_Address32[j - 1]; |
| obm_printf( "FAIL! pa%d:[@0x%08lx]=0x%08X Exp=0x%08X - Dif=0x%08X\n\r", uiPattern, (uiSourceAddress + ((j - 1) * 4)), uiTemp, 0xFFFFFFFF, (uiTemp ^ 0xFFFFFFFF)); |
| |
| } |
| // else |
| // obm_printf("PASS - pa%d:[@0x%08lx]=0x%08X Exp=0x%08X\n\r", uiPattern, (uiSourceAddress + ((j - 1) * 4)), Tmp_Address32[j - 1], 0xFFFFFFFF); |
| |
| |
| i++; |
| if (i >= 32) i = 0; |
| } |
| } |
| else |
| { |
| for (j = 0; j < size_in_word; ) |
| { |
| Tmp_Address32[j++] = (u32)(1 << i); |
| Tmp_Address32[j++] = 0xFFFFFFFF; |
| |
| i++; |
| if (i >= 32) i = 0; |
| } |
| } |
| break; |
| |
| case WALKING_ZEROS: |
| //obm_printf("Generating WALKING_ZEROS Pattern\n\r"); |
| i = 0; |
| if (bCheck) |
| { |
| for (j = 0; j < size_in_word;) |
| { |
| if (Tmp_Address32[j++] != ~(1 << i)) |
| { |
| uiFails++; |
| uiTemp = Tmp_Address32[j - 1]; |
| obm_printf( "FAIL! pa%d:[@0x%08lx]=0x%08X Exp=0x%08X - Dif=0x%08X\n\r", uiPattern, (uiSourceAddress + ((j - 1) * 4)), uiTemp, ~(1 << i), (uiTemp ^ ~(1 << i))); |
| |
| } |
| // else |
| // obm_printf("PASS - pa%d:[@0x%08lx]=0x%08X Exp=0x%08X\n\r", uiPattern, (uiSourceAddress + ((j - 1) * 4)), Tmp_Address32[j - 1], ~(1 << i)); |
| |
| if (Tmp_Address32[j++] != 0) |
| { |
| uiFails++; |
| uiTemp = Tmp_Address32[j - 1]; |
| obm_printf( "FAIL! pa%d:[@0x%08lx]=0x%08X Exp=0x%08X - Dif=0x%08X\n\r", uiPattern, (uiSourceAddress + ((j - 1) * 4)), uiTemp, 0, (uiTemp ^ 0)); |
| |
| } |
| // else |
| // obm_printf("PASS - pa%d:[@0x%08lx]=0x%08X Exp=0x%08X\n\r", uiPattern, (uiSourceAddress + ((j - 1) * 4)), Tmp_Address32[j - 1], 0); |
| |
| |
| i++; |
| if (i >= 32) i = 0; |
| } |
| } |
| else |
| { |
| for (j = 0; j < size_in_word; ) |
| { |
| Tmp_Address32[j++] = (u32)~(1 << i); |
| Tmp_Address32[j++] = 0; |
| |
| i++; |
| if (i >= 32) i = 0; |
| } |
| } |
| break; |
| |
| case SSTAILGATE_0101XXXX: //SSTAILGATE 0101XXXX |
| value = 0xFFFEFFFE; |
| //obm_printf("Generating WALKING_ZEROS Pattern\n\r"); |
| i = 0; |
| if (bCheck) |
| { |
| for (j = 0; j < size_in_word;) |
| { |
| if (Tmp_Address32[j++] != value) |
| { |
| uiFails++; |
| uiTemp = Tmp_Address32[j - 1]; |
| obm_printf( "FAIL! pa%d:[@0x%08lx]=0x%08X Exp=0x%08X - Dif=0x%08X\n\r", uiPattern, (uiSourceAddress + ((j - 1) * 4)), uiTemp, value, (uiTemp ^ value)); |
| |
| } |
| // else |
| // obm_printf("PASS - pa%d:[@0x%08lx]=0x%08X Exp=0x%08X\n\r", uiPattern, (uiSourceAddress + ((j - 1) * 4)), Tmp_Address32[j - 1], value); |
| |
| if (Tmp_Address32[j++] != 0) |
| { |
| uiFails++; |
| uiTemp = Tmp_Address32[j - 1]; |
| obm_printf( "FAIL! pa%d:[@0x%08lx]=0x%08X Exp=0x%08X - Dif=0x%08X\n\r", uiPattern, (uiSourceAddress + ((j - 1) * 4)), uiTemp, 0, (uiTemp ^ 0)); |
| |
| } |
| // else |
| // obm_printf("PASS - pa%d:[@0x%08lx]=0x%08X Exp=0x%08X\n\r", uiPattern, (uiSourceAddress + ((j - 1) * 4)), Tmp_Address32[j - 1], 0); |
| |
| value = ror32_mcu(value); |
| } |
| } |
| else |
| { |
| for (j = 0; j < size_in_word; ) |
| { |
| Tmp_Address32[j++] = value; |
| Tmp_Address32[j++] = 0; |
| value = ror32_mcu(value); |
| } |
| } |
| break; |
| |
| case SSTAILGATE_01010000: //SSTAILGATE 0101XXXX |
| value = 0xFEFEFEFE; |
| //obm_printf("Generating WALKING_ZEROS Pattern\n\r"); |
| i = 0; |
| if (bCheck) |
| { |
| for (j = 0; j < size_in_word;) |
| { |
| if (Tmp_Address32[j++] != value) |
| { |
| uiFails++; |
| uiTemp = Tmp_Address32[j - 1]; |
| obm_printf( "FAIL! pa%d:[@0x%08lx]=0x%08X Exp=0x%08X - Dif=0x%08X\n\r", uiPattern, (uiSourceAddress + ((j - 1) * 4)), uiTemp, value, (uiTemp ^ value)); |
| |
| } |
| // else |
| // obm_printf("PASS - pa%d:[@0x%08lx]=0x%08X Exp=0x%08X\n\r", uiPattern, (uiSourceAddress + ((j - 1) * 4)), Tmp_Address32[j - 1], value); |
| |
| if (Tmp_Address32[j++] != 0) |
| { |
| uiFails++; |
| uiTemp = Tmp_Address32[j - 1]; |
| obm_printf( "FAIL! pa%d:[@0x%08lx]=0x%08X Exp=0x%08X - Dif=0x%08X\n\r", uiPattern, (uiSourceAddress + ((j - 1) * 4)), uiTemp, 0, (uiTemp ^ 0)); |
| |
| } |
| // else |
| // obm_printf("PASS - pa%d:[@0x%08lx]=0x%08X Exp=0x%08X\n\r", uiPattern, (uiSourceAddress + ((j - 1) * 4)), Tmp_Address32[j - 1], 0); |
| |
| value = ror32_mcu(value); |
| } |
| } |
| else |
| { |
| for (j = 0; j < size_in_word; ) |
| { |
| Tmp_Address32[j++] = value; |
| Tmp_Address32[j++] = 0; |
| value = ror32_mcu(value); |
| } |
| } |
| break; |
| |
| case SSTAILGATE_01011111: //SSTAILGATE 0101XXXX |
| case MSTAILGATE: |
| //obm_printf("Generating SSTAILGATE_0101 Pattern\n\r"); |
| if (uiPattern == SSTAILGATE_01011111) |
| uiStartVal = 0x00000001; |
| else if (uiPattern == MSTAILGATE) |
| uiStartVal = 0xFFFFFFFF; |
| |
| c_pattern = (uiStartVal); |
| c_pattern_or_signal = (uiStartVal | test_signal); |
| |
| if (bCheck) |
| { |
| for (i = 0; i < size_in_word;) |
| { |
| if (Tmp_Address32[i++] != c_zero) |
| { |
| uiFails++; |
| uiTemp = Tmp_Address32[i - 1]; |
| obm_printf( "FAIL! pa%d:[@0x%08lx]=0x%08X Exp=0x%08X - Dif=0x%08X\n\r", uiPattern, (uiSourceAddress + ((i - 1) * 4)), uiTemp, c_zero, (uiTemp ^ c_zero)); |
| |
| |
| } |
| else if (Tmp_Address32[i++] != c_pattern_or_signal) |
| { |
| uiFails++; |
| uiTemp = Tmp_Address32[i - 1]; |
| obm_printf( "FAIL! pa%d:[@0x%08lx]=0x%08X Exp=0x%08X - Dif=0x%08X\n\r", uiPattern, (uiSourceAddress + ((i - 1) * 4)), uiTemp, c_pattern_or_signal, (uiTemp ^ c_pattern_or_signal)); |
| |
| } |
| else if (Tmp_Address32[i++] != c_zero) |
| { |
| uiFails++; |
| uiTemp = Tmp_Address32[i - 1]; |
| obm_printf( "FAIL! pa%d:[@0x%08lx]=0x%08X Exp=0x%08X - Dif=0x%08X\n\r", uiPattern, (uiSourceAddress + ((i - 1) * 4)), uiTemp, c_zero, (uiTemp ^ c_zero)); |
| |
| } |
| else if (Tmp_Address32[i++] != c_pattern_or_signal) |
| { |
| uiFails++; |
| uiTemp = Tmp_Address32[i - 1]; |
| obm_printf( "FAIL! pa%d:[@0x%08lx]=0x%08X Exp=0x%08X - Dif=0x%08X\n\r", uiPattern, (uiSourceAddress + ((i - 1) * 4)), uiTemp, c_pattern_or_signal, (uiTemp ^ c_pattern_or_signal)); |
| |
| } |
| else if (Tmp_Address32[i++] != c_pattern) |
| { |
| uiFails++; |
| uiTemp = Tmp_Address32[i - 1]; |
| obm_printf( "FAIL! pa%d:[@0x%08lx]=0x%08X Exp=0x%08X - Dif=0x%08X\n\r", uiPattern, (uiSourceAddress + ((i - 1) * 4)), uiTemp, c_pattern, (uiTemp ^ c_pattern)); |
| |
| } |
| else if (Tmp_Address32[i++] != c_pattern) |
| { |
| uiFails++; |
| uiTemp = Tmp_Address32[i - 1]; |
| obm_printf( "FAIL! pa%d:[@0x%08lx]=0x%08X Exp=0x%08X - Dif=0x%08X\n\r", uiPattern, (uiSourceAddress + ((i - 1) * 4)), uiTemp, c_pattern, (uiTemp ^ c_pattern)); |
| |
| } |
| else if (Tmp_Address32[i++] != c_pattern) |
| { |
| uiFails++; |
| uiTemp = Tmp_Address32[i - 1]; |
| obm_printf( "FAIL! pa%d:[@0x%08lx]=0x%08X Exp=0x%08X - Dif=0x%08X\n\r", uiPattern, (uiSourceAddress + ((i - 1) * 4)), uiTemp, c_pattern, (uiTemp ^ c_pattern)); |
| |
| } |
| else if (Tmp_Address32[i++] != c_pattern) |
| { |
| uiFails++; |
| uiTemp = Tmp_Address32[i - 1]; |
| obm_printf( "FAIL! pa%d:[@0x%08lx]=0x%08X Exp=0x%08X - Dif=0x%08X\n\r", uiPattern, (uiSourceAddress + ((i - 1) * 4)), uiTemp, c_pattern, (uiTemp ^ c_pattern)); |
| |
| } |
| // else |
| // obm_printf("PASS - pa%d all data\n\r", uiPattern); |
| |
| } |
| } |
| else |
| { |
| for (i = 0; i < size_in_word;) |
| { |
| Tmp_Address32[i++] = c_zero; |
| Tmp_Address32[i++] = c_pattern_or_signal; |
| Tmp_Address32[i++] = c_zero; |
| Tmp_Address32[i++] = c_pattern_or_signal; |
| Tmp_Address32[i++] = c_pattern; |
| Tmp_Address32[i++] = c_pattern; |
| Tmp_Address32[i++] = c_pattern; |
| Tmp_Address32[i++] = c_pattern; |
| } |
| } |
| break; |
| |
| case SSTAILGATE_01011010: //SSTAILGATE 01011010 |
| //obm_printf("Generating SSTAILGATE_1100 Pattern\n\r"); |
| uiStartVal = 0x00000001; |
| c_pattern = (uiStartVal); |
| c_pattern_or_signal = (uiStartVal | test_signal); |
| |
| if (bCheck) |
| { |
| for (i = 0; i < size_in_word;) |
| { |
| if (Tmp_Address32[i++] != c_zero) |
| { |
| uiFails++; |
| uiTemp = Tmp_Address32[i - 1]; |
| obm_printf( "FAIL! pa%d:[@0x%08lx]=0x%08X Exp=0x%08X - Dif=0x%08X\n\r", uiPattern, (uiSourceAddress + ((i - 1) * 4)), uiTemp, c_zero, (uiTemp ^ c_zero)); |
| |
| |
| } |
| else if (Tmp_Address32[i++] != c_pattern_or_signal) |
| { |
| uiFails++; |
| uiTemp = Tmp_Address32[i - 1]; |
| obm_printf( "FAIL! pa%d:[@0x%08lx]=0x%08X Exp=0x%08X - Dif=0x%08X\n\r", uiPattern, (uiSourceAddress + ((i - 1) * 4)), uiTemp, c_pattern_or_signal, (uiTemp ^ c_pattern_or_signal)); |
| |
| } |
| else if (Tmp_Address32[i++] != c_zero) |
| { |
| uiFails++; |
| uiTemp = Tmp_Address32[i - 1]; |
| obm_printf( "FAIL! pa%d:[@0x%08lx]=0x%08X Exp=0x%08X - Dif=0x%08X\n\r", uiPattern, (uiSourceAddress + ((i - 1) * 4)), uiTemp, c_zero, (uiTemp ^ c_zero)); |
| |
| } |
| else if (Tmp_Address32[i++] != c_pattern_or_signal) |
| { |
| uiFails++; |
| uiTemp = Tmp_Address32[i - 1]; |
| obm_printf( "FAIL! pa%d:[@0x%08lx]=0x%08X Exp=0x%08X - Dif=0x%08X\n\r", uiPattern, (uiSourceAddress + ((i - 1) * 4)), uiTemp, c_pattern_or_signal, (uiTemp ^ c_pattern_or_signal)); |
| |
| } |
| else if (Tmp_Address32[i++] != c_pattern) |
| { |
| uiFails++; |
| uiTemp = Tmp_Address32[i - 1]; |
| obm_printf( "FAIL! pa%d:[@0x%08lx]=0x%08X Exp=0x%08X - Dif=0x%08X\n\r", uiPattern, (uiSourceAddress + ((i - 1) * 4)), uiTemp, c_pattern, (uiTemp ^ c_pattern)); |
| |
| } |
| else if (Tmp_Address32[i++] != c_zero) |
| { |
| uiFails++; |
| uiTemp = Tmp_Address32[i - 1]; |
| obm_printf( "FAIL! pa%d:[@0x%08lx]=0x%08X Exp=0x%08X - Dif=0x%08X\n\r", uiPattern, (uiSourceAddress + ((i - 1) * 4)), uiTemp, c_zero, (uiTemp ^ c_zero)); |
| |
| } |
| else if (Tmp_Address32[i++] != c_pattern) |
| { |
| uiFails++; |
| uiTemp = Tmp_Address32[i - 1]; |
| obm_printf( "FAIL! pa%d:[@0x%08lx]=0x%08X Exp=0x%08X - Dif=0x%08X\n\r", uiPattern, (uiSourceAddress + ((i - 1) * 4)), uiTemp, c_pattern, (uiTemp ^ c_pattern)); |
| |
| } |
| else if (Tmp_Address32[i++] != c_zero) |
| { |
| uiFails++; |
| uiTemp = Tmp_Address32[i - 1]; |
| obm_printf( "FAIL! pa%d:[@0x%08lx]=0x%08X Exp=0x%08X - Dif=0x%08X\n\r", uiPattern, (uiSourceAddress + ((i - 1) * 4)), uiTemp, c_zero, (uiTemp ^ c_zero)); |
| |
| } |
| // else |
| // obm_printf("PASS - pa%d all data\n\r", uiPattern); |
| |
| uiStartVal = rol32_mcu(uiStartVal); |
| test_signal = rol32_mcu(test_signal); |
| |
| c_pattern = (uiStartVal); |
| c_pattern_or_signal = (uiStartVal | test_signal); |
| |
| |
| } |
| } |
| else |
| { |
| for (i = 0; i < size_in_word;) |
| { |
| Tmp_Address32[i++] = c_zero; |
| Tmp_Address32[i++] = c_pattern_or_signal; |
| Tmp_Address32[i++] = c_zero; |
| Tmp_Address32[i++] = c_pattern_or_signal; |
| Tmp_Address32[i++] = c_pattern; |
| Tmp_Address32[i++] = c_zero; |
| Tmp_Address32[i++] = c_pattern; |
| Tmp_Address32[i++] = c_zero; |
| |
| uiStartVal = rol32_mcu(uiStartVal); |
| test_signal = rol32_mcu(test_signal); |
| |
| c_pattern = (uiStartVal); |
| c_pattern_or_signal = (uiStartVal | test_signal); |
| } |
| } |
| break; |
| |
| case FREQ_SWEEP: |
| //obm_printf("Generating FREQ_SWEEP Pattern\n\r"); |
| i = 0; |
| c_pattern = (c_zero); |
| c_pattern_or_signal = (~c_zero); |
| for (j = 1; j < size_in_word / 2; j++) |
| { |
| k = 0; |
| while (k < j) |
| { |
| if (bCheck) |
| { |
| if (Tmp_Address32[i++] != c_pattern) |
| { |
| uiFails++; |
| uiTemp = Tmp_Address32[i - 1]; |
| obm_printf( "FAIL! pa%d:[@0x%08lx]=0x%08X Exp=0x%08X - Dif=0x%08X - DB=0x%08X - DA=0x%08X\n\r", uiPattern, (uiSourceAddress + ((i - 1) * 4)), uiTemp, c_pattern, (uiTemp ^ c_pattern), read_data_u32(uiSourceAddress + ((i - 1) * 4)), read_data_u32(uiSourceAddress + ((i + 1) * 4))); |
| |
| } |
| // else |
| // obm_printf("PASS - pa%d:[@0x%08lx]=0x%08X Exp=0x%08X\n\r", uiPattern, (uiSourceAddress + ((i - 1) * 4)), Tmp_Address32[i - 1], c_pattern); |
| } |
| else |
| { |
| Tmp_Address32[i++] = c_pattern; |
| } |
| k++; |
| if (i >= size_in_word) |
| break; |
| } |
| if (i >= size_in_word) |
| break; |
| |
| k = 0; |
| while (k < j) |
| { |
| if (bCheck) |
| { |
| if (Tmp_Address32[i++] != c_pattern_or_signal) |
| { |
| uiFails++; |
| uiTemp = Tmp_Address32[i - 1]; |
| obm_printf( "FAIL! pa%d:[@0x%08lx]=0x%08X Exp=0x%08X - Dif=0x%08X - DB=0x%08X - DA=0x%08X\n\r", uiPattern, (uiSourceAddress + ((i - 1) * 4)), uiTemp, c_pattern_or_signal, (uiTemp ^ c_pattern_or_signal), read_data_u32(uiSourceAddress + ((i - 1) * 4)), read_data_u32(uiSourceAddress + ((i + 1) * 4))); |
| |
| } |
| // else |
| // obm_printf("PASS - pa%d:[@0x%08lx]=0x%08X Exp=0x%08X\n\r", uiPattern, (uiSourceAddress + ((i - 1) * 4)), Tmp_Address32[i - 1], c_pattern_or_signal); |
| } |
| else |
| { |
| Tmp_Address32[i++] = c_pattern_or_signal; |
| } |
| k++; |
| if (i >= size_in_word) |
| break; |
| } |
| if (i >= size_in_word) |
| break; |
| } |
| break; |
| |
| case VERT_INCREMENT: |
| //obm_printf("Generating VERT_INCREMENT Pattern\n\r"); |
| c_pattern = (uiStartVal); |
| if (bCheck) |
| { |
| for (i = 0; i < size_in_word;) { |
| if (Tmp_Address32[i++] != c_pattern) |
| { |
| uiFails++; |
| uiTemp = Tmp_Address32[i - 1]; |
| obm_printf( "FAIL! pa%d:[@0x%08lx]=0x%08X Exp=0x%08X - Dif=0x%08X - DB=0x%08X - DA=0x%08X\n\r", uiPattern, (uiSourceAddress + ((i - 1) * 4)), uiTemp, c_pattern, (uiTemp ^ c_pattern), read_data_u32(uiSourceAddress + ((i - 1) * 4)), read_data_u32(uiSourceAddress + ((i + 1) * 4))); |
| |
| } |
| // else |
| // obm_printf("PASS - pa%d:[@0x%08lx]=0x%08X Exp=0x%08X\n\r", uiPattern, (uiSourceAddress + ((i - 1) * 4)), Tmp_Address32[i - 1], c_pattern); |
| |
| c_pattern++; |
| } |
| } |
| else |
| { |
| for (i = 0; i < size_in_word;) { |
| Tmp_Address32[i++] = c_pattern; |
| c_pattern++; |
| } |
| } |
| break; |
| |
| case HORZ_INCREMENT: |
| //obm_printf("Generating HORZ_INCREMENT Pattern\n\r"); |
| c_pattern = 0x00000001; |
| i = 0; |
| for (k = 0; k < (size_in_word / 16); k++) |
| { |
| for (j = 0; j < 16; j++) |
| { |
| if ((j % 2) == 1) { // ODD |
| if (bCheck) |
| { |
| if (Tmp_Address32[i++] != c_pattern) |
| { |
| uiFails++; |
| uiTemp = Tmp_Address32[i - 1]; |
| obm_printf( "FAIL! pa%d:[@0x%08lx]=0x%08X Exp=0x%08X - Dif=0x%08X - DB=0x%08X - DA=0x%08X\n\r", uiPattern, (uiSourceAddress + ((i - 1) * 4)), uiTemp, c_pattern, (uiTemp ^ c_pattern), read_data_u32(uiSourceAddress + ((i - 1) * 4)), read_data_u32(uiSourceAddress + ((i + 1) * 4))); |
| |
| } |
| // else |
| // obm_printf("PASS - pa%d:[@0x%08lx]=0x%08X Exp=0x%08X\n\r", uiPattern, (uiSourceAddress + ((i - 1) * 4)), Tmp_Address32[i - 1], c_pattern); |
| } |
| else |
| { |
| Tmp_Address32[i++] = c_pattern; |
| } |
| } |
| else { // EVEN |
| if (bCheck) |
| { |
| if (Tmp_Address32[i++] != c_zero) |
| { |
| uiFails++; |
| uiTemp = Tmp_Address32[i - 1]; |
| obm_printf( "FAIL! pa%d:[@0x%08lx]=0x%08X Exp=0x%08X - Dif=0x%08X - DB=0x%08X - DA=0x%08X\n\r", uiPattern, (uiSourceAddress + ((i - 1) * 4)), uiTemp, c_zero, (uiTemp ^ c_zero), read_data_u32(uiSourceAddress + ((i - 1) * 4)), read_data_u32(uiSourceAddress + ((i + 1) * 4))); |
| } |
| // else |
| // obm_printf("PASS - pa%d:[@0x%08lx]=0x%08X Exp=0x%08X\n\r", uiPattern, (uiSourceAddress + ((i - 1) * 4)), Tmp_Address32[i - 1], c_zero); |
| } |
| else |
| { |
| Tmp_Address32[i++] = c_zero; |
| } |
| } |
| if (i >= size_in_word) |
| break; |
| if (((j % 4) / 2) == 1) { // {2,3,6,7,10,11,14,15} |
| if (bCheck) |
| { |
| if (Tmp_Address32[i++] != c_pattern) |
| { |
| uiFails++; |
| uiTemp = Tmp_Address32[i - 1]; |
| obm_printf( "FAIL! pa%d:[@0x%08lx]=0x%08X Exp=0x%08X - Dif=0x%08X - DB=0x%08X - DA=0x%08X\n\r", uiPattern, (uiSourceAddress + ((i - 1) * 4)), uiTemp, c_pattern, (uiTemp ^ c_pattern), read_data_u32(uiSourceAddress + ((i - 1) * 4)), read_data_u32(uiSourceAddress + ((i + 1) * 4))); |
| |
| } |
| // else |
| // obm_printf("PASS - pa%d:[@0x%08lx]=0x%08X Exp=0x%08X\n\r", uiPattern, (uiSourceAddress + ((i - 1) * 4)), Tmp_Address32[i - 1], c_pattern); |
| } |
| else |
| { |
| Tmp_Address32[i++] = c_pattern; |
| } |
| } |
| else { // {0,1,4,5,8,9,12,13} |
| if (bCheck) |
| { |
| if (Tmp_Address32[i++] != c_zero) |
| { |
| uiFails++; |
| uiTemp = Tmp_Address32[i - 1]; |
| obm_printf( "FAIL! pa%d:[@0x%08lx]=0x%08X Exp=0x%08X - Dif=0x%08X - DB=0x%08X - DA=0x%08X\n\r", uiPattern, (uiSourceAddress + ((i - 1) * 4)), uiTemp, c_zero, (uiTemp ^ c_zero), read_data_u32(uiSourceAddress + ((i - 1) * 4)), read_data_u32(uiSourceAddress + ((i + 1) * 4))); |
| |
| } |
| // else |
| // obm_printf("PASS - pa%d:[@0x%08lx]=0x%08X Exp=0x%08X\n\r", uiPattern, (uiSourceAddress + ((i - 1) * 4)), Tmp_Address32[i - 1], c_zero); |
| } |
| else |
| { |
| Tmp_Address32[i++] = c_zero; |
| } |
| } |
| if (i >= size_in_word) |
| break; |
| if (((j % 8) / 4) == 1) { // {4,5,6,7,12,13,14,15} |
| if (bCheck) |
| { |
| if (Tmp_Address32[i++] != c_pattern) |
| { |
| uiFails++; |
| uiTemp = Tmp_Address32[i - 1]; |
| obm_printf( "FAIL! pa%d:[@0x%08lx]=0x%08X Exp=0x%08X - Dif=0x%08X - DB=0x%08X - DA=0x%08X\n\r", uiPattern, (uiSourceAddress + ((i - 1) * 4)), uiTemp, c_pattern, (uiTemp ^ c_pattern), read_data_u32(uiSourceAddress + ((i - 1) * 4)), read_data_u32(uiSourceAddress + ((i + 1) * 4))); |
| |
| } |
| // else |
| // obm_printf("PASS - pa%d:[@0x%08lx]=0x%08X Exp=0x%08X\n\r", uiPattern, (uiSourceAddress + ((i - 1) * 4)), Tmp_Address32[i - 1], c_pattern); |
| } |
| else |
| { |
| Tmp_Address32[i++] = c_pattern; |
| //obm_printf("i(%d) - j(%d) = %08X\n\r",i,j,c_pattern); |
| } |
| } |
| else { // {0,1,2,3,8,9,10,11} |
| if (bCheck) |
| { |
| |
| if (Tmp_Address32[i++] != c_zero) |
| { |
| uiFails++; |
| uiTemp = Tmp_Address32[i - 1]; |
| obm_printf( "FAIL! pa%d:[@0x%08lx]=0x%08X Exp=0x%08X - Dif=0x%08X - DB=0x%08X - DA=0x%08X\n\r", uiPattern, (uiSourceAddress + ((i - 1) * 4)), uiTemp, c_zero, (uiTemp ^ c_zero), read_data_u32(uiSourceAddress + ((i - 1) * 4)), read_data_u32(uiSourceAddress + ((i + 1) * 4))); |
| |
| } |
| // else |
| // obm_printf("PASS - pa%d:[@0x%08lx]=0x%08X Exp=0x%08X\n\r", uiPattern, (uiSourceAddress + ((i - 1) * 4)), Tmp_Address32[i - 1], c_zero); |
| } |
| else |
| { |
| Tmp_Address32[i++] = c_zero; |
| //obm_printf("i(%d) - j(%d) = %08X\n\r",i,j,c_zero); |
| } |
| } |
| if (i >= size_in_word) |
| break; |
| if ((j / 8) == 1) { // {8 - 15} |
| if (bCheck) |
| { |
| if (Tmp_Address32[i++] != c_pattern) |
| { |
| uiFails++; |
| uiTemp = Tmp_Address32[i - 1]; |
| obm_printf( "FAIL! pa%d:[@0x%08lx]=0x%08X Exp=0x%08X - Dif=0x%08X - DB=0x%08X - DA=0x%08X\n\r", uiPattern, (uiSourceAddress + ((i - 1) * 4)), uiTemp, c_pattern, (uiTemp ^ c_pattern), read_data_u32(uiSourceAddress + ((i - 1) * 4)), read_data_u32(uiSourceAddress + ((i + 1) * 4))); |
| |
| } |
| // else |
| // obm_printf("PASS - pa%d:[@0x%08lx]=0x%08X Exp=0x%08X\n\r", uiPattern, (uiSourceAddress + ((i - 1) * 4)), Tmp_Address32[i - 1], c_pattern); |
| } |
| else |
| { |
| Tmp_Address32[i++] = c_pattern; |
| //obm_printf("i(%d) - j(%d) = %08X\n\r",i,j,c_pattern); |
| } |
| } |
| else { // {0 - 7} |
| if (bCheck) |
| { |
| if (Tmp_Address32[i++] != c_zero) |
| { |
| uiFails++; |
| uiTemp = Tmp_Address32[i - 1]; |
| obm_printf( "FAIL! pa%d:[@0x%08lx]=0x%08X Exp=0x%08X - Dif=0x%08X - DB=0x%08X - DA=0x%08X\n\r", uiPattern, (uiSourceAddress + ((i - 1) * 4)), uiTemp, c_zero, (uiTemp ^ c_zero), read_data_u32(uiSourceAddress + ((i - 1) * 4)), read_data_u32(uiSourceAddress + ((i + 1) * 4))); |
| |
| } |
| // else |
| // obm_printf("PASS - pa%d:[@0x%08lx]=0x%08X Exp=0x%08X\n\r", uiPattern, (uiSourceAddress + ((i - 1) * 4)), Tmp_Address32[i - 1], c_zero); |
| } |
| else |
| { |
| Tmp_Address32[i++] = c_zero; |
| } |
| } |
| if (i >= size_in_word) |
| break; |
| } |
| if (i >= size_in_word) |
| break; |
| |
| c_pattern = rol32_mcu(c_pattern); |
| } |
| break; |
| |
| default: |
| obm_printf("No option with uipat[%d ]\n\r", uiPattern); |
| break; |
| |
| } |
| |
| if (uiFails) |
| { |
| giPatternNumOfFails[uiPattern] += uiFails; |
| giPatternFails[uiPattern]++; |
| } |
| return uiFails; |
| } |
| |
| static u32 mem_all_pattern_test(u32 uiStartBase, u32 uiSize) |
| { |
| u32 fail_cnt = 0, total_fail = 0, pattern = 0; |
| u32 bResult = DDR_TEST_FAIL; |
| u32 uiStartVal[10] = { 0xa5a5a5a5, 0xA5A50000, 0x2d2d2d2d, 0x5a5a5a5a, 0x89abcdef, |
| 0xD2D2D2D2, 0x01010101, 0xECA86420, 0x00000000, 0xFFFFFFFF }; |
| unsigned long uiSource = 0; |
| int trace_print_level = 0; |
| // only test width with 32b and 64b as the limited size of SQU |
| for (pattern = ANALOG; pattern <= HORZ_INCREMENT; pattern++) |
| // for(pattern = 8; pattern <= HORZ_INCREMENT; pattern++) |
| { |
| //temp = (pattern - ANALOG); |
| //uiSource = uiStartBase + temp*uiSize; |
| uiSource = uiStartBase; |
| |
| obm_printf( "Addr=[0x%08lx], Size=[0x%X]Bytes, Pattern=%d, StartValue=[0x%08X]\n\r", uiSource, uiSize, pattern, uiStartVal[pattern % 10]); |
| allp_mcuGenerateWordPattern(uiSource, pattern, (uiSize / WORD_SIZE), uiStartVal[pattern % 10], 0); |
| fail_cnt += allp_mcuGenerateWordPattern(uiSource, pattern, (uiSize / WORD_SIZE), uiStartVal[pattern % 10], 1); |
| |
| if (fail_cnt) |
| obm_printf( "***FAIL*** pattern test failed=%d times - Address[0x%08lx] - Pattern[%d] - Start Value[0x%08X], Size=[0x%x]B\n\r", fail_cnt, uiSource, pattern, uiStartVal[pattern % 10], uiSize); |
| else |
| obm_printf("pattern test ok\n\n\r"); |
| |
| total_fail += fail_cnt; |
| |
| if (total_fail) //break on any fail |
| break; |
| } |
| |
| if (total_fail == 0) |
| { |
| bResult = DDR_TEST_PASS; |
| obm_printf( "===OK=== all pattern tests ok - Address[0x%08lx], Size=[0x%x]B\n\n\r", uiSource, uiSize); |
| } |
| else |
| { |
| bResult = DDR_TEST_FAIL; |
| obm_printf( "===FAIL=== all pattern tests failed - total_fail=%d, Address[0x%08lx], Size=[0x%x]B\n\n\r", total_fail, uiSource, uiSize); |
| } |
| |
| return bResult; |
| } |
| |
| #else //CONFIG_USE_DDR_ALL_PATTERN |
| |
| static u32 mem_data16_pattern_test(u32 uiStartBase, u32 uiSize) |
| { |
| u32 i=0,j=0,k=0; |
| u32 data=0; |
| u32 err=0; |
| u32 start_addr=0x7e000000; |
| u32 len=0x400000; |
| u32 bResult = DDR_TEST_FAIL; |
| static u32 test_pattern[NR_TEST_PATTERN] = { |
| 0x01010101,0x02020202,0x04040404,0x08080808, |
| 0x10101010,0x20202020,0x40404040,0x80808080, |
| 0xFEFEFEFE,0xFDFDFDFD,0xFBFBFBFB,0xF7F7F7F7, |
| 0xEFEFEFEF,0xDFDFDFDF,0xBFBFBFBF,0x7F7F7F7F, |
| }; |
| //u32 local_test_pattern[NR_TEST_PATTERN]; |
| |
| obm_printf("mem_data16_pattern_test [0x%08x-->0x%08x]!!!\n\r", |
| uiStartBase, uiStartBase + uiSize); |
| |
| start_addr = uiStartBase; |
| len = uiSize; |
| len &= (~(sizeof(test_pattern) - 1)); |
| obm_printf("len: %x\n\r", len); |
| |
| #if 1 |
| for(j = 0; j <= 15; j++) |
| { |
| for(i = 0; i< len/4; i++) |
| { |
| data_write32(start_addr + i*4, test_pattern[j]); |
| } |
| flush_dcache_all(); |
| |
| for(i = 0; i < len/4; i++) |
| { |
| data = data_read32(start_addr + i*4); |
| if(data != test_pattern[j]) |
| { |
| obm_printf("FAIL! data%d:[@0x%08lx]=0x%08X Exp=0x%08X - Dif=0x%08X\n\r",j,start_addr+i*4,data,test_pattern[j],(data^test_pattern[j])); |
| err++; |
| } |
| } |
| } |
| #else |
| for (i = 0; i < NR_TEST_PATTERN; i++) { |
| /* prepare pattern data */ |
| for (j = 0; j < NR_TEST_PATTERN; j++) { |
| local_test_pattern[j] = test_pattern[i]; |
| } |
| |
| for (j = 0; j < len; j += sizeof(local_test_pattern)) { |
| memcpy((void *)(start_addr + j), (void *)local_test_pattern, sizeof(local_test_pattern)); |
| } |
| flush_dcache_all(); |
| |
| for (j = 0; j < len; j += sizeof(local_test_pattern)) { |
| memcpy(local_test_pattern, (void *)(start_addr + j), sizeof(local_test_pattern)); |
| for (k = 0; k < NR_TEST_PATTERN; k++) { |
| if (local_test_pattern[k] != test_pattern[i]) { |
| err++; |
| obm_printf("mem err: wr 0x%08x rd 0x%08x @0x%08x\n\r", |
| test_pattern[i], local_test_pattern[k], |
| (start_addr + j + k)); |
| } |
| } |
| } |
| } |
| #endif |
| if (err == 0) |
| { |
| bResult = DDR_TEST_PASS; |
| obm_printf("===PASS=== all data tests passed - StartAddress[0x%08lx], Size=[0x%x]B\n\n\r",start_addr,len); |
| } |
| else |
| { |
| bResult = DDR_TEST_FAIL; |
| obm_printf("===FAIL=== all data tests passed - total_fail=%d, StartAddress[0x%08lx], Size=[0x%x]B\n\n\r",err, start_addr, len); |
| } |
| |
| return bResult; |
| } |
| #endif |
| |
| u32 asr_ddr_pattern_test(u32 uiStartBase, u32 uiSize) |
| { |
| u32 ret; |
| |
| #ifdef CONFIG_USE_DDR_ALL_PATTERN |
| ret = mem_all_pattern_test(uiStartBase, uiSize); |
| #else |
| ret = mem_data16_pattern_test(uiStartBase, uiSize); |
| #endif |
| return ret; |
| } |
| |
| VOID ASR_DdrPatternTest(pTIM pTIM_h, pTIM pDTIM_h, OTA_IMAGE_TYPE DTIMType) |
| { |
| pIMAGE_INFO_3_4_0 pImageInfo = NULL; |
| UINT_T OsloStart, OsloSize, Ret; |
| UINT_T TosStart, TosSize; |
| |
| if (!ASRFlag_NeedRunDDRT(pTIM_h) || pOBM2OSL_h->ddrt_info.bits.test_done) |
| return; |
| |
| PlatformFrequencyChange(-1, 1, -1); |
| |
| OsloStart = 0x1400000; |
| OsloSize = 0xC00000; //20M ~ 32M is for Uboot |
| TosStart = OsloStart + OsloSize; |
| TosSize = 0; |
| |
| #ifdef CONFIG_TEE_OS |
| pImageInfo = FindImageInTIM(pDTIM_h, TZSWIDENTIFIER); |
| #ifdef CONFIG_ASR_SDTIM |
| if(ImageIsSDTIMIncluded(pImageInfo)) { |
| IMAGE_INFO_3_4_0 ImageInfoSDtim; |
| pImageInfo = SDTimImageInfoUpdate(pImageInfo, &ImageInfoSDtim, DTIMType); |
| } |
| #endif |
| if (pImageInfo) { |
| TosStart = pImageInfo->LoadAddr; |
| if(pOBM2OSL_h->tee_dram_size) |
| TosSize = pOBM2OSL_h->tee_dram_size; |
| else |
| TosSize = 0x400000; //define TOS size; |
| } |
| #endif |
| |
| if (TosStart == (OsloStart + OsloSize)) |
| { |
| Ret = asr_ddr_pattern_test(OsloStart, OsloSize + TosSize); |
| } else { |
| Ret = asr_ddr_pattern_test(OsloStart, OsloSize); |
| if (Ret == DDR_TEST_PASS) |
| Ret = asr_ddr_pattern_test(TosStart, TosSize); |
| } |
| |
| pOBM2OSL_h->ddrt_info.bits.test_done = 1; //done |
| pOBM2OSL_h->ddrt_info.bits.test_res = Ret; |
| pOBM2OSL_h->ddrt_info.bits.uboot_start = OsloStart >> 20; |
| pOBM2OSL_h->ddrt_info.bits.uboot_size = OsloSize >> 20; |
| pOBM2OSL_h->ddrt_info.bits.tos_start = TosStart >> 20; |
| pOBM2OSL_h->ddrt_info.bits.tos_size = TosSize >> 20; |
| |
| return; |
| } |