testDriver.c
5.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
/**************************************************************************
* *
* Copyright (C) 1996 Silicon Graphics, Inc. *
* *
* These coded instructions, statements, and computer programs contain *
* unpublished proprietary information of Silicon Graphics, Inc., and *
* are protected by Federal copyright law. They may not be disclosed *
* to third parties or copied or duplicated in any form, in whole or *
* in part, without the prior written consent of Silicon Graphics, Inc. *
* *
*************************************************************************/
/*
* File: testDriver.c
* Creator: hal@sgi.com
* Purpose: Primary test driver:
*
* compile time loaded array of structured tests
* (location in array determines test sequence order),
*
* test driver loop which invokes individual tests, then
* reports test status via gng message reporting.
*/
#include <ultra64.h>
#include "testDriver.h"
#include "gng.h"
extern int controllerSlot;
Test_t testList[] = {
{ &(rdramTest), "RDRAM memory\n(test 0):",
GNG_PASS_FAIL_BIT, PASS_MESSAGE_RETRACE_COUNT, 0},
{ &(clocktest), "62.5MHz Clock\n(test 1):",
GNG_PASS_FAIL_BIT, PASS_MESSAGE_RETRACE_COUNT, 1},
{ &(intr1test), "Cartridge Interrupt\n(test 2):",
GNG_PASS_FAIL_BIT, PASS_MESSAGE_RETRACE_COUNT, 2},
{ &(piAllTest), "PI RW DMA/PIO, INT\n(test 3):",
GNG_PASS_FAIL_BIT, PASS_MESSAGE_RETRACE_COUNT, 3},
{ &(rsp), "RSP Diagnostic Tests\n(test 4):",
GNG_PASS_FAIL_BIT, PASS_MESSAGE_RETRACE_COUNT, 4},
{ &(dlDriver), "RDP Display List Checksum\n(test 5):",
GNG_PASS_FAIL_BIT, PASS_MESSAGE_RETRACE_COUNT, 5},
{ &(pifCheck), "PIF controller\n(test 6):",
GNG_PASS_FAIL_BIT, PASS_MESSAGE_RETRACE_COUNT, 6},
{ &(VoltageTest), "Power and Grounds\n(test 7):",
GNG_PASS_FAIL_BIT, PASS_MESSAGE_RETRACE_COUNT, 7},
{ &(ResetTimeTest), "Reset Time\n(test 8):",
GNG_PASS_FAIL_BIT, PASS_MESSAGE_RETRACE_COUNT, 8},
{ &(chk50PReadWrite), "AD16 BUS RW cycle count\n(test 9):",
GNG_PASS_FAIL_BIT, PASS_MESSAGE_RETRACE_COUNT, 9},
{ &(chk50PExtjoy), "EXTJOY controller check\n(test 10 = 0x0a):",
GNG_PASS_FAIL_BIT, PASS_MESSAGE_RETRACE_COUNT, 10},
{ &(AD16_LatchedAddressTest), "AD16 BUS address latch\n(test 11 = 0x0b):",
GNG_PASS_FAIL_BIT, PASS_MESSAGE_RETRACE_COUNT, 11},
/*
* All user-interaction tests are run at the end of the test sequence, with
* the exception of the CPU test.
*/
{ &(ControllerTest), "Controllers 2, 3 and 4\n(test 12 = 0xc):",
GNG_PASS_FAIL_BIT, PASS_MESSAGE_RETRACE_COUNT, 12},
{ &(nmitest_phase1), "Reset Switch\n(button check)\n(user decides PASS/FAIL)\n(test 13 = 0x0d):",
GNG_PASS_FAIL_BIT | GNG_NMI_TEST_BIT, PASS_MESSAGE_RETRACE_COUNT,
13},
{ &(audMain), "Audio Playback\n(auditory check)\n(user decides PASS/FAIL)\n(Push Button to start)\n(test 14 = 0x0e):",
GNG_INHIBIT_PRINT, 0, 14},
{ &(RunViTests), "Video Patterns\n(visual check)\n(user decides PASS/FAIL)\n(Use button to cycle tests)\n(Push Button to start)\n(test 15 = 0x0f):",
GNG_INHIBIT_PRINT, 0, 15},
{ &(CpuTest), "R4300 CPU Test\n(test 16 = 0x10):",
GNG_PASS_FAIL_BIT, PASS_MESSAGE_RETRACE_COUNT, 16},
/*
* Last entry must have a NULL pTestFunction field entry
*/
{ NULL, "end of tests",
GNG_PASS_FAIL_BIT | GNG_FINAL_TEST_BIT,
PASS_MESSAGE_RETRACE_COUNT, 16},
};
void testLoop(int index)
{
Test_t *pTest;
int errCount;
pTest = &(testList[index]);
while (pTest->pTestFunction != NULL) {
/*
* write pTest->testNumber to the LED panel on the ZARU test jig
*/
ZaruSetMemA(pTest->testNumber);
/*
* Always print the test message before the test starts. We'll re-print the
* message with PASS/FAIL reporting afterwards, if the test requested it.
*/
gng_report(pTest->gngMessageText, 0, GNG_INHIBIT_PRINT, PASS_MESSAGE_RETRACE_COUNT);
/*
* Run the test.
*/
errCount = (*pTest->pTestFunction)();
/*
* If test does need PASS/FAIL reporting, do so now.
*/
if (pTest->testFlags & GNG_PASS_FAIL_BIT) {
gng_report(pTest->gngMessageText, errCount,
pTest->testFlags, pTest->retraceCount);
}
pTest = &(testList[++index]);
}
gng_report("Go/No-go testing complete.\n", 0,
GNG_PASS_FAIL_BIT | GNG_FINAL_TEST_BIT, 0);
}
void
testDriver(int nmiEntryFlag)
{
Test_t *pTest;
int i;
if (nmiEntryFlag == FALSE) {
/*
* Iterate through the tests; optionally do a gng_report with their
* status upon completion.
*/
testLoop(0);
} else {
/*
* Find the NMI test by examining the testFlags field, then print a
* gng_report() as per the testFlags, retraceCount fields.
*
* Then, iterate through the rest of the test sequence.
*/
i = 0;
pTest = &(testList[i]);
while ( (pTest->pTestFunction != NULL) &&
(pTest->testFlags & GNG_NMI_TEST_BIT) == 0 ) {
pTest = &(testList[++i]);
}
/*
* We should be pointing at the NMI test now. Skip past it & continue.
*/
testLoop(++i);
}
}