]> Joshua Wise's Git repositories - netwatch.git/blob - net/net.c
01b4521cddcb523b572900c435c9e2d5552cb0c5
[netwatch.git] / net / net.c
1 #include <pci.h>
2 #include <pci-bother.h>
3 #include <output.h>
4 #include "net.h"
5
6 static struct nic *_nic = 0x0;
7
8 extern struct pci_driver a3c90x_driver;
9
10 static char test[1024] = {0};
11
12 void eth_poll()
13 {
14         int i;
15         static int c;
16         
17         if (!_nic)
18                 return;
19
20         _nic->poll(_nic, 0);
21         
22         if ((c++) % 30)
23                 return;
24         
25         for (i = 0; i < 1024; i++)
26         {
27                 switch(i%5)
28                 {
29                 case 0: test[i] = 'H'; break;
30                 case 1: test[i] = 'A'; break;
31                 case 2: test[i] = 'R'; break;
32                 case 3: test[i] = 'B'; break;
33                 case 4: test[i] = 'L'; break;
34                 }
35         }
36         _nic->transmit("\x00\x03\x93\x87\x84\x8C", 0x1337, 1024, test);
37 }
38
39 int eth_register(struct nic *nic)
40 {
41         if (_nic)
42                 return -1;
43         _nic = nic;
44         return 0;
45 }
46
47 void eth_init()
48 {
49         /* Required for DMA to work. :( */
50         smram_tseg_set_state(SMRAM_TSEG_OPEN);
51         pci_probe_driver(a3c90x_driver);
52 }
This page took 0.023181 seconds and 2 git commands to generate.