|
|
1.1 ! root 1: /* ethread.c - ethread */ ! 2: ! 3: #include <conf.h> ! 4: #include <kernel.h> ! 5: #include <proc.h> ! 6: #include <network.h> ! 7: ! 8: /*------------------------------------------------------------------------ ! 9: * ethread - read a single packet from the ethernet ! 10: *------------------------------------------------------------------------ ! 11: */ ! 12: ethread(devptr, buff, len) ! 13: struct devsw *devptr; ! 14: char *buff; ! 15: int len; ! 16: { ! 17: PStype ps; ! 18: short wbuff; ! 19: struct etblk *etptr; ! 20: struct dcmd *dcmptr; ! 21: struct dqregs *dqptr; ! 22: ! 23: etptr = (struct etblk *) devptr->dvioblk; ! 24: dcmptr = etptr->ercmd; ! 25: dqptr = etptr->eioaddr; ! 26: wait(etptr->etrsem); ! 27: disable(ps); ! 28: etptr->etrpid = currpid; ! 29: recvclr(); ! 30: ethrstrt(etptr, buff, len); ! 31: while (recvtim(DQ_RTO) == TIMEOUT) { ! 32: wbuff = (dcmptr=etptr->ewcmd)->dc_buf; ! 33: ethstrt(etptr, buff); ! 34: ethrstrt(etptr, buff, len); ! 35: if (etptr->etlen != 0) { ! 36: ethwstrt(etptr, wbuff, etptr->etlen, DC_NORM); ! 37: } ! 38: } ! 39: if ( (dcmptr->dc_st1 & DC_LUSE) == DC_ERRU) { ! 40: len = SYSERR; ! 41: } else { ! 42: len = (dcmptr->dc_st1&DC_HLEN)|(dcmptr->dc_st2 & DC_LLEN); ! 43: len += DC_XLEN; ! 44: } ! 45: signal(etptr->etrsem); ! 46: restore(ps); ! 47: return(len); ! 48: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.