IxEthMii.h 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  1. /**
  2. * @file IxEthMii.h
  3. *
  4. * @brief this file contains the public API of @ref IxEthMii component
  5. *
  6. * Design notes :
  7. * The main intent of this API is to inplement MII high level fonctionalitoes
  8. * to support the codelets provided with the IXP400 software releases. It
  9. * superceedes previous interfaces provided with @ref IxEThAcc component.
  10. *
  11. * This API has been tested with the PHYs provided with the
  12. * IXP400 development platforms. It may not work for specific Ethernet PHYs
  13. * used on specific boards.
  14. *
  15. * This source code detects and interface the LXT972, LXT973 and KS6995
  16. * Ethernet PHYs.
  17. *
  18. * This source code should be considered as an example which may need
  19. * to be adapted for different hardware implementations.
  20. *
  21. * It is strongly recommended to use public domain and GPL utilities
  22. * like libmii, mii-diag for MII interface support.
  23. *
  24. *
  25. *
  26. * @par
  27. * IXP400 SW Release version 2.0
  28. *
  29. * -- Copyright Notice --
  30. *
  31. * @par
  32. * Copyright 2001-2005, Intel Corporation.
  33. * All rights reserved.
  34. *
  35. * @par
  36. * SPDX-License-Identifier: BSD-3-Clause
  37. * @par
  38. * -- End of Copyright Notice --
  39. */
  40. #ifndef IxEthMii_H
  41. #define IxEthMii_H
  42. #include <IxTypes.h>
  43. /**
  44. * @defgroup IxEthMii IXP400 Ethernet Phy Access (IxEthMii) API
  45. *
  46. * @brief ethMii is a library that does provides access to the
  47. * Ethernet PHYs
  48. *
  49. *@{
  50. */
  51. /**
  52. * @ingroup IxEthMii
  53. *
  54. * @fn ixEthMiiPhyScan(BOOL phyPresent[], UINT32 maxPhyCount)
  55. *
  56. * @brief Scan the MDIO bus for PHYs
  57. * This function scans PHY addresses 0 through 31, and sets phyPresent[n] to
  58. * true if a phy is discovered at address n.
  59. *
  60. * - Reentrant - no
  61. * - ISR Callable - no
  62. *
  63. * @pre The MAC on Ethernet Port 2 (NPE C) must be initialised, and generating the MDIO clock.
  64. *
  65. * @param phyPresent BOOL [in] - boolean array of IXP425_ETH_ACC_MII_MAX_ADDR entries
  66. * @param maxPhyCount UINT32 [in] - number of PHYs to search for (the scan will stop when
  67. * the indicated number of PHYs is found).
  68. *
  69. * @return IX_STATUS
  70. * - IX_ETH_ACC_SUCCESS
  71. * - IX_ETH_ACC_FAIL : invalid arguments.
  72. *
  73. * <hr>
  74. */
  75. PUBLIC IX_STATUS ixEthMiiPhyScan(BOOL phyPresent[], UINT32 maxPhyCount);
  76. /**
  77. * @ingroup IxEthMii
  78. *
  79. * @fn ixEthMiiPhyConfig(UINT32 phyAddr,
  80. BOOL speed100,
  81. BOOL fullDuplex,
  82. BOOL autonegotiate)
  83. *
  84. *
  85. * @brief Configure a PHY
  86. * Configure a PHY's speed, duplex and autonegotiation status
  87. *
  88. * - Reentrant - no
  89. * - ISR Callable - no
  90. *
  91. * @pre The MAC on Ethernet Port 2 (NPE C) must be initialised, and generating the MDIO clock.
  92. *
  93. * @param phyAddr UINT32 [in]
  94. * @param speed100 BOOL [in] - set to true for 100Mbit/s operation, false for 10Mbit/s
  95. * @param fullDuplex BOOL [in] - set to true for Full Duplex, false for Half Duplex
  96. * @param autonegotiate BOOL [in] - set to true to enable autonegotiation
  97. *
  98. * @return IX_STATUS
  99. * - IX_SUCCESS
  100. * - IX_FAIL : invalid arguments.
  101. *
  102. * <hr>
  103. */
  104. PUBLIC IX_STATUS ixEthMiiPhyConfig(UINT32 phyAddr,
  105. BOOL speed100,
  106. BOOL fullDuplex,
  107. BOOL autonegotiate);
  108. /**
  109. * @ingroup IxEthMii
  110. *
  111. * @fn ixEthMiiPhyLoopbackEnable(UINT32 phyAddr)
  112. *
  113. *
  114. * @brief Enable PHY Loopback in a specific Eth MII port
  115. *
  116. * @note When PHY Loopback is enabled, frames sent out to the PHY from the
  117. * IXP400 will be looped back to the IXP400. They will not be transmitted out
  118. * on the wire.
  119. *
  120. * - Reentrant - no
  121. * - ISR Callable - no
  122. *
  123. * @param phyAddr UINT32 [in] - the address of the Ethernet PHY (0-31)
  124. *
  125. * @return IX_STATUS
  126. * - IX_SUCCESS
  127. * - IX_FAIL : invalid arguments.
  128. * <hr>
  129. */
  130. PUBLIC IX_STATUS
  131. ixEthMiiPhyLoopbackEnable (UINT32 phyAddr);
  132. /**
  133. * @ingroup IxEthMii
  134. *
  135. * @fn ixEthMiiPhyLoopbackDisable(UINT32 phyAddr)
  136. *
  137. *
  138. * @brief Disable PHY Loopback in a specific Eth MII port
  139. *
  140. * - Reentrant - no
  141. * - ISR Callable - no
  142. *
  143. * @param phyAddr UINT32 [in] - the address of the Ethernet PHY (0-31)
  144. *
  145. * @return IX_STATUS
  146. * - IX_SUCCESS
  147. * - IX_FAIL : invalid arguments.
  148. * <hr>
  149. */
  150. PUBLIC IX_STATUS
  151. ixEthMiiPhyLoopbackDisable (UINT32 phyAddr);
  152. /**
  153. * @ingroup IxEthMii
  154. *
  155. * @fn ixEthMiiPhyReset(UINT32 phyAddr)
  156. *
  157. * @brief Reset a PHY
  158. * Reset a PHY
  159. *
  160. * - Reentrant - no
  161. * - ISR Callable - no
  162. *
  163. * @pre The MAC on Ethernet Port 2 (NPE C) must be initialised, and generating the MDIO clock.
  164. *
  165. * @param phyAddr UINT32 [in] - the address of the Ethernet PHY (0-31)
  166. *
  167. * @return IX_STATUS
  168. * - IX_SUCCESS
  169. * - IX_FAIL : invalid arguments.
  170. *
  171. * <hr>
  172. */
  173. PUBLIC IX_STATUS ixEthMiiPhyReset(UINT32 phyAddr);
  174. /**
  175. * @ingroup IxEthMii
  176. *
  177. * @fn ixEthMiiLinkStatus(UINT32 phyAddr,
  178. BOOL *linkUp,
  179. BOOL *speed100,
  180. BOOL *fullDuplex,
  181. BOOL *autoneg)
  182. *
  183. * @brief Retrieve the current status of a PHY
  184. * Retrieve the link, speed, duplex and autonegotiation status of a PHY
  185. *
  186. * - Reentrant - no
  187. * - ISR Callable - no
  188. *
  189. * @pre The MAC on Ethernet Port 2 (NPE C) must be initialised, and generating the MDIO clock.
  190. *
  191. * @param phyAddr UINT32 [in] - the address of the Ethernet PHY (0-31)
  192. * @param linkUp BOOL [out] - set to true if the link is up
  193. * @param speed100 BOOL [out] - set to true indicates 100Mbit/s, false indicates 10Mbit/s
  194. * @param fullDuplex BOOL [out] - set to true indicates Full Duplex, false indicates Half Duplex
  195. * @param autoneg BOOL [out] - set to true indicates autonegotiation is enabled, false indicates autonegotiation is disabled
  196. *
  197. * @return IX_STATUS
  198. * - IX_SUCCESS
  199. * - IX_FAIL : invalid arguments.
  200. *
  201. * <hr>
  202. */
  203. PUBLIC IX_STATUS ixEthMiiLinkStatus(UINT32 phyAddr,
  204. BOOL *linkUp,
  205. BOOL *speed100,
  206. BOOL *fullDuplex,
  207. BOOL *autoneg);
  208. /**
  209. * @ingroup IxEthMii
  210. *
  211. * @fn ixEthMiiPhyShow (UINT32 phyAddr)
  212. *
  213. *
  214. * @brief Display information on a specified PHY
  215. * Display link status, speed, duplex and Auto Negotiation status
  216. *
  217. * - Reentrant - no
  218. * - ISR Callable - no
  219. *
  220. * @pre The MAC on Ethernet Port 2 (NPE C) must be initialised, and generating the MDIO clock.
  221. *
  222. * @param phyAddr UINT32 [in] - the address of the Ethernet PHY (0-31)
  223. *
  224. * @return IX_STATUS
  225. * - IX_SUCCESS
  226. * - IX_FAIL : invalid arguments.
  227. *
  228. * <hr>
  229. */
  230. PUBLIC IX_STATUS ixEthMiiPhyShow (UINT32 phyAddr);
  231. #endif /* ndef IxEthMii_H */
  232. /**
  233. *@}
  234. */