*
* Returns: 0 if the test succeeds, 1 if the test fails.
*/
- pattern = (vu_long) 0xaaaaaaaa;
- anti_pattern = (vu_long) 0x55555555;
+ pattern = (vu_long)0xaaaaaaaaaaaaaaaa;
+ anti_pattern = (vu_long)0x5555555555555555;
debug("%s:%d: length = 0x%.8lx\n", __func__, __LINE__, num_words);
/*
max = sizeof(unsigned long) * 8;
for (k = 0; k < max; k++) {
- q = 0x00000001L << k;
+ q = 1UL << k;
for (j = 0; j < 8; j++) {
schedule();
q = ~q;
ulong errs = 0;
ulong incr, length;
ulong val, readback;
+ const int plen = 2 * sizeof(ulong);
/* Alternate the pattern */
incr = 1;
* the "negative" patterns and increment the "positive"
* patterns to preserve this feature.
*/
- if (pattern & 0x80000000)
+ if (pattern > (ulong)LONG_MAX)
pattern = -pattern; /* complement & increment */
else
pattern = ~pattern;
}
length = (end_addr - start_addr) / sizeof(ulong);
end = buf + length;
- printf("\rPattern %08lX Writing..."
+ printf("\rPattern %0*lX Writing..."
"%12s"
"\b\b\b\b\b\b\b\b\b\b",
- pattern, "");
+ plen, pattern, "");
for (addr = buf, val = pattern; addr < end; addr++) {
schedule();
if (readback != val) {
ulong offset = addr - buf;
- printf("\nMem error @ 0x%08X: "
- "found %08lX, expected %08lX\n",
- (uint)(uintptr_t)(start_addr + offset*sizeof(vu_long)),
- readback, val);
+ printf("\nMem error @ 0x%0*lX: found %0*lX, expected %0*lX\n",
+ plen, start_addr + offset * sizeof(vu_long),
+ plen, readback, plen, val);
errs++;
if (ctrlc())
return -1;
unmap_sysmem((void *)buf);
- if (errs == -1UL) {
- /* Memory test was aborted - write a newline to finish off */
- putc('\n');
- }
- printf("Tested %d iteration(s) with %lu errors.\n", iteration, count);
+ printf("\nTested %d iteration(s) with %lu errors.\n", iteration, count);
return errs != 0;
}