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

VxWorks

开发平台:

C/C++

  1. /* if_lnPci.h - AMD LANCE 79C970 Ethernet interface header */
  2. /* Copyright 1984-2001 Wind River Systems, Inc. */
  3. /*
  4. modification history
  5. --------------------
  6. 01b,09nov01,dat  Adding obsolescence warnings to outdated drivers
  7. 01a,11Jan95,vin  written from version 01p of if_ln.h.
  8. */
  9. /*
  10. DESCRIPTION
  11. -----------
  12. Pci Bus is inherently little endian. So if a big endian processor is 
  13. interfaced with the PCI bus all the values programmed to the registers
  14. on the PCI bus should be swapped.
  15. */
  16. #ifndef __INCif_lnPcih
  17. #define __INCif_lnPcih
  18. #warning "if_lnPci driver is obsolete, please use ln97xEnd driver"
  19. #ifdef __cplusplus
  20. extern "C" {
  21. #endif
  22. #if (_BYTE_ORDER == _BIG_ENDIAN)
  23. #define PCISWAP(x) LONGSWAP(x) /* processor big endian */
  24. #else
  25. #define PCISWAP(x) (x) /* processor little endian */
  26. #endif /* _BYTE_ORDER == _BIG_ENDIAN */
  27. /*
  28.  * Control and Status Register access structure
  29.  * WARNING: bit operations should not be done on CSR0!
  30.  * Many of the bits are Read/Clear and will be cleared by any other
  31.  * bit operation on the register.  Note especially that if the
  32.  * stop bit is set, all other operations will retain the stopped
  33.  * condition.  This means that a bit set to do init and start will
  34.  * always fail because stop has priority.
  35.  */
  36. typedef struct
  37.     {
  38.     ULONG rdp; /* register data Port */
  39.     ULONG rap; /* Register Address Port */
  40.     ULONG rr; /* Reset Register */
  41.     ULONG bdp; /* Bus Configuration Register Data Port */
  42.     } LN_DEVICE;
  43. /*
  44.  * Initialization Block.
  45.  * Specifies addresses of receive and transmit descriptor rings.
  46.  */
  47. typedef struct lnIB
  48.     {
  49.     ULONG lnIBMode; /* mode register */
  50.     char lnIBPadr [8];  /* PADR: bswapd ethnt phys address */
  51. /* LADRF: logical address filter */
  52.     ULONG lnIBLadrfLow; /* least significant long word */
  53.     ULONG lnIBLadrfHigh; /* most significant long word */
  54. /* RDRA: read ring address */
  55.     ULONG lnIBRdra; /* long word */
  56. /* TDRA: transmit ring address */
  57.     ULONG lnIBTdra; /* long word */
  58.     } ln_ib;
  59. /*
  60.  * Receive Message Descriptor Entry.
  61.  * Four words per entry.  Number of entries must be a power of two.
  62.  */
  63. typedef struct lnRMD
  64.     {
  65.     ULONG lnRMD0; /* bits 31:00 of receive buffer address */
  66.     ULONG lnRMD1; /* status & buffer byte count (negative) */
  67.     ULONG lnRMD2; /* message byte count */
  68.     ULONG lnRMD3; /* reserved */
  69.     } ln_rmd;
  70. /*
  71.  * Transmit Message Descriptor Entry.
  72.  * Four words per entry.  Number of entries must be a power of two.
  73.  */
  74. typedef struct lnTMD
  75.     {
  76.     ULONG lnTMD0; /* bits 31:00 of transmit buffer address */
  77.     ULONG lnTMD1; /* message byte count */
  78.     ULONG lnTMD2; /* errors */
  79.     ULONG lnTMD3; /* reserved */
  80.     } ln_tmd;
  81. /* csr and bcr addresses */
  82. #define CSR(x) (x)
  83. #define BCR(x) (x)
  84. /* Definitions for fields and bits in the LN_DEVICE */
  85. #define  CSR0_ERR 0x8000 /* (RO) err flg (BABL|CERR|MISS|MERR) */
  86. #define  CSR0_BABL 0x4000 /* (RC) babble transmitter timeout */
  87. #define  CSR0_CERR 0x2000 /* (RC) collision error */
  88. #define  CSR0_MISS 0x1000 /* (RC) missed packet */
  89. #define  CSR0_MERR 0x0800 /* (RC) memory error */
  90. #define  CSR0_RINT 0x0400 /* (RC) receiver interrupt */
  91. #define  CSR0_TINT 0x0200 /* (RC) transmitter interrupt */
  92. #define  CSR0_IDON 0x0100 /* (RC) initialization done */
  93. #define  CSR0_INTR 0x0080 /* (RO) interrupt flag */
  94. #define  CSR0_INEA 0x0040 /* (RW) interrupt enable */
  95. #define  CSR0_RXON 0x0020 /* (RO) receiver on */
  96. #define  CSR0_TXON 0x0010 /* (RO) transmitter on */
  97. #define  CSR0_TDMD 0x0008 /* (WOO)transmit demand */
  98. #define  CSR0_STOP 0x0004 /* (WOO)stop (& reset) chip */
  99. #define  CSR0_STRT 0x0002 /* (RW) start chip */
  100. #define  CSR0_INIT 0x0001 /* (RW) initialize (acces init block) */
  101. #define CSR0_INTMASK  (CSR0_BABL 
  102.  | CSR0_CERR 
  103.  | CSR0_MISS 
  104.  | CSR0_MERR 
  105.  | CSR0_RINT 
  106.  | CSR0_TINT 
  107.  | CSR0_IDON 
  108.  | CSR0_INEA)
  109. #define CSR3_BSWP 0x0004   /* Byte Swap */
  110. #define BCR20_SSIZE32 0x0100
  111. #define BCR20_SWSTYLE_LANCE 0x0000
  112. #define BCR20_SWSTYLE_ILACC 0x0001
  113. #define BCR20_SWSTYLE_PCNET 0x0002
  114. /* initialization block */
  115. #define IB_MODE_TLEN_MSK 0xf0000000
  116. #define IB_MODE_RLEN_MSK 0x00f00000
  117. /* receive descriptor */
  118. #define RMD1_OWN 0x80000000 /* Own */
  119. #define RMD1_ERR 0x40000000 /* Error */
  120. #define RMD1_FRAM 0x20000000 /* Framming Error */
  121. #define RMD1_OFLO 0x10000000 /* Overflow */
  122. #define RMD1_CRC 0x08000000 /* CRC */
  123. #define RMD1_BUFF 0x04000000 /* Buffer Error */
  124. #define RMD1_STP 0x02000000 /* Start of Packet */
  125. #define RMD1_ENP 0x01000000 /* End of Packet */
  126. #define RMD1_RES 0x00ff0000 /* reserved */
  127. #define RMD1_CNST 0x0000f000 /* rmd1 constant value */
  128. #define RMD1_BCNT_MSK 0x00000fff /* buffer cnt mask */
  129. #define RMD2_MCNT_MSK 0x00000fff /* message buffer cnt mask */
  130. /* transmit descriptor */
  131. #define TMD1_OWN 0x80000000 /* Own */
  132. #define TMD1_ERR 0x40000000 /* Error */
  133. #define TMD1_MORE 0x10000000 /* More than One Retry */
  134. #define TMD1_ONE 0x08000000 /* One Retry */
  135. #define TMD1_DEF 0x04000000 /* Deferred */
  136. #define TMD1_STP 0x02000000 /* Start of Packet */
  137. #define TMD1_ENP 0x01000000 /* End of Packet */
  138. #define TMD1_RES 0x00FF0000 /* High Address */
  139. #define TMD1_CNST 0x0000f000 /* tmd1 constant value */
  140. #define TMD2_BUFF 0x80000000 /* Buffer Error */
  141. #define TMD2_UFLO 0x40000000 /* Underflow Error */
  142. #define TMD2_LCOL 0x10000000 /* Late Collision */
  143. #define TMD2_LCAR 0x08000000 /* Lost Carrier */
  144. #define TMD2_RTRY 0x04000000 /* Retry Error */
  145. #define TMD2_TDR 0x03FF0000 /* Time Domain Reflectometry */
  146. #define TMD1_BCNT_MSK 0x00000fff /* buffer cnt mask */
  147. #define rbuf_adr lnRMD0
  148. #define rbuf_rmd1 lnRMD1
  149. #define rbuf_mcnt lnRMD2
  150. #define rbuf_rmd3 lnRMD3
  151. #define tbuf_adr lnTMD0
  152. #define tbuf_tmd1 lnTMD1
  153. #define tbuf_tmd2 lnTMD2
  154. #define tbuf_tmd3 lnTMD3
  155. #ifdef __cplusplus
  156. }
  157. #endif
  158. #endif /* __INCif_lnPcih */