1 enum { 2 MaxEther = 2, 3 Ntypes = 8, 4 }; 5 6 typedef struct Ether Ether; 7 struct Ether { 8 int ctlrno; 9 int port; 10 int irq; 11 int tbdf; /* type+busno+devno+funcno */ 12 13 void *ctlr; 14 Queue* oq; 15 uchar ea[Eaddrlen]; 16 17 long (*ifstat)(Ether*, void*, long, ulong); 18 #ifdef MULTIETHERTYPES 19 void (*attach)(Ether*); /* filled in by reset routine */ 20 void (*detach)(Ether*); 21 void (*transmit)(Ether*); 22 void (*interrupt)(Ureg*, void*); 23 long (*ctl)(Ether*, void*, long); /* custom ctl messages */ 24 void (*power)(Ether*, int); /* power on/off */ 25 void (*shutdown)(Ether*); /* shutdown hardware before reboot */ 26 #endif 27 Netif; 28 }; 29 30 extern Block* etheriq(Ether*, Block*, int); 31 extern void addethercard(char*, int(*)(Ether*)); 32 extern ulong ethercrc(uchar*, int); 33 extern int parseether(uchar*, char*); 34 35 #define NEXT(x, l) (((x)+1)%(l)) 36 #define PREV(x, l) (((x) == 0) ? (l)-1: (x)-1) 37