RTL8139: Difference between revisions

[unchecked revision][unchecked revision]
Content deleted Content added
No edit summary
mNo edit summary
Line 53:
 
ex:
<source lang="c">
char rx_buffer[8192+16]; // declare the local buffer space (8k + header)
outportd(0x30, (unsigned long)rx_buffer); // send dword memory location to RBSTART (0x30)
</source>
 
=== Set IMR + ISR ===
 
Line 68 ⟶ 69:
 
ex:
<source lang="c">
outportw(0x3C, 0x0005); // Sets the TOK and ROK bits high
</source>
 
NB: When you handle an interrupt, you ''have'' to write the bit corresponding to the interrupt to reset it. The doc says reading the register is enough to reset the buffer to zero and writing has no effect. ''This is not the case on QEmu'', and probably on some/most hardware too. Writing a bit when it has no effect will probably not hurt.
 
Line 89 ⟶ 91:
 
Example:
<source lang="c">
outportl(0x44, 0xf | (1 << 7)); // (1 << 7) is the WRAP bit, 0xf is AB+AM+APM+AAP
</source>
 
=== Enable Receive and Transmitter ===
 
Line 104 ⟶ 107:
 
ex:
<source lang="c">
outportb(0x37, 0x0C); // Sets the RE and TE bits high
</source>
 
== Related Articles ==