Refactor Network driver loading, automatically pick driver based on hardware.

Remove duplicate PCI define, move PCNet PCI defines to Drivers/Run.CC.
This commit is contained in:
TomAwezome 2021-07-05 12:19:55 -04:00
parent dc2f09abfa
commit 2695917b38
9 changed files with 174 additions and 51 deletions

View file

@ -40,10 +40,10 @@ body {background-color:#000000;}
<a name="l13"></a> </span><span class=cF2>-</span><span class=cF0> </span><span class=cF2>Clear documentation.</span><span class=cF0>
<a name="l14"></a></span><span class=cF2>*/</span><span class=cF0>
<a name="l15"></a>
<a name="l16"></a>#</span><span class=cF1>define</span><span class=cF0> PCNET_DEVICE_ID </span><span class=cFE>0x2000</span><span class=cF0>
<a name="l17"></a>#</span><span class=cF1>define</span><span class=cF0> PCNET_VENDOR_ID </span><span class=cFE>0x1022</span><span class=cF0>
<a name="l16"></a></span><span class=cF2>//#define</span><span class=cF0> </span><span class=cF2>PCNET_DEVICE_ID</span><span class=cF0> </span><span class=cF2>0x2000</span><span class=cF0>
<a name="l17"></a></span><span class=cF2>//#define</span><span class=cF0> </span><span class=cF2>PCNET_VENDOR_ID</span><span class=cF0> </span><span class=cF2>0x1022</span><span class=cF0>
<a name="l18"></a>
<a name="l19"></a>#</span><span class=cF1>define</span><span class=cF0> PCI_REG_COMMAND </span><span class=cFE>0x04</span><span class=cF0>
<a name="l19"></a></span><span class=cF2>//#define</span><span class=cF0> </span><span class=cF2>PCI_REG_COMMAND</span><span class=cF0> </span><span class=cF2>0x04</span><span class=cF0>
<a name="l20"></a>
<a name="l21"></a>#</span><span class=cF1>define</span><span class=cF0> PCNET_CMDf_IOEN </span><span class=cFE>0</span><span class=cF0>
<a name="l22"></a>#</span><span class=cF1>define</span><span class=cF0> PCNET_CMDf_BMEN </span><span class=cFE>2</span><span class=cF0>
@ -150,7 +150,7 @@ body {background-color:#000000;}
<a name="l123"></a></span><span class=cF9>CPCIDev</span><span class=cF0> *PCNetPCIDevFind()
<a name="l124"></a>{</span><span class=cF2>// Find and return PCNetII card as a CPCIDev pointer.</span><span class=cF0>
<a name="l125"></a>
<a name="l126"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF5>PCIDevFind</span><span class=cF0>(,, PCNET_VENDOR_ID, PCNET_DEVICE_ID);
<a name="l126"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF5>PCIDevFind</span><span class=cF0>(,, PCIV_PCNET, PCID_PCNET);
<a name="l127"></a>}
<a name="l128"></a>
<a name="l129"></a></span><span class=cF9>U32</span><span class=cF0> PCNetIOBaseGet()
@ -667,7 +667,7 @@ body {background-color:#000000;}
<a name="l640"></a> </span><span class=cF5>PCIWriteU16</span><span class=cF0>(pcnet.pci-&gt;bus,
<a name="l641"></a> pcnet.pci-&gt;</span><span class=cFB>dev</span><span class=cF0>,
<a name="l642"></a> pcnet.pci-&gt;fun,
<a name="l643"></a> PCI_REG_COMMAND,
<a name="l643"></a> </span><span class=cF3>PCIR_COMMAND</span><span class=cF0>,
<a name="l644"></a> PCNET_CMDF_IOEN | PCNET_CMDF_BMEN);
<a name="l645"></a>
<a name="l646"></a> PCNetReset;

View file

@ -0,0 +1,74 @@
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=US-ASCII">
<meta name="generator" content="ZealOS V0.05">
<style type="text/css">
body {background-color:#000000;}
.cF0{color:#ffffff;background-color:#000000;}
.cF1{color:#3465a4;background-color:#000000;}
.cF2{color:#4e9a06;background-color:#000000;}
.cF3{color:#06989a;background-color:#000000;}
.cF4{color:#a24444;background-color:#000000;}
.cF5{color:#75507b;background-color:#000000;}
.cF6{color:#ce982f;background-color:#000000;}
.cF7{color:#bcc0b9;background-color:#000000;}
.cF8{color:#555753;background-color:#000000;}
.cF9{color:#729fcf;background-color:#000000;}
.cFA{color:#82bc49;background-color:#000000;}
.cFB{color:#34e2e2;background-color:#000000;}
.cFC{color:#ac3535;background-color:#000000;}
.cFD{color:#ad7fa8;background-color:#000000;}
.cFE{color:#fce94f;background-color:#000000;}
.cFF{color:#000000;background-color:#000000;}
</style>
</head>
<body>
<pre style="font-family:monospace;font-size:12pt">
<a name="l1"></a><span class=cF2>// Must be in same directory as driver files.</span><span class=cF0>
<a name="l2"></a></span><span class=cF2>// (Uses __DIR__)</span><span class=cF0>
<a name="l3"></a>
<a name="l4"></a>#</span><span class=cF1>define</span><span class=cF0> PCIV_PCNET </span><span class=cFE>0x1022</span><span class=cF0>
<a name="l5"></a>#</span><span class=cF1>define</span><span class=cF0> PCID_PCNET </span><span class=cFE>0x2000</span><span class=cF0>
<a name="l6"></a>
<a name="l7"></a>#</span><span class=cF1>define</span><span class=cF0> PCIV_82545EM </span><span class=cFE>0x8086</span><span class=cF0>
<a name="l8"></a>#</span><span class=cF1>define</span><span class=cF0> PCID_82545EM </span><span class=cFE>0x100F</span><span class=cF0>
<a name="l9"></a>
<a name="l10"></a></span><span class=cF1>U0</span><span class=cF0> NetDriverInclude(</span><span class=cF1>U8</span><span class=cF0> *driver)
<a name="l11"></a>{
<a name="l12"></a> </span><span class=cF1>U8</span><span class=cF0> *filename = </span><span class=cF5>MStrPrint</span><span class=cF0>(</span><span class=cF3>__DIR__</span><span class=cF0> </span><span class=cF6>&quot;/%s&quot;</span><span class=cF0>, driver);
<a name="l13"></a>
<a name="l14"></a> </span><span class=cF5>ExeFile</span><span class=cF0>(filename);
<a name="l15"></a> </span><span class=cF5>Free</span><span class=cF0>(filename);
<a name="l16"></a>}
<a name="l17"></a>
<a name="l18"></a></span><span class=cF1>U0</span><span class=cF0> NetDriverInit()
<a name="l19"></a>{
<a name="l20"></a> </span><span class=cF9>CPCIDev</span><span class=cF0> *net_driver_pci = </span><span class=cF5>PCIDevFind</span><span class=cF0>(</span><span class=cF3>PCIC_NETWORK</span><span class=cF0>);
<a name="l21"></a>
<a name="l22"></a> </span><span class=cF1>switch</span><span class=cF0> (net_driver_pci-&gt;vendor_id)
<a name="l23"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l24"></a> </span><span class=cF1>case</span><span class=cF0> PCIV_PCNET:
<a name="l25"></a> </span><span class=cF1>switch</span><span class=cF0> (net_driver_pci-&gt;device_id)
<a name="l26"></a> {
<a name="l27"></a> </span><span class=cF1>case</span><span class=cF0> PCID_PCNET:
<a name="l28"></a> NetDriverInclude(</span><span class=cF6>&quot;PCNet&quot;</span><span class=cF0>);
<a name="l29"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l30"></a> }
<a name="l31"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l32"></a>
<a name="l33"></a> </span><span class=cF1>case</span><span class=cF0> PCIV_82545EM:
<a name="l34"></a> </span><span class=cF1>switch</span><span class=cF0> (net_driver_pci-&gt;device_id)
<a name="l35"></a> {
<a name="l36"></a> </span><span class=cF1>case</span><span class=cF0> PCID_82545EM:
<a name="l37"></a> NetDriverInclude(</span><span class=cF6>&quot;82545EM&quot;</span><span class=cF0>);
<a name="l38"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l39"></a> }
<a name="l40"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l41"></a>
<a name="l42"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l43"></a>}
<a name="l44"></a>
<a name="l45"></a>NetDriverInit;
</span></pre></body>
</html>

View file

@ -29,6 +29,7 @@ body {background-color:#000000;}
<a name="l1"></a><span class=cF0>Directory of C:/Home/Net/Drivers
<a name="l2"></a></span><a href="https://tomawezome.github.io/ZealOS/Home/Net/Drivers/index.html#l1"><span class=c04>./</span></a><span class=cF0>
<a name="l3"></a></span><a href="https://tomawezome.github.io/ZealOS/Home/Net/index.html#l1"><span class=c04>../</span></a><span class=cF4>
<a name="l4"></a></span><a href="https://tomawezome.github.io/ZealOS/Home/Net/Drivers/PCNet.CC.html#l1"><span class=cF4>PCNet.CC</span></a><span class=cF0>
<a name="l4"></a></span><a href="https://tomawezome.github.io/ZealOS/Home/Net/Drivers/PCNet.CC.html#l1"><span class=cF4>PCNet.CC</span></a><span class=cF4>
<a name="l5"></a></span><a href="https://tomawezome.github.io/ZealOS/Home/Net/Drivers/Run.CC.html#l1"><span class=cF4>Run.CC</span></a><span class=cF0>
</span></pre></body>
</html>

View file

@ -31,30 +31,32 @@ body {background-color:#000000;}
<a name="l4"></a>#</span><span class=cF1>include</span><span class=cF0> </span><span class=cF6>&quot;Utilities/NetLog&quot;</span><span class=cF0>
<a name="l5"></a>
<a name="l6"></a>#</span><span class=cF1>include</span><span class=cF0> </span><span class=cF6>&quot;Utilities/NetQueue&quot;</span><span class=cF0>
<a name="l7"></a>#</span><span class=cF1>include</span><span class=cF0> </span><span class=cF6>&quot;Drivers/PCNet&quot;</span><span class=cF0>
<a name="l8"></a>#</span><span class=cF1>include</span><span class=cF0> </span><span class=cF6>&quot;Protocols/Ethernet&quot;</span><span class=cF0>
<a name="l7"></a>
<a name="l8"></a>#</span><span class=cF1>include</span><span class=cF0> </span><span class=cF6>&quot;Drivers/Run&quot;</span><span class=cF0>
<a name="l9"></a>
<a name="l10"></a>#</span><span class=cF1>include</span><span class=cF0> </span><span class=cF6>&quot;Protocols/ARP&quot;</span><span class=cF0>
<a name="l11"></a>#</span><span class=cF1>include</span><span class=cF0> </span><span class=cF6>&quot;Protocols/IPV4&quot;</span><span class=cF0>
<a name="l12"></a>#</span><span class=cF1>include</span><span class=cF0> </span><span class=cF6>&quot;Protocols/ICMP&quot;</span><span class=cF0>
<a name="l13"></a>
<a name="l14"></a>#</span><span class=cF1>include</span><span class=cF0> </span><span class=cF6>&quot;Protocols/Sockets&quot;</span><span class=cF0>
<a name="l10"></a>#</span><span class=cF1>include</span><span class=cF0> </span><span class=cF6>&quot;Protocols/Ethernet&quot;</span><span class=cF0>
<a name="l11"></a>
<a name="l12"></a>#</span><span class=cF1>include</span><span class=cF0> </span><span class=cF6>&quot;Protocols/ARP&quot;</span><span class=cF0>
<a name="l13"></a>#</span><span class=cF1>include</span><span class=cF0> </span><span class=cF6>&quot;Protocols/IPV4&quot;</span><span class=cF0>
<a name="l14"></a>#</span><span class=cF1>include</span><span class=cF0> </span><span class=cF6>&quot;Protocols/ICMP&quot;</span><span class=cF0>
<a name="l15"></a>
<a name="l16"></a>#</span><span class=cF1>include</span><span class=cF0> </span><span class=cF6>&quot;Utilities/BST&quot;</span><span class=cF0>
<a name="l16"></a>#</span><span class=cF1>include</span><span class=cF0> </span><span class=cF6>&quot;Protocols/Sockets&quot;</span><span class=cF0>
<a name="l17"></a>
<a name="l18"></a></span><span class=cF2>// todo create MakeUDP and MakeTCP to clean this up</span><span class=cF0>
<a name="l19"></a>#</span><span class=cF1>include</span><span class=cF0> </span><span class=cF6>&quot;Protocols/UDP/UDP.HH&quot;</span><span class=cF0>
<a name="l20"></a>#</span><span class=cF1>include</span><span class=cF0> </span><span class=cF6>&quot;Protocols/UDP/UDPTree&quot;</span><span class=cF0>
<a name="l21"></a>#</span><span class=cF1>include</span><span class=cF0> </span><span class=cF6>&quot;Protocols/UDP/UDP.CC&quot;</span><span class=cF0>
<a name="l22"></a>
<a name="l23"></a>#</span><span class=cF1>include</span><span class=cF0> </span><span class=cF6>&quot;Protocols/TCP/TCP.HH&quot;</span><span class=cF0>
<a name="l24"></a>#</span><span class=cF1>include</span><span class=cF0> </span><span class=cF6>&quot;Protocols/TCP/TCPTree&quot;</span><span class=cF0>
<a name="l25"></a>#</span><span class=cF1>include</span><span class=cF0> </span><span class=cF6>&quot;Protocols/TCP/TCP.CC&quot;</span><span class=cF0>
<a name="l26"></a>#</span><span class=cF1>include</span><span class=cF0> </span><span class=cF6>&quot;Protocols/TCP/TCPHandler&quot;</span><span class=cF0>
<a name="l27"></a>
<a name="l28"></a>
<a name="l29"></a>#</span><span class=cF1>include</span><span class=cF0> </span><span class=cF6>&quot;Protocols/DNS&quot;</span><span class=cF0>
<a name="l30"></a>#</span><span class=cF1>include</span><span class=cF0> </span><span class=cF6>&quot;Protocols/DHCP&quot;</span><span class=cF0>
<a name="l31"></a>
<a name="l32"></a>#</span><span class=cF1>include</span><span class=cF0> </span><span class=cF6>&quot;Utilities/NetHandler&quot;</span><span class=cF0> </span><span class=cF2>// needs IPV4, UDP, ICMP</span></pre></body>
<a name="l18"></a>#</span><span class=cF1>include</span><span class=cF0> </span><span class=cF6>&quot;Utilities/BST&quot;</span><span class=cF0>
<a name="l19"></a>
<a name="l20"></a></span><span class=cF2>// todo create MakeUDP and MakeTCP to clean this up</span><span class=cF0>
<a name="l21"></a>#</span><span class=cF1>include</span><span class=cF0> </span><span class=cF6>&quot;Protocols/UDP/UDP.HH&quot;</span><span class=cF0>
<a name="l22"></a>#</span><span class=cF1>include</span><span class=cF0> </span><span class=cF6>&quot;Protocols/UDP/UDPTree&quot;</span><span class=cF0>
<a name="l23"></a>#</span><span class=cF1>include</span><span class=cF0> </span><span class=cF6>&quot;Protocols/UDP/UDP.CC&quot;</span><span class=cF0>
<a name="l24"></a>
<a name="l25"></a>#</span><span class=cF1>include</span><span class=cF0> </span><span class=cF6>&quot;Protocols/TCP/TCP.HH&quot;</span><span class=cF0>
<a name="l26"></a>#</span><span class=cF1>include</span><span class=cF0> </span><span class=cF6>&quot;Protocols/TCP/TCPTree&quot;</span><span class=cF0>
<a name="l27"></a>#</span><span class=cF1>include</span><span class=cF0> </span><span class=cF6>&quot;Protocols/TCP/TCP.CC&quot;</span><span class=cF0>
<a name="l28"></a>#</span><span class=cF1>include</span><span class=cF0> </span><span class=cF6>&quot;Protocols/TCP/TCPHandler&quot;</span><span class=cF0>
<a name="l29"></a>
<a name="l30"></a>
<a name="l31"></a>#</span><span class=cF1>include</span><span class=cF0> </span><span class=cF6>&quot;Protocols/DNS&quot;</span><span class=cF0>
<a name="l32"></a>#</span><span class=cF1>include</span><span class=cF0> </span><span class=cF6>&quot;Protocols/DHCP&quot;</span><span class=cF0>
<a name="l33"></a>
<a name="l34"></a>#</span><span class=cF1>include</span><span class=cF0> </span><span class=cF6>&quot;Utilities/NetHandler&quot;</span><span class=cF0> </span><span class=cF2>// needs IPV4, UDP, ICMP</span></pre></body>
</html>

View file

@ -33,21 +33,20 @@ body {background-color:#000000;}
<a name="l5"></a></span><a href="https://tomawezome.github.io/ZealOS/Demo/index.html#l1"><span class=c04>Demo/</span></a><span class=cF0>
<a name="l6"></a></span><a href="https://tomawezome.github.io/ZealOS/Doc/index.html#l1"><span class=c04>Doc/</span></a><span class=cF0>
<a name="l7"></a></span><a href="https://tomawezome.github.io/ZealOS/Downloads/index.html#l1"><span class=c04>Downloads/</span></a><span class=cF0>
<a name="l8"></a></span><a href="https://tomawezome.github.io/ZealOS/HTML/index.html#l1"><span class=c04>HTML/</span></a><span class=cF0>
<a name="l9"></a></span><a href="https://tomawezome.github.io/ZealOS/Home/index.html#l1"><span class=c04>Home/</span></a><span class=cF0>
<a name="l10"></a></span><a href="https://tomawezome.github.io/ZealOS/Kernel/index.html#l1"><span class=c04>Kernel/</span></a><span class=cF0>
<a name="l11"></a></span><a href="https://tomawezome.github.io/ZealOS/Misc/index.html#l1"><span class=c04>Misc/</span></a><span class=cF0>
<a name="l12"></a></span><a href="https://tomawezome.github.io/ZealOS/System/index.html#l1"><span class=c04>System/</span></a><span class=cF0>
<a name="l13"></a></span><a href="https://tomawezome.github.io/ZealOS/Tmp/index.html#l1"><span class=c04>Tmp/</span></a><span class=cF4>
<a name="l14"></a></span><a href="https://tomawezome.github.io/ZealOS/Kernel.BIN.C.html#l1"><span class=cF4>Kernel.BIN.C</span></a><span class=cF4>
<a name="l15"></a></span><a href="https://tomawezome.github.io/ZealOS/HomeKeyPlugIns.CC.html#l1"><span class=cF4>HomeKeyPlugIns.CC</span></a><span class=cF4>
<a name="l16"></a></span><a href="https://tomawezome.github.io/ZealOS/HomeLocalize.CC.html#l1"><span class=cF4>HomeLocalize.CC</span></a><span class=cF4>
<a name="l17"></a></span><a href="https://tomawezome.github.io/ZealOS/HomeSys.CC.html#l1"><span class=cF4>HomeSys.CC</span></a><span class=cF4>
<a name="l18"></a></span><a href="https://tomawezome.github.io/ZealOS/HomeWrappers.CC.html#l1"><span class=cF4>HomeWrappers.CC</span></a><span class=cF4>
<a name="l19"></a></span><a href="https://tomawezome.github.io/ZealOS/MakeHome.CC.html#l1"><span class=cF4>MakeHome.CC</span></a><span class=cF4>
<a name="l20"></a></span><a href="https://tomawezome.github.io/ZealOS/Once.CC.html#l1"><span class=cF4>Once.CC</span></a><span class=cF4>
<a name="l21"></a></span><a href="https://tomawezome.github.io/ZealOS/StartOS.CC.html#l1"><span class=cF4>StartOS.CC</span></a><span class=cF4>
<a name="l22"></a></span><a href="https://tomawezome.github.io/ZealOS/PersonalMenu.DD.html#l1"><span class=cF4>PersonalMenu.DD</span></a><span class=cF4>
<a name="l23"></a></span><a href="https://tomawezome.github.io/ZealOS/PersonalNotes.DD.html#l1"><span class=cF4>PersonalNotes.DD</span></a><span class=cF0>
<a name="l8"></a></span><a href="https://tomawezome.github.io/ZealOS/Home/index.html#l1"><span class=c04>Home/</span></a><span class=cF0>
<a name="l9"></a></span><a href="https://tomawezome.github.io/ZealOS/Kernel/index.html#l1"><span class=c04>Kernel/</span></a><span class=cF0>
<a name="l10"></a></span><a href="https://tomawezome.github.io/ZealOS/Misc/index.html#l1"><span class=c04>Misc/</span></a><span class=cF0>
<a name="l11"></a></span><a href="https://tomawezome.github.io/ZealOS/System/index.html#l1"><span class=c04>System/</span></a><span class=cF0>
<a name="l12"></a></span><a href="https://tomawezome.github.io/ZealOS/Tmp/index.html#l1"><span class=c04>Tmp/</span></a><span class=cF4>
<a name="l13"></a></span><a href="https://tomawezome.github.io/ZealOS/Kernel.BIN.C.html#l1"><span class=cF4>Kernel.BIN.C</span></a><span class=cF4>
<a name="l14"></a></span><a href="https://tomawezome.github.io/ZealOS/HomeKeyPlugIns.CC.html#l1"><span class=cF4>HomeKeyPlugIns.CC</span></a><span class=cF4>
<a name="l15"></a></span><a href="https://tomawezome.github.io/ZealOS/HomeLocalize.CC.html#l1"><span class=cF4>HomeLocalize.CC</span></a><span class=cF4>
<a name="l16"></a></span><a href="https://tomawezome.github.io/ZealOS/HomeSys.CC.html#l1"><span class=cF4>HomeSys.CC</span></a><span class=cF4>
<a name="l17"></a></span><a href="https://tomawezome.github.io/ZealOS/HomeWrappers.CC.html#l1"><span class=cF4>HomeWrappers.CC</span></a><span class=cF4>
<a name="l18"></a></span><a href="https://tomawezome.github.io/ZealOS/MakeHome.CC.html#l1"><span class=cF4>MakeHome.CC</span></a><span class=cF4>
<a name="l19"></a></span><a href="https://tomawezome.github.io/ZealOS/Once.CC.html#l1"><span class=cF4>Once.CC</span></a><span class=cF4>
<a name="l20"></a></span><a href="https://tomawezome.github.io/ZealOS/StartOS.CC.html#l1"><span class=cF4>StartOS.CC</span></a><span class=cF4>
<a name="l21"></a></span><a href="https://tomawezome.github.io/ZealOS/PersonalMenu.DD.html#l1"><span class=cF4>PersonalMenu.DD</span></a><span class=cF4>
<a name="l22"></a></span><a href="https://tomawezome.github.io/ZealOS/PersonalNotes.DD.html#l1"><span class=cF4>PersonalNotes.DD</span></a><span class=cF0>
</span></pre></body>
</html>

View file

@ -13,10 +13,10 @@
- Clear documentation.
*/
#define PCNET_DEVICE_ID 0x2000
#define PCNET_VENDOR_ID 0x1022
//#define PCNET_DEVICE_ID 0x2000
//#define PCNET_VENDOR_ID 0x1022
#define PCI_REG_COMMAND 0x04
//#define PCI_REG_COMMAND 0x04
#define PCNET_CMDf_IOEN 0
#define PCNET_CMDf_BMEN 2
@ -123,7 +123,7 @@ class CPCNetBufferSetup
CPCIDev *PCNetPCIDevFind()
{// Find and return PCNetII card as a CPCIDev pointer.
return PCIDevFind(,, PCNET_VENDOR_ID, PCNET_DEVICE_ID);
return PCIDevFind(,, PCIV_PCNET, PCID_PCNET);
}
U32 PCNetIOBaseGet()
@ -640,7 +640,7 @@ U0 PCNetInit()
PCIWriteU16(pcnet.pci->bus,
pcnet.pci->dev,
pcnet.pci->fun,
PCI_REG_COMMAND,
PCIR_COMMAND,
PCNET_CMDF_IOEN | PCNET_CMDF_BMEN);
PCNetReset;

45
src/Home/Net/Drivers/Run.CC Executable file
View file

@ -0,0 +1,45 @@
// Must be in same directory as driver files.
// (Uses __DIR__)
#define PCIV_PCNET 0x1022
#define PCID_PCNET 0x2000
#define PCIV_82545EM 0x8086
#define PCID_82545EM 0x100F
U0 NetDriverInclude(U8 *driver)
{
U8 *filename = MStrPrint(__DIR__ "/%s", driver);
ExeFile(filename);
Free(filename);
}
U0 NetDriverInit()
{
CPCIDev *net_driver_pci = PCIDevFind(PCIC_NETWORK);
switch (net_driver_pci->vendor_id)
{
case PCIV_PCNET:
switch (net_driver_pci->device_id)
{
case PCID_PCNET:
NetDriverInclude("PCNet");
break;
}
break;
case PCIV_82545EM:
switch (net_driver_pci->device_id)
{
case PCID_82545EM:
NetDriverInclude("82545EM");
break;
}
break;
}
}
NetDriverInit;

View file

@ -4,7 +4,9 @@ Cd(__DIR__);
#include "Utilities/NetLog"
#include "Utilities/NetQueue"
#include "Drivers/PCNet"
#include "Drivers/Run"
#include "Protocols/Ethernet"
#include "Protocols/ARP"