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

VxWorks

开发平台:

C/C++

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