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

VxWorks

开发平台:

C/C++

  1. /* if_ei.h - Intel 82596 network interface header */
  2. /* Copyright 1990-2001 Wind River Systems, Inc. */
  3. /*
  4. modification history
  5. --------------------
  6. 02i,09nov01,dat  Adding obsolescence warnings to outdated drivers
  7. 02h,22sep92,rrr  added support for c++
  8. 02g,29jul92,rrr  Grabbed ricks if_ei.h header file and checked it in in hope of
  9.                  getting the ei driver to work.
  10. 02f,16jul92,rfs  Moved driver specific items to driver file, where they belong.
  11. 02e,26may92,rrr  the tree shuffle
  12. 02d,12nov91,wmd  added two elements to EI_SOFTC, wid and transLock.
  13. 02c,04oct91,rrr  passed through the ansification filter
  14.   -fixed #else and #endif
  15.   -changed copyright notice
  16. 02b,16sep91,rfs  added two elements to EI_SOFTC
  17. 02a,22jul91,jcf  completely rewritten to utilize simplified mode,
  18.             rfs  added big endian support, reworked buffer loaning.
  19. 01e,01may91,elh  added rbufRefCnt for buffer loaning support.
  20. 01d,08jan91,gae  removed CDELAY.
  21. 01c,04jan91,gae  installed Intel changes and more cleanup.
  22. 01b,12dec90,elh  cleaned up, merged with if_eivar.h
  23. 01a,01nov90,rl   written.
  24. */
  25. #ifndef __INCif_eih
  26. #define __INCif_eih
  27. #ifdef __cplusplus
  28. extern "C" {
  29. #endif
  30. #warning "if_ei driver is obsolete, please use ei82596End driver"
  31. #if ((CPU_FAMILY==I960) && (defined __GNUC__))
  32. #pragma align 1 /* tell gcc960 not to optimize alignments */
  33. #endif /* CPU_FAMILY==I960 */
  34. /* constants needed within this file */
  35. #define EH_SIZE 14   /* avoid structure padding issues */
  36. #define N_MCAST 12
  37. /* Intel 82596 endian safe link macros and structure definitions */
  38. #define LINK_WR(pLink,value)
  39. (((pLink)->lsw = (UINT16)((UINT32)(value) & 0x0000ffff)),
  40. ((pLink)->msw  = (UINT16)(((UINT32)(value) >> 16) & 0x0000ffff)))
  41. #define LINK_RD(pLink) ((pLink)->lsw | ((pLink)->msw << 16))
  42. #define STAT_RD LINK_RD /* statistic read is a link read */
  43. #define STAT_WR LINK_WR /* statistic write is a link write */
  44. typedef struct ei_link  /* EI_LINK - endian resolvable link */
  45.     {
  46.     UINT16  lsw; /* least significant word */
  47.     UINT16  msw; /* most significant word */
  48.     } EI_LINK;
  49. typedef struct ei_node  /* EI_NODE - common linked list object */
  50.     {
  51.     UINT16 field1;
  52.     UINT16 field2;
  53.     EI_LINK lNext; /* link to next node */
  54.     EI_LINK field4;
  55.     UINT16 field5;
  56.     UINT16 field6;
  57.     UINT8 field7 [EH_SIZE];
  58.     char field8 [ETHERMTU];
  59. struct ei_node *pNext; /* ptr to next node */
  60.     } EI_NODE;
  61. typedef EI_LINK EI_STAT;  /* EI_STAT - 82596 error statistic */
  62. /* Intel 82596 structure and bit mask definitions */
  63. /* PORT commands */
  64. #define PORT_RESET 0x0
  65. #define PORT_SELFTEST 0x1
  66. #define PORT_NEWSCP 0x2
  67. #define PORT_DUMP 0x3
  68. /* System Configuration Pointer and bit field defines */
  69. typedef struct scp  /* SCP - System Configuration Pointer */
  70.     {
  71.     UINT16 scpRsv1; /* reserved */
  72.     UINT16 scpSysbus; /* SYSBUS */
  73.     UINT16 scpRsv2; /* reserved */
  74.     UINT16 scpRsv3; /* reserved */
  75.     EI_LINK pIscp; /* ISCP address */
  76.     } SCP;
  77. #define SCP_MODE_82586 0x0000  /* operate in i82586 mode */
  78. #define SCP_MODE_SEGMENTED 0x0002  /* operate in i82596 segmented mode */
  79. #define SCP_MODE_LINEAR 0x0004  /* operate in i82596 linear mode */
  80. #define SCP_EXT_TRIGGER 0x0008  /* ext. trig. of Bus Throttle timers */
  81. #define SCP_LOCK_DISABLE 0x0010  /* lock function disabled */
  82. #define SCP_INT_LOW 0x0020  /* interrupt pin is active low */
  83. #define SCP_SYSBUS_BIT6 0x0040  /* reserved - bit 6 - *MUST BE ONE* */
  84. #define SCP_SYSBUS_BIT7 0x0080  /* reserved - bit 7 - *MUST BE ZERO* */
  85. /* Intermediate System Configuration Pointer */
  86. typedef struct iscp  /* ISCP - Intermediate System Config. Ptr. */
  87.     {
  88.     volatile UINT16 iscpBusy; /* i82596 is being initialized */
  89.     UINT16 iscpRsv1; /* reserved */
  90.     EI_LINK pScb; /* SCB address */
  91.     } ISCP;
  92. /* System Control Block and bit field defines */
  93. typedef struct scb  /* SCB - System Control Block */
  94.     {
  95.     volatile UINT16 scbStatus; /* Status Word */
  96.     volatile UINT16 scbCommand; /* Command Word */
  97.     EI_LINK  pCB; /* command block address */
  98.     EI_LINK  pRF; /* receive frame area address */
  99.     EI_STAT  crcErr; /* CRC error count */
  100.     EI_STAT  allignErr; /* frames misaligned and CRC err cnt */
  101.     EI_STAT  noResErr; /* no resources error count */
  102.     EI_STAT  ovErr; /* overrun error count */
  103.     EI_STAT  cdErr; /* collision detected error count */
  104.     EI_STAT  frameErr; /* short frame error count */
  105.     UINT16   tOff; /* T-off timer */
  106.     UINT16   tOn; /* T-on timer */
  107.     } SCB;
  108. #define SCB_S_RUIDLE 0x0000 /* RU is idle */
  109. #define SCB_S_BTTL 0x0008 /* Bus Throttle timers loaded */
  110. #define SCB_S_RUMASK 0x00f0 /* state mask */
  111. #define SCB_S_RUSUSP 0x0010 /* RU is suspended */
  112. #define SCB_S_RUNORSRC 0x0020 /* RU has no resources */
  113. #define SCB_S_RURSV1 0x0030 /* reserved */
  114. #define SCB_S_RUREADY 0x0040 /* RU is ready */
  115. #define SCB_S_RUNRBD 0x0080 /* RU has no more RBD's */
  116. #define SCB_S_RUNORSRCR 0x00a0 /* RU no more resources/no more RBD's */
  117. #define SCB_S_CUMASK 0x0f00 /* state mask */
  118. #define SCB_S_CUSUSP 0x0100 /* CU is suspended */
  119. #define SCB_S_CUACTIVE 0x0200 /* CU is active */
  120. #define SCB_S_CURSV1 0x0300 /* reserved */
  121. #define SCB_S_CURSV2 0x0400 /* reserved */
  122. #define SCB_S_CURSV3 0x0500 /* reserved */
  123. #define SCB_S_CURSV4 0x0600 /* reserved */
  124. #define SCB_S_CURSV5 0x0700 /* reserved */
  125. #define SCB_S_XMASK 0xf000 /* state mask */
  126. #define SCB_S_CUIDLE 0x0000 /* CU is idle */
  127. #define SCB_S_RNR 0x1000 /* RU left the ready state */
  128. #define SCB_S_CNA 0x2000 /* CU left the active state */
  129. #define SCB_S_FR 0x4000 /* RU finished receiveing a frame */
  130. #define SCB_S_CX 0x8000 /* CU finished a cmd with I bit set */
  131. #define SCB_C_RUNOP 0x0000 /* NOP */
  132. #define SCB_C_RUSTART 0x0010 /* start reception of frames */
  133. #define SCB_C_RURESUME 0x0020 /* resume reception of frames */
  134. #define SCB_C_RUSUSPEND 0x0030 /* suspend reception of frames */
  135. #define SCB_C_RUABORT 0x0040 /* abort receiver immediately */
  136. #define SCB_C_RURSV1 0x0050 /* reserved */
  137. #define SCB_C_RURSV2 0x0060 /* reserved */
  138. #define SCB_C_RURSV3 0x0070 /* reserved */
  139. #define SCB_C_RESET 0x0080 /* reset chip */
  140. #define SCB_C_CUNOP 0x0000 /* NOP */
  141. #define SCB_C_CUSTART 0x0100 /* start execution */
  142. #define SCB_C_CURESUME 0x0200 /* resume execution */
  143. #define SCB_C_CUSUSPEND 0x0300 /* suspend execution after cur. cmd */
  144. #define SCB_C_CUABORT 0x0400 /* abort current cmd immediately */
  145. #define SCB_C_CULOADBT 0x0500 /* load bus throttle timers after cnt */
  146. #define SCB_C_CULDBTIMM 0x0600 /* load bus throttle timers now */
  147. #define SCB_C_CURSV1 0x0700 /* reserved */
  148. #define SCB_C_ACK_RNR 0x1000 /* ACK that RU became not ready */
  149. #define SCB_C_ACK_CNA 0x2000 /* ACK that CU bacame not active */
  150. #define SCB_C_ACK_FR 0x4000 /* ACK that RU received a frame */
  151. #define SCB_C_ACK_CX 0x8000 /* ACK that CU completed an action */
  152. /* Action Command Descriptions */
  153. typedef struct ac_iasetup  /* AC_IASETUP - Individual Address Setup */
  154.     {
  155.     UINT8  ciAddress[6]; /* local ethernet address */
  156.     UINT16 ciFill;
  157.     } AC_IASETUP;
  158. typedef struct ac_config  /* AC_CONFIG - i82596 Configure */
  159.     {
  160.     UINT8 ccByte8; /* byte count, prefetched bit*/
  161.     UINT8 ccByte9; /* FIFO limit, monitor bits */
  162.     UINT8 ccByte10; /* save bad frames */
  163.     UINT8 ccByte11; /* address length, loopback */
  164.     UINT8 ccByte12; /* backoff method */
  165.     UINT8 ccByte13; /* interframe spacing */
  166.     UINT8 ccByte14; /* slot time -low byte */
  167.     UINT8 ccByte15; /* slot time -upper 3 bits, max retry */
  168.     UINT8 ccByte16; /* promiscuious mode, CRC, padding */
  169.     UINT8 ccByte17; /* carrier sense, collision detect */
  170.     UINT8 ccByte18; /* minimum frame length */
  171.     UINT8 ccByte19; /* auto retransmit, multicast,... */
  172.     UINT8 ccByte20; /* DCR slot num, full duplex */
  173.     UINT8 ccByte21; /* disable backoff, ... */
  174.     UINT16 ccFill;
  175.     } AC_CONFIG;
  176. typedef struct ac_mcast  /* AC_MCAST - Mulitcast Setup */
  177.     {
  178.     UINT16 cmMcCount;   /* the number of bytes in MC list */
  179.     UINT8  cmAddrList[6 * N_MCAST]; /* mulitcast address list */
  180.     } AC_MCAST;
  181. typedef struct ac_tdr  /* AC_TDR - Time Domain Reflectometry */
  182.     {
  183.     UINT16 ctInfo; /* time, link OK, tx err, line err */
  184.     UINT16 ctReserve1; /* reserved */
  185.     } AC_TDR;
  186. typedef struct ac_dump  /* AC_DUMP - Dump */
  187.     {
  188.     EI_LINK bufAddr;  /* address of dump buffer */
  189.     } AC_DUMP;
  190. /* Command Frame Description and defines */
  191. typedef struct cfd  /* CFD - Command Frame Descriptor */
  192.     {
  193.     volatile UINT16 cfdStatus; /* command status */
  194.     UINT16 cfdCommand; /* command */
  195.     EI_LINK link; /* address of next CB */
  196.     union  /* command dependent section */
  197. {
  198. struct ac_iasetup cfd_iasetup; /* IA setup */
  199. struct ac_config cfd_config; /* config */
  200. struct ac_mcast cfd_mcast; /* multicast setup */
  201. struct ac_tdr cfd_tdr; /* TDR */
  202. struct ac_dump cfd_dump; /* dump */
  203. } cfd_cmd;
  204.     } CFD;
  205. #define cfdIASetup cfd_cmd.cfd_iasetup
  206. #define cfdConfig cfd_cmd.cfd_config
  207. #define cfdMcast  cfd_cmd.cfd_mcast
  208. #define cfdTDR  cfd_cmd.cfd_tdr
  209. #define cfdDump  cfd_cmd.cfd_dump
  210. #define CFD_C_NOP 0x0000 /* No Operation */
  211. #define CFD_C_IASETUP 0x0001 /* Individual Address Setup */
  212. #define CFD_C_CONFIG 0x0002 /* Configure Chip */
  213. #define CFD_C_MASETUP 0x0003 /* Multicast Setup */
  214. #define CFD_C_XMIT 0x0004 /* Transmit (see below too ...) */
  215. #define CFD_C_TDR 0x0005 /* Time Domain Reflectometry */
  216. #define CFD_C_DUMP 0x0006 /* Dump Registers */
  217. #define CFD_C_DIAG 0x0007 /* Diagnose */
  218. #define CFD_C_INT 0x2000 /* 596 interrupts CPU after execution */
  219. #define CFD_C_SE 0x4000 /* CU should suspend after execution */
  220. #define CFD_C_EL 0x8000 /* End of command list */
  221. #define CFD_S_ABORTED 0x1000 /* Command was aborted via CU Abort */
  222. #define CFD_S_OK 0x2000 /* Command completed successfully */
  223. #define CFD_S_BUSY 0x4000 /* CU is executing this command */
  224. #define CFD_S_COMPLETE 0x8000 /* Command complete */
  225. /* 82596 Transmit/Receive Frames */
  226. typedef struct tfd  /* TFD - Transmit Frame Descriptor */
  227.     {
  228.     volatile UINT16 status; /* status field */
  229.     UINT16 command; /* command field */
  230.     EI_LINK lNext; /* link to next desc. */
  231.     EI_LINK lBufDesc; /* link to buf desc. */
  232.     UINT16 count; /* length of data */
  233.     UINT16 reserved; /* not used */
  234.     UINT8 enetHdr [EH_SIZE]; /* the ethernet header */
  235.     char enetData [ETHERMTU]; /* transmit data */
  236. struct tfd *pNext; /* ptr to next desc. */
  237.     } TFD;
  238. /* special TFD specific command block bit masks */
  239. #define CFD_C_TX_FLEX 0x0008 /* Use Flexible Mode */
  240. #define CFD_C_TX_NOCRC 0x0010 /* Do not insert CRC */
  241. #define CFD_S_COLL_MASK 0x000f /* to access number of collisions */
  242. #define CFD_S_RETRY 0x0020 /* reached the max number of retries */
  243. #define CFD_S_HBEAT 0x0040 /* Heartbeat Indicator */
  244. #define CFD_S_TRDEF 0x0080 /* Transmission Deferred */
  245. #define CFD_S_DMA_UNDR 0x0100 /* DMA Underrun (no data) */
  246. #define CFD_S_NO_CTS 0x0200 /* Lost Clear To Send signal */
  247. #define CFD_S_NO_CRS 0x0400 /* No Carrier Sense */
  248. #define CFD_S_LATE_COLL 0x0800 /* Late collision is detected */
  249. #define TFD_CNT_EOF 0x8000 /* all data kept in TFD */
  250. typedef struct rfd  /* RFD - Receive Frame Descriptor */
  251.     {
  252.     volatile UINT16 status; /* status field */
  253.     UINT16 command; /* command field */
  254.     EI_LINK lNext; /* link to next desc. */
  255.     EI_LINK lBufDesc; /* link to buf desc. */
  256.     volatile UINT16 actualCnt; /* actual byte count */
  257.     UINT16 bufSize; /* buffer size */
  258.     UINT8 enetHdr [EH_SIZE]; /* the ethernet header */
  259.     char enetData [ETHERMTU]; /* received data */
  260. struct tfd *pNext; /* ptr to next desc. */
  261.     UINT8 refCnt; /* reference count */
  262.     } RFD;
  263. /* RFD bit masks */
  264. #define RFD_S_COLL 0x0001 /* collision during reception */
  265. #define RFD_S_EOP 0x0040 /* no EOP flag */
  266. #define RFD_S_MATCH 0x0080 /* dest Addr matched the IA address */
  267. #define RFD_S_DMA 0x0100 /* DMA Overrun failure to get bus */
  268. #define RFD_S_RSRC 0x0200 /* received, but ran out of buffers */
  269. #define RFD_S_ALGN 0x0400 /* received misaligned with CRC error */
  270. #define RFD_S_CRC 0x0800 /* received with CRC error */
  271. #define RFD_S_LEN 0x1000 /* received with length error */
  272. #define RFD_S_OK 0x2000 /* frame received successfully */
  273. #define RFD_S_BUSY 0x4000 /* frame reception ready/in progress */
  274. #define RFD_S_COMPLETE 0x8000 /* frame reception complete */
  275. #define RFD_M_FLEXMODE 0x0008 /* flexible mode */
  276. #define RFD_M_SUSPEND 0x4000 /* suspend RU after receiving frame */
  277. #define RFD_M_EL 0x8000 /* end of RFD list */
  278. #if ((CPU_FAMILY==I960) && (defined __GNUC__))
  279. #pragma align 0                 /* turn off alignment requirement */
  280. #endif /* CPU_FAMILY==I960 */
  281. #ifdef __cplusplus
  282. }
  283. #endif
  284. #endif /* __INCif_eih */