if_ln.h
上传用户:luoyougen
上传日期:2008-05-12
资源大小:23136k
文件大小:8k
源码类别:

VxWorks

开发平台:

C/C++

  1. /* if_ln.h - AMD LANCE Ethernet interface header */
  2. /* Copyright 1984-2001 Wind River Systems, Inc. */
  3. /*
  4. modification history
  5. --------------------
  6. 01t,09nov01,dat  Adding obsolescence warnings to outdated drivers
  7. 01s,08apr97,spm  restored TMD_ERR #define needed for if_lnsgi driver
  8. 01r,26jan96,vin  modified for BSD44.
  9. 01q,22jun94,dzb  removed obsolete definitions.
  10. 01p,22sep92,rrr  added support for c++
  11. 01o,29jul92,rfs  moved driver specific items to driver file, where they belong
  12. 01n,26may92,rrr  the tree shuffle
  13. 01m,04oct91,rrr  passed through the ansification filter
  14.   -changed copyright notice
  15. 01l,25jul91,jwt  removed bit fields (added masks) for portability.
  16. 01k,18may91,gae  reworked lncsr_3b register for Radstone's APEX driver,
  17.  and potentially more portable code.
  18. 01j,05oct90,shl  added copyright notice.
  19.                  made #endif ANSI style.
  20. 01i,07may90,hjb  added LN_RMD_RLEN, LN_TMD_TLEN, LN_NUM_RESERVES definitions;
  21.  added bufSize, canLoanRmds, freeBufs, nFree and deleted
  22.  numOutStandingLoans, loanStats from struct ls_softc.
  23. 01h,19apr90,hjb  added LN_MIN_FIRST_DATA_CHAIN, LN_MAX_MDS, RMD_ERR, TMD_OWN,
  24.  TMD_ERR, TMD_BUFF, TMD_UFLO, TMD_LCAR, ls_flags,
  25.  loanRefCnt, loanStats, LS_PROMISCUOUS_FLAG,
  26.  LS_MEM_ALLOC_FLAG, LS_PAD_USED_FLAG,
  27.  LS_RCV_HANDLING_FLAG, LS_START_OUTPUT_FLAG;
  28.  deleted xmitHandlingAtTaskLevel, recvHandlingTaskLevel.
  29. 01g,18mar90,hjb  added padEnable boolean variable in ls_softc structure.
  30. 01f,10nov89,dab  added padding to CSR structure for Tadpole lance driver.
  31. 01e,02nov89,shl  fixed syntax error.
  32. 01d,24may89,jcf  added recvHandlingAtTaskLevel to ls_softc structure.
  33. 01c,21apr89,jcf  added memBase, csr0Errs, and xmitHandlingAtTaskLevel
  34.    +dnw   to ls_softc structure.
  35. 01b,09aug88,gae  bumped up LN_BUFSIZE to solve large packet problems.
  36. 01a,15apr88,dfm  written.
  37. */
  38. #ifndef __INCif_lnh
  39. #define __INCif_lnh
  40. #warning "if_ln driver is obsolete, please use ln7990End driver"
  41. #ifdef __cplusplus
  42. extern "C" {
  43. #endif
  44. /*
  45.  * Control block definitions for AMD LANCE (Ethernet) chip.
  46.  * This has some of the same (mis)features as the Intel 82586 with
  47.  * regards to byte ordering.  It assumes that a memory address specifies
  48.  * the location of the least significant byte of a multi-byte value.  This
  49.  * is correct for most Intel & DEC processors, but is wrong for 680x0s.
  50.  * As a result, all addresses specified to the chip must have their
  51.  * words swapped.  At least it has a control bit to automatically swap
  52.  * bytes during data transfer dma.  (The 82586 is much worse.)
  53.  */
  54. /*
  55.  * Control and Status Register access structure
  56.  * WARNING: bit operations should not be done on CSR0!
  57.  * Many of the bits are Read/Clear and will be cleared by any other
  58.  * bit operation on the register.  Note especially that if the
  59.  * stop bit is set, all other operations will retain the stopped
  60.  * condition.  This means that a bit set to do init and start will
  61.  * always fail because stop has priority.
  62.  */
  63. typedef struct
  64.     {
  65. /* This union describes a plethora of ways to access the data register */
  66.     union
  67. {
  68. u_short     RDP;
  69.         u_short     lnCSR0; /* RDP if (RAP==0) */
  70. u_short lnCSR1; /* RDP if (RAP==1) */
  71. u_short iadr_l; /* Init Block addr bits 15:00 */
  72. u_short lnCSR2; /* RDP if (RAP==2) */
  73. u_short iadr_h; /* Init Block addr bits 23:16 */
  74. u_short lnCSR3; /* RDP if (RAP==3) */
  75. u_short ln_csr3b;
  76. } ln_csr;
  77.     u_short RAP;
  78.     u_short pad; /* XXX Tadpole padding */
  79.     } LN_DEVICE;
  80. /* Definitions for fields and bits in the LN_DEVICE */
  81. #define  lncsr_ERR    0x8000 /* (RO) error flag (BABL|CERR|MISS|MERR) */
  82. #define  lncsr_BABL   0x4000 /* (RC) babble transmitter timeout */
  83. #define  lncsr_CERR   0x2000 /* (RC) collision error */
  84. #define  lncsr_MISS   0x1000 /* (RC) missed packet */
  85. #define  lncsr_MERR   0x0800 /* (RC) memory error */
  86. #define  lncsr_RINT   0x0400 /* (RC) receiver interrupt */
  87. #define  lncsr_TINT   0x0200 /* (RC) transmitter interrupt */
  88. #define  lncsr_IDON   0x0100 /* (RC) initialization done */
  89. #define  lncsr_INTR   0x0080 /* (RO) interrupt flag */
  90. #define  lncsr_INEA   0x0040 /* (RW) interrupt enable */
  91. #define  lncsr_RXON   0x0020 /* (RO) receiver on */
  92. #define  lncsr_TXON   0x0010 /* (RO) transmitter on */
  93. #define  lncsr_TDMD   0x0008 /* (WOO)transmit demand */
  94. #define  lncsr_STOP   0x0004 /* (WOO)stop (& reset) chip */
  95. #define  lncsr_STRT   0x0002 /* (RW) start chip */
  96. #define  lncsr_INIT   0x0001 /* (RW) initialize (acces init block) */
  97. #define lncsr3_BSWP     0x0004  /* Byte Swap */
  98. #define lncsr3_ACON     0x0002  /* ALE Control */
  99. #define lncsr3_BCON     0x0001  /* Byte Control */
  100. #define lncsr_0 ln_csr.lnCSR0
  101. #define lncsr_iadr_l ln_csr.iadr_l
  102. #define lncsr_iadr_h ln_csr.iadr_h
  103. #define lncsr_INTMASK (lncsr_BABL 
  104.      | lncsr_CERR 
  105.      | lncsr_MISS 
  106.      | lncsr_MERR 
  107.      | lncsr_RINT 
  108.      | lncsr_TINT 
  109.      | lncsr_IDON 
  110.      | lncsr_INEA)
  111. /*
  112.  * Initialization Block.
  113.  * Specifies addresses of receive and transmit descriptor rings.
  114.  */
  115. typedef struct lnIB
  116.     {
  117.     u_short lnIBMode; /* mode register */
  118.     char lnIBPadr [6]; /* PADR: byte swapped ethernet physical addr */
  119. /* LADRF: logical address filter */
  120.     u_short lnIBLadrfLow; /* least significant word */
  121.     u_short lnIBLadrfMidLow; /* low middle word */
  122.     u_short lnIBLadrfMidHigh;   /* high middle word */
  123.     u_short lnIBLadrfHigh; /* most significant word */
  124. /* RDRA: read ring address */
  125.     u_short lnIBRdraLow; /* low word */
  126.     u_short lnIBRdraHigh; /* high word */
  127. /* TDRA: transmit ring address */
  128.     u_short lnIBTdraLow; /* low word */
  129.     u_short lnIBTdraHigh; /* high word */
  130.     } ln_ib;
  131. /*
  132.  * Receive Message Descriptor Entry.
  133.  * Four words per entry.  Number of entries must be a power of two.
  134.  */
  135. typedef struct lnRMD
  136.     {
  137.     u_short lnRMD0; /* bits 15:00 of receive buf */
  138.     u_short lnRMD1;         /* bits 23:16 of receive buf and status */
  139.     u_short lnRMD2; /* buffer byte count (negative) */
  140.     u_short lnRMD3; /* message byte count */
  141.     } ln_rmd;
  142. #define lnrmd1_OWN      0x8000          /* Own */
  143. #define lnrmd1_ERR      0x4000          /* Error */
  144. #define lnrmd1_FRAM     0x2000          /* Framming Error */
  145. #define lnrmd1_OFLO     0x1000          /* Overflow */
  146. #define lnrmd1_CRC      0x0800          /* CRC */
  147. #define lnrmd1_BUFF     0x0400          /* Buffer Error */
  148. #define lnrmd1_STP      0x0200          /* Start of Packet */
  149. #define lnrmd1_ENP      0x0100          /* End of Packet */
  150. #define lnrmd1_HADR     0x00FF          /* High Address */
  151. #define RMD_ERR 0x6000
  152. #define rbuf_ladr lnRMD0
  153. #define rbuf_hadr lnRMD1
  154. #define rbuf_stat lnRMD1
  155. #define rbuf_bcnt lnRMD2
  156. #define rbuf_mcnt lnRMD3
  157. /*
  158.  * Transmit Message Descriptor Entry.
  159.  * Four words per entry.  Number of entries must be a power of two.
  160.  */
  161. typedef struct lnTMD
  162.     {
  163.     u_short lnTMD0; /* bits 15:00 of transmit buf */
  164.     u_short lnTMD1; /* bits 23:16 of transmit buf and status */
  165.     u_short lnTMD2; /* message byte count */
  166.     u_short lnTMD3; /* errors */
  167.     } ln_tmd;
  168. #define lntmd1_OWN      0x8000          /* Own */
  169. #define lntmd1_ERR      0x4000          /* Error */
  170. #define lntmd1_MORE     0x1000          /* More than One Retry */
  171. #define lntmd1_ONE      0x0800          /* One Retry */
  172. #define lntmd1_DEF      0x0400          /* Deferred */
  173. #define lntmd1_STP      0x0200          /* Start of Packet */
  174. #define lntmd1_ENP      0x0100          /* End of Packet */
  175. #define lntmd1_HADR     0x00FF          /* High Address */
  176. #define lntmd3_BUFF     0x8000          /* Buffer Error */
  177. #define lntmd3_UFLO     0x4000          /* Underflow Error */
  178. #define lntmd3_LCOL     0x1000          /* Late Collision */
  179. #define lntmd3_LCAR     0x0800          /* Lost Carrier */
  180. #define lntmd3_RTRY     0x0400          /* Retry Error */
  181. #define lntmd3_TDR      0x03FF          /* Time Domain Reflectometry */
  182. #define TMD_OWN 0x8000
  183. #define TMD_ERR         0x6000
  184. #define TMD_BUFF 0x8000
  185. #define TMD_UFLO 0x4000
  186. #define TMD_LCAR 0x0800
  187. #define tbuf_ladr lnTMD0
  188. #define tbuf_hadr lnTMD1
  189. #define tbuf_stat lnTMD1
  190. #define tbuf_bcnt lnTMD2
  191. #define tbuf_err lnTMD3
  192. #ifdef __cplusplus
  193. }
  194. #endif
  195. #endif /* __INCif_lnh */