etherif.h 878 B

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