| plan 9 kernel history: overview | file list | diff list |
1993/1117/pc/ether8390.c (diff list | history)
| 1993/1116/sys/src/9/pc/ether8390.c:147,158 – 1993/1117/sys/src/9/pc/ether8390.c:147,158 (short | long | prev | next) | ||
| 1992/1222 | } Hdr; static void | |
| 1993/1116 |
| |
| 1993/1117 | dp8390disable(Dp8390 *dp8390) | |
| 1992/1222 | { | |
| 1993/0915 |
| |
| 1993/1117 | ulong port; | |
| 1992/1222 | int timo; | |
| 1993/1116 |
| |
| 1993/1117 | port = dp8390->dp8390; | |
| 1992/1222 | /* * Stop the chip. Set the Stp bit and wait for the chip * to finish whatever was on its tiny mind before it sets | |
| 1993/1116/sys/src/9/pc/ether8390.c:161,198 – 1993/1117/sys/src/9/pc/ether8390.c:161,198 | ||
| 1992/1222 | * chip there if this is called when probing for a device * at boot. */ | |
| 1993/0915 |
| |
| 1993/1117 | dp8390outb(port+Cr, Page0|RDMAabort|Stp); dp8390outb(port+Rbcr0, 0); dp8390outb(port+Rbcr1, 0); for(timo = 10000; (dp8390inb(port+Isr) & Rst) == 0 && timo; timo--) | |
| 1992/1222 | ; } | |
| 1993/0212 | static void | |
| 1993/1116 |
| |
| 1993/1117 | dp8390ring(Dp8390 *dp8390) | |
| 1993/0212 | { | |
| 1993/0915 |
| |
| 1993/1117 | ulong port; | |
| 1993/0212 | ||
| 1993/1116 |
| |
| 1993/1117 | port = dp8390->dp8390; dp8390outb(port+Pstart, dp8390->pstart); dp8390outb(port+Pstop, dp8390->pstop); dp8390outb(port+Bnry, dp8390->pstop-1); | |
| 1993/0212 | ||
| 1993/0915 |
| |
| 1993/1116 |
| |
| 1993/0915 |
| |
| 1993/1117 | dp8390outb(port+Cr, Page1|RDMAabort|Stp); dp8390outb(port+Curr, dp8390->pstart); dp8390outb(port+Cr, Page0|RDMAabort|Stp); | |
| 1993/0915 | ||
| 1993/1116 |
| |
| 1993/1117 | dp8390->nxtpkt = dp8390->pstart; | |
| 1993/0212 | } | |
| 1992/1222 | void | |
| 1993/1116 | dp8390setea(Ether *ether) | |
| 1992/1222 | { | |
| 1993/0915 |
| |
| 1993/1117 | ulong port; | |
| 1992/1222 | uchar cr; int i; | |
| 1993/1116 |
| |
| 1993/1117 | port = ((Dp8390*)ether->private)->dp8390; | |
| 1992/1222 | /* * Set the ethernet address into the chip. * Take care to restore the command register | |
| 1993/1116/sys/src/9/pc/ether8390.c:200,220 – 1993/1117/sys/src/9/pc/ether8390.c:200,220 | ||
| 1992/1222 | * addresses as we never set the multicast * enable. */ | |
| 1993/0915 |
| |
| 1993/1117 | cr = dp8390inb(port+Cr) & ~Txp; dp8390outb(port+Cr, Page1|(~(Ps1|Ps0) & cr)); | |
| 1993/1116 | for(i = 0; i < sizeof(ether->ea); i++) | |
| 1993/0915 |
| |
| 1993/1117 | dp8390outb(port+Par0+i, ether->ea[i]); dp8390outb(port+Cr, cr); | |
| 1992/1222 | } | |
| 1993/0915 | void | |
| 1993/1116 | dp8390getea(Ether *ether) | |
| 1993/0915 | { | |
| 1993/1117 | ulong port; | |
| 1993/0915 | uchar cr; int i; | |
| 1993/1116 |
| |
| 1993/1117 | port = ((Dp8390*)ether->private)->dp8390; | |
| 1993/0915 | /* | |
| 1993/1116 | * Get the ethernet address from the chip. | |
| 1993/0915 | * Take care to restore the command register | |
| 1993/1116/sys/src/9/pc/ether8390.c:222,270 – 1993/1117/sys/src/9/pc/ether8390.c:222,270 | ||
| 1993/0915 | * addresses as we never set the multicast * enable. */ | |
| 1993/1117 | cr = dp8390inb(port+Cr) & ~Txp; dp8390outb(port+Cr, Page1|(~(Ps1|Ps0) & cr)); | |
| 1993/1116 | for(i = 0; i < sizeof(ether->ea); i++) | |
| 1993/0915 |
| |
| 1993/1117 | ether->ea[i] = dp8390inb(port+Par0+i); dp8390outb(port+Cr, cr); | |
| 1993/0915 | } | |
| 1993/1116 | static void* | |
| 1993/1117 | dp8390read(Dp8390 *dp8390, void *to, ulong from, ulong len) | |
| 1992/1222 | { | |
| 1993/0915 |
| |
| 1993/1117 | ulong port; | |
| 1992/1222 | uchar cr; int timo; | |
| 1993/1116 |
| |
| 1993/1117 | port = dp8390->dp8390; | |
| 1992/1222 | /* | |
| 1993/0212 | * Read some data at offset 'from' in the card's memory | |
| 1992/1222 | * using the DP8390 remote DMA facility, and place it at * 'to' in main memory, via the I/O data port. */ | |
| 1993/0915 |
| |
| 1993/1117 | cr = dp8390inb(port+Cr) & ~Txp; dp8390outb(port+Cr, Page0|RDMAabort|Sta); dp8390outb(port+Isr, Rdc); | |
| 1992/1222 | /* * Set up the remote DMA address and count. */ | |
| 1993/1116 |
| |
| 1993/1117 | if(dp8390->bit16) | |
| 1992/1222 | len = ROUNDUP(len, 2); | |
| 1993/0915 |
| |
| 1993/1117 | dp8390outb(port+Rbcr0, len & 0xFF); dp8390outb(port+Rbcr1, (len>>8) & 0xFF); dp8390outb(port+Rsar0, from & 0xFF); dp8390outb(port+Rsar1, (from>>8) & 0xFF); | |
| 1992/1222 | /* * Start the remote DMA read and suck the data * out of the I/O port. */ | |
| 1993/0915 |
| |
| 1993/1116 |
| |
| 1993/1117 | dp8390outb(port+Cr, Page0|RDMAread|Sta); if(dp8390->bit16) inss(dp8390->data, to, len/2); | |
| 1992/1222 | else | |
| 1993/1116 |
| |
| 1993/1117 | insb(dp8390->data, to, len); | |
| 1992/1222 | /* * Wait for the remote DMA to complete. The timeout | |
| 1993/1116/sys/src/9/pc/ether8390.c:273,283 – 1993/1117/sys/src/9/pc/ether8390.c:273,283 | ||
| 1992/1222 | * to the miracles of the bus, we could get this far * and still be talking to a slot full of nothing. */ | |
| 1993/0915 |
| |
| 1993/1117 | for(timo = 10000; (dp8390inb(port+Isr) & Rdc) == 0 && timo; timo--) | |
| 1992/1222 | ; | |
| 1993/0915 |
| |
| 1993/1117 | dp8390outb(port+Isr, Rdc); dp8390outb(port+Cr, cr); | |
| 1992/1222 | return to; } | |
| 1993/1116/sys/src/9/pc/ether8390.c:287,293 – 1993/1117/sys/src/9/pc/ether8390.c:287,293 | ||
| 1993/0915 | ulong dp8390, crda; | |
| 1992/1222 | uchar cr; | |
| 1993/1116 |
| |
| 1993/1117 | dp8390 = ((Dp8390*)ether->private)->dp8390; | |
| 1992/1222 | /* | |
| 1993/0212 | * Write some data to offset 'to' in the card's memory | |
| 1992/1222 | * using the DP8390 remote DMA facility, reading it at | |
| 1993/1116/sys/src/9/pc/ether8390.c:373,379 – 1993/1117/sys/src/9/pc/ether8390.c:373,379 | ||
| 1993/1116 | ushort type; Netfile *f, **fp, **ep; | |
| 1992/1222 | ||
| 1993/1116 |
| |
| 1993/1117 | dp8390 = ((Dp8390*)ether->private)->dp8390; | |
| 1993/1116 | for(curr = getcurr(dp8390); ether->nxtpkt != curr; curr = getcurr(dp8390)){ ether->inpackets++; | |
| 1992/1222 | ||
| 1993/1116/sys/src/9/pc/ether8390.c:461,467 – 1993/1117/sys/src/9/pc/ether8390.c:461,467 | ||
| 1993/0915 | ulong dp8390; | |
| 1992/1222 | RingBuf *ring; | |
| 1993/0212 | ||
| 1993/1116 |
| |
| 1993/1117 | dp8390 = ((Dp8390*)ether->private)->dp8390; | |
| 1993/1116 | ring = ðer->tb[ether->ti]; if(ether->tbusy == 0 && ring->owner == Interface){ | |
| 1993/0213 | ||
| 1993/1116/sys/src/9/pc/ether8390.c:482,488 – 1993/1117/sys/src/9/pc/ether8390.c:482,488 | ||
| 1993/0212 | uchar txp; int resend; | |
| 1993/1116 |
| |
| 1993/1117 | dp8390 = ((Dp8390*)ether->private)->dp8390; | |
| 1993/0212 | /* * The following procedure is taken from the DP8390[12D] datasheet, * it seems pretty adamant that this is what has to be done. | |
| 1993/1116/sys/src/9/pc/ether8390.c:514,520 – 1993/1117/sys/src/9/pc/ether8390.c:514,520 | ||
| 1993/0915 | ulong dp8390; | |
| 1993/0212 | uchar isr, r; | |
| 1992/1222 | ||
| 1993/1116 |
| |
| 1993/1117 | dp8390 = ((Dp8390*)ether->private)->dp8390; | |
| 1992/1222 | /* * While there is something of interest, * clear all the interrupts and process. | |
| 1993/1116/sys/src/9/pc/ether8390.c:570,575 – 1993/1117/sys/src/9/pc/ether8390.c:570,578 | ||
| 1993/1116 | static void promiscuous(Ether *ether, int on) { | |
| 1993/1117 | ulong dp8390; dp8390 = ((Dp8390*)ether->private)->dp8390; | |
| 1993/1116 | /* * Set/reset promiscuous mode. */ | |
| 1993/1116/sys/src/9/pc/ether8390.c:582,587 – 1993/1117/sys/src/9/pc/ether8390.c:585,593 | ||
| 1993/1116 | void dp8390attach(Ether *ether) { | |
| 1993/1117 | ulong dp8390; dp8390 = ((Dp8390*)ether->private)->dp8390; | |
| 1993/1116 | /* * Enable the chip for transmit/receive. * The init routine leaves the chip in monitor | |
| 1993/1116/sys/src/9/pc/ether8390.c:597,603 – 1993/1117/sys/src/9/pc/ether8390.c:603,609 | ||
| 1993/1116 | { ulong dp8390; | |
| 1993/1117 | dp8390 = ((Dp8390*)ether->private)->dp8390; | |
| 1993/1116 | /* * This is the initialisation procedure described * as 'mandatory' in the datasheet, with references | |