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

1993/1120/pc/ether8390.c (diff list | history)

1993/1119/sys/src/9/pc/ether8390.c:446,4551993/1120/sys/src/9/pc/ether8390.c:446,452 (short | long | prev | next)
1993/1116    
			for(fp = ether->f; fp < ep; fp++) { 
				f = *fp; 
				if(f && (f->type == type || f->type < 0)) 
1993/1119    
{ 
print("Q%d|", len); 
1993/1116    
					qproduce(f->in, ðer->rpkt, len); 
1993/1119    
} 
1993/1116    
			} 
1992/1222    
		} 
 
1993/1119/sys/src/9/pc/ether8390.c:473,4821993/1120/sys/src/9/pc/ether8390.c:470,480
1993/1118    
} 
1993/0212    
 
1993/1118    
static long 
write(Ether *ether, void *buf, long n) 
1993/1120    
write(Ether *ether, void *buf, long len) 
1993/1118    
{ 
	Dp8390 *dp8390; 
	ulong port; 
1993/1120    
	Etherpkt *pkt; 
1993/0213    
 
1993/1118    
	dp8390 = ether->private; 
	port = dp8390->dp8390; 
1993/1119/sys/src/9/pc/ether8390.c:486,5031993/1120/sys/src/9/pc/ether8390.c:484,521
1993/1119    
		print("dp8390: transmitter jammed\n"); 
		return 0; 
1993/0212    
	} 
1993/1119    
	ether->tlen = n; 
1993/1120    
	ether->tlen = len; 
1993/1118    
 
1993/1120    
	/* 
	 * If it's a shared-memory interface, copy the packet 
	 * directly to the shared-memory area. Otherwise, copy 
	 * it to a staging buffer so the I/O-port write can be 
	 * done in one. 
	 */ 
1993/1118    
	if(dp8390->ram) 
		memmove((void*)(ether->mem+dp8390->tstart*Dp8390BufSz), buf, n); 
1993/1120    
		pkt = (Etherpkt*)(ether->mem+dp8390->tstart*Dp8390BufSz); 
1993/1118    
	else 
		dp8390write(dp8390, dp8390->tstart*Dp8390BufSz, buf, n); 
1993/1120    
		pkt = ðer->tpkt; 
	memmove(pkt, buf, len); 
1993/1118    
 
	dp8390outb(port+Tbcr0, n & 0xFF); 
	dp8390outb(port+Tbcr1, (n>>8) & 0xFF); 
1993/1120    
	/* 
	 * Give the packet a source address and make sure it 
	 * is of minimum length. 
	 */ 
	memmove(pkt->s, ether->ea, sizeof(ether->ea)); 
	if(len < ETHERMINTU){ 
		memset(pkt->d+len, 0, ETHERMINTU-len); 
		len = ETHERMINTU; 
	} 
 
	if(dp8390->ram == 0) 
		dp8390write(dp8390, dp8390->tstart*Dp8390BufSz, pkt, len); 
 
	dp8390outb(port+Tbcr0, len & 0xFF); 
	dp8390outb(port+Tbcr1, (len>>8) & 0xFF); 
1993/1118    
	dp8390outb(port+Cr, Page0|RDMAabort|Txp|Sta); 
 
	return n; 
1993/1120    
	return len; 
1993/0212    
} 
 
1993/1116    
static void 
1993/1119/sys/src/9/pc/ether8390.c:551,5571993/1120/sys/src/9/pc/ether8390.c:569,574
1992/1222    
	 */ 
1993/1118    
	dp8390outb(port+Imr, 0x00); 
	while(isr = dp8390inb(port+Isr)){ 
1993/1119    
print("I%2.2ux|", isr); 
1992/1222    
 
		if(isr & Ovw){ 
1993/1116    
			overflow(ether); 


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