|
|
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 "0123456789abcdefghijklmnopqrstuvwxyz\
20: ABCDEFGHIJKLMNOPQRSTUVWXYZ"
21:
22: extern long log_first, log_last;
23: extern char port_on[];
24: extern long viocb[];
25: /*
26: Routine to exercise VIOC :
27: (1) print a heading message to all terminals on VIOC
28: (If receive Unsolicited interrupt from VIOC, dump silos)
29: */
30: v_ex(vno)
31: long vno;
32: { long register pno, error;
33:
34: error = 0;
35: NL;writes("\n4. Send/Receive Test ");NL;
36: for(pno=log_first; pno<=log_last; pno++) {
37: v_autol(pno,OFF,AUTOLP); /* Make sure no auto loop */
38: /* when we do not want it */
39: NL;writes("Port number ");writeh(pno-1);
40: switch (port_on[pno-1]) {
41: case 0: {
42: writes("\tNOT TESTED, port is not on-line");NL;
43: break;
44: }
45: case 1: {
46: pstr(pno,HEAD);
47: pstr(pno,PORT);
48: if (pno>10) {
49: pchar(pno,pno-11+'A');
50: }
51: else pchar(pno,pno-1+'0');
52: pchar(pno,'\n');
53: writes("\tSet AUTO-LOOPBACK");NL;
54: v_autol(pno,ON,AUTOLP);
55: writes("\t\tSending message to port");NL;
56: if (pstr(pno,TST_STR)) {
57: DELAY(0x100000);/* wait for VIOC to receive LB */
58: writes("\t\tChecking LOOPBACK message");NL;
59: if (chk_port(pno)) error++;
60: }
61: else error++;
62: break;
63: }
64: case 2: {
65: writes("\tNOT TESTED, port did not initialize.");NL;
66: break;
67: }
68: default:{
69: writes("\tNOT TESTED, unknown port status.");NL;
70: }
71: }
72: }
73: /* writes("\n5. Misc Commands Test:\n\n");
74: writes("\n\tRPARALX Command Test: ");
75: if (!v_reqpar(pno)) writes("\n\t *** RPARLAX Failed ***"); */
76: writes("\nDone with "); writed(error); writes(" errors\n");
77: }
78: chk_port(pno)
79: long pno;
80: {
81: register long strlen, ix, error;
82: char *cptr, *tst_str, rd_str[100];
83: char get1c(), ce, ca;
84:
85: tst_str = cptr = TST_STR;
86: for(strlen=0; cptr[strlen] != NULL; strlen++); /* Get length */
87: error = 0;
88: for(ix=0; ix<strlen; ix++) {
89: rd_str[ix] = get1c(pno); /* read them back */
90: if (rd_str[ix]==(char)0xff) {
91: /* writes("\n Port no: "); writeh(pno-1); NL; */
92: writes("\t*** Can't find loop-back message ***\n");
93: error++;
94: break;
95: }
96: ca = ((long)rd_str[ix] & 0x7f); /* 7 bit ASCII */
97: ce = ((long)tst_str[ix] & 0x7f);
98: if (ce != ca) {
99: /* writes("\n Port no: "); writeh(pno-1); NL; */
100: writes("\t*** Loop-back & sent message are");
101: writes(" not matched ***\n");
102: error++;
103: break;
104: }
105: }
106: out:
107: pstr(pno,"\n\rdone\n\r");
108: return(error);
109: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.