plan 9 kernel history: overview | file list | diff list

1993/1212/carrera/devether.c (diff list | history)

1993/1211/sys/src/9/carrera/devether.c:75,811993/1212/sys/src/9/carrera/devether.c:75,81 (short | long | prev | next)
1993/0903    
enum 
{ 
1993/0904    
	Nrb		= 16,		/* receive buffers */ 
	Ntb		= 8,		/* transmit buffers */ 
1993/1212    
	Ntb		= 16,		/* transmit buffers */ 
1993/0904    
}; 
1993/0903    
 
1993/0904    
enum 
1993/1211/sys/src/9/carrera/devether.c:425,4301993/1212/sys/src/9/carrera/devether.c:425,438
1993/0906    
	} 
1993/0905    
} 
 
1993/1212    
static int 
isoutbuf(void *arg) 
{ 
	Ether *ctlr = arg; 
 
	return ctlr->tda[ctlr->th].status == Host; 
} 
 
1993/0905    
void 
1993/0903    
etherintr(void) 
{ 
1993/1211/sys/src/9/carrera/devether.c:462,4681993/1212/sys/src/9/carrera/devether.c:470,477
1993/0906    
				txpkt = &c->tda[c->ti]; 
1993/0904    
			} 
			status &= ~(Txdn|Txer); 
1993/0918    
			wakeup(&c->tr); 
1993/1212    
			if(isoutbuf(c)) 
				wakeup(&c->tr); 
1993/0903    
		} 
1993/0904    
 
		if((status & (Pktrx|Rde)) == 0) 
1993/1211/sys/src/9/carrera/devether.c:514,5201993/1212/sys/src/9/carrera/devether.c:523,529
1993/0904    
			status &= ~Lcd; 
	 
		/* 
		 * Warnings that something is afoot. 
1993/1212    
		 * Warnings that something is atoe. 
1993/0904    
		 */ 
		if(status & Hbl){ 
1993/0906    
			print("sonic: cd heartbeat lost\n"); 
1993/1211/sys/src/9/carrera/devether.c:675,6881993/1212/sys/src/9/carrera/devether.c:684,689
1993/0903    
} 
 
static int 
isoutbuf(void *arg) 
{ 
1993/0904    
	Ether *ctlr = arg; 
1993/0903    
                 
1993/0904    
	return ctlr->tda[ctlr->th].status == Host; 
1993/0903    
} 
                 
1993/1202    
static int 
etherloop(Etherpkt *p, long n) 
{ 
	int s, different; 
1993/1211/sys/src/9/carrera/devether.c:722,7341993/1212/sys/src/9/carrera/devether.c:723,735
1993/0903    
 
	USED(offset); 
 
	if(n > ETHERMAXTU) 
		error(Ebadarg); 
                 
	/* etherif.c handles structure */ 
	if(NETTYPE(c->qid.path) != Ndataqid) 
1993/0904    
		return netifwrite(ether[0], c, buf, n); 
1993/0903    
 
1993/1212    
	if(n > ETHERMAXTU) 
		error(Ebadarg); 
 
1993/0903    
	/* we handle data */ 
1993/1202    
	if(etherloop(buf, n)) 
		return n; 
1993/1211/sys/src/9/carrera/devether.c:739,7531993/1212/sys/src/9/carrera/devether.c:740,751
1993/0918    
		nexterror(); 
	} 
 
1993/1211    
	tsleep(&ctlr->tr, isoutbuf, ctlr, 1000); 
1993/1212    
	tsleep(&ctlr->tr, isoutbuf, ctlr, 10000); 
1993/0905    
 
1993/1211    
	if(!isoutbuf(ctlr)) { 
1993/0903    
		print("ether transmitter jammed\n"); 
1993/1211    
		reset(ctlr); 
		WR(cr, Rxen); 
	} 
1993/1212    
	if(!isoutbuf(ctlr)) 
		print("ether transmitter jammed cr #%lux\n", RD(cr)); 
1993/0904    
	else { 
1993/0906    
		p =(Pbuf*)ctlr->tb[ctlr->th]; 
1993/1212    
		p = (Pbuf*)ctlr->tb[ctlr->th]; 
1993/0903    
		memmove(p->d, buf, n); 
		if(n < 60) { 
			memset(p->d+n, 0, 60-n); 


source code copyright © 1990-2005 Lucent Technologies; see license
Plan 9 distribution
comments to russ cox (rsc@swtch.com)