home *** CD-ROM | disk | FTP | other *** search
/ Doom Fever / Doom_Fever-1995_Maple_Media.iso / dmutil / drivers.zip / LANCE.INC < prev    next >
Text File  |  1990-09-29  |  16KB  |  414 lines

  1. ; LANCE.INC
  2. ;
  3. ; lance registers
  4. ;
  5. CSR0    equ    0        ;control and status register 0
  6. CSR1    equ    1
  7. CSR2    equ    2
  8. CSR3    equ    3
  9. ;
  10. ;-------------------------------------------------------------------------
  11. ; control and status register 0
  12. ; rap = 0
  13. ;
  14. ;    |---------------|---------------|---------------|---------------|
  15. ;    |15 |14 |13 |12 |11 |10 | 9 | 8 | 7 | 6    | 5 | 4 | 3 | 2 | 1 | 0    |
  16. ;    |---------------------------------------------------------------|
  17. ;    | e | b | c | m    | m | r    | t | i    | i | i | r | t    | t | s    | s | i    |
  18. ;    | r | a    | e | i    | e | i    | i | d    | n | n | x | x    | d | t    | t | n    |
  19. ;    | r | b    | r | s    | r | n    | n | o    | t | e | o | o    | n | o    | r | i    |
  20. ;    |   | l    | r | s    | r | t    | t | n    | r | a | n | n    | d | p    | t | t    |
  21. ;    |---------------|---------------|---------------|---------------|
  22. ;
  23. L_ERR    equ    8000h        ;or of babl, cerr, miss, merr (read only)
  24. L_BABL    equ    4000h        ;transmit timeout error    (write 1 clear)
  25. L_CERR    equ    2000h        ;collision error (sqe error) (write 1 clear)
  26. L_MISS    equ    1000h        ;no buffer on receive (write 1 clear)
  27. ;
  28. L_MERR    equ    0800h        ;bus timeout error (write 1 clear)
  29. L_RINT    equ    0400h        ;receive interrupt (write 1 clear)
  30. L_TINT    equ    0200h        ;transmit interrupt (write 1 clear)
  31. L_IDON    equ    0100h        ;initialization done (write 1 clear)
  32. ;
  33. L_INTR    equ    0080h    ;interrupt (or of babl,miss,merr,rint,tint,idon
  34. L_INEA    equ    0040h        ;interrupt enable
  35. L_RXON    equ    0020h        ;receiver on
  36. L_TXON    equ    0010h        ;transmitter on
  37. ;
  38. L_TDND    equ    0008h        ;transmit demand
  39. L_STOP    equ    0004h        ;stop
  40. L_STRT    equ    0002h        ;start
  41. L_INIT    equ    0001h        ;initialize
  42. ;
  43. L_MASK    equ    l_babl+l_cerr+l_miss+l_merr+l_rint+l_tint
  44.  
  45.  
  46.  
  47. ;-----------------------------------------------------------------------
  48. ; control and status register 1
  49. ; rap = 1
  50. ;
  51. ;  Accessable when csr0 stop = 1
  52. ;
  53. ;     ---------------------------------------------------------------
  54. ;    |15 |14 |13 |12 |11 |10 | 9 | 8 | 7 | 6    | 5 | 4 | 3 | 2 | 1 | 0    |
  55. ;    |---------------------------------------------------------------|
  56. ;    |                  iadr  (bits 1 - 15)                      | 0 |
  57. ;     ---------------------------------------------------------------
  58. ;
  59. ; iadr - The low order 16 bits of the address of the first
  60. ;         in the initialization Block.
  61. ;
  62. ;----------------------------------------------------------------------
  63. ; control and status register 2
  64. ; rap = 2
  65. ;
  66. ;  Accessable when csr0 stop = 1
  67. ;
  68. ;    |---------------|---------------|---------------|---------------|
  69. ;    |15 |14 |13 |12 |11 |10 | 9 | 8 | 7 | 6    | 5 | 4 | 3 | 2 | 1 | 0    |
  70. ;    |---------------------------------------------------------------|
  71. ;    | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |       iadr (bits 16 - 32)     |
  72. ;     ---------------------------------------------------------------
  73. ;
  74. ; iadr - (bits 16 - 32) The hi order 8 bits of the address of the first
  75. ;         in the initialization Block.
  76. ;
  77. ;-------------------------------------------------------------------------
  78. ; control and status register 3
  79. ; rap = 3
  80. ;
  81. ;  Accessable when csr0 stop = 1
  82. ;
  83. ;    |---------------|---------------|---------------|---------------|
  84. ;    |15 |14 |13 |12 |11 |10 | 9 | 8 | 7 | 6    | 5 | 4 | 3 | 2 | 1 | 0    |
  85. ;    |---------------------------------------------------------------|
  86. ;    | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | b    | a | b    |
  87. ;       |                                                   | s    | c | c    |
  88. ;    |                                                   | w    | o | o    |
  89. ;       |                                                   | p    | n | n    |
  90. ;     ---------------------------------------------------------------
  91. ;
  92. L_BSWP    equ    0004            ;0 = <0:7> even addresses byte swap 
  93. L_ACON    equ    0002            ;0 = ale, 1 = /as
  94. L_BCON    equ    0001            ;0 = /bm1, bm0, /hold
  95. ;
  96. BUS_MASTER    equ    0        ;initialization word
  97. ;
  98.  
  99.  
  100.  
  101. ;------------------------------------------------------------------------
  102. ; initialization block
  103. ;
  104. init_block    struc
  105. i_mode    dw    0        ;mode register usually 0
  106. i_padr    db    0,0,0,0,0,0    ;ethernet address
  107. i_ladrf    db    0,0,0,0,0,0,0,0    ;logical address filter (mulitcast filter)
  108. i_rdra    dw    0        ;lo order pointer to receive descriptor ring
  109. i_rlen    dw    0        ;number of rec descriptors (power of 2)
  110. i_tdra    dw    0        ;lo order pointer to transmit descriptor ring
  111. i_tlen    dw    0        ;number of xmit descritport (power of 2)
  112. init_block    ends
  113.  
  114. INITBLK_SZ    equ    SIZE     init_block
  115.  
  116. ;
  117. ;l_mode
  118. ;
  119. ; offset
  120. ;    |---------------|---------------|---------------|---------------|
  121. ;   00    |15 |14 |13 |12 |11 |10 | 9 | 8 | 7 | 6    | 5 | 4 | 3 | 2 | 1 | 0    |
  122. ;    |---------------------------------------------------------------|
  123. ;    | p | 0    | 0 | 0    | 0 | 0    | 0 | 0    | 0 | i | d | c | d | l    | d | d    |
  124. ;    | r |                     | n | t | o | t | o    | t | r    |
  125. ;    | o |                     | t | r | l | c | o    | x | x    |
  126. ;    | m |                     | l | y | l | r | p    |   |    |
  127. ;     ---------------------------------------------------------------
  128. ;
  129. L_PROM    equ    8000h        ;promiscuous mode
  130. L_INTL    equ    0040h        ;internal loop back
  131. L_DRTY    equ    0020h        ;disable retry
  132. L_COLL    equ    0010h        ;force collision
  133. L_DTCR    equ    0008h        ;disable transmit crc
  134. L_LOOP    equ    00040        ;loop back
  135. L_DTX    equ    0002h        ;disable transmitter
  136. L_DRX    equ    0001h        ;disable receiver
  137. ;
  138. RUN_MODE    equ    0        ;run mode
  139. XMIT_MODE    equ    l_drx        ;disable receiver
  140. RCV_MODE    equ    l_dtx        ;disable xmitter
  141. TEST_MODE    equ    l_intl+l_loop    ;diagnostics mode
  142. ;
  143.  
  144.  
  145.  
  146. ; physical address
  147. ;
  148. ; offset
  149. ;     ---------------------------------------------------------------
  150. ;   02    |15 |14 |13 |12 |11 |10 | 9 | 8 | 7 | 6    | 5 | 4 | 3 | 2 | 1 | 0    |
  151. ;    |---------------------------------------------------------------|
  152. ;    |                       bits 0 - 15                         | 0 |
  153. ;     ---------------------------------------------------------------
  154. ;
  155. ;     ---------------------------------------------------------------
  156. ;   04    |15 |14 |13 |12 |11 |10 | 9 | 8 | 7 | 6    | 5 | 4 | 3 | 2 | 1 | 0    |
  157. ;    |---------------------------------------------------------------|
  158. ;    |                       bits 16 - 31                            |
  159. ;     ---------------------------------------------------------------
  160. ;
  161. ;     ---------------------------------------------------------------
  162. ;   06    |15 |14 |13 |12 |11 |10 | 9 | 8 | 7 | 6    | 5 | 4 | 3 | 2 | 1 | 0    |
  163. ;    |---------------------------------------------------------------|
  164. ;    |                       bits 32 - 47                    |
  165. ;     ---------------------------------------------------------------
  166. ;
  167. ;
  168. ; Multicast address
  169. ;
  170. ; offset
  171. ;     ---------------------------------------------------------------
  172. ;   08    |15 |14 |13 |12 |11 |10 | 9 | 8 | 7 | 6    | 5 | 4 | 3 | 2 | 1 | 0    |
  173. ;    |---------------------------------------------------------------|
  174. ;    |                       bits 0 - 15                             |
  175. ;     ---------------------------------------------------------------
  176. ;
  177. ;     ---------------------------------------------------------------
  178. ;   0a    |15 |14 |13 |12 |11 |10 | 9 | 8 | 7 | 6    | 5 | 4 | 3 | 2 | 1 | 0    |
  179. ;    |---------------------------------------------------------------|
  180. ;    |                       bits 16 - 31                            |
  181. ;     ---------------------------------------------------------------
  182. ;
  183. ;     ---------------------------------------------------------------
  184. ;   0c    |15 |14 |13 |12 |11 |10 | 9 | 8 | 7 | 6    | 5 | 4 | 3 | 2 | 1 | 0    |
  185. ;    |---------------------------------------------------------------|
  186. ;    |                       bits 32 - 47                    |
  187. ;     ---------------------------------------------------------------
  188. ;
  189. ;     ---------------------------------------------------------------
  190. ;   0e  |15 |14 |13 |12 |11 |10 | 9 | 8 | 7 | 6    | 5 | 4 | 3 | 2 | 1 | 0    |
  191. ;    |---------------------------------------------------------------|
  192. ;    |                       bits 38 - 63                    |
  193. ;     ---------------------------------------------------------------
  194. ;
  195. ;
  196. ; Receive Descriptor Ring Pointer
  197. ;
  198. ; offset
  199. ;    |---------------|---------------|---------------|---------------|
  200. ;   10    |15 |14 |13 |12 |11 |10 | 9 | 8 | 7 | 6    | 5 | 4 | 3 | 2 | 1 | 0    |
  201. ;    |---------------------------------------------------------------|
  202. ;    |   rlen    | 0 | 0 | 0 | 0 | 0 |     rdra  (bits 16 - 23)      |
  203. ;     ---------------------------------------------------------------
  204. ;
  205. ;    |---------------|---------------|---------------|---------------|
  206. ;   12    |15 |14 |13 |12 |11 |10 | 9 | 8 | 7 | 6    | 5 | 4 | 3 | 2 | 1 | 0    |
  207. ;    |---------------------------------------------------------------|
  208. ;    |                       rdra  (bits 3 - 15)        | 0 | 0 | 0 |
  209. ;     ---------------------------------------------------------------
  210. ;     note rings are aligned on quad word boundries
  211. ;
  212. ;                number of entries
  213. ;                    -----------------
  214. RLEN1    equ    00h    ; 1
  215. RLEN2    equ    20h      ; 2
  216. RLEN4    equ    40h      ; 4
  217. RLEN8    equ    60h      ; 8
  218. RLEN16    equ    80h     ; 16
  219. RLEN32    equ    0a0h     ; 32
  220. RLEN64    equ    0c0h     ; 64
  221. RLEN128    equ    0e0h    ; 128
  222. ;
  223. ; Transmit Descriptor Ring Pointer
  224. ;
  225. ; offset
  226. ;    |---------------|---------------|---------------|---------------|
  227. ;   14    |15 |14 |13 |12 |11 |10 | 9 | 8 | 7 | 6    | 5 | 4 | 3 | 2 | 1 | 0    |
  228. ;    |---------------------------------------------------------------|
  229. ;    |   tlen    | 0 | 0 | 0 | 0 | 0 |     tdra  (bits 16 - 23)      |
  230. ;     ---------------------------------------------------------------
  231. ;
  232. ;    |---------------|---------------|---------------|---------------|
  233. ;   16    |15 |14 |13 |12 |11 |10 | 9 | 8 | 7 | 6    | 5 | 4 | 3 | 2 | 1 | 0    |
  234. ;    |---------------------------------------------------------------|
  235. ;    |                       tdra  (bits 3 - 15)        | 0 | 0 | 0 |
  236. ;     ---------------------------------------------------------------
  237. ;     note rings are aligned on quad word boundries
  238. ;
  239. ;             number of entries
  240. ;                -----------------
  241. TLEN1    equ    00h    ; 1
  242. TLEN2    equ    20h      ; 2
  243. TLEN4    equ    40h      ; 4
  244. TLEN8    equ    60h      ; 8
  245. TLEN16    equ    80h     ; 16
  246. TLEN32    equ    0a0h     ; 32
  247. TLEN64    equ    0c0h     ; 64
  248. TLEN128    equ    0e0h    ; 128
  249. ;
  250. ;------------------------------------------------------------------------
  251. ;
  252. ; Receive descriptor ring
  253. ;
  254. rec_desc_ring    struc
  255. rd_addr    dw    0        ;lo order address of the buffer attached
  256. rd_stat    dw    0        ;buffer status and hi order pointer
  257. rd_bcnt    dw    0        ;buffer byte count
  258. rd_mcnt    dw    0        ;message byte count
  259. rec_desc_ring    ends
  260. RDESCLEN    equ    SIZE rec_desc_ring
  261. ;
  262. ;
  263. ; rmd0
  264. ; rd_addr
  265. ;
  266. ;offset     ---------------------------------------------------------------
  267. ;   00    |15 |14 |13 |12 |11 |10 | 9 | 8 | 7 | 6    | 5 | 4 | 3 | 2 | 1 | 0    |
  268. ;    |---------------------------------------------------------------|
  269. ;    |                     ladr  (bits 0 - 15)                       |
  270. ;     ---------------------------------------------------------------
  271. ;
  272. ; lo order 16 bits of the buffer pointed to by this descriptor
  273. ;
  274. ;
  275. ; rmd1
  276. ; rd_stat
  277. ;
  278. ;    |---------------|---------------|---------------|---------------|
  279. ;   02    |15 |14 |13 |12 |11 |10 | 9 | 8 | 7 | 6    | 5 | 4 | 3 | 2 | 1 | 0    |
  280. ;    |---------------------------------------------------------------|
  281. ;    | o | e | f | o    | c | b    | s | e    |     hadr  (bits 16 - 23)      |
  282. ;    | w | r    | r | f    | r | u    | t | n    |                 |
  283. ;    | n | r    | a | l    | c | f    | p | p    |                 |
  284. ;    |   |     | m | o    |   | f    |   |     |                 |
  285. ;     ---------------------------------------------------------------
  286. ;
  287. ; status and hi order bits of buffer pointer to by this descriptor
  288. ;
  289. R_OWN    equ    8000h        ;0 = full, host set after read data
  290. R_ERR    equ    4000h
  291. ;
  292. ; receive status
  293. R_FRAM    equ    2000h        ;framing error (cleared by host)
  294. R_OFLO    equ    1000h        ;silo overflow (cleared by host)
  295. R_CRC    equ    0800h        ;crc error (cleared by host)
  296. R_BUFF    equ    0400h        ;buffer error (cleared by host)
  297. R_STP    equ    0200h        ;Start of Packet (cleared by host)
  298. R_ENP    equ    0100h        ;End of Packet (cleared by host)
  299. ;
  300. ; rmd2
  301. ; rd_bcnt
  302. ;
  303. ;    |---------------|---------------|---------------|---------------|
  304. ;   04    |15 |14 |13 |12 |11 |10 | 9 | 8 | 7 | 6    | 5 | 4 | 3 | 2 | 1 | 0    |
  305. ;    |---------------------------------------------------------------|
  306. ;    | 1 | 1 | 1 | 1    |               bcnt                            |
  307. ;     ---------------------------------------------------------------
  308. ;
  309. ; bcnt - Length of buffer pointed to by this desctriptor, two's compliment
  310. ;
  311. RD_MASK    equ    0F000h        ;or mask
  312. ;
  313. ; rmd3
  314. ; rd_mcnt
  315. ;
  316. ;    |---------------|---------------|---------------|---------------|
  317. ;   06    |15 |14 |13 |12 |11 |10 | 9 | 8 | 7 | 6    | 5 | 4 | 3 | 2 | 1 | 0    |
  318. ;    |---------------------------------------------------------------|
  319. ;    | 0 | 0 | 0 | 0    |               mcnt                            |
  320. ;     ---------------------------------------------------------------
  321. ;
  322. ; mcnt - Length of message in buffer
  323. ;
  324. mcnt_mask    equ    0fffh    ;
  325.  
  326. ;------------------------------------------------------------------------
  327. ;
  328. ; Transmit descriptor ring
  329. ;
  330. xmt_desc_ring    struc
  331. td_addr    dw    0        ;lo order address of the buffer attached
  332. td_stat    dw    0        ;buffer status and hi order pointer
  333. td_bcnt    dw    0        ;buffer byte count
  334. td_tdr    dw    0        ;errors and tdr count
  335. xmt_desc_ring    ends
  336. TDESCLEN    equ    SIZE xmt_desc_ring
  337. ;
  338. ;
  339. ; tmd0
  340. ; td_addr
  341. ;    |---------------|---------------|---------------|---------------|
  342. ;   00    |15 |14 |13 |12 |11 |10 | 9 | 8 | 7 | 6    | 5 | 4 | 3 | 2 | 1 | 0    |
  343. ;    |---------------------------------------------------------------|
  344. ;    |                     ladr  (bits 0 - 15)                       |
  345. ;     ---------------------------------------------------------------
  346. ;
  347. ; lo order 16 bits of the buffer pointed to by this descriptor
  348. ;
  349. ;
  350. ; tmd1
  351. ; td_stat
  352. ;
  353. ;    |---------------|---------------|---------------|---------------|
  354. ;   02    |15 |14 |13 |12 |11 |10 | 9 | 8 | 7 | 6    | 5 | 4 | 3 | 2 | 1 | 0    |
  355. ;    |---------------------------------------------------------------|
  356. ;    | o | e | 0 | m    | o | d    | s | e    |     hadr  (bits 16 - 23)      |
  357. ;    | w | r    |   | o    | n | e    | t | n    |                 |
  358. ;    | n | r    |   | r    | e | f    | p | p    |                 |
  359. ;    |   |     |   | e    |   |     |   |     |                 |
  360. ;     ---------------------------------------------------------------
  361. ;
  362. ; status and hi order bits of buffer pointer to by this descriptor
  363. ;
  364. ;
  365. ; transmit status
  366. ;
  367. T_OWN    equ    8000h        ;0 = empty host set when full
  368. T_ERR    equ    4000h
  369. ;
  370. T_MORE    equ    1000h        ;16 retrys (set by lance, cleared by host)
  371. T_ONE    equ    0800h        ;one retry (set by lance, cleared by host)
  372. T_DEF    equ    0400h        ;deffered xsmit (setby lance, cleared by host)
  373. T_STP    equ    0200h        ;First buffer in packet (set/cleared by host)
  374. T_ENP    equ    0100h        ;End of Packet (set/cleared by host
  375. ;
  376. ;
  377. ;
  378. ; tmd2
  379. ; td_bcnt
  380. ;
  381. ;    |---------------|---------------|---------------|---------------|
  382. ;   04    |15 |14 |13 |12 |11 |10 | 9 | 8 | 7 | 6    | 5 | 4 | 3 | 2 | 1 | 0    |
  383. ;    |---------------------------------------------------------------|
  384. ;    | 1 | 1 | 1 | 1    |               bcnt                            |
  385. ;     ---------------------------------------------------------------
  386. ;
  387. ; bcnt - Length of buffer pointed to by this desctriptor, expressed as a
  388. ;        twos compliment negative number.
  389. ;
  390. TD_BMASK    equ    0F000h        ;or mask
  391. ;
  392. ;
  393. ;
  394. ; tmd3
  395. ; td_tdr
  396. ;
  397. ;    |---------------|---------------|---------------|---------------|
  398. ;   06    |15 |14 |13 |12 |11 |10 | 9 | 8 | 7 | 6    | 5 | 4 | 3 | 2 | 1 | 0    |
  399. ;    |---------------------------------------------------------------|
  400. ;    | b | u | 0 | l    | l | r |   tdr  (time domain reflectometery)   |
  401. ;    | u | f    |   | c    | c | t    |                    |
  402. ;    | f | l    |   | o    | a | r    |                    |
  403. ;    | f | o    |   | l    | r | y    |                    |
  404. ;     ---------------------------------------------------------------
  405. ;    only valid if the err bit in tmd1 is set
  406. ;
  407. T_BUFF    equ    8000h    ;buffer error (set by lance, uflo also set)
  408. T_UFLO    equ    4000h    ;silo underflow (set by lance,cleared by host)
  409. T_LCOL    equ    1000h    ;late collision (set by lance,cleared by host)
  410. T_LCAR    equ    0800h    ;loss of carrier (set by lance,cleared by host)
  411. T_RTRY    equ    0400h    ;tried 16 times (set by lance,cleared by host)
  412.  
  413.