iotestebus.c
1.62 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/*************************************************************************
*
* File: iotestebus.c
*
* This file contains the routines to the E-bus data path through the MI
*
* $Header: /root/leakn64/depot/rf/sw/n64os20l/iosim/src/iotestebus.c,v 1.2 2002/05/30 05:52:50 whs Exp $
*
*/
#include <stdio.h>
#include <stdlib.h>
#include "trace.h"
#include "iomap.h"
#include "iotest.h"
#ifndef __sgi__
#ifndef u_int
typedef unsigned int u_int;
#endif
#endif
/***********************************************************************
* Routines
*/
int
EbusTestPgRw(int a1, int a2, int a3, int a4)
{
u_int data, ret;
unsigned int address;
int i, j, k;
for (i = 0; i < 1/*RDRAM_MAX_COUNT*/; i++) {
for (j = 0; j < 1/*BANKS_PER_RDRAM*/; j++) {
address = i * (BANKS_PER_RDRAM * RDRAM_BANK_SIZE)
+ j * RDRAM_BANK_SIZE;
for (k = 0; k < (2 * RDRAM_PAGE_SIZE)/sizeof(u_int); k++) {
data = (i << 3) | (j << 2) | (k & 0x3);
IO_WRITE(address, data);
address = address + sizeof(u_int);
} /* for */
} /* for */
} /* for */
for (i = 0; i < 1/*RDRAM_MAX_COUNT*/; i++) {
for (j = 0; j < 1/*BANKS_PER_RDRAM*/; j++) {
address = i * (BANKS_PER_RDRAM * RDRAM_BANK_SIZE)
+ j * RDRAM_BANK_SIZE;
for (k = 0; k < (2 * RDRAM_PAGE_SIZE)/sizeof(u_int); k++) {
data = (i << 3) | (j << 2) | (k & 0x3);
ret = IO_READ(address);
if (data != ret) {
errorCount++;
_TRACE(DERROR, LOG_ERROR(data, ret));
} /* if */
address = address + sizeof(u_int);
} /* for */
} /* for */
} /* for */
errorTotal += errorCount;
return((errorCount == 0) ? 0 : -1);
} /* EbusTestPgRw */