etherif.h 961 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. enum {
  2. MaxEther = 48,
  3. Ntypes = 8,
  4. };
  5. typedef struct Ether Ether;
  6. struct Ether {
  7. ISAConf; /* hardware info */
  8. int ctlrno;
  9. int tbdf; /* type+busno+devno+funcno */
  10. int minmtu;
  11. int maxmtu;
  12. uchar ea[Eaddrlen];
  13. void (*attach)(Ether*); /* filled in by reset routine */
  14. void (*detach)(Ether*);
  15. void (*transmit)(Ether*);
  16. void (*interrupt)(Ureg*, void*);
  17. long (*ifstat)(Ether*, void*, long, ulong);
  18. long (*ctl)(Ether*, void*, long); /* custom ctl messages */
  19. void (*power)(Ether*, int); /* power on/off */
  20. void (*shutdown)(Ether*); /* shutdown hardware before reboot */
  21. void *ctlr;
  22. Queue* oq;
  23. Netif;
  24. };
  25. extern Block* etheriq(Ether*, Block*, int);
  26. extern void addethercard(char*, int(*)(Ether*));
  27. extern ulong ethercrc(uchar*, int);
  28. extern int parseether(uchar*, char*);
  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))