ni5010.h 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. /*
  2. * Racal-Interlan ni5010 Ethernet definitions
  3. *
  4. * This is an extension to the Linux operating system, and is covered by the
  5. * same GNU General Public License that covers that work.
  6. *
  7. * copyrights (c) 1996 by Jan-Pascal van Best (jvbest@wi.leidenuniv.nl)
  8. *
  9. * I have done a look in the following sources:
  10. * crynwr-packet-driver by Russ Nelson
  11. */
  12. #define NI5010_BUFSIZE 2048 /* number of bytes in a buffer */
  13. #define NI5010_MAGICVAL0 0x00 /* magic-values for ni5010 card */
  14. #define NI5010_MAGICVAL1 0x55
  15. #define NI5010_MAGICVAL2 0xAA
  16. #define SA_ADDR0 0x02
  17. #define SA_ADDR1 0x07
  18. #define SA_ADDR2 0x01
  19. /* The number of low I/O ports used by the ni5010 ethercard. */
  20. #define NI5010_IO_EXTENT 32
  21. #define PRINTK(x) if (NI5010_DEBUG) printk x
  22. #define PRINTK2(x) if (NI5010_DEBUG>=2) printk x
  23. #define PRINTK3(x) if (NI5010_DEBUG>=3) printk x
  24. /* The various IE command registers */
  25. #define EDLC_XSTAT (ioaddr + 0x00) /* EDLC transmit csr */
  26. #define EDLC_XCLR (ioaddr + 0x00) /* EDLC transmit "Clear IRQ" */
  27. #define EDLC_XMASK (ioaddr + 0x01) /* EDLC transmit "IRQ Masks" */
  28. #define EDLC_RSTAT (ioaddr + 0x02) /* EDLC receive csr */
  29. #define EDLC_RCLR (ioaddr + 0x02) /* EDLC receive "Clear IRQ" */
  30. #define EDLC_RMASK (ioaddr + 0x03) /* EDLC receive "IRQ Masks" */
  31. #define EDLC_XMODE (ioaddr + 0x04) /* EDLC transmit Mode */
  32. #define EDLC_RMODE (ioaddr + 0x05) /* EDLC receive Mode */
  33. #define EDLC_RESET (ioaddr + 0x06) /* EDLC RESET register */
  34. #define EDLC_TDR1 (ioaddr + 0x07) /* "Time Domain Reflectometry" reg1 */
  35. #define EDLC_ADDR (ioaddr + 0x08) /* EDLC station address, 6 bytes */
  36. /* 0x0E doesn't exist for r/w */
  37. #define EDLC_TDR2 (ioaddr + 0x0f) /* "Time Domain Reflectometry" reg2 */
  38. #define IE_GP (ioaddr + 0x10) /* GP pointer (word register) */
  39. /* 0x11 is 2nd byte of GP Pointer */
  40. #define IE_RCNT (ioaddr + 0x10) /* Count of bytes in rcv'd packet */
  41. /* 0x11 is 2nd byte of "Byte Count" */
  42. #define IE_MMODE (ioaddr + 0x12) /* Memory Mode register */
  43. #define IE_DMA_RST (ioaddr + 0x13) /* IE DMA Reset. write only */
  44. #define IE_ISTAT (ioaddr + 0x13) /* IE Interrupt Status. read only */
  45. #define IE_RBUF (ioaddr + 0x14) /* IE Receive Buffer port */
  46. #define IE_XBUF (ioaddr + 0x15) /* IE Transmit Buffer port */
  47. #define IE_SAPROM (ioaddr + 0x16) /* window on station addr prom */
  48. #define IE_RESET (ioaddr + 0x17) /* any write causes Board Reset */
  49. /* bits in EDLC_XSTAT, interrupt clear on write, status when read */
  50. #define XS_TPOK 0x80 /* transmit packet successful */
  51. #define XS_CS 0x40 /* carrier sense */
  52. #define XS_RCVD 0x20 /* transmitted packet received */
  53. #define XS_SHORT 0x10 /* transmission media is shorted */
  54. #define XS_UFLW 0x08 /* underflow. iff failed board */
  55. #define XS_COLL 0x04 /* collision occurred */
  56. #define XS_16COLL 0x02 /* 16th collision occurred */
  57. #define XS_PERR 0x01 /* parity error */
  58. #define XS_CLR_UFLW 0x08 /* clear underflow */
  59. #define XS_CLR_COLL 0x04 /* clear collision */
  60. #define XS_CLR_16COLL 0x02 /* clear 16th collision */
  61. #define XS_CLR_PERR 0x01 /* clear parity error */
  62. /* bits in EDLC_XMASK, mask/enable transmit interrupts. register is r/w */
  63. #define XM_TPOK 0x80 /* =1 to enable Xmt Pkt OK interrupts */
  64. #define XM_RCVD 0x20 /* =1 to enable Xmt Pkt Rcvd ints */
  65. #define XM_UFLW 0x08 /* =1 to enable Xmt Underflow ints */
  66. #define XM_COLL 0x04 /* =1 to enable Xmt Collision ints */
  67. #define XM_COLL16 0x02 /* =1 to enable Xmt 16th Coll ints */
  68. #define XM_PERR 0x01 /* =1 to enable Xmt Parity Error ints */
  69. /* note: always clear this bit */
  70. #define XM_ALL (XM_TPOK | XM_RCVD | XM_UFLW | XM_COLL | XM_COLL16)
  71. /* bits in EDLC_RSTAT, interrupt clear on write, status when read */
  72. #define RS_PKT_OK 0x80 /* received good packet */
  73. #define RS_RST_PKT 0x10 /* RESET packet received */
  74. #define RS_RUNT 0x08 /* Runt Pkt rcvd. Len < 64 Bytes */
  75. #define RS_ALIGN 0x04 /* Alignment error. not 8 bit aligned */
  76. #define RS_CRC_ERR 0x02 /* Bad CRC on rcvd pkt */
  77. #define RS_OFLW 0x01 /* overflow for rcv FIFO */
  78. #define RS_VALID_BITS ( RS_PKT_OK | RS_RST_PKT | RS_RUNT | RS_ALIGN | RS_CRC_ERR | RS_OFLW )
  79. /* all valid RSTAT bits */
  80. #define RS_CLR_PKT_OK 0x80 /* clear rcvd packet interrupt */
  81. #define RS_CLR_RST_PKT 0x10 /* clear RESET packet received */
  82. #define RS_CLR_RUNT 0x08 /* clear Runt Pckt received */
  83. #define RS_CLR_ALIGN 0x04 /* clear Alignment error */
  84. #define RS_CLR_CRC_ERR 0x02 /* clear CRC error */
  85. #define RS_CLR_OFLW 0x01 /* clear rcv FIFO Overflow */
  86. /* bits in EDLC_RMASK, mask/enable receive interrupts. register is r/w */
  87. #define RM_PKT_OK 0x80 /* =1 to enable rcvd good packet ints */
  88. #define RM_RST_PKT 0x10 /* =1 to enable RESET packet ints */
  89. #define RM_RUNT 0x08 /* =1 to enable Runt Pkt rcvd ints */
  90. #define RM_ALIGN 0x04 /* =1 to enable Alignment error ints */
  91. #define RM_CRC_ERR 0x02 /* =1 to enable Bad CRC error ints */
  92. #define RM_OFLW 0x01 /* =1 to enable overflow error ints */
  93. /* bits in EDLC_RMODE, set Receive Packet mode. register is r/w */
  94. #define RMD_TEST 0x80 /* =1 for Chip testing. normally 0 */
  95. #define RMD_ADD_SIZ 0x10 /* =1 5-byte addr match. normally 0 */
  96. #define RMD_EN_RUNT 0x08 /* =1 enable runt rcv. normally 0 */
  97. #define RMD_EN_RST 0x04 /* =1 to rcv RESET pkt. normally 0 */
  98. #define RMD_PROMISC 0x03 /* receive *all* packets. unusual */
  99. #define RMD_MULTICAST 0x02 /* receive multicasts too. unusual */
  100. #define RMD_BROADCAST 0x01 /* receive broadcasts & normal. usual */
  101. #define RMD_NO_PACKETS 0x00 /* don't receive any packets. unusual */
  102. /* bits in EDLC_XMODE, set Transmit Packet mode. register is r/w */
  103. #define XMD_COLL_CNT 0xf0 /* coll's since success. read-only */
  104. #define XMD_IG_PAR 0x08 /* =1 to ignore parity. ALWAYS set */
  105. #define XMD_T_MODE 0x04 /* =1 to power xcvr. ALWAYS set this */
  106. #define XMD_LBC 0x02 /* =1 for loopbakc. normally set */
  107. #define XMD_DIS_C 0x01 /* =1 disables contention. normally 0 */
  108. /* bits in EDLC_RESET, write only */
  109. #define RS_RESET 0x80 /* =1 to hold EDLC in reset state */
  110. /* bits in IE_MMODE, write only */
  111. #define MM_EN_DMA 0x80 /* =1 begin DMA xfer, Cplt clrs it */
  112. #define MM_EN_RCV 0x40 /* =1 allows Pkt rcv. clr'd by rcv */
  113. #define MM_EN_XMT 0x20 /* =1 begin Xmt pkt. Cplt clrs it */
  114. #define MM_BUS_PAGE 0x18 /* =00 ALWAYS. Used when MUX=1 */
  115. #define MM_NET_PAGE 0x06 /* =00 ALWAYS. Used when MUX=0 */
  116. #define MM_MUX 0x01 /* =1 means Rcv Buff on system bus */
  117. /* =0 means Xmt Buff on system bus */
  118. /* bits in IE_ISTAT, read only */
  119. #define IS_TDIAG 0x80 /* =1 if Diagnostic problem */
  120. #define IS_EN_RCV 0x20 /* =1 until frame is rcv'd cplt */
  121. #define IS_EN_XMT 0x10 /* =1 until frame is xmt'd cplt */
  122. #define IS_EN_DMA 0x08 /* =1 until DMA is cplt or aborted */
  123. #define IS_DMA_INT 0x04 /* =0 iff DMA done interrupt. */
  124. #define IS_R_INT 0x02 /* =0 iff unmasked Rcv interrupt */
  125. #define IS_X_INT 0x01 /* =0 iff unmasked Xmt interrupt */