File:  [Power 6/32 Unix Tahoe 4.2BSD] / cci / d / pits / v_ex.c
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Sun Jul 28 12:24:19 2019 UTC (7 years ago) by root
Branches: bsd, MAIN
CVS tags: v12b, v121, HEAD
Power 6/32 Unix version 1.2b


#include "vioc.h"
#include "conf.h"
#include "const.h"
#include "pte.h"

#define  ON		0x80
#define  OFF		0
#define	 LOOPBK		0
#define	 ECHO		1

#define  MAXPORT	16
#define  MAXRLEN	50
#define  MAXSLEN	256
#define  HEAD		"\n\r\t** VIOC test **\n"
#define  PORT		"\rlogical port no "
#define  NL		writec('\n')

#define  TST_STR  "0123456789abcdefghijklmnopqrstuvwxyz\
ABCDEFGHIJKLMNOPQRSTUVWXYZ"

extern long log_first, log_last;
extern char port_on[];
extern long viocb[];
/*	
	Routine to exercise VIOC :
	(1) print a heading message to all terminals on VIOC
	(If receive Unsolicited interrupt from VIOC, dump silos)
*/
v_ex(vno)
long vno;
{	long register pno, error;

	error = 0;
	NL;writes("\n4. Send/Receive Test ");NL; 
	for(pno=log_first; pno<=log_last; pno++) {
		v_autol(pno,OFF,AUTOLP);  /* Make sure no auto loop 	 */
				  	  /* when we do not want it	 */
		NL;writes("Port number ");writeh(pno-1);  
		switch (port_on[pno-1]) {
		case 0: {
			  writes("\tNOT TESTED, port is not on-line");NL;
			  break;
		        }
		case 1: {
			  pstr(pno,HEAD);
			  pstr(pno,PORT);
			  if (pno>10) { 
				       pchar(pno,pno-11+'A');
				     }
			  else pchar(pno,pno-1+'0'); 
			  pchar(pno,'\n');
			  writes("\tSet AUTO-LOOPBACK");NL;
			  v_autol(pno,ON,AUTOLP);
			  writes("\t\tSending message to port");NL;
			  if (pstr(pno,TST_STR))  {
			     DELAY(0x100000);/* wait for VIOC to receive LB */
			     writes("\t\tChecking LOOPBACK message");NL;
			     if (chk_port(pno)) error++;
			     }
			  else error++;
			  break;		
			}
		case 2: {
			  writes("\tNOT TESTED, port did not initialize.");NL;
			  break;
			}
		default:{
			  writes("\tNOT TESTED, unknown port status.");NL;
			}
		}
	}
/*	writes("\n5. Misc Commands Test:\n\n");
	writes("\n\tRPARALX Command Test: ");
	if (!v_reqpar(pno)) writes("\n\t *** RPARLAX  Failed ***");	*/
	writes("\nDone with "); writed(error); writes(" errors\n");
}
chk_port(pno)
long pno;
{
	register long strlen, ix, error;
	char *cptr, *tst_str, rd_str[100];
	char get1c(), ce, ca;

	tst_str = cptr = TST_STR;
	for(strlen=0; cptr[strlen] != NULL; strlen++);		/* Get length */
	error = 0;
	for(ix=0; ix<strlen; ix++) {
		rd_str[ix] = get1c(pno);	/* read them back */
		if (rd_str[ix]==(char)0xff) {
		/*	writes("\n    Port no: "); writeh(pno-1); NL;   */
			writes("\t*** Can't find loop-back message ***\n");
			error++;
			break;
			}
		ca = ((long)rd_str[ix] & 0x7f);		/* 7 bit ASCII */	
		ce = ((long)tst_str[ix] & 0x7f);
		if (ce != ca) {
		/*	writes("\n    Port no: "); writeh(pno-1); NL;   */
			writes("\t*** Loop-back & sent message are");
			writes(" not matched ***\n");
			error++;
			break;
			}
		}
out:
	pstr(pno,"\n\rdone\n\r");
	return(error);
}

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.