|
|
1.1 root 1:
2: #include "vioc.h"
3: #include "conf.h"
4: #include "const.h"
5: #include "pte.h"
6:
7: #define ON 0x80
8: #define OFF 0
9: #define LOOPBK 0
10: #define ECHO 1
11:
12: #define MAXPORT 16
13: #define MAXRLEN 50
14: #define MAXSLEN 256
15: #define HEAD "\n\r\t** VIOC test **\n"
16: #define PORT "\rlogical port no "
17: #define NL writec('\n')
18:
19: #define TST_STR "1234567890abcdefghigklmnopq"
20:
21: extern long log_p0, log_pn;
22: extern char port_on[];
23:
24:
25: /* Routine to exercise VIOC :
26: (1) print a heading message to all terminals on VIOC
27: (If receive Unsolicited interrupt from VIOC, dump silos)
28: */
29: v_ex()
30: { long register pno, error;
31: char no;
32:
33: writes("\n\t** VIOC test **\n");
34: writes("start testing...\n");
35: for(pno=log_p0; pno<=log_pn; pno++) {
36: if (port_on[pno-1]) {
37: pstr(pno,HEAD); /* Print heading to port */
38: pstr(pno,PORT);
39: if (pno>9) { pchar(pno,'1');
40: pchar(pno,pno-10+'0');
41: }
42: else pchar(pno,pno+'0');
43: pchar(pno,'\n');
44:
45: v_autol(pno,ON,AUTOLP); /* Set auto loop back */
46: pstr(pno,TST_STR); /* sent test string to port */
47: }
48: }
49: error = 0;
50: for(pno=log_p0; pno<=log_pn; pno++) {
51: if (port_on[pno-1]) {
52: if (chk_port(pno)) error++;
53: v_autol(pno,OFF,AUTOLP); /* Disable auto loop back */
54: }
55: }
56: writes("\nDone with "); writeh(error); writes(" errors\n");
57: }
58:
59:
60: chk_port(pno)
61: long pno;
62: {
63: register long strlen, ix, error;
64: char *cptr, *tst_str, rd_str[100], port;
65: char get1c(), ce, ca;
66:
67: writes("\nchecking port "); writed(pno);
68: tst_str = cptr = TST_STR;
69: for(strlen=0; cptr[strlen] != NULL; strlen++); /* Get length */
70: error = 0;
71: port = '0';
72: for(ix=0; ix<strlen; ix++) {
73: rd_str[ix] = get1c(pno); /* read them back */
74: if (rd_str[ix]==(char)0xff) {
75: writes("\nbuffer ");
76: writec((char)port+pno); writes(" empty");
77: error++;
78: break;
79: }
80: ca = ((long)rd_str[ix] & 0x7f); /* 7 bit ASCII */
81: ce = ((long)tst_str[ix] & 0x7f);
82: if (ce != ca) {
83: writes("\n** P");writed(pno);
84: writes(" expected : "); writeh(ce);
85: writes(" *** actual : "); writeh(ca);
86: error++;
87: break;
88: }
89: }
90: out:
91: pstr(pno,"\n\rdone\n\r");
92: return(error);
93: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.