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