RTL8139: Difference between revisions
[unchecked revision] | [unchecked revision] |
Content deleted Content added
m Bot: Replace deprecated source tag with syntaxhighlight |
|||
Line 53:
this should essentially *power on* the device.
<
outportb( ioaddr + 0x52, 0x0);
</syntaxhighlight>
==== Software Reset! ====
Line 71:
initialization procedure.
<
outportb( ioaddr + 0x37, 0x10);
while( (inb(ioaddr + 0x37) & 0x10) != 0) { }
</syntaxhighlight>
==== Init Receive buffer ====
Line 82:
that variables memory location to the RBSTART register (0x30).
<
//ioaddr is obtained from PCI configuration
outportd(ioaddr + 0x30, (uintptr_t)rx_buffer); // send uint32_t memory location to RBSTART (0x30)
</syntaxhighlight>
Note that 'rx_buffer' needs to be a pointer to a '''physical address'''. In this case a size of 8192 + 16 (8K + 16 bytes) is recommended, see below.
Line 100:
a TOK or ROK IRQ happens, it actually will go through and fire up an IRQ.
<
outportw(ioaddr + 0x3C, 0x0005); // Sets the TOK and ROK bits high
</syntaxhighlight>
=== Configuring receive buffer (RCR) ===
Line 138:
Once this is completed, then the card will start allowing packets in and/or out.
<
outportb(ioaddr + 0x37, 0x0C); // Sets the RE and TE bits high
</syntaxhighlight>
=== Transmitting Packets ===
Line 173:
For example, this is tested and works on QEmu:
<
void rtl8139_handler(uint8_t isr, uint64_t error, uint64_t irq) {
uint16_t status = inw(io_base + 0x3e);
Line 185:
}
}
</syntaxhighlight>
== Related Articles ==
|