1 /* 2 * All the goo for PC ethernet cards. 3 */ 4 typedef struct Card Card; 5 typedef struct Type Type; 6 typedef struct Ctlr Ctlr; 7 8 /* 9 * Hardware interface. 10 */ 11 struct Card { 12 ISAConf; 13 14 int (*reset)(Ctlr*); 15 void (*attach)(Ctlr*); 16 17 void *(*read)(Ctlr*, void*, ulong, ulong); 18 void *(*write)(Ctlr*, ulong, void*, ulong); 19 20 void (*receive)(Ctlr*); 21 void (*transmit)(Ctlr*); 22 void (*intr)(Ureg*, void*); 23 void (*overflow)(Ctlr*); 24 25 uchar bit16; /* true if a 16 bit interface */ 26 uchar ram; /* true if card has shared memory */ 27 28 ulong dp8390; /* I/O address of 8390 (if any) */ 29 ulong data; /* I/O data port if no shared memory */ 30 uchar nxtpkt; /* software bndry */ 31 uchar tstart; /* 8390 ring addresses */ 32 uchar pstart; 33 uchar pstop; 34 35 uchar dummyrr; /* do dummy remote read */ 36 }; 37 38 /* 39 * Software controller. 40 */ 41 struct Ctlr { 42 Card card; /* hardware info */ 43 int ctlrno; 44 int present; 45 46 Queue* iq; 47 Queue* oq; 48 49 int inpackets; 50 int outpackets; 51 int crcs; /* input crc errors */ 52 int oerrs; /* output errors */ 53 int frames; /* framing errors */ 54 int overflows; /* packet overflows */ 55 int buffs; /* buffering errors */ 56 }; 57 58 extern int sccethreset(Ctlr*); 59 extern int etheriq(Ctlr*, Block*, int); 60