]> Joshua Wise's Git repositories - netwatch.git/blobdiff - net/net.c
Open up TSEG so we can blast more packets out. Be a little less verbose.
[netwatch.git] / net / net.c
index b89abe2d2b0f56206aa4446121de9099a28d8a0c..01b4521cddcb523b572900c435c9e2d5552cb0c5 100644 (file)
--- a/net/net.c
+++ b/net/net.c
@@ -1,36 +1,52 @@
 #include <pci.h>
+#include <pci-bother.h>
 #include <output.h>
-#include "3c905.h"
+#include "net.h"
 
-static int found = 0, _bus, _dev, _fn;
+static struct nic *_nic = 0x0;
 
-static int bother_3c905(pci_dev_t *dev, void *nutrinus)
+extern struct pci_driver a3c90x_driver;
+
+static char test[1024] = {0};
+
+void eth_poll()
 {
-       if (dev->vid == 0x10B7 || dev->did == 0x9200)
+       int i;
+       static int c;
+       
+       if (!_nic)
+               return;
+
+       _nic->poll(_nic, 0);
+       
+       if ((c++) % 30)
+               return;
+       
+       for (i = 0; i < 1024; i++)
        {
-               outputf("Found a 3c905 to bother");
-               
-               _bus = dev->bus;
-               _dev = dev->dev;
-               _fn = dev->fn;
-               found = 1;
-               
-               return 1;
+               switch(i%5)
+               {
+               case 0: test[i] = 'H'; break;
+               case 1: test[i] = 'A'; break;
+               case 2: test[i] = 'R'; break;
+               case 3: test[i] = 'B'; break;
+               case 4: test[i] = 'L'; break;
+               }
        }
-       return 0;
+       _nic->transmit("\x00\x03\x93\x87\x84\x8C", 0x1337, 1024, test);
 }
 
-void eth_poll()
+int eth_register(struct nic *nic)
 {
-       if (!found)
-               return;
-               
-       pci_write16(_bus, _dev, _fn, 0x04, 0xFF);
-       
-       pci_write16(_bus, _dev, _fn, 0x04, 0x00);
+       if (_nic)
+               return -1;
+       _nic = nic;
+       return 0;
 }
 
 void eth_init()
 {
-       pci_probe(bother_3c905, 0x0);
+       /* Required for DMA to work. :( */
+       smram_tseg_set_state(SMRAM_TSEG_OPEN);
+       pci_probe_driver(a3c90x_driver);
 }
This page took 0.021831 seconds and 4 git commands to generate.