eth_phy_802_3_regs.h 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. /*
  2. * SPDX-FileCopyrightText: 2019-2023 Espressif Systems (Shanghai) CO LTD
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. */
  6. #pragma once
  7. #include <stdint.h>
  8. #ifdef __cplusplus
  9. extern "C" {
  10. #endif
  11. /**
  12. *
  13. * This file defines basic PHY registers in compliance to IEEE 802.3, 22.2.4 Management functions section.
  14. *
  15. */
  16. /**
  17. * @brief BMCR(Basic Mode Control Register)
  18. *
  19. */
  20. typedef union {
  21. struct {
  22. uint32_t reserved : 7; /*!< Reserved */
  23. uint32_t collision_test : 1; /*!< Collision test */
  24. uint32_t duplex_mode : 1; /*!< Duplex mode:Full Duplex(1) and Half Duplex(0) */
  25. uint32_t restart_auto_nego : 1; /*!< Restart auto-negotiation */
  26. uint32_t isolate : 1; /*!< Isolate the PHY from MII except the SMI interface */
  27. uint32_t power_down : 1; /*!< Power off PHY except SMI interface */
  28. uint32_t en_auto_nego : 1; /*!< Enable auto negotiation */
  29. uint32_t speed_select : 1; /*!< Select speed: 100Mbps(1) and 10Mbps(0) */
  30. uint32_t en_loopback : 1; /*!< Enables transmit data to be routed to the receive path */
  31. uint32_t reset : 1; /*!< Reset PHY registers. This bit is self-clearing. */
  32. };
  33. uint32_t val;
  34. } bmcr_reg_t;
  35. #define ETH_PHY_BMCR_REG_ADDR (0x00)
  36. /**
  37. * @brief BMSR(Basic Mode Status Register)
  38. *
  39. */
  40. typedef union {
  41. struct {
  42. uint32_t ext_capability : 1; /*!< Extended register capability */
  43. uint32_t jabber_detect : 1; /*!< Jabber condition detected */
  44. uint32_t link_status : 1; /*!< Link status */
  45. uint32_t auto_nego_ability : 1; /*!< Auto negotiation ability */
  46. uint32_t remote_fault : 1; /*!< Remote fault detected */
  47. uint32_t auto_nego_complete : 1; /*!< Auto negotiation completed */
  48. uint32_t mf_preamble_suppress : 1; /*!< Preamble suppression capability for management frame */
  49. uint32_t reserved : 1; /*!< Reserved */
  50. uint32_t ext_status : 1; /*!< Extended Status */
  51. uint32_t base100_t2_hdx : 1; /*!< 100Base-T2 Half Duplex capability */
  52. uint32_t base100_t2_fdx : 1; /*!< 100Base-T2 Full Duplex capability */
  53. uint32_t base10_t_hdx : 1; /*!< 10Base-T Half Duplex capability */
  54. uint32_t base10_t_fdx : 1; /*!< 10Base-T Full Duplex capability */
  55. uint32_t base100_tx_hdx : 1; /*!< 100Base-Tx Half Duplex capability */
  56. uint32_t base100_tx_fdx : 1; /*!< 100Base-Tx Full Duplex capability */
  57. uint32_t based100_t4 : 1; /*!< 100Base-T4 capability */
  58. };
  59. uint32_t val;
  60. } bmsr_reg_t;
  61. #define ETH_PHY_BMSR_REG_ADDR (0x01)
  62. /**
  63. * @brief PHYIDR1(PHY Identifier Register 1)
  64. *
  65. */
  66. typedef union {
  67. struct {
  68. uint32_t oui_msb : 16; /*!< Organizationally Unique Identifier(OUI) most significant bits */
  69. };
  70. uint32_t val;
  71. } phyidr1_reg_t;
  72. #define ETH_PHY_IDR1_REG_ADDR (0x02)
  73. /**
  74. * @brief PHYIDR2(PHY Identifier Register 2)
  75. *
  76. */
  77. typedef union {
  78. struct {
  79. uint32_t model_revision : 4; /*!< Model revision number */
  80. uint32_t vendor_model : 6; /*!< Vendor model number */
  81. uint32_t oui_lsb : 6; /*!< Organizationally Unique Identifier(OUI) least significant bits */
  82. };
  83. uint32_t val;
  84. } phyidr2_reg_t;
  85. #define ETH_PHY_IDR2_REG_ADDR (0x03)
  86. /**
  87. * @brief ANAR(Auto-Negotiation Advertisement Register)
  88. *
  89. */
  90. typedef union {
  91. struct {
  92. uint32_t protocol_select : 5; /*!< Binary encoded selector supported by this PHY */
  93. uint32_t base10_t : 1; /*!< 10Base-T support */
  94. uint32_t base10_t_fd : 1; /*!< 10Base-T full duplex support */
  95. uint32_t base100_tx : 1; /*!< 100Base-TX support */
  96. uint32_t base100_tx_fd : 1; /*!< 100Base-TX full duplex support */
  97. uint32_t base100_t4 : 1; /*!< 100Base-T4 support */
  98. uint32_t symmetric_pause : 1; /*!< Symmetric pause support for full duplex links */
  99. uint32_t asymmetric_pause : 1; /*!< Asymmetric pause support for full duplex links */
  100. uint32_t reserved1 : 1; /*!< Reserved */
  101. uint32_t remote_fault : 1; /*!< Advertise remote fault detection capability */
  102. uint32_t acknowledge : 1; /*!< Link partner ability data reception acknowledged */
  103. uint32_t next_page : 1; /*!< Next page indication, if set, next page transfer is desired */
  104. };
  105. uint32_t val;
  106. } anar_reg_t;
  107. #define ETH_PHY_ANAR_REG_ADDR (0x04)
  108. /**
  109. * @brief ANLPAR(Auto-Negotiation Link Partner Ability Register)
  110. *
  111. */
  112. typedef union {
  113. struct {
  114. uint32_t protocol_select : 5; /*!< Link Partner’s binary encoded node selector */
  115. uint32_t base10_t : 1; /*!< 10Base-T support */
  116. uint32_t base10_t_fd : 1; /*!< 10Base-T full duplex support */
  117. uint32_t base100_tx : 1; /*!< 100Base-TX support */
  118. uint32_t base100_tx_fd : 1; /*!< 100Base-TX full duplex support */
  119. uint32_t base100_t4 : 1; /*!< 100Base-T4 support */
  120. uint32_t symmetric_pause : 1; /*!< Symmetric pause supported by Link Partner */
  121. uint32_t asymmetric_pause : 1; /*!< Asymmetric pause supported by Link Partner */
  122. uint32_t reserved : 1; /*!< Reserved */
  123. uint32_t remote_fault : 1; /*!< Link partner is indicating a remote fault */
  124. uint32_t acknowledge : 1; /*!< Acknowledges from link partner */
  125. uint32_t next_page : 1; /*!< Next page indication */
  126. };
  127. uint32_t val;
  128. } anlpar_reg_t;
  129. #define ETH_PHY_ANLPAR_REG_ADDR (0x05)
  130. /**
  131. * @brief ANER(Auto-Negotiate Expansion Register)
  132. *
  133. */
  134. typedef union {
  135. struct {
  136. uint32_t link_partner_auto_nego_able : 1; /*!< Link partner auto-negotiation ability */
  137. uint32_t link_page_received : 1; /*!< Link code word page has received */
  138. uint32_t next_page_able : 1; /*!< Next page ablility */
  139. uint32_t link_partner_next_page_able : 1; /*!< Link partner next page ability */
  140. uint32_t parallel_detection_fault : 1; /*!< Parallel detection fault */
  141. uint32_t reserved : 11; /*!< Reserved */
  142. };
  143. uint32_t val;
  144. } aner_reg_t;
  145. #define ETH_PHY_ANER_REG_ADDR (0x06)
  146. #ifdef __cplusplus
  147. }
  148. #endif