etherif.h 913 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. enum {
  2. MaxEther = 24,
  3. Ntypes = 8,
  4. };
  5. typedef struct Ether Ether;
  6. struct Ether {
  7. DevConf;
  8. int ctlrno;
  9. int tbdf; /* type+busno+devno+funcno */
  10. int minmtu;
  11. int maxmtu;
  12. uchar ea[Eaddrlen];
  13. int encry;
  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. Queue* oq;
  24. Netif;
  25. };
  26. extern Block* etheriq(Ether*, Block*, int);
  27. extern void addethercard(char*, int(*)(Ether*));
  28. extern ulong ethercrc(uchar*, int);
  29. #define NEXT(x, l) (((x)+1)%(l))
  30. #define PREV(x, l) (((x) == 0) ? (l)-1: (x)-1)
  31. #define HOWMANY(x, y) (((x)+((y)-1))/(y))
  32. #define ROUNDUP(x, y) (HOWMANY((x), (y))*(y))