stress_ext.c
2.17 KB
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
/* The purpose of this program is to stress the external buses(BusData[8-0]) */
/* of the RDRAMs. When we access the address 0x003fc038, the following request */
/* packet is sent to the RDRAMs: */
/* */
/* Clock Bus- BusData */
/* Ctrl [8] [7] [6] [5] [4] [3] [2] [1] [0] */
/* -------------------------------------------------------------- */
/* [0]e xxx xxx 0 0 0 0 1 1 1 0 */
/* o xxx xxx 1 1 1 1 0 0 0 0 */
/* [1]e xxx 0 0 0 0 0 1 1 1 1 */
/* o xxx 0 0 0 0 0 0 0 0 0 */
/* [2]e xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx */
/* o xxx xxx xxx xxx xxx xxx xxx xxx 0 0 */
/* */
/* This is because BusData[7:0] stand for Adr[9:2] at clock [0]even, Adr[17:10] */
/* at clock [0]odd, and BusData[8:0] stand for Adr[26:18] at [1]even, */
/* Adr[35:27] at [1]odd. Adr[1:0] is sent through BusData[1:0] at clock [2] odd. */
/* (for more detail, refer "RDRAM reference manual" page 70.) Should you have */
/* any more efficient idea, please feel free to change address, value, or even */
/* whole program. */
#include <ultra64.h>
#include <assert.h>
#include "main.h"
extern errorReport1(u32, u32, u32);
extern errorReport2(u32, u32, u32, u32, u32);
u32 stressExternalBus(u32 cnt)
{
u32 i, j, error_cnt=0;
u32 value=0xff00ff00;
u32 *addr=(u32 *)OS_PHYSICAL_TO_K1(0x003fc038);
for (j=0; j<10000; j++)
for (i=0; i<cnt; i++)
*addr = value;
for (j=0; j<10000; j++)
for (i=0; i<cnt; i++)
if (*addr != value)
{
error_cnt++;
#ifdef DEBUG
errorReport1((u32)addr, value, *addr);
#endif
}
return 0;
}