stress_int.c
988 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/* The purpose of this program is stressing internal address buses. */
/* The addresses are accessed in a butterfly fashion. */
#include <ultra64.h>
#include <assert.h>
#include "main.h"
extern errorReport1(u32, u32, u32);
extern errorReport2(u32, u32, u32, u32, u32);
u32 stressInternalAddressBus(u32 *begadr, u32 *endadr)
{
u32 *ptr1, *ptr2;
u32 loop, i;
u32 error_cnt=0;
u32 pattern1=0x55555555;
u32 pattern2=0xaaaaaaaa;
ptr1 = begadr;
ptr2 = endadr;
loop = (endadr - begadr) >> 1;
#ifdef DEBUG
SOAKPRINTF("loop = %x\n", loop);
#endif
for (i=0; i<loop; i++)
{
*ptr1++ = pattern1;
*(--ptr2) = pattern2;
}
for (; i>0; i--)
{
if (*ptr2++ != pattern2)
{
error_cnt ++;
#ifdef DEBUG
errorReport1((u32)(ptr2 - 1), pattern2, *(ptr2 - 1));
#endif
}
if (*(--ptr1) != pattern1)
{
error_cnt ++;
#ifdef DEBUG
errorReport1((u32)ptr1, pattern1, *ptr1);
#endif
}
}
return error_cnt;
}