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

VxWorks

开发平台:

C/C++

  1. /* if_lnIsa.h - AMD LANCE 79C961 Ethernet interface header */
  2. /* Copyright 1984-1996 Wind River Systems, Inc. */
  3. /*
  4. modification history
  5. --------------------
  6. 01a,21Aug96,joes  written from version 01a of if_lnPci.h.
  7. */
  8. /*
  9. DESCRIPTION
  10. -----------
  11. This device is strictly an ISA bus device. All register setup is done
  12. through sysIn/OutByte calls which are x86 IO accesses
  13. */
  14. #ifndef __INCif_lnIsah
  15. #define __INCif_lnIsah
  16. #ifdef __cplusplus
  17. extern "C" {
  18. #endif
  19. /*
  20.  * Control and Status Register access structure
  21.  * WARNING: bit operations should not be done on CSR0!
  22.  * Many of the bits are Read/Clear and will be cleared by any other
  23.  * bit operation on the register.  Note especially that if the
  24.  * stop bit is set, all other operations will retain the stopped
  25.  * condition.  This means that a bit set to do init and start will
  26.  * always fail because stop has priority.
  27.  */
  28. typedef struct
  29. {
  30.   USHORT   hwAddr[8]; /* E'net hardware address */
  31.   USHORT rdp; /* register data Port */
  32.   USHORT rap; /* Register Address Port */
  33.   USHORT rr; /* Reset Register */
  34.   USHORT idp; /* ISA Configuration Register Data Port */
  35. } LN_DEVICE;
  36. /*
  37.  * Initialization Block.
  38.  * Specifies addresses of receive and transmit descriptor rings.
  39.  */
  40. typedef struct lnIB
  41. {
  42.   USHORT lnIBMode; /* mode register */
  43.   char lnIBPadr [6]; /* PADR: bswapd ethnt phys address */
  44.                                         /* LADRF: logical address filter */
  45.   USHORT lnIBLadrfLow; /* least significant word */
  46.   USHORT lnIBLadrfMidLow; /* low middle word */
  47.   USHORT lnIBLadrfMidHigh;   /* high middle word */
  48.   USHORT lnIBLadrfHigh; /* most significant word */
  49. /* RDRA: read ring address */
  50.   USHORT lnIBRdraLow; /* Bits [15:0]*/
  51.   UCHAR lnIBRdraHigh; /* Bits [23:16]  */
  52.   UCHAR lnRLEN; /* Recv desc. ring len */
  53. /* TDRA: transmit ring address */
  54.   USHORT lnIBTdraLow; /* Bits [15:0]*/
  55.   UCHAR lnIBTdraHigh; /* Bits [23:16]  */
  56.   UCHAR lnTLEN; /* Transmit desc. ring len */
  57. } ln_ib;
  58. /*
  59.  * Receive Message Descriptor Entry.
  60.  * Four words per entry.  Number of entries must be a power of two.
  61.  */
  62. typedef struct lnRMD
  63. {
  64.   USHORT lnRMD0; /* bits 15:00 of receive buffer address */
  65.   USHORT lnRMD1; /* status & Hi order address bits */
  66.   USHORT lnRMD2; /* buffer byte count */
  67.   USHORT lnRMD3; /* #bytes received */
  68. } ln_rmd;
  69. /*
  70.  * Transmit Message Descriptor Entry.
  71.  * Four words per entry.  Number of entries must be a power of two.
  72.  */
  73. typedef struct lnTMD
  74. {
  75.   USHORT lnTMD0; /* bits [15:00] of transmit buffer address */
  76.   USHORT lnTMD1; /* Status and  bits [23:16] of tx buffer */
  77.   USHORT lnTMD2; /* Buffer Byte count */
  78.   USHORT lnTMD3; /* Errors */
  79. } ln_tmd;
  80. /* csr and bcr addresses */
  81. #define CSR(x) (x)
  82. #define BCR(x) (x)
  83. /* Definitions for fields and bits in the LN_DEVICE */
  84. #define  CSR0_ERR 0x8000 /* (RO) err flg(BABL|CERR|MISS|MERR)*/
  85. #define  CSR0_BABL 0x4000 /* (RC) babble transmitter timeout */
  86. #define  CSR0_CERR 0x2000 /* (RC) collision error */
  87. #define  CSR0_MISS 0x1000 /* (RC) missed packet */
  88. #define  CSR0_MERR 0x0800 /* (RC) memory error */
  89. #define  CSR0_RINT 0x0400 /* (RC) receiver interrupt */
  90. #define  CSR0_TINT 0x0200 /* (RC) transmitter interrupt */
  91. #define  CSR0_IDON 0x0100 /* (RC) initialization done */
  92. #define  CSR0_INTR 0x0080 /* (RO) interrupt flag */
  93. #define  CSR0_IENA 0x0040 /* (RW) interrupt enable */
  94. #define  CSR0_RXON 0x0020 /* (RO) receiver on */
  95. #define  CSR0_TXON 0x0010 /* (RO) transmitter on */
  96. #define  CSR0_TDMD 0x0008 /* (WOO)transmit demand */
  97. #define  CSR0_STOP 0x0004 /* (WOO)stop (& reset) chip */
  98. #define  CSR0_STRT 0x0002 /* (RW) start chip */
  99. #define  CSR0_INIT 0x0001 /* (RW) initialize (acces init block) */
  100. #define CSR0_INTMASK  (CSR0_BABL 
  101.  | CSR0_CERR 
  102.  | CSR0_MISS 
  103.  | CSR0_MERR 
  104.  | CSR0_RINT 
  105.  | CSR0_TINT 
  106.  | CSR0_IDON 
  107.  | CSR0_INEA)
  108. /* receive descriptor */
  109. #define RMD1_OWN 0x8000 /* Own */
  110. #define RMD1_ERR 0x4000 /* Error */
  111. #define RMD1_FRAM 0x2000 /* Framing Error */
  112. #define RMD1_OFLO 0x1000 /* Overflow */
  113. #define RMD1_CRC 0x0800 /* CRC */
  114. #define RMD1_BUFF 0x0400 /* Buffer Error */
  115. #define RMD1_STP 0x0200 /* Start of Packet */
  116. #define RMD1_ENP 0x0100 /* End of Packet */
  117. #define RMD1_HADR_MASK 0x00ff /* Hi Address bits */
  118. /* transmit descriptor */
  119. #define TMD1_OWN 0x8000 /* Own */
  120. #define TMD1_ERR 0x4000 /* Error */
  121. #define TMD1_ADD_FCS 0x2000 /* Add FCS dynamically */
  122. #define TMD1_MORE 0x1000 /* More than One Retry */
  123. #define TMD1_ONE 0x0800 /* One Retry */
  124. #define TMD1_DEF 0x0400 /* Deferred */
  125. #define TMD1_STP 0x0200 /* Start of Packet */
  126. #define TMD1_ENP 0x0100 /* End of Packet */
  127. #define TMD1_RES 0x00FF /* High Address bits */
  128. #define TMD3_BUFF 0x8000 /* Buffer Error */
  129. #define TMD3_UFLO 0x4000 /* Underflow Error */
  130. #define TMD3_LCOL 0x1000 /* Late Collision */
  131. #define TMD3_LCAR 0x0800 /* Lost Carrier */
  132. #define TMD3_RTRY 0x0400 /* Retry Error */
  133. #define TMD3_TDR 0x03FF /* Time Domain Reflectometry */
  134. #define RMD2_BCNT_MSK 0x0fff /* buffer cnt mask */
  135. #define RMD2_MBO 0xf000 /* RMD2 Must be Ones bits */
  136. #define RMD3_MCNT_MSK 0x0fff /* message buffer cnt mask */
  137. #define rbuf_adr lnRMD0
  138. #define rbuf_rmd1 lnRMD1
  139. #define rbuf_bcnt lnRMD2
  140. #define rbuf_mcnt lnRMD3
  141. #define TMD2_BCNT_MSK 0x0fff /* buffer cnt mask */
  142. #define TMD2_MBO 0xf000 /* TMD2 Must be ones */
  143. #define tbuf_adr lnTMD0
  144. #define tbuf_tmd1 lnTMD1
  145. #define tbuf_tmd2 lnTMD2
  146. #define tbuf_tmd3 lnTMD3
  147. #define CSR15_PROM 0x8000 /* promiscuous mode */
  148. #define CSR15_DRCVBC 0x4000 /* Disable Recv Broadcast */
  149. #define CSR15_DRVCPA 0x2000 /* Disable Resc Phys Address */
  150. #define CSR15_DLNKTST 0x1000 /* Disable Link Status */
  151. #define CSR15_DAPC 0x0800 /* Disable Auto Polarity Correction */ 
  152. #define CSR15_MENDECL 0x0400 /* MENDEC Loopback */
  153. #define CSR15_LRT 0x0200 /* Low Recv Threshold (T-MAU mode only) */
  154. #define CSR15_GPSI 0x0100 /* PortSel [0:1] = 10 is GPSI */
  155. #define CSR15_10T 0x0080 /* PortSel [0:1] = 01 is 10baseT */
  156. #define CSR15_AUI 0x0000 /* PortSel [0:1] = 00 is AUI */
  157. #define CSR15_INTL 0x0040 /* Internal loopback */
  158. #define CSR15_DRTY 0x0020 /* Disable Retry */ 
  159. #define CSR15_FCOLL 0x0010 /* Force Collision */
  160. #define CSR15_DXMTFCS 0x0008 /* Disable Tx FCS */
  161. #define CSR15_LOOP 0x0004 /* Loopback Enable */ 
  162. #define CSR15_DTX 0x0002 /* Disable Tx */
  163. #define CSR15_DRX 0x0001 /* Disable Rx */
  164. /* All definitions below here are related to the PnP and EEPROM Interface */
  165.      /* lnIdpXXXX function register numbers */
  166. #define ISACSR0 0
  167. #define ISACSR1 1
  168. #define ISACSR2 2
  169. #define ISACSR3 3
  170. #define ISACSR4 4
  171. #define ISACSR5 5
  172. #define ISACSR6 6
  173. #define ISACSR7 7
  174. #define ISACSR8 8
  175. /* ISA CSR 3 EEPROM configuration bit definitions */
  176. #define EE_VALID 0x8000
  177. #define EE_LOAD 0x4000
  178. #define EE_EN 0x0010
  179. #define EE_SHFBUSY 0x0008
  180. #define EE_CS 0x0004
  181. #define EE_SK 0x0002
  182. #define EE_DATA 0x0001
  183. /* 
  184.  * The Following values are used in defining the EEPROM contents. Refer to
  185.  * the diagram outlining EEPROM data in the description of lnIsa_eewrite()
  186.  */
  187. #define EE_PAD  0x00
  188. #define EISA0 0x00
  189. #define EISA1 0x00
  190. #define EISA2 0x00
  191. #define EISA3 0x00
  192. #define ISACSR0_HI 0x00
  193. #define ISACSR0_LO 0x05
  194. #define ISACSR1_HI 0x00
  195. #define ISACSR1_LO 0x05
  196. #define ISACSR2_HI 0x02 /* PNP Active */
  197. #define ISACSR2_LO 0x01 /* MedSel = 10BaseT */
  198. #define ISACSR5_HI 0x00
  199. #define ISACSR5_LO 0x84 /* LED1 = RCV */
  200. #define ISACSR6_HI 0x00
  201. #define ISACSR6_LO 0x08 /* LED2 = RCVPOL */
  202. #define ISACSR7_HI 0x00
  203. #define ISACSR7_LO 0x90 /* LED3 = XMT */
  204. #define PNP_60 (IO_ADRS_LNISA>>8) /* IO adrs hi byte */
  205. #define PNP_61 (IO_ADRS_LNISA & 0xff)  /* IO Adrs lo byte */
  206. #define PNP_70 INT_LVL_LNISA /* Interrupt Level */
  207. #define PNP_71 INT_TYPE_LNISA /* Interrupt type */
  208. #define PNP_74 DMA_CHAN_LNISA /* DMA Channel */
  209. /* define these values in config.h if BOOT PROM support required */
  210. #ifndef BPROM_LNISA_PRESENT
  211. #define BPROM_ADRS_LNISA 0
  212. #define BPROM_CTRL_LNISA  0
  213. #define BPROM_SIZE_HI 0
  214. #define BPROM_SIZE_LO 0
  215. #endif
  216. #define PNP_40 (BPROM_ADRS_LNISA>>16) /* Boot Prom Addr Hi */
  217. #define PNP_41 (BPROM_ADRS_LNISA>>8) /* Boot Prom Addr Lo */
  218. #define PNP_42 BPROM_CTRL_LNISA /* Boot Prom control */
  219. #define PNP_43 BPROM_SIZE_HI /* Boot Prom size hi*/
  220. #define PNP_44 BPROM_SIZE_LO /* Boot Prom size lo*/
  221. /* define these values in config.h if SRAM support required */
  222. #ifndef SRAM_LNISA_PRESENT
  223. #define SRAM_ADRS_LNISA 0
  224. #define SRAM_CTRL_LNISA 0
  225. #define SRAM_SIZE_LO_LNISA 0
  226. #define SRAM_SIZE_HI_LNISA 0
  227. #endif
  228. #define PNP_48 (SRAM_ADRS_LNISA>>16) /* SRAM addr hi */
  229. #define PNP_49 (SRAM_ADRS_LNISA>>8) /* SRAM addr lo */
  230. #define PNP_4A SRAM_CTRL_LNISA /* SRAM SR16B */
  231. #define PNP_4B SRAM_SIZE_LO_LNISA /* SRAM size lo */
  232. #define PNP_4C SRAM_SIZE_HI_LNISA /* SRAM size hi */
  233. #define PNP_F0 GENERAL_CTRL_LNISA /* General Control */
  234. #define EE_CHKSUM 0x00 /* place holder for checksum */
  235. #ifndef EXT_SHIFT0
  236. #define EXT_SHIFT0 0xAA /* External shift chain */
  237. #endif
  238. #ifndef EXT_SHIFT1
  239. #define EXT_SHIFT1 0xAA /* External shift chain */
  240. #endif
  241. #define EE_CHKSUM1_OFFSET 6 /* word offset to first chksum word */
  242. #define EE_CHKSUM2_OFFSET 51 /* byte offset to second chksum byte */
  243. #define EE_WORD_LEN_MIN  0x1B   /* Minimum number of words in valid EEPROM */
  244. #define EE_WORD_LEN_MAX  128   /* Maximum number of words in valid EEPROM */
  245. #define EE_TWP 3 /* number of ticks to wait for EEPROM write  */
  246. /* Microsoft Plug n'Play Register definitions */
  247. #define PNP_ADDR_PORT  0x279 /* PnP Register Address Port */
  248. #define PNP_WR_PORT 0xA79 /* PnP Register Write Data Port */
  249. #define PNP_RD_PORT 0x223 /* PnP Register Read Data Port (initial) */
  250. #define PNP_INIT_KEY_LEN 32
  251. #define PNP_SET_RD_DATA 0x0
  252. #define PNP_SERIAL_ISO  0x1
  253. #define PNP_CONFIG_CTRL 0x2
  254. #define PNP_WAKE 0x3
  255. #define PNP_RSRC_DATA 0x4
  256. #define PNP_STATUS 0x5
  257. #define PNP_CSN 0x6
  258. #define PNP_DEV_NUM 0x7
  259. #define PNP_ACTIVATE 0x30
  260. #define PNP_IO_RANGE 0x31
  261. #define PNP_MEM_BASE0_HIBYTE 0x40 /* Mem Desc 0 Base Addr bits[23:16]*/
  262. #define PNP_MEM_BASE0_LOBYTE 0x41 /* Mem Desc 0 Base Addr bits[15:8]*/
  263. #define PNP_MEM_CONTROL 0x42 /* Memory Control Register */
  264. #define PNP_MEM_LIMIT0_HIBYTE 0x43 /* Memory upper limit bits[23:16] */
  265. #define PNP_MEM_LIMIT0_LOBYTE 0x44 /* Memory upper limit bits[15:8] */
  266. #define PNP_IO_BASE0_HIBYTE 0x60 /* IO Desc 0 lower limit bits[15:8] */
  267. #define PNP_IO_BASE0_LOBYTE 0x61 /* IO Desc 0 lower limit bits[7:0] */
  268. #define PNP_IRQ_LEVEL_SEL0 0x70 /* Interrupt level select 0 */
  269. #define PNP_IRQ_TYPE_SEL0 0x71 /* Interrupt type select 0 */
  270. #define PNP_DMA_CHANNEL_SEL0 0x74 /* DMA Channel Select 0 */
  271. /* PNP Config Control Bit definitions */
  272. #define PNP_CONFIG_CTRL_RESETDEV 0x1
  273. #define PNP_CONFIG_CTRL_WAITFORKEY 0x2
  274. #define PNP_CONFIG_CTRL_RESETCSN 0x4
  275. /* PNP Memory Control Register bit defintions */
  276. #define PNP_CONTROL_RANGE 0x0
  277. #define PNP_CONTROL_LIMIT 0x1
  278. #define PNP_CONTROL_8BIT 0x00
  279. #define PNP_CONTROL_16BIT 0x02
  280. #define PNP_CONTROL_16OR8BIT 0x04
  281. #define PNP_CONTROL_32BIT 0x06 /*not supported by AMD961 */
  282. /* PNP memory range definitions */
  283. #define PNP_MEM_RANGE_NONE 0x0
  284. #define PNP_MEM_RANGE_8K 0xf
  285. #define PNP_MEM_RANGE_16K 0xe
  286. #define PNP_MEM_RANGE_32K 0xc
  287. #define PNP_MEM_RANGE_64K 0x8
  288. #ifdef __cplusplus
  289. }
  290. #endif
  291. #endif /* __INCif_lnIsah */