|
|
1.1 root 1: /* constant definitions for program */
2: #define LINE 80
3: #define CRTN 0x0d
4: #define EOL '.'
5: #define INTSIZE 8
6: #define msg1 "\n**************** Memory Test (V1.1) ****************"
7: #define msg2 "\nSUBTEST TITLE"
8: #define msg3 "\n 0 Execute subtest 1 - 6"
9: #define msg4 "\n 1 Marching patterns"
10: #define msg5 "\n 2 Unique address"
11: #define msg6 "\n 3 Adjacent cell disturbance"
12: #define msg7 "\n 4 ECC single bit error correct"
13: #define msg8 "\n 5 ECC single bit (data) error detection"
14: #define msg9 "\n 6 ECC single bit (check) error detection"
15: #define NL '\012'
16: #define MAX_TST 6 /* Max. no of subtests */
17: #include "definitions"
18:
19: extern long maxmem,count,tstmsk,endprog,nonstop;
20: extern long loop_flg,hlt_flg,prt_flg,test_no;
21: extern struct OPTIONS OPTIONS;
22: long abend,abmax;
23: int bitbl[8] = { 1,2,4,8,16,32,64,128};
24:
25: monitor()
26: {
27: int number;
28: long startadd,endadd;
29: long debug,debuga,debugb,debugc;
30: prt_flg = loop_flg = 0;
31: abend = endprog;
32: abmax = maxmem;
33: /**********************************************************
34: If the header option was set, output test header and report
35: memory size as calculated in init.x, also indicate brd type
36: **********************************************************/
37: if (OPTIONS.header) {
38: writes(msg1);
39: writes("\n\nMemory size = ");
40: writed(maxmem); writes(" bytes;");
41: if (OPTIONS.fourmb) {
42: writes(" 4mb memory board option selected\n");
43: }
44: else {
45: writes(" 1mb memory board option selected\n");
46: }
47: }
48: if (!OPTIONS.diagmode) {
49: endprog = abend;
50: maxmem = abmax;
51: }
52: /*************************************************************
53: If the diagnostic mode flag is set, query user for parameters.
54: Output the ending address of the memory program and max memory
55: address. Check the validity of the start and ending addresses
56: entered by the user.
57: *************************************************************/
58: if (OPTIONS.diagmode) {
59: writes("\nminimum memory address is ");writeh(endprog);
60: writes("\n\nmaximum memory address is ");writeh(maxmem);
61: start: writes("\n\nenter starting memory address : ");
62: startadd = gethex();
63: if (startadd >= endprog){
64: endprog = startadd;
65: }
66: else{
67: writes("\nthe starting address must be >= ");
68: writeh(endprog);
69: goto start;
70: }
71: end: writes("\n\nenter ending memory address : ");
72: endadd = gethex();
73: if (endadd > startadd && endadd <= maxmem){
74: maxmem = endadd;
75: }
76: else{
77: writes("\nthe ending address must be > ");
78: writeh(startadd);
79: writes(" and <= ");
80: writeh(maxmem);
81: goto end;
82: }
83: gettest();
84: writes("\n\nenter cycle count : ");count = gethex();
85: if (count == 0xffffffff) nonstop = 1;
86: if (count == 0x0) count = 1;
87: }
88: /***************************************************************
89: If the selected test was greater than MAX_TST then set tstmsk to
90: run all tests. Otherwise set tstmsk to the selected test.
91: ***************************************************************/
92: if (!test_no) tstmsk = 1|2|4|8|16|32;
93: else {
94: number = test_no;
95: tstmsk = bitbl[--number];
96: }
97: if (OPTIONS.err_msg) prt_flg =1;
98: if (OPTIONS.loop_err) loop_flg =1;
99: else hlt_flg = 1;
100: }
101: /****************************************************
102: This routine gets the user input and validates it, if
103: an invalid response is made the user will be queried
104: again.
105: ****************************************************/
106: gettest()
107: {
108: int valid;
109: char c;
110: valid = 1;
111: while(valid){
112: writes("\n\nenter subtest number or '?' for help : ");
113: c = readc();
114: switch(c){
115: case '0':
116: test_no = 0;
117: valid = 0;
118: break;
119: case '1':
120: test_no = 1;
121: valid = 0;
122: break;
123: case '2':
124: test_no = 2;
125: valid = 0;
126: break;
127: case '3':
128: test_no = 3;
129: valid = 0;
130: break;
131: case '4':
132: test_no = 4;
133: valid = 0;
134: break;
135: case '5':
136: test_no = 5;
137: valid = 0;
138: break;
139: case '6':
140: test_no = 6;
141: valid = 0;
142: break;
143: case '?':
144: tsthelp();
145: break;
146: default:
147: writes(" invalid test number");
148: break; }
149: }
150: return;
151: }
152: /*********************************************************
153: This routine just outputs the test numbers and description
154: to the user
155: *********************************************************/
156: tsthelp()
157: {
158: writes("\n");writes(msg2);writes(msg3);writes(msg4);writes(msg5);
159: writes(msg6);writes(msg7);writes(msg8);writes(msg9);
160: return;
161: }
162: /**********************************************************
163: Hex input routine, call fill and validates the characters
164: in the character buffer. Then returns the HEX value back to
165: the calling routine.
166: **********************************************************/
167: gethex()
168: {
169: char s[LINE];
170: int k[1],i,n;
171: n=0x0;
172: fill(s,k); /* Fill s[] */
173: for (i=0;i<k[0];++i) {
174: if (s[i] >= 'a' && s[i] <= 'f')
175: n=0x10*n+s[i]-'W';
176: if (s[i] >= 'A' && s[i] <= 'F')
177: n=0x10*n+s[i]-'7';
178: if (s[i] >= '0' && s[i] <= '9')
179: n=0x10*n+s[i]-'0';
180: if ((s[i] < '0' ) || (s[i] > '9' && s[i] < 'A') || (s[i] > 'F'
181: && s[i] < 'a') || (s[i] > 'f'))
182: {
183: writes("\nInvalid hex digit: "); writec(s[i]); writes(" (ignored)");
184: }
185: }
186: return(n);
187: }
188: /****************************************************
189: This routine fills a character buffer with characters
190: that are input on the console.
191: ****************************************************/
192: fill(s,k)
193: char s[];
194: int k[];
195: {
196: char c;
197: int i;
198: k[0]=0;
199: for (i=0;(c=readc())!=CRTN;++i)
200: {
201: if (k[0]>LINE - 1) break;
202: if (c==EOL) break;
203: s[i]=c;
204: ++k[0];
205: }
206: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.