etherif.h 934 B

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