File:  [Power 6/32 Unix Tahoe 4.2BSD] / cci / d / ioex / 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 (6 years, 11 months 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	"1234567890abcdefghigklmnopq"

extern long log_p0, log_pn;
extern char port_on[];


/*	Routine to exercise VIOC :
	(1) print a heading message to all terminals on VIOC
	(If receive Unsolicited interrupt from VIOC, dump silos)
*/
v_ex()
{	long register pno, error;
	char no;

	writes("\n\t** VIOC test **\n");
	writes("start testing...\n");
	for(pno=log_p0; pno<=log_pn; pno++) {
		if (port_on[pno-1]) {
			pstr(pno,HEAD);		/* Print heading to port */
			pstr(pno,PORT);
			if (pno>9) { pchar(pno,'1');
				     pchar(pno,pno-10+'0');
				   }
				else pchar(pno,pno+'0'); 
			pchar(pno,'\n');

			v_autol(pno,ON,AUTOLP);	/* Set auto loop back */
			pstr(pno,TST_STR);	/* sent test string to port */
			}
		}
	error = 0;
	for(pno=log_p0; pno<=log_pn; pno++) {
		if (port_on[pno-1])  {
			if (chk_port(pno)) error++;
			v_autol(pno,OFF,AUTOLP);  /* Disable auto loop back */
			}
		}
	writes("\nDone with "); writeh(error); writes(" errors\n");
}


chk_port(pno)
long pno;
{
	register long strlen, ix, error;
	char *cptr, *tst_str, rd_str[100], port;
	char get1c(), ce, ca;

	writes("\nchecking port "); writed(pno);
	tst_str = cptr = TST_STR;
	for(strlen=0; cptr[strlen] != NULL; strlen++);		/* Get length */
	error = 0;
	port = '0';
	for(ix=0; ix<strlen; ix++) {
		rd_str[ix] = get1c(pno);	/* read them back */
		if (rd_str[ix]==(char)0xff) {
			writes("\nbuffer ");
			writec((char)port+pno); writes(" empty");
			error++;
			break;
			}
		ca = ((long)rd_str[ix] & 0x7f);		/* 7 bit ASCII */	
		ce = ((long)tst_str[ix] & 0x7f);
		if (ce != ca) {
			writes("\n** P");writed(pno);
			writes("  expected : "); writeh(ce); 
			writes("   *** actual : "); writeh(ca);
			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.