home *** CD-ROM | disk | FTP | other *** search
/ The Pier Shareware 6 / The_Pier_Shareware_Number_6_(The_Pier_Exchange)_(1995).iso / 024 / psi110g.zip / EC.H < prev    next >
C/C++ Source or Header  |  1994-04-17  |  4KB  |  98 lines

  1. #ifndef _EC_H
  2. #define _EC_H
  3.   
  4. #ifndef _IFACE_H
  5. #include "iface.h"
  6. #endif
  7.   
  8. /* Stuff specific to the 3-Com 3C500 Ethernet controller board */
  9. #define EC_MAX  3
  10. extern int Nec; /* Actual number of Ethernet controllers */
  11.   
  12. /* Find base address of specified device */
  13. #define IE(dev) (ec_dev[dev].addr)
  14.   
  15. /* The various IE command registers */
  16. #define EDLC_ADDR(num)  (num)       /* EDLC station address, 6 bytes */
  17. #define EDLC_RCV(num)   ((num)+0x6) /* EDLC receive csr */
  18. #define EDLC_XMT(num)   ((num)+0x7) /* EDLC transmit csr */
  19. #define IE_GP(num)  ((num)+0x8) /* GP pointer */
  20. #define IE_RP(num)  ((num)+0xa) /* Receive buffer pointer */
  21. #define IE_SAPROM(num)  ((num)+0xc) /* window on station addr prom */
  22. #define IE_CSR(num) ((num)+0xe) /* IE command/status */
  23. #define IE_BFR(num) ((num)+0xf) /* window on packet buffer */
  24.   
  25. /* Bits in EDLC_RCV, interrupt enable on write, status when read */
  26. #define EDLC_NONE   0x00    /* match mode in bits 5-6, write only */
  27. #define EDLC_ALL    0x40    /* promiscuous receive, write only */
  28. #define EDLC_BROAD  0x80    /* station address plus broadcast */
  29. #define EDLC_MULTI  0xc0    /* station address plus multicast */
  30.   
  31. #define EDLC_STALE  0x80    /* receive CSR status previously read */
  32. #define EDLC_GOOD   0x20    /* well formed packets only */
  33. #define EDLC_ANY    0x10    /* any packet, even those with errors */
  34. #define EDLC_SHORT  0x08    /* short frame */
  35. #define EDLC_DRIBBLE    0x04    /* dribble error */
  36. #define EDLC_FCS    0x02    /* CRC error */
  37. #define EDLC_OVER   0x01    /* data overflow */
  38.   
  39. #define EDLC_RERROR (EDLC_SHORT|EDLC_DRIBBLE|EDLC_FCS|EDLC_OVER)
  40. #define EDLC_RMASK  (EDLC_GOOD|EDLC_ANY|EDLC_RERROR)
  41.   
  42. /* bits in EDLC_XMT, interrupt enable on write, status when read */
  43. #define EDLC_IDLE   0x08    /* transmit idle */
  44. #define EDLC_16     0x04    /* packet experienced 16 collisions */
  45. #define EDLC_JAM    0x02    /* packet experienced a collision */
  46. #define EDLC_UNDER  0x01    /* data underflow */
  47.   
  48. /* bits in IE_CSR */
  49. #define IE_RESET    0x80    /* reset the controller (wo) */
  50. #define IE_XMTBSY   0x80    /* Transmitter busy (ro) */
  51. #define IE_RIDE     0x40    /* request interrupt/DMA enable (rw) */
  52. #define IE_DMA      0x20    /* DMA request (rw) */
  53. #define IE_EDMA     0x10    /* DMA done (ro) */
  54.   
  55. #define IE_BUFCTL   0x0c    /* mask for buffer control field (rw) */
  56. #define IE_LOOP     0x0c    /* 2 bit field in bits 2,3, loopback */
  57. #define IE_RCVEDLC  0x08    /* gives buffer to receiver */
  58. #define IE_XMTEDLC  0x04    /* gives buffer to transmit */
  59. #define IE_SYSBFR   0x00    /* gives buffer to processor */
  60.   
  61. #define IE_CRC      0x01    /* causes CRC error on transmit (wo) */
  62. #define IE_RCVBSY   0x01    /* receive in progress (ro) */
  63.   
  64. /* miscellaneous sizes */
  65. #define BFRSIZ      2048    /* number of bytes in a buffer */
  66.   
  67. struct estats {
  68.     long recv;      /* Good packets received */
  69.     long bad;       /* Bad receive packets */
  70.     long over;      /* Overflow errors */
  71.     long drop;      /* Dropped because RX queue too long */
  72.     long nomem;     /* Dropped because buffer malloc failed */
  73.     long intrpt;        /* Interrupts */
  74.     long xmit;      /* Total output packets */
  75.     long timeout;       /* Transmitter timeouts */
  76.     long jam;       /* Collisions */
  77.     long jam16;     /* 16 successive collisions */
  78. };
  79. struct ec {
  80.     struct iface *iface;
  81.     struct estats estats;   /* Controller statistics */
  82.     unsigned base;      /* Base I/O address */
  83.     unsigned vec;       /* Interrupt vector */
  84.     short size;     /* Size of current transmit packet */
  85. };
  86. extern struct ec Ec[];
  87.   
  88. /* In ecvec.asm: */
  89. INTERRUPT ec0vec __ARGS((void));
  90. INTERRUPT ec1vec __ARGS((void));
  91. INTERRUPT ec2vec __ARGS((void));
  92.   
  93. /* In ec.c: */
  94. void ecint __ARGS((int dev));
  95.   
  96. #endif /* _EC_H */
  97.   
  98.