etherif.h 730 B

123456789101112131415161718192021222324252627282930313233343536
  1. typedef struct Ether Ether;
  2. struct Ether {
  3. ISAConf; /* hardware info */
  4. int ctlrno;
  5. char iname[NAMELEN];
  6. char oname[NAMELEN];
  7. int tbdf; /* type+busno+devno+funcno */
  8. int mbps; /* Mbps */
  9. uchar ea[Easize];
  10. void (*attach)(Ether*); /* filled in by reset routine */
  11. void (*transmit)(Ether*);
  12. void (*interrupt)(Ureg*, void*);
  13. void *ctlr;
  14. Ifc ifc;
  15. Lock rqlock;
  16. Msgbuf* rqhead;
  17. Msgbuf* rqtail;
  18. Rendez rqr;
  19. Lock tqlock;
  20. Msgbuf* tqhead;
  21. Msgbuf* tqtail;
  22. Rendez tqr;
  23. };
  24. #define NEXT(x, l) (((x)+1)%(l))
  25. #define PREV(x, l) (((x) == 0) ? (l)-1: (x)-1)
  26. #define HOWMANY(x, y) (((x)+((y)-1))/(y))
  27. #define ROUNDUP(x, y) (HOWMANY((x), (y))*(y))
  28. extern void etheriq(Ether*, Msgbuf*);
  29. extern Msgbuf* etheroq(Ether*);