File:  [XINU] / xinu / sys / ethread.c
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 17:39:04 2018 UTC (8 years, 2 months ago) by root
Branches: xinu, MAIN
CVS tags: xinu-19870308, HEAD
Xinu for VAX

/* ethread.c - ethread */

#include <conf.h>
#include <kernel.h>
#include <proc.h>
#include <network.h>

/*------------------------------------------------------------------------
 *  ethread - read a single packet from the ethernet
 *------------------------------------------------------------------------
 */
ethread(devptr, buff, len)
struct	devsw	*devptr;
char	*buff;
int	len;
{
	PStype	ps;
	short	wbuff;
	struct	etblk	*etptr;
	struct	dcmd	*dcmptr;
	struct	dqregs	*dqptr;

	etptr = (struct etblk *) devptr->dvioblk;
	dcmptr = etptr->ercmd;
	dqptr = etptr->eioaddr;
	wait(etptr->etrsem);
	disable(ps);
	etptr->etrpid = currpid;
	recvclr();
	ethrstrt(etptr, buff, len);
	while (recvtim(DQ_RTO) == TIMEOUT) {
		wbuff = (dcmptr=etptr->ewcmd)->dc_buf;
		ethstrt(etptr, buff);
		ethrstrt(etptr, buff, len);
		if (etptr->etlen != 0) {
			ethwstrt(etptr, wbuff, etptr->etlen, DC_NORM);
		}
	}
	if ( (dcmptr->dc_st1 & DC_LUSE) == DC_ERRU) {
		len = SYSERR;
	} else {
		len = (dcmptr->dc_st1&DC_HLEN)|(dcmptr->dc_st2 & DC_LLEN);
		len += DC_XLEN;
	}
	signal(etptr->etrsem);
	restore(ps);
	return(len);
}

unix.superglobalmegacorp.com

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