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

VxWorks

开发平台:

C/C++

  1. /* if_ilac.h - AMD 79C900 Ethernet network interface driver */
  2. /*
  3.  * @(#)ilacc.h 1.1 CETIA 93/03/31
  4.  *
  5.  * This header file contains information specific to the AM 79C900 ILACC
  6.  */
  7. /*
  8. modification history
  9. --------------------
  10. 01a,02jan93,kat  written based on code supplied by cetia.
  11. */
  12. #ifndef _IF_ILAC_H_
  13. #define _IF_ILAC_H_
  14. #define ILAC_ADDR               0xFD800000
  15. #define ROUND_BUF_SIZE          0x600
  16. #define ROUND_TRING_SIZE        0x10
  17. #define ROUND_RRING_SIZE        0x10
  18. #define RECV_DES_CNT            0x20
  19. #define L2RECV_DES_CNT          0x5
  20. #define XMIT_DES_CNT            0x1
  21. #define L2XMIT_DES_CNT          0x0
  22. /*
  23.  * There are five control and status registers:
  24.  * csr0 contains misc error and status bits.
  25.  * csr1 contains the low order word of the address of the init block.
  26.  * csr2 contains the high order byte of the address of the init block.
  27.  * csr3 allows redefinition of the bus master interface and masking IT.
  28.  * csr4 
  29.  */
  30. /* bits in csr0 */
  31. #define CSR0_ERR 0x8000 /* error summary */
  32. #define CSR0_BABL 0x4000 /* babble error */
  33. #define CSR0_CERR 0x2000 /* collision error */
  34. #define CSR0_MISS 0x1000 /* missed packet */
  35. #define CSR0_MERR 0x0800 /* memory error */
  36. #define CSR0_RINT 0x0400 /* receiver interrupt */
  37. #define CSR0_TINT 0x0200 /* transmitter interrupt */
  38. #define CSR0_IDON 0x0100 /* initialization done */
  39. #define CSR0_INTR 0x0080 /* interrupt flag */
  40. #define CSR0_INEA 0x0040 /* interrupt enable */
  41. #define CSR0_RXON 0x0020 /* receiver on */
  42. #define CSR0_TXON 0x0010 /* transmitter on */
  43. #define CSR0_TDMD 0x0008 /* transmit demand */
  44. #define CSR0_STOP 0x0004 /* stop the ilacc */
  45. #define CSR0_STRT 0x0002 /* start the ilacc */
  46. #define CSR0_INIT 0x0001 /* initialize the ilacc */
  47. /* bits in csr3 */
  48. #define CSR3_BABLM 0x4000 /* BABL Mask */
  49. #define CSR3_MISSM 0x1000 /* MISSed packet Mask */
  50. #define CSR3_MERRM 0x0800 /* MEmory eRRor Mask */
  51. #define CSR3_RINTM 0x0400 /* Receive INTerrupt Mask */
  52. #define CSR3_TINTM 0x0200 /* Transmit INTerrupt Mask */
  53. #define CSR3_IDONM 0x0100 /* Initialization DOne Mask */
  54. #define CSR3_BSWP 0x0004 /* byte swap (now read-only)*/
  55. #define CSR3_ACON 0x0002 /* ale control */
  56. /* bits in csr4 */
  57. #define CSR4_BACON_68K  0x0040 /* 32 bit 680x0 */
  58. #define CSR4_TXSTRTM    0x0004 /* Transmit STaRT interrupt Mask  */
  59. #define CSR4_LBDM       0x0001 /* LoopBack Done interrupt Mask */
  60. /* initial setting of csr0 */
  61. #define CSR0_IVALUE (CSR0_IDON | CSR0_INEA | CSR0_STRT | CSR0_INIT)
  62. /* clear interrupt cause bits */
  63. #define CSR0_ACKINT     (CSR0_RINT | CSR0_TINT | CSR0_MERR | CSR0_MISS | CSR0_IDON)
  64. /* our setting of csr3 */
  65. #define CSR3_VALUE (CSR3_ACON | CSR3_BSWP)
  66. /*
  67.  * Initialization Block.
  68.  * Chip initialization includes the reading of the init block to obtain
  69.  * the operating parameters.
  70.  */
  71. typedef struct
  72. {
  73.     unsigned int   tlen:4; /* xmit ring length, power of 2 */
  74.     unsigned int   res_t:4; /* reserved */
  75.     unsigned int   rlen:4; /* rcv. ring length, power of 2 */
  76.     unsigned int   res_r:4; /* reserved */
  77.     unsigned short mode; /* mode register */
  78.     
  79.     unsigned char  padr[8]; /* physical address */
  80.     unsigned short ladrf[4]; /* logical address filter */
  81.     unsigned long  rdra; /* rcv ring desc addr */
  82.     unsigned long  tdra; /* xmit ring desc addr */
  83. } INIT_BLK;
  84. /* bits in mode register: allows alteration of the chips operating parameters */
  85. #define IBM_PROM 0x8000 /* promiscuous mode */
  86. #define IBM_INTL 0x0040 /* internal loopback */
  87. #define IBM_DRTY 0x0020 /* disable retry */
  88. #define IBM_COLL 0x0010 /* force collision */
  89. #define IBM_DTCR 0x0008 /* disable transmit crc */
  90. #define IBM_LOOP 0x0004 /* loopback */
  91. #define IBM_DTX 0x0002 /* disable transmitter */
  92. #define IBM_DRX 0x0001 /* disable receiver */
  93. /* 
  94.  * Buffer Management is accomplished through message descriptors organized
  95.  * in ring structures in main memory. There are two rings allocated for the
  96.  * device: a receive ring and a transmit ring. The following defines the 
  97.  * structure of the descriptor rings.
  98.  */
  99. /*****************************************************************************/
  100. /*                  Receive  List type definition                            */
  101. /*****************************************************************************/
  102. typedef struct
  103. {
  104.     unsigned long addr; /* buf addr */
  105.     unsigned char flags; /* misc error and status bits */
  106.     unsigned char res; /* reserved */
  107.     unsigned int  ones:4; /* 1111*/
  108.     unsigned int  bcnt:12; /* buffer byte count */
  109.     unsigned char rcc; /* receive collision count */
  110.     unsigned char rpc; /* runt packet count */
  111.     unsigned int  zeros:4; /* 0000 */
  112.     unsigned int  mcnt:12; /* message byte count */
  113.     unsigned long align;
  114. } RM_DESC;
  115. /* bits in the flags field */
  116. #define RFLG_OWN 0x80 /* ownership bit, 1==LANCE */
  117. #define RFLG_ERR 0x40 /* error summary */
  118. #define RFLG_FRAM 0x20 /* framing error */
  119. #define RFLG_OFLO 0x10 /* overflow error */
  120. #define RFLG_CRC 0x08 /* crc error */
  121. #define RFLG_BUFF 0x04 /* buffer error */
  122. #define RFLG_STP 0x02 /* start of packet */
  123. #define RFLG_ENP 0x01 /* end of packet */
  124. /* bits in the buffer byte count field */
  125. #define RBCNT_ONES 0xf000 /* must be ones */
  126. #define RBCNT_BCNT 0x0fff /* buf byte count, in 2's compl */
  127. /* bits in the message byte count field */
  128. #define RMCNT_RES 0xf000 /* reserved, read as zeros */
  129. #define RMCNT_BCNT 0x0fff /* message byte count */
  130. /*****************************************************************************/
  131. /*                  Transmit List type definition                            */
  132. /*****************************************************************************/
  133. /* transmit message descriptor entry */
  134. typedef struct
  135. {
  136.     unsigned long  addr; /* buf addr */
  137.     unsigned char  status; /* misc error and status bits */
  138.     unsigned char  res; /* reserved */
  139. /*
  140.     unsigned int   ones:4;   
  141.     unsigned int   bcnt:12; 
  142. */ 
  143.     unsigned short bcnt; 
  144.     unsigned int   error:6; /* errors flags */
  145.     unsigned int   tdr:10; /* time domain reflectometry */
  146.     unsigned int   res2:12; /* reserved */
  147.     unsigned int   tcc:4; /* transmit collision count */
  148.     unsigned long  align;
  149. } TM_DESC;
  150. /* bits in the status field */
  151. #define TST_OWN 0x80 /* ownership bit, 1==LANCE */
  152. #define TST_ERR 0x40 /* error summary */
  153. #define TST_RES 0x20 /* reserved bit */
  154. #define TST_MORE 0x10 /* more than one retry was needed */
  155. #define TST_ONE 0x08 /* one retry was needed */
  156. #define TST_DEF 0x04 /* defer while trying to transmit */
  157. #define TST_STP 0x02 /* start of packet */
  158. #define TST_ENP 0x01 /* end of packet */
  159. /* setting of status field when packet is to be transmitted */
  160. #define TST_XMIT (TST_STP | TST_ENP | TST_OWN)
  161. /* bits in the buffer byte count field */
  162. #define TBCNT_ONES 0xf000 /* must be ones */
  163. #define TBCNT_BCNT 0x0fff /* buf byte count, in 2's compl */
  164. #define TBCNT_MIN 64 /* minimum length of buf */
  165. #define TBCNT_MINFC 100 /* minimum length of first chain buf */
  166. /* bits in the error field */
  167. #define TERR_BUFF 0x8000 /* buffer error */
  168. #define TERR_UFLO 0x4000 /* underflow error */
  169. #define TERR_RES 0x2000 /* reserved bit */
  170. #define TERR_LCOL 0x1000 /* late collision */
  171. #define TERR_LCAR 0x0800 /* loss of carrier */
  172. #define TERR_RTRY 0x0400 /* retry error */
  173. #define TERR_TDR 0x03ff /* time domain reflectometry */
  174. #define HW_DELAY        0x2000000           /* Hardware timing */
  175. #define INIT_TMO        HW_DELAY
  176. #define STRT_TMO        HW_DELAY
  177. #define RECV_TMO        HW_DELAY
  178. #define XMIT_TMO        HW_DELAY/3
  179. typedef struct
  180. { /* device registers */
  181.     unsigned short unused; /* unused */
  182.     unsigned short rdp; /* one of registers csr00-58 */
  183.     unsigned char  reserv[7]; /* unused */
  184.     unsigned char  rap; /* register select */
  185. } ILAC_DEVICE;
  186. #endif