| plan 9 kernel history: overview | file list | diff list |
1999/0921/mpc/etherwavelan.c (diff list | history)
| 1999/0625/sys/src/9/mpc/etherwavelan.c:19,25 – 1999/0921/sys/src/9/mpc/etherwavelan.c:19,25 (short | long | prev | next) | ||
| 1999/0623 | #include "etherwavelan.h" | |
| 1999/0921 | static int wavelan_receive(Ether *ether); | |
| 1999/0623 | static int txstart(Ether *ether); static void | |
| 1999/0625/sys/src/9/mpc/etherwavelan.c:291,296 – 1999/0921/sys/src/9/mpc/etherwavelan.c:291,298 | ||
| 1999/0623 | ctlr = ether->ctlr; base = ctlr->port; | |
| 1999/0921 | print("%ld: send packet %d\n", m->ticks, length); | |
| 1999/0623 | outb(PIORL(base), xmtdata_base & 0xff); outb(PIORH(base), ((xmtdata_base >> 8) & PIORH_MASK) | PIORH_SEL_TX); outb(PIOP(base), length & 0xff); /* lsb */ | |
| 1999/0625/sys/src/9/mpc/etherwavelan.c:396,402 – 1999/0921/sys/src/9/mpc/etherwavelan.c:398,404 | ||
| 1999/0623 | ctlr->rx_packets++; | |
| 1999/0921 | if ((bp = rbpalloc(iallocb)) == 0){ | |
| 1999/0623 | print("wavelan: could not rbpalloc(%d).\n", sksize); ctlr->rx_dropped++; return; | |
| 1999/0625/sys/src/9/mpc/etherwavelan.c:415,421 – 1999/0921/sys/src/9/mpc/etherwavelan.c:417,423 | ||
| 1999/0623 | } } /* wavelan_read */ | |
| 1999/0921 | static int | |
| 1999/0623 | wavelan_receive(Ether *ether) { Ctlr *ctlr; | |
| 1999/0625/sys/src/9/mpc/etherwavelan.c:442,453 – 1999/0921/sys/src/9/mpc/etherwavelan.c:444,456 | ||
| 1999/0623 | newrfp |= inb(RPLH(base)) << 8; newrfp %= RX_SIZE; | |
| 1999/0921 | if(0) print("before wavelan_cs: i593_rfp %d stop %d newrfp %d ctlr->rfp %d\n", i593_rfp, ctlr->stop, newrfp, ctlr->rfp); | |
| 1999/0623 |
| |
| 1999/0921 | if (newrfp == ctlr->rfp) { | |
| 1999/0623 | print("wavelan_cs: odd RFPs: i593_rfp %d stop %d newrfp %d ctlr->rfp %d\n", i593_rfp, ctlr->stop, newrfp, ctlr->rfp); | |
| 1999/0921 | return 0; } | |
| 1999/0623 | while(newrfp != ctlr->rfp) { rp = newrfp; | |
| 1999/0625/sys/src/9/mpc/etherwavelan.c:466,471 – 1999/0921/sys/src/9/mpc/etherwavelan.c:469,475 | ||
| 1999/0623 | status = c[0] | (c[1] << 8); len = c[2] | (c[3] << 8); | |
| 1999/0921 | print("%ld: len = %d status = %ux %ux %ux\n", m->ticks, len, status, newrfp, rp); | |
| 1999/0623 | if(!(status & RX_RCV_OK)) { if(status & RX_NO_SFD) ctlr->rx_no_sfd++; if(status & RX_CRC_ERR) ctlr->rx_crc++; | |
| 1999/0625/sys/src/9/mpc/etherwavelan.c:483,491 – 1999/0921/sys/src/9/mpc/etherwavelan.c:487,504 | ||
| 1999/0623 | * per packet. */ ctlr->stop = (i593_rfp + RX_SIZE - ((RX_SIZE / 64) * 3)) % RX_SIZE; | |
| 1999/0921 | //print("ctlr->stop = %ux\n", ctlr->stop); | |
| 1999/0623 | outb(LCCR(base), OP0_SWIT_TO_PORT_1 | CR0_CHNL); outb(LCCR(base), CR1_STOP_REG_UPDATE | (ctlr->stop >> RX_SIZE_SHIFT)); outb(LCCR(base), OP1_SWIT_TO_PORT_0); | |
| 1999/0921 | newrfp = inb(RPLL(base)); newrfp |= inb(RPLH(base)) << 8; newrfp %= RX_SIZE; if(newrfp != ctlr->rfp) print("after wavelan_cs: left over = %d\n", (newrfp - ctlr->rfp + RX_SIZE) % RX_SIZE); return 1; | |
| 1999/0623 | } /* wavelan_receive */ static void | |
| 1999/0625/sys/src/9/mpc/etherwavelan.c:505,511 – 1999/0921/sys/src/9/mpc/etherwavelan.c:518,525 | ||
| 1999/0623 | outb(LCCR(base), CR0_STATUS_0 | OP0_NOP); interrupt_handler(ether, inb(LCSR(base))); | |
| 1999/0921 | outb(LCCR(base), CR0_STATUS_0 | OP0_NOP); print("status = %ux\n", inb(LCSR(base))); | |
| 1999/0623 | iunlock(&ctlr->wlock); }; /* wavelan interrupt */ | |