rtlregs.h 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  1. #ifndef _DEV_RTLREGS_H_
  2. #define _DEV_RTLREGS_H_
  3. /*
  4. * Copyright (C) 2001-2004 by egnite Software GmbH
  5. * Copyright (C) 2010 by egnite GmbH
  6. *
  7. * All rights reserved.
  8. *
  9. * Redistribution and use in source and binary forms, with or without
  10. * modification, are permitted provided that the following conditions
  11. * are met:
  12. *
  13. * 1. Redistributions of source code must retain the above copyright
  14. * notice, this list of conditions and the following disclaimer.
  15. * 2. Redistributions in binary form must reproduce the above copyright
  16. * notice, this list of conditions and the following disclaimer in the
  17. * documentation and/or other materials provided with the distribution.
  18. * 3. Neither the name of the copyright holders nor the names of
  19. * contributors may be used to endorse or promote products derived
  20. * from this software without specific prior written permission.
  21. *
  22. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  23. * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  24. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
  25. * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  26. * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
  27. * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
  28. * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
  29. * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
  30. * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  31. * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
  32. * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  33. * SUCH DAMAGE.
  34. *
  35. * For additional information see http://www.ethernut.de/
  36. */
  37. /*
  38. * $Id: rtlregs.h 4115 2012-04-12 21:06:13Z olereinhardt $
  39. */
  40. /*!
  41. * \brief Realtek 8019AS register definitions.
  42. */
  43. #define NIC_BASE 0x8300
  44. /*
  45. * Register offset applicable to all register pages.
  46. */
  47. #define NIC_CR _MMIO_BYTE(NIC_BASE + 0x00) /*!< \brief Command register */
  48. #define NIC_IOPORT _MMIO_BYTE(NIC_BASE + 0x10)
  49. #define NIC_RESET _MMIO_BYTE(NIC_BASE + 0x1f) /*!< \brief Reset port */
  50. /*
  51. * Page 0 register offsets.
  52. */
  53. #define NIC_PG0_CLDA0 _MMIO_BYTE(NIC_BASE + 0x01) /*!< \brief Current local DMA address 0 */
  54. #define NIC_PG0_PSTART _MMIO_BYTE(NIC_BASE + 0x01) /*!< \brief Page start register */
  55. #define NIC_PG0_CLDA1 _MMIO_BYTE(NIC_BASE + 0x02) /*!< \brief Current local DMA address 1 */
  56. #define NIC_PG0_PSTOP _MMIO_BYTE(NIC_BASE + 0x02) /*!< \brief Page stop register */
  57. #define NIC_PG0_BNRY _MMIO_BYTE(NIC_BASE + 0x03) /*!< \brief Boundary pointer */
  58. #define NIC_PG0_TSR _MMIO_BYTE(NIC_BASE + 0x04) /*!< \brief Transmit status register */
  59. #define NIC_PG0_TPSR _MMIO_BYTE(NIC_BASE + 0x04) /*!< \brief Transmit page start address */
  60. #define NIC_PG0_NCR _MMIO_BYTE(NIC_BASE + 0x05) /*!< \brief Number of collisions register */
  61. #define NIC_PG0_TBCR0 _MMIO_BYTE(NIC_BASE + 0x05) /*!< \brief Transmit byte count register 0 */
  62. #define NIC_PG0_FIFO _MMIO_BYTE(NIC_BASE + 0x06) /*!< \brief FIFO */
  63. #define NIC_PG0_TBCR1 _MMIO_BYTE(NIC_BASE + 0x06) /*!< \brief Transmit byte count register 1 */
  64. #define NIC_PG0_ISR _MMIO_BYTE(NIC_BASE + 0x07) /*!< \brief Interrupt status register */
  65. #define NIC_PG0_CRDA0 _MMIO_BYTE(NIC_BASE + 0x08) /*!< \brief Current remote DMA address 0 */
  66. #define NIC_PG0_RSAR0 _MMIO_BYTE(NIC_BASE + 0x08) /*!< \brief Remote start address register 0
  67. Low byte address to read from the buffer. */
  68. #define NIC_PG0_CRDA1 _MMIO_BYTE(NIC_BASE + 0x09) /*!< \brief Current remote DMA address 1 */
  69. #define NIC_PG0_RSAR1 _MMIO_BYTE(NIC_BASE + 0x09) /*!< \brief Remote start address register 1
  70. High byte address to read from the buffer. */
  71. #define NIC_PG0_RBCR0 _MMIO_BYTE(NIC_BASE + 0x0a) /*!< \brief Remote byte count register 0
  72. Low byte of the number of bytes to read
  73. from the buffer. */
  74. #define NIC_PG0_RBCR1 _MMIO_BYTE(NIC_BASE + 0x0b) /*!< \brief Remote byte count register 1
  75. High byte of the number of bytes to read
  76. from the buffer. */
  77. #define NIC_PG0_RSR _MMIO_BYTE(NIC_BASE + 0x0c) /*!< \brief Receive status register */
  78. #define NIC_PG0_RCR _MMIO_BYTE(NIC_BASE + 0x0c) /*!< \brief Receive configuration register */
  79. #define NIC_PG0_CNTR0 _MMIO_BYTE(NIC_BASE + 0x0d) /*!< \brief Tally counter 0 (frame alignment errors) */
  80. #define NIC_PG0_TCR _MMIO_BYTE(NIC_BASE + 0x0d) /*!< \brief Transmit configuration register */
  81. #define NIC_PG0_CNTR1 _MMIO_BYTE(NIC_BASE + 0x0e) /*!< \brief Tally counter 1 (CRC errors) */
  82. #define NIC_PG0_DCR _MMIO_BYTE(NIC_BASE + 0x0e) /*!< \brief Data configuration register */
  83. #define NIC_PG0_CNTR2 _MMIO_BYTE(NIC_BASE + 0x0f) /*!< \brief Tally counter 2 (Missed packet errors) */
  84. #define NIC_PG0_IMR _MMIO_BYTE(NIC_BASE + 0x0f) /*!< \brief Interrupt mask register */
  85. /*
  86. * Page 1 register offsets.
  87. */
  88. #define NIC_PG1_PAR0 _MMIO_BYTE(NIC_BASE + 0x01) /*!< \brief Physical address register 0 */
  89. #define NIC_PG1_PAR1 _MMIO_BYTE(NIC_BASE + 0x02) /*!< \brief Physical address register 1 */
  90. #define NIC_PG1_PAR2 _MMIO_BYTE(NIC_BASE + 0x03) /*!< \brief Physical address register 2 */
  91. #define NIC_PG1_PAR3 _MMIO_BYTE(NIC_BASE + 0x04) /*!< \brief Physical address register 3 */
  92. #define NIC_PG1_PAR4 _MMIO_BYTE(NIC_BASE + 0x05) /*!< \brief Physical address register 4 */
  93. #define NIC_PG1_PAR5 _MMIO_BYTE(NIC_BASE + 0x06) /*!< \brief Physical address register 5 */
  94. #define NIC_PG1_CURR _MMIO_BYTE(NIC_BASE + 0x07) /*!< \brief Current page register
  95. The next incoming packet will be stored
  96. at this page address. */
  97. #define NIC_PG1_MAR0 _MMIO_BYTE(NIC_BASE + 0x08) /*!< \brief Multicast address register 0 */
  98. #define NIC_PG1_MAR1 _MMIO_BYTE(NIC_BASE + 0x09) /*!< \brief Multicast address register 1 */
  99. #define NIC_PG1_MAR2 _MMIO_BYTE(NIC_BASE + 0x0a) /*!< \brief Multicast address register 2 */
  100. #define NIC_PG1_MAR3 _MMIO_BYTE(NIC_BASE + 0x0b) /*!< \brief Multicast address register 3 */
  101. #define NIC_PG1_MAR4 _MMIO_BYTE(NIC_BASE + 0x0c) /*!< \brief Multicast address register 4 */
  102. #define NIC_PG1_MAR5 _MMIO_BYTE(NIC_BASE + 0x0d) /*!< \brief Multicast address register 5 */
  103. #define NIC_PG1_MAR6 _MMIO_BYTE(NIC_BASE + 0x0e) /*!< \brief Multicast address register 6 */
  104. #define NIC_PG1_MAR7 _MMIO_BYTE(NIC_BASE + 0x0f) /*!< \brief Multicast address register 7 */
  105. /*
  106. * Page 3 register offsets.
  107. */
  108. #define NIC_PG3_EECR _MMIO_BYTE(NIC_BASE + 0x01) /*!< \brief EEPROM command register */
  109. #define NIC_PG3_CONFIG2 _MMIO_BYTE(NIC_BASE + 0x05) /*!< \brief Configuration register 2 */
  110. #define NIC_PG3_CONFIG3 _MMIO_BYTE(NIC_BASE + 0x06) /*!< \brief Configuration register 3 */
  111. /*
  112. * Command register bits.
  113. */
  114. #define NIC_CR_STP 0x01 /*!< \brief Stop */
  115. #define NIC_CR_STA 0x02 /*!< \brief Start */
  116. #define NIC_CR_TXP 0x04 /*!< \brief Transmit packet */
  117. #define NIC_CR_RD0 0x08 /*!< \brief Remote DMA command bit 0 */
  118. #define NIC_CR_RD1 0x10 /*!< \brief Remote DMA command bit 1 */
  119. #define NIC_CR_RD2 0x20 /*!< \brief Remote DMA command bit 2 */
  120. #define NIC_CR_PS0 0x40 /*!< \brief Page select bit 0 */
  121. #define NIC_CR_PS1 0x80 /*!< \brief Page select bit 1 */
  122. /*
  123. * Interrupt status register bits.
  124. */
  125. #define NIC_ISR_PRX 0x01 /*!< \brief Packet received */
  126. #define NIC_ISR_PTX 0x02 /*!< \brief Packet transmitted */
  127. #define NIC_ISR_RXE 0x04 /*!< \brief Receive error */
  128. #define NIC_ISR_TXE 0x08 /*!< \brief Transmit error */
  129. #define NIC_ISR_OVW 0x10 /*!< \brief Overwrite warning */
  130. #define NIC_ISR_CNT 0x20 /*!< \brief Counter overflow */
  131. #define NIC_ISR_RDC 0x40 /*!< \brief Remote DMA complete */
  132. #define NIC_ISR_RST 0x80 /*!< \brief Reset status */
  133. /*
  134. * Interrupt mask register bits.
  135. */
  136. #define NIC_IMR_PRXE 0x01 /*!< \brief Packet received interrupt enable */
  137. #define NIC_IMR_PTXE 0x02 /*!< \brief Packet transmitted interrupt enable */
  138. #define NIC_IMR_RXEE 0x04 /*!< \brief Receive error interrupt enable */
  139. #define NIC_IMR_TXEE 0x08 /*!< \brief Transmit error interrupt enable */
  140. #define NIC_IMR_OVWE 0x10 /*!< \brief Overwrite warning interrupt enable */
  141. #define NIC_IMR_CNTE 0x20 /*!< \brief Counter overflow interrupt enable */
  142. #define NIC_IMR_RCDE 0x40 /*!< \brief Remote DMA complete interrupt enable */
  143. /*
  144. * Data configuration register bits.
  145. */
  146. #define NIC_DCR_WTS 0x01 /*!< \brief Word transfer select */
  147. #define NIC_DCR_BOS 0x02 /*!< \brief Byte order select */
  148. #define NIC_DCR_LAS 0x04 /*!< \brief Long address select */
  149. #define NIC_DCR_LS 0x08 /*!< \brief Loopback select */
  150. #define NIC_DCR_AR 0x10 /*!< \brief Auto-initialize remote */
  151. #define NIC_DCR_FT0 0x20 /*!< \brief FIFO threshold select bit 0 */
  152. #define NIC_DCR_FT1 0x40 /*!< \brief FIFO threshold select bit 1 */
  153. /*
  154. * Transmit configuration register bits.
  155. */
  156. #define NIC_TCR_CRC 0x01 /*!< \brief Inhibit CRC */
  157. #define NIC_TCR_LB0 0x02 /*!< \brief Encoded loopback control bit 0 */
  158. #define NIC_TCR_LB1 0x04 /*!< \brief Encoded loopback control bit 1 */
  159. #define NIC_TCR_ATD 0x08 /*!< \brief Auto transmit disable */
  160. #define NIC_TCR_OFST 0x10 /*!< \brief Collision offset enable */
  161. /*
  162. * Transmit status register bits.
  163. */
  164. #define NIC_TSR_PTX 0x01 /*!< \brief Packet transmitted */
  165. #define NIC_TSR_COL 0x04 /*!< \brief Transmit collided */
  166. #define NIC_TSR_ABT 0x08 /*!< \brief Transmit aborted */
  167. #define NIC_TSR_CRS 0x10 /*!< \brief Carrier sense lost */
  168. #define NIC_TSR_FU 0x20 /*!< \brief FIFO underrun */
  169. #define NIC_TSR_CDH 0x40 /*!< \brief CD heartbeat */
  170. #define NIC_TSR_OWC 0x80 /*!< \brief Out of window collision */
  171. /*
  172. * Receive configuration register bits.
  173. */
  174. #define NIC_RCR_SEP 0x01 /*!< \brief Save errored packets */
  175. #define NIC_RCR_AR 0x02 /*!< \brief Accept runt packets */
  176. #define NIC_RCR_AB 0x04 /*!< \brief Accept broadcast */
  177. #define NIC_RCR_AM 0x08 /*!< \brief Accept multicast */
  178. #define NIC_RCR_PRO 0x10 /*!< \brief Promiscuous physical */
  179. #define NIC_RCR_MON 0x20 /*!< \brief Monitor mode */
  180. /*
  181. * Receive status register bits.
  182. */
  183. #define NIC_RSR_PRX 0x01 /*!< \brief Packet received intact */
  184. #define NIC_RSR_CRC 0x02 /*!< \brief CRC error */
  185. #define NIC_RSR_FAE 0x04 /*!< \brief Frame alignment error */
  186. #define NIC_RSR_FO 0x08 /*!< \brief FIFO overrun */
  187. #define NIC_RSR_MPA 0x10 /*!< \brief Missed packet */
  188. #define NIC_RSR_PHY 0x20 /*!< \brief Physical/multicast address */
  189. #define NIC_RSR_DIS 0x40 /*!< \brief Receiver disabled */
  190. #define NIC_RSR_DFR 0x80 /*!< \brief Deferring */
  191. /*
  192. * EEPROM command register bits.
  193. */
  194. #define NIC_EECR_EEM1 0x80 /*!< \brief EEPROM Operating Mode */
  195. #define NIC_EECR_EEM0 0x40 /*!< \brief EEPROM Operating Mode
  196. - 0 0 Normal operation
  197. - 0 1 Auto-load
  198. - 1 0 9346 programming
  199. - 1 1 Config register write enab */
  200. #define NIC_EECR_EECS 0x08 /*!< \brief EEPROM Chip Select */
  201. #define NIC_EECR_EESK 0x04 /*!< \brief EEPROM Clock */
  202. #define NIC_EECR_EEDI 0x02 /*!< \brief EEPROM Data In */
  203. #define NIC_EECR_EEDO 0x01 /*!< \brief EEPROM Data Out */
  204. /*
  205. * Configuration register 2 bits.
  206. */
  207. #define NIC_CONFIG2_PL1 0x80 /*!< \brief Network media type */
  208. #define NIC_CONFIG2_PL0 0x40 /*!< \brief Network media type
  209. - 0 0 TP/CX auto-detect
  210. - 0 1 10baseT
  211. - 1 0 10base5
  212. - 1 1 10base2 */
  213. #define NIC_CONFIG2_BSELB 0x20 /*!< \brief BROM disable */
  214. #define NIC_CONFIG2_BS4 0x10 /*!< \brief BROM size/base */
  215. #define NIC_CONFIG2_BS3 0x08
  216. #define NIC_CONFIG2_BS2 0x04
  217. #define NIC_CONFIG2_BS1 0x02
  218. #define NIC_CONFIG2_BS0 0x01
  219. /*
  220. * Configuration register 3 bits
  221. */
  222. #define NIC_CONFIG3_PNP 0x80 /*!< \brief PnP Mode */
  223. #define NIC_CONFIG3_FUDUP 0x40 /*!< \brief Full duplex */
  224. #define NIC_CONFIG3_LEDS1 0x20 /*!< \brief LED1/2 pin configuration
  225. - 0 LED1 == LED_RX, LED2 == LED_TX
  226. - 1 LED1 == LED_CRS, LED2 == MCSB */
  227. #define NIC_CONFIG3_LEDS0 0x10 /*!< \brief LED0 pin configration
  228. - 0 LED0 pin == LED_COL
  229. - 1 LED0 pin == LED_LINK */
  230. #define NIC_CONFIG3_SLEEP 0x04 /*!< \brief Sleep mode */
  231. #define NIC_CONFIG3_PWRDN 0x02 /*!< \brief Power Down */
  232. #define NIC_CONFIG3_ACTIVEB 0x01 /*!< \brief inverse of bit 0 in PnP Act Reg */
  233. #endif