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

1992/0502/pc/devether.c (diff list | history)

1992/0501/sys/src/9/pc/devether.c:475,4811992/0502/sys/src/9/pc/devether.c:475,481 (short | long | prev | next)
1992/0424    
			rb = &cp->rb[cp->rh]; 
1992/0501    
			etherup(cp, rb->pkt, rb->len); 
1992/0424    
			rb->owner = Interface; 
			cp->rh = NEXT(cp->rh, Nrb); 
1992/0502    
			cp->rh = NEXT(cp->rh, cp->nrb); 
1992/0424    
		} 
1992/0410    
 
1992/0424    
		qunlock(&cp->rlock); 
1992/0501/sys/src/9/pc/devether.c:614,6231992/0502/sys/src/9/pc/devether.c:614,623
1992/0424    
	int i; 
	uchar msr; 
1992/0403    
 
1992/0501    
	cp->tb = ialloc(sizeof(Buffer)*Ntb, 1); 
1992/0424    
	cp->ntb = Ntb; 
1992/0501    
	cp->rb = ialloc(sizeof(Buffer)*Nrb, 1); 
	cp->nrb = Nrb; 
1992/0502    
	cp->tb = ialloc(sizeof(Buffer)*Ntb, 1); 
	cp->ntb = Ntb; 
1992/0424    
 
	msr = IN(hw, msr); 
	OUT(hw, msr, 0x40|msr); 
1992/0501/sys/src/9/pc/devether.c:684,6911992/0502/sys/src/9/pc/devether.c:684,689
1992/0424    
	OUT(cp->hw, w.tcr, 0); 
1992/0403    
} 
 
1992/0501    
static ulong wraps; 
                 
1992/0424    
static void 
wd8013receive(Ctlr *cp) 
1992/0403    
{ 
1992/0501/sys/src/9/pc/devether.c:708,7331992/0502/sys/src/9/pc/devether.c:706,727
1992/0424    
		cp->inpackets++; 
		p = &((Ring*)hw->ram)[next]; 
1992/0501    
		len = (p->len1<<8)|p->len0-4; 
if(len > sizeof(Etherpkt)) 
    print("!"); 
1992/0424    
 
		rb = &cp->rb[cp->ri]; 
		if(rb->owner == Interface){ 
1992/0501    
			rb->len = len; 
1992/0424    
			/*copy in packet*/ 
1992/0501    
			if(p->data+len >= hw->ram+hw->size){ 
wraps++; 
1992/0502    
			if((p->data+len) >= (hw->ram+hw->size)){ 
1992/0501    
				len = hw->ram+hw->size - p->data; 
				memmove(rb->pkt+len, 
					&((Ring*)hw->ram)[hw->pstart], 
					p->data+rb->len - hw->ram+hw->size); 
1992/0502    
					(p->data+rb->len) - (hw->ram+hw->size)); 
1992/0425    
			} 
1992/0501    
			memmove(rb->pkt, p->data, len); 
1992/0424    
			rb->owner = Host; 
			cp->ri = NEXT(cp->ri, Nrb); 
1992/0502    
			cp->ri = NEXT(cp->ri, cp->nrb); 
1992/0424    
		} 
 
1992/0501    
p->status = 0; 
1992/0502    
		p->status = 0; 
1992/0424    
		next = p->next; 
		bnry = next-1; 
1992/0501    
		if(bnry < hw->pstart) 
1992/0501/sys/src/9/pc/devether.c:747,7531992/0502/sys/src/9/pc/devether.c:741,746
1992/0424    
	tb = &cp->tb[cp->ti]; 
	if(tb->busy == 0 && tb->owner == Interface){ 
		hw = cp->hw; 
1992/0501    
tb->len = tb->len+1 & ~1; 
		memmove(hw->ram, tb->pkt, tb->len); 
1992/0424    
		OUT(hw, w.tbcr0, tb->len & 0xFF); 
		OUT(hw, w.tbcr1, (tb->len>>8) & 0xFF); 
1992/0501/sys/src/9/pc/devether.c:785,7911992/0502/sys/src/9/pc/devether.c:778,784
1992/0424    
			tb = &cp->tb[cp->ti]; 
			tb->owner = Host; 
			tb->busy = 0; 
			cp->ti = NEXT(cp->ti, Ntb); 
1992/0502    
			cp->ti = NEXT(cp->ti, cp->ntb); 
1992/0424    
			(*cp->hw->transmit)(cp); 
			wakeup(&cp->tr); 
		} 
1992/0501/sys/src/9/pc/devether.c:820,8411992/0502/sys/src/9/pc/devether.c:813,816
1992/0409    
void 
1992/0411    
consdebug(void) 
1992/0409    
{ 
1992/0501    
	Ctlr *cp = &ctlr[0]; 
	Hw *hw = cp->hw; 
	Buffer *bp; 
	uchar bnry, curr; 
                 
	print("th%d ti%d rh%d ri%d\n", 
		cp->th, cp->ti, cp->rh, cp->ri); 
	bp = &cp->tb[cp->ti]; 
	print("t: owner %d busy %d len %d\n", 
		bp->owner, bp->busy, bp->len); 
	bnry = IN(hw, r.bnry); 
	OUT(hw, w.cr, 0x62); 
	curr = IN(hw, curr); 
	OUT(hw, w.cr, 0x22); 
	print("bnry %d, curr %d\n", bnry, curr); 
	print("in %d out %d crcs %d oerrs %d frames %d overflows %d buffs %d wraps %d\n", 
		cp->inpackets, cp->outpackets, cp->crcs, cp->oerrs, cp->frames, 
		cp->overflows, cp->buffs, wraps); 
1992/0403    
} 


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