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

VxWorks

开发平台:

C/C++

  1. /* if_elc.h - SMC 8013WC network interface header */ 
  2. /* Copyright 1984-1993 Wind River Systems, Inc. */
  3. /*
  4. modification history
  5. --------------------
  6. 01b,03oct94,hdn  changed TSTART to TSTART[01] for two TX buffer.
  7. 01d,03nov93,hdn  made RAMSIZE 16Kbytes.
  8. 01c,23jun93,hdn  added a structure IRQ_TABLE.
  9. 01b,17jun93,hdn  renamed to if_elc.h. 
  10. 01a,09jun92,hdn  written. 
  11. */
  12. #ifndef __INCif_elch
  13. #define __INCif_elch
  14. #ifdef __cplusplus
  15. extern "C" {
  16. #endif
  17. #define SMC8013WC_RAMSIZE 0x4000
  18. #define SMC8013WC_TSTART0 0x00
  19. #define SMC8013WC_TSTART1 0x08
  20. #define SMC8013WC_PSTART 0x10
  21. #define SMC8013WC_PSTOP 0x3f
  22. typedef struct 
  23.     {
  24.     UCHAR rstat;
  25.     UCHAR next;
  26.     UCHAR lowByteCnt;
  27.     UCHAR uppByteCnt;
  28.     } ELC_HEADER;
  29. typedef struct 
  30.     {
  31. #define collisions stat[0]
  32. #define crcs stat[1]
  33. #define aligns stat[2]
  34. #define missed stat[3]
  35. #define overruns stat[4]
  36. #define disabled stat[5]
  37. #define deferring stat[6]
  38. #define underruns stat[7]
  39. #define aborts stat[8]
  40. #define outofwindow stat[9]
  41. #define heartbeats stat[10]
  42. #define badPacket stat[11]
  43. #define shortPacket stat[12]
  44. #define tnoerror stat[13]
  45. #define rnoerror stat[14]
  46. #define terror stat[15]
  47. #define rerror stat[16]
  48. #define overwrite stat[17]
  49. #define wrapped stat[18]
  50. #define interrupts stat[19]
  51. #define reset stat[20]
  52. #define strayint stat[21]
  53.     UINT stat[23];
  54.     } ELC_STAT;
  55. typedef struct 
  56.     {
  57.     struct arpcom es_ac;
  58. #define es_if es_ac.ac_if
  59. #define es_enaddr es_ac.ac_enaddr
  60.     USHORT bicAddr;
  61.     USHORT elcAddr;
  62.     UINT memAddr;
  63.     UINT memSize;
  64.     int intLevel;
  65.     int intVec;
  66.     int config;
  67.     UINT transmitPage[2];
  68.     UINT transmitCnt;
  69.     ELC_STAT elcStat;
  70.     UCHAR next;
  71.     UCHAR uppByteCnt;
  72.     UCHAR current;
  73.     UCHAR imask;
  74.     UCHAR istat;
  75.     UCHAR tstat;
  76.     UCHAR rstat;
  77.     UCHAR receiveBuf[0x4000];
  78.     int flags;
  79.     UINT txreq;
  80.     } ELC_SOFTC;
  81. typedef struct
  82.     {
  83.     UCHAR ir2;
  84.     UCHAR ir01;
  85.     } IRQ_TABLE;
  86. #define CAST
  87. /* SMC 83c584 BIC (Bus Interface Controller) */ 
  88. #define BIC_REG_ADDR_INTERVAL 1
  89. #define BIC_ADRS(base,reg)   (CAST (base+(reg*BIC_REG_ADDR_INTERVAL)))
  90. #define BIC_MSR(base) BIC_ADRS(base,0x00) /* memory select */
  91. #define BIC_ICR(base) BIC_ADRS(base,0x01) /* interface config */
  92. #define BIC_IAR(base) BIC_ADRS(base,0x02) /* IO address */
  93. #define BIC_BIO(base) BIC_ADRS(base,0x03) /* BIOS ROM address */
  94. #define BIC_IRR(base) BIC_ADRS(base,0x04) /* interrupt request */
  95. #define BIC_LAAR(base) BIC_ADRS(base,0x05) /* LA address */
  96. #define BIC_JUMP(base) BIC_ADRS(base,0x06) /* jumpers */
  97. #define BIC_GP2(base) BIC_ADRS(base,0x07) /* general purpose */
  98. #define BIC_LAR0(base) BIC_ADRS(base,0x08) /* LAN address */
  99. #define BIC_LAR1(base) BIC_ADRS(base,0x09) /* LAN address */
  100. #define BIC_LAR2(base) BIC_ADRS(base,0x0a) /* LAN address */
  101. #define BIC_LAR3(base) BIC_ADRS(base,0x0b) /* LAN address */
  102. #define BIC_LAR4(base) BIC_ADRS(base,0x0c) /* LAN address */
  103. #define BIC_LAR5(base) BIC_ADRS(base,0x0d) /* LAN address */
  104. #define BIC_ID(base) BIC_ADRS(base,0x0e) /* board ID */
  105. #define BIC_CKSM(base) BIC_ADRS(base,0x0f) /* checksum */
  106. /* MSR: Memory Select Register */
  107. #define MSR_RST 0x80
  108. #define MSR_MEN 0x40
  109. #define MSR_RA18 0x20
  110. #define MSR_RA17 0x10
  111. #define MSR_RA16 0x08
  112. #define MSR_RA15 0x04
  113. #define MSR_RA14 0x02
  114. #define MSR_RA13 0x01
  115. /* ICR: Interface Configuration Register */
  116. #define ICR_STO 0x80
  117. #define ICR_RIO 0x40
  118. #define ICR_RX7 0x20
  119. #define ICR_RLA 0x10
  120. #define ICR_MSZ 0x08
  121. #define ICR_IR2 0x04
  122. #define ICR_EAR 0x02
  123. #define ICR_BIT16 0x01
  124. /* IAR: IO Address Register */
  125. #define IAR_IA15 0x80
  126. #define IAR_IA14 0x40
  127. #define IAR_IA13 0x20
  128. #define IAR_IA9 0x10
  129. #define IAR_IA8 0x08
  130. #define IAR_IA7 0x04
  131. #define IAR_IA6 0x02
  132. #define IAR_IA5 0x01
  133. /* BIO: BIOS ROM Address Register */
  134. #define BIO_RS1 0x80
  135. #define BIO_RS0 0x40
  136. #define BIO_BA18 0x20
  137. #define BIO_BA17 0x10
  138. #define BIO_BA16 0x08
  139. #define BIO_BA15 0x04
  140. #define BIO_BA14 0x02
  141. #define BIO_INT 0x01
  142. /* EAR: EEROM Address Register */
  143. #define EAR_EA6 0x80
  144. #define EAR_EA5 0x40
  145. #define EAR_EA4 0x20
  146. #define EAR_EA3 0x10
  147. #define EAR_RAM 0x08
  148. #define EAR_RPE 0x04
  149. #define EAR_RP1 0x02
  150. #define EAR_RP 0x01
  151. /* IRR: Interrupt Request Register */
  152. #define IRR_IEN 0x80
  153. #define IRR_IR1 0x40
  154. #define IRR_IR0 0x20
  155. #define IRR_FLSH 0x10
  156. #define IRR_OUT3 0x08
  157. #define IRR_OUT2 0x04
  158. #define IRR_OUT1 0x02
  159. #define IRR_ZWS8 0x01
  160. /* LAAR: LA Address  Register */
  161. #define LAAR_M16EN 0x80
  162. #define LAAR_L16EN 0x40
  163. #define LAAR_ZWS16 0x20
  164. #define LAAR_LA23 0x10
  165. #define LAAR_LA22 0x08
  166. #define LAAR_LA21 0x04
  167. #define LAAR_LA20 0x02
  168. #define LAAR_LA19 0x01
  169. /* SMC 83c690 ELC (Ethernet LAN Controller) */ 
  170. #define ELC_REG_ADDR_INTERVAL 1
  171. #define ELC_ADRS(base,reg)   (CAST (base+(reg*ELC_REG_ADDR_INTERVAL)))
  172. /* page-0, read */
  173. #define ELC_CMD(base) ELC_ADRS(base,0x00) /* command */
  174. #define ELC_TRINCRL(base) ELC_ADRS(base,0x01) /* TRDMA incrementer */
  175. #define ELC_TRINCRH(base) ELC_ADRS(base,0x02) /* TRDMA incrementer */
  176. #define ELC_BOUND(base) ELC_ADRS(base,0x03) /* boundary page */
  177. #define ELC_TSTAT(base) ELC_ADRS(base,0x04) /* transmit status */
  178. #define ELC_COLCNT(base) ELC_ADRS(base,0x05) /* collision error */
  179. #define ELC_INTSTAT(base) ELC_ADRS(base,0x07) /* interrupt status */
  180. #define ELC_RSTAT(base) ELC_ADRS(base,0x0c) /* receive status */
  181. #define ELC_ALICNT(base) ELC_ADRS(base,0x0d) /* alignment error */
  182. #define ELC_CRCCNT(base) ELC_ADRS(base,0x0e) /* crc error */
  183. #define ELC_MPCNT(base) ELC_ADRS(base,0x0f) /* missed packet */
  184. /* page-0, write */
  185. #define ELC_RSTART(base) ELC_ADRS(base,0x01) /* receive start */
  186. #define ELC_RSTOP(base) ELC_ADRS(base,0x02) /* receive stop */
  187. #define ELC_TSTART(base) ELC_ADRS(base,0x04) /* transmit start */
  188. #define ELC_TCNTL(base) ELC_ADRS(base,0x05) /* transmit counter */
  189. #define ELC_TCNTH(base) ELC_ADRS(base,0x06) /* transmit counter */
  190. #define ELC_RBCR0(base) ELC_ADRS(base,0x0a) /* remote byte count */
  191. #define ELC_RBCR1(base) ELC_ADRS(base,0x0b) /* remote byte count */
  192. #define ELC_RCON(base) ELC_ADRS(base,0x0c) /* receive config */
  193. #define ELC_TCON(base) ELC_ADRS(base,0x0d) /* transmit config */
  194. #define ELC_DCON(base) ELC_ADRS(base,0x0e) /* data config */
  195. #define ELC_INTMASK(base) ELC_ADRS(base,0x0f) /* interrupt mask */
  196. /* page-1, read and write */
  197. #define ELC_STA0(base) ELC_ADRS(base,0x01) /* station address */
  198. #define ELC_STA1(base) ELC_ADRS(base,0x02) /* station address */
  199. #define ELC_STA2(base) ELC_ADRS(base,0x03) /* station address */
  200. #define ELC_STA3(base) ELC_ADRS(base,0x04) /* station address */
  201. #define ELC_STA4(base) ELC_ADRS(base,0x05) /* station address */
  202. #define ELC_STA5(base) ELC_ADRS(base,0x06) /* station address */
  203. #define ELC_CURR(base) ELC_ADRS(base,0x07) /* current page */
  204. #define ELC_MAR0(base) ELC_ADRS(base,0x08) /* multicast address */
  205. #define ELC_MAR1(base) ELC_ADRS(base,0x09) /* multicast address */
  206. #define ELC_MAR2(base) ELC_ADRS(base,0x0a) /* multicast address */
  207. #define ELC_MAR3(base) ELC_ADRS(base,0x0b) /* multicast address */
  208. #define ELC_MAR4(base) ELC_ADRS(base,0x0c) /* multicast address */
  209. #define ELC_MAR5(base) ELC_ADRS(base,0x0d) /* multicast address */
  210. #define ELC_MAR6(base) ELC_ADRS(base,0x0e) /* multicast address */
  211. #define ELC_MAR7(base) ELC_ADRS(base,0x0f) /* multicast address */
  212. /* page-2, read and write */
  213. #define ELC_NEXT(base) ELC_ADRS(base,0x05) /* next page */
  214. #define ELC_BLOCK(base) ELC_ADRS(base,0x06) /* block address */
  215. #define ELC_ENH(base) ELC_ADRS(base,0x07) /* enable features */
  216. /* COMMAND: Command Register */
  217. #define CMD_PS1 0x80
  218. #define CMD_PS0 0x40
  219. #define CMD_CMD5 0x20
  220. #define CMD_CMD4 0x10
  221. #define CMD_CMD3 0x08
  222. #define CMD_TXP 0x04
  223. #define CMD_STA 0x02
  224. #define CMD_STP 0x01
  225. /* RCON: Receive Configuration Register */
  226. #define RCON_MON 0x20
  227. #define RCON_PROM 0x10
  228. #define RCON_GROUP 0x08
  229. #define RCON_BROAD 0x04
  230. #define RCON_RUNTS 0x02
  231. #define RCON_SEP 0x01
  232. /* TCON: Transmit Configuration Register */
  233. #define TCON_LB1 0x04
  234. #define TCON_LB0 0x02
  235. #define TCON_CRCN 0x01
  236. /* DCON: Data Configuration Register */
  237. #define DCON_BSIZE1 0x40
  238. #define DCON_BSIZE0 0x20
  239. #define DCON_BUS16 0x01
  240. /* INTMASK: Interrupt Mask Register */
  241. #define IM_XDCE 0x40
  242. #define IM_CNTE 0x20
  243. #define IM_OVWE 0x10
  244. #define IM_TXEE 0x08
  245. #define IM_RXEE 0x04
  246. #define IM_PTXE 0x02
  247. #define IM_PRXE 0x01
  248. /* INTSTAT: Interrupt Status Register */
  249. #define ISTAT_RST 0x80
  250. #define ISTAT_CNT 0x20
  251. #define ISTAT_OVW 0x10
  252. #define ISTAT_TXE 0x08
  253. #define ISTAT_RXE 0x04
  254. #define ISTAT_PTX 0x02
  255. #define ISTAT_PRX 0x01
  256. /* TSTAT: Transmit Status Register */
  257. #define TSTAT_OWC 0x80
  258. #define TSTAT_CDH 0x40
  259. #define TSTAT_UNDER 0x20
  260. #define TSTAT_CRL 0x10
  261. #define TSTAT_ABORT 0x08
  262. #define TSTAT_TWC 0x04
  263. #define TSTAT_NDT 0x02
  264. #define TSTAT_PTX 0x01
  265. /* RSTAT: Receive Status Register */
  266. #define RSTAT_DFR 0x80
  267. #define RSTAT_DIS 0x40
  268. #define RSTAT_GROUP 0x20
  269. #define RSTAT_MPA 0x10
  270. #define RSTAT_OVER 0x08
  271. #define RSTAT_FAE 0x04
  272. #define RSTAT_CRC 0x02
  273. #define RSTAT_PRX 0x01
  274. /* ENH: Enable Features */
  275. #define ENH_WAIT1 0x80
  276. #define ENH_WAIT0 0x40
  277. #define ENH_SLOT1 0x10
  278. #define ENH_SLOT0 0x08
  279. /* flags - software synchronize bit difinitions */
  280. #define TXING 0x01
  281. #define RXING 0x02
  282. #define TXREQ 0x04
  283. #ifdef __cplusplus
  284. }
  285. #endif
  286. #endif /* __INCif_elch */