etherif.h 865 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  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. int minmtu;
  12. int maxmtu;
  13. Netif;
  14. void (*attach)(Ether*); /* filled in by reset routine */
  15. void (*detach)(Ether*);
  16. void (*transmit)(Ether*);
  17. void (*interrupt)(Ureg*, void*);
  18. long (*ifstat)(Ether*, void*, long, ulong);
  19. long (*ctl)(Ether*, void*, long); /* custom ctl messages */
  20. void (*power)(Ether*, int); /* power on/off */
  21. void (*shutdown)(Ether*); /* shutdown hardware before reboot */
  22. void* ctlr;
  23. uchar ea[Eaddrlen];
  24. void* address;
  25. int irq;
  26. Queue* oq;
  27. };
  28. extern Block* etheriq(Ether*, Block*, int);
  29. extern void addethercard(char*, int(*)(Ether*));
  30. extern ulong ethercrc(uchar*, int);
  31. extern int parseether(uchar*, char*);
  32. #define NEXT(x, l) (((x)+1)%(l))
  33. #define PREV(x, l) (((x) == 0) ? (l)-1: (x)-1)