lan8742.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613
  1. /**
  2. ******************************************************************************
  3. * @file lan8742.c
  4. * @author MCD Application Team
  5. * @brief This file provides a set of functions needed to manage the LAN742
  6. * PHY devices.
  7. ******************************************************************************
  8. * @attention
  9. *
  10. * Copyright (c) 2017 STMicroelectronics.
  11. * All rights reserved.
  12. *
  13. * This software is licensed under terms that can be found in the LICENSE file
  14. * in the root directory of this software component.
  15. * If no LICENSE file comes with this software, it is provided AS-IS.
  16. *
  17. ******************************************************************************
  18. */
  19. /* Includes ------------------------------------------------------------------*/
  20. #include "lan8742.h"
  21. /** @addtogroup BSP
  22. * @{
  23. */
  24. /** @addtogroup Component
  25. * @{
  26. */
  27. /** @defgroup LAN8742 LAN8742
  28. * @{
  29. */
  30. /* Private typedef -----------------------------------------------------------*/
  31. /* Private define ------------------------------------------------------------*/
  32. /** @defgroup LAN8742_Private_Defines LAN8742 Private Defines
  33. * @{
  34. */
  35. #define LAN8742_MAX_DEV_ADDR ((uint32_t)31U)
  36. /**
  37. * @}
  38. */
  39. /* Private macro -------------------------------------------------------------*/
  40. /* Private variables ---------------------------------------------------------*/
  41. /* Private function prototypes -----------------------------------------------*/
  42. /* Private functions ---------------------------------------------------------*/
  43. /** @defgroup LAN8742_Private_Functions LAN8742 Private Functions
  44. * @{
  45. */
  46. /**
  47. * @brief Register IO functions to component object
  48. * @param pObj: device object of LAN8742_Object_t.
  49. * @param ioctx: holds device IO functions.
  50. * @retval LAN8742_STATUS_OK if OK
  51. * LAN8742_STATUS_ERROR if missing mandatory function
  52. */
  53. int32_t LAN8742_RegisterBusIO(lan8742_Object_t *pObj, lan8742_IOCtx_t *ioctx)
  54. {
  55. if(!pObj || !ioctx->ReadReg || !ioctx->WriteReg || !ioctx->GetTick)
  56. {
  57. return LAN8742_STATUS_ERROR;
  58. }
  59. pObj->IO.Init = ioctx->Init;
  60. pObj->IO.DeInit = ioctx->DeInit;
  61. pObj->IO.ReadReg = ioctx->ReadReg;
  62. pObj->IO.WriteReg = ioctx->WriteReg;
  63. pObj->IO.GetTick = ioctx->GetTick;
  64. return LAN8742_STATUS_OK;
  65. }
  66. /**
  67. * @brief Initialize the lan8742 and configure the needed hardware resources
  68. * @param pObj: device object LAN8742_Object_t.
  69. * @retval LAN8742_STATUS_OK if OK
  70. * LAN8742_STATUS_ADDRESS_ERROR if cannot find device address
  71. * LAN8742_STATUS_READ_ERROR if cannot read register
  72. */
  73. int32_t LAN8742_Init(lan8742_Object_t *pObj)
  74. {
  75. uint32_t regvalue = 0, addr = 0;
  76. int32_t status = LAN8742_STATUS_OK;
  77. if(pObj->Is_Initialized == 0)
  78. {
  79. if(pObj->IO.Init != 0)
  80. {
  81. /* GPIO and Clocks initialization */
  82. pObj->IO.Init();
  83. }
  84. /* for later check */
  85. pObj->DevAddr = LAN8742_MAX_DEV_ADDR + 1;
  86. /* Get the device address from special mode register */
  87. for(addr = 0; addr <= LAN8742_MAX_DEV_ADDR; addr ++)
  88. {
  89. if(pObj->IO.ReadReg(addr, LAN8742_SMR, &regvalue) < 0)
  90. {
  91. status = LAN8742_STATUS_READ_ERROR;
  92. /* Can't read from this device address
  93. continue with next address */
  94. continue;
  95. }
  96. if((regvalue & LAN8742_SMR_PHY_ADDR) == addr)
  97. {
  98. pObj->DevAddr = addr;
  99. status = LAN8742_STATUS_OK;
  100. break;
  101. }
  102. }
  103. if(pObj->DevAddr > LAN8742_MAX_DEV_ADDR)
  104. {
  105. status = LAN8742_STATUS_ADDRESS_ERROR;
  106. }
  107. /* if device address is matched */
  108. if(status == LAN8742_STATUS_OK)
  109. {
  110. pObj->Is_Initialized = 1;
  111. }
  112. }
  113. return status;
  114. }
  115. /**
  116. * @brief De-Initialize the lan8742 and it's hardware resources
  117. * @param pObj: device object LAN8742_Object_t.
  118. * @retval None
  119. */
  120. int32_t LAN8742_DeInit(lan8742_Object_t *pObj)
  121. {
  122. if(pObj->Is_Initialized)
  123. {
  124. if(pObj->IO.DeInit != 0)
  125. {
  126. if(pObj->IO.DeInit() < 0)
  127. {
  128. return LAN8742_STATUS_ERROR;
  129. }
  130. }
  131. pObj->Is_Initialized = 0;
  132. }
  133. return LAN8742_STATUS_OK;
  134. }
  135. /**
  136. * @brief Disable the LAN8742 power down mode.
  137. * @param pObj: device object LAN8742_Object_t.
  138. * @retval LAN8742_STATUS_OK if OK
  139. * LAN8742_STATUS_READ_ERROR if cannot read register
  140. * LAN8742_STATUS_WRITE_ERROR if cannot write to register
  141. */
  142. int32_t LAN8742_DisablePowerDownMode(lan8742_Object_t *pObj)
  143. {
  144. uint32_t readval = 0;
  145. int32_t status = LAN8742_STATUS_OK;
  146. if(pObj->IO.ReadReg(pObj->DevAddr, LAN8742_BCR, &readval) >= 0)
  147. {
  148. readval &= ~LAN8742_BCR_POWER_DOWN;
  149. /* Apply configuration */
  150. if(pObj->IO.WriteReg(pObj->DevAddr, LAN8742_BCR, readval) < 0)
  151. {
  152. status = LAN8742_STATUS_WRITE_ERROR;
  153. }
  154. }
  155. else
  156. {
  157. status = LAN8742_STATUS_READ_ERROR;
  158. }
  159. return status;
  160. }
  161. /**
  162. * @brief Enable the LAN8742 power down mode.
  163. * @param pObj: device object LAN8742_Object_t.
  164. * @retval LAN8742_STATUS_OK if OK
  165. * LAN8742_STATUS_READ_ERROR if cannot read register
  166. * LAN8742_STATUS_WRITE_ERROR if cannot write to register
  167. */
  168. int32_t LAN8742_EnablePowerDownMode(lan8742_Object_t *pObj)
  169. {
  170. uint32_t readval = 0;
  171. int32_t status = LAN8742_STATUS_OK;
  172. if(pObj->IO.ReadReg(pObj->DevAddr, LAN8742_BCR, &readval) >= 0)
  173. {
  174. readval |= LAN8742_BCR_POWER_DOWN;
  175. /* Apply configuration */
  176. if(pObj->IO.WriteReg(pObj->DevAddr, LAN8742_BCR, readval) < 0)
  177. {
  178. status = LAN8742_STATUS_WRITE_ERROR;
  179. }
  180. }
  181. else
  182. {
  183. status = LAN8742_STATUS_READ_ERROR;
  184. }
  185. return status;
  186. }
  187. /**
  188. * @brief Start the auto negotiation process.
  189. * @param pObj: device object LAN8742_Object_t.
  190. * @retval LAN8742_STATUS_OK if OK
  191. * LAN8742_STATUS_READ_ERROR if cannot read register
  192. * LAN8742_STATUS_WRITE_ERROR if cannot write to register
  193. */
  194. int32_t LAN8742_StartAutoNego(lan8742_Object_t *pObj)
  195. {
  196. uint32_t readval = 0;
  197. int32_t status = LAN8742_STATUS_OK;
  198. if(pObj->IO.ReadReg(pObj->DevAddr, LAN8742_BCR, &readval) >= 0)
  199. {
  200. readval |= LAN8742_BCR_AUTONEGO_EN;
  201. /* Apply configuration */
  202. if(pObj->IO.WriteReg(pObj->DevAddr, LAN8742_BCR, readval) < 0)
  203. {
  204. status = LAN8742_STATUS_WRITE_ERROR;
  205. }
  206. }
  207. else
  208. {
  209. status = LAN8742_STATUS_READ_ERROR;
  210. }
  211. return status;
  212. }
  213. /**
  214. * @brief Get the link state of LAN8742 device.
  215. * @param pObj: Pointer to device object.
  216. * @param pLinkState: Pointer to link state
  217. * @retval LAN8742_STATUS_LINK_DOWN if link is down
  218. * LAN8742_STATUS_AUTONEGO_NOTDONE if Auto nego not completed
  219. * LAN8742_STATUS_100MBITS_FULLDUPLEX if 100Mb/s FD
  220. * LAN8742_STATUS_100MBITS_HALFDUPLEX if 100Mb/s HD
  221. * LAN8742_STATUS_10MBITS_FULLDUPLEX if 10Mb/s FD
  222. * LAN8742_STATUS_10MBITS_HALFDUPLEX if 10Mb/s HD
  223. * LAN8742_STATUS_READ_ERROR if cannot read register
  224. * LAN8742_STATUS_WRITE_ERROR if cannot write to register
  225. */
  226. int32_t LAN8742_GetLinkState(lan8742_Object_t *pObj)
  227. {
  228. uint32_t readval = 0;
  229. /* Read Status register */
  230. if(pObj->IO.ReadReg(pObj->DevAddr, LAN8742_BSR, &readval) < 0)
  231. {
  232. return LAN8742_STATUS_READ_ERROR;
  233. }
  234. /* Read Status register again */
  235. if(pObj->IO.ReadReg(pObj->DevAddr, LAN8742_BSR, &readval) < 0)
  236. {
  237. return LAN8742_STATUS_READ_ERROR;
  238. }
  239. if((readval & LAN8742_BSR_LINK_STATUS) == 0)
  240. {
  241. /* Return Link Down status */
  242. return LAN8742_STATUS_LINK_DOWN;
  243. }
  244. /* Check Auto negotiation */
  245. if(pObj->IO.ReadReg(pObj->DevAddr, LAN8742_BCR, &readval) < 0)
  246. {
  247. return LAN8742_STATUS_READ_ERROR;
  248. }
  249. if((readval & LAN8742_BCR_AUTONEGO_EN) != LAN8742_BCR_AUTONEGO_EN)
  250. {
  251. if(((readval & LAN8742_BCR_SPEED_SELECT) == LAN8742_BCR_SPEED_SELECT) && ((readval & LAN8742_BCR_DUPLEX_MODE) == LAN8742_BCR_DUPLEX_MODE))
  252. {
  253. return LAN8742_STATUS_100MBITS_FULLDUPLEX;
  254. }
  255. else if ((readval & LAN8742_BCR_SPEED_SELECT) == LAN8742_BCR_SPEED_SELECT)
  256. {
  257. return LAN8742_STATUS_100MBITS_HALFDUPLEX;
  258. }
  259. else if ((readval & LAN8742_BCR_DUPLEX_MODE) == LAN8742_BCR_DUPLEX_MODE)
  260. {
  261. return LAN8742_STATUS_10MBITS_FULLDUPLEX;
  262. }
  263. else
  264. {
  265. return LAN8742_STATUS_10MBITS_HALFDUPLEX;
  266. }
  267. }
  268. else /* Auto Nego enabled */
  269. {
  270. if(pObj->IO.ReadReg(pObj->DevAddr, LAN8742_PHYSCSR, &readval) < 0)
  271. {
  272. return LAN8742_STATUS_READ_ERROR;
  273. }
  274. /* Check if auto nego not done */
  275. if((readval & LAN8742_PHYSCSR_AUTONEGO_DONE) == 0)
  276. {
  277. return LAN8742_STATUS_AUTONEGO_NOTDONE;
  278. }
  279. if((readval & LAN8742_PHYSCSR_HCDSPEEDMASK) == LAN8742_PHYSCSR_100BTX_FD)
  280. {
  281. return LAN8742_STATUS_100MBITS_FULLDUPLEX;
  282. }
  283. else if ((readval & LAN8742_PHYSCSR_HCDSPEEDMASK) == LAN8742_PHYSCSR_100BTX_HD)
  284. {
  285. return LAN8742_STATUS_100MBITS_HALFDUPLEX;
  286. }
  287. else if ((readval & LAN8742_PHYSCSR_HCDSPEEDMASK) == LAN8742_PHYSCSR_10BT_FD)
  288. {
  289. return LAN8742_STATUS_10MBITS_FULLDUPLEX;
  290. }
  291. else
  292. {
  293. return LAN8742_STATUS_10MBITS_HALFDUPLEX;
  294. }
  295. }
  296. }
  297. /**
  298. * @brief Set the link state of LAN8742 device.
  299. * @param pObj: Pointer to device object.
  300. * @param pLinkState: link state can be one of the following
  301. * LAN8742_STATUS_100MBITS_FULLDUPLEX if 100Mb/s FD
  302. * LAN8742_STATUS_100MBITS_HALFDUPLEX if 100Mb/s HD
  303. * LAN8742_STATUS_10MBITS_FULLDUPLEX if 10Mb/s FD
  304. * LAN8742_STATUS_10MBITS_HALFDUPLEX if 10Mb/s HD
  305. * @retval LAN8742_STATUS_OK if OK
  306. * LAN8742_STATUS_ERROR if parameter error
  307. * LAN8742_STATUS_READ_ERROR if cannot read register
  308. * LAN8742_STATUS_WRITE_ERROR if cannot write to register
  309. */
  310. int32_t LAN8742_SetLinkState(lan8742_Object_t *pObj, uint32_t LinkState)
  311. {
  312. uint32_t bcrvalue = 0;
  313. int32_t status = LAN8742_STATUS_OK;
  314. if(pObj->IO.ReadReg(pObj->DevAddr, LAN8742_BCR, &bcrvalue) >= 0)
  315. {
  316. /* Disable link config (Auto nego, speed and duplex) */
  317. bcrvalue &= ~(LAN8742_BCR_AUTONEGO_EN | LAN8742_BCR_SPEED_SELECT | LAN8742_BCR_DUPLEX_MODE);
  318. if(LinkState == LAN8742_STATUS_100MBITS_FULLDUPLEX)
  319. {
  320. bcrvalue |= (LAN8742_BCR_SPEED_SELECT | LAN8742_BCR_DUPLEX_MODE);
  321. }
  322. else if (LinkState == LAN8742_STATUS_100MBITS_HALFDUPLEX)
  323. {
  324. bcrvalue |= LAN8742_BCR_SPEED_SELECT;
  325. }
  326. else if (LinkState == LAN8742_STATUS_10MBITS_FULLDUPLEX)
  327. {
  328. bcrvalue |= LAN8742_BCR_DUPLEX_MODE;
  329. }
  330. else
  331. {
  332. /* Wrong link status parameter */
  333. status = LAN8742_STATUS_ERROR;
  334. }
  335. }
  336. else
  337. {
  338. status = LAN8742_STATUS_READ_ERROR;
  339. }
  340. if(status == LAN8742_STATUS_OK)
  341. {
  342. /* Apply configuration */
  343. if(pObj->IO.WriteReg(pObj->DevAddr, LAN8742_BCR, bcrvalue) < 0)
  344. {
  345. status = LAN8742_STATUS_WRITE_ERROR;
  346. }
  347. }
  348. return status;
  349. }
  350. /**
  351. * @brief Enable loopback mode.
  352. * @param pObj: Pointer to device object.
  353. * @retval LAN8742_STATUS_OK if OK
  354. * LAN8742_STATUS_READ_ERROR if cannot read register
  355. * LAN8742_STATUS_WRITE_ERROR if cannot write to register
  356. */
  357. int32_t LAN8742_EnableLoopbackMode(lan8742_Object_t *pObj)
  358. {
  359. uint32_t readval = 0;
  360. int32_t status = LAN8742_STATUS_OK;
  361. if(pObj->IO.ReadReg(pObj->DevAddr, LAN8742_BCR, &readval) >= 0)
  362. {
  363. readval |= LAN8742_BCR_LOOPBACK;
  364. /* Apply configuration */
  365. if(pObj->IO.WriteReg(pObj->DevAddr, LAN8742_BCR, readval) < 0)
  366. {
  367. status = LAN8742_STATUS_WRITE_ERROR;
  368. }
  369. }
  370. else
  371. {
  372. status = LAN8742_STATUS_READ_ERROR;
  373. }
  374. return status;
  375. }
  376. /**
  377. * @brief Disable loopback mode.
  378. * @param pObj: Pointer to device object.
  379. * @retval LAN8742_STATUS_OK if OK
  380. * LAN8742_STATUS_READ_ERROR if cannot read register
  381. * LAN8742_STATUS_WRITE_ERROR if cannot write to register
  382. */
  383. int32_t LAN8742_DisableLoopbackMode(lan8742_Object_t *pObj)
  384. {
  385. uint32_t readval = 0;
  386. int32_t status = LAN8742_STATUS_OK;
  387. if(pObj->IO.ReadReg(pObj->DevAddr, LAN8742_BCR, &readval) >= 0)
  388. {
  389. readval &= ~LAN8742_BCR_LOOPBACK;
  390. /* Apply configuration */
  391. if(pObj->IO.WriteReg(pObj->DevAddr, LAN8742_BCR, readval) < 0)
  392. {
  393. status = LAN8742_STATUS_WRITE_ERROR;
  394. }
  395. }
  396. else
  397. {
  398. status = LAN8742_STATUS_READ_ERROR;
  399. }
  400. return status;
  401. }
  402. /**
  403. * @brief Enable IT source.
  404. * @param pObj: Pointer to device object.
  405. * @param Interrupt: IT source to be enabled
  406. * should be a value or a combination of the following:
  407. * LAN8742_WOL_IT
  408. * LAN8742_ENERGYON_IT
  409. * LAN8742_AUTONEGO_COMPLETE_IT
  410. * LAN8742_REMOTE_FAULT_IT
  411. * LAN8742_LINK_DOWN_IT
  412. * LAN8742_AUTONEGO_LP_ACK_IT
  413. * LAN8742_PARALLEL_DETECTION_FAULT_IT
  414. * LAN8742_AUTONEGO_PAGE_RECEIVED_IT
  415. * @retval LAN8742_STATUS_OK if OK
  416. * LAN8742_STATUS_READ_ERROR if cannot read register
  417. * LAN8742_STATUS_WRITE_ERROR if cannot write to register
  418. */
  419. int32_t LAN8742_EnableIT(lan8742_Object_t *pObj, uint32_t Interrupt)
  420. {
  421. uint32_t readval = 0;
  422. int32_t status = LAN8742_STATUS_OK;
  423. if(pObj->IO.ReadReg(pObj->DevAddr, LAN8742_IMR, &readval) >= 0)
  424. {
  425. readval |= Interrupt;
  426. /* Apply configuration */
  427. if(pObj->IO.WriteReg(pObj->DevAddr, LAN8742_IMR, readval) < 0)
  428. {
  429. status = LAN8742_STATUS_WRITE_ERROR;
  430. }
  431. }
  432. else
  433. {
  434. status = LAN8742_STATUS_READ_ERROR;
  435. }
  436. return status;
  437. }
  438. /**
  439. * @brief Disable IT source.
  440. * @param pObj: Pointer to device object.
  441. * @param Interrupt: IT source to be disabled
  442. * should be a value or a combination of the following:
  443. * LAN8742_WOL_IT
  444. * LAN8742_ENERGYON_IT
  445. * LAN8742_AUTONEGO_COMPLETE_IT
  446. * LAN8742_REMOTE_FAULT_IT
  447. * LAN8742_LINK_DOWN_IT
  448. * LAN8742_AUTONEGO_LP_ACK_IT
  449. * LAN8742_PARALLEL_DETECTION_FAULT_IT
  450. * LAN8742_AUTONEGO_PAGE_RECEIVED_IT
  451. * @retval LAN8742_STATUS_OK if OK
  452. * LAN8742_STATUS_READ_ERROR if cannot read register
  453. * LAN8742_STATUS_WRITE_ERROR if cannot write to register
  454. */
  455. int32_t LAN8742_DisableIT(lan8742_Object_t *pObj, uint32_t Interrupt)
  456. {
  457. uint32_t readval = 0;
  458. int32_t status = LAN8742_STATUS_OK;
  459. if(pObj->IO.ReadReg(pObj->DevAddr, LAN8742_IMR, &readval) >= 0)
  460. {
  461. readval &= ~Interrupt;
  462. /* Apply configuration */
  463. if(pObj->IO.WriteReg(pObj->DevAddr, LAN8742_IMR, readval) < 0)
  464. {
  465. status = LAN8742_STATUS_WRITE_ERROR;
  466. }
  467. }
  468. else
  469. {
  470. status = LAN8742_STATUS_READ_ERROR;
  471. }
  472. return status;
  473. }
  474. /**
  475. * @brief Clear IT flag.
  476. * @param pObj: Pointer to device object.
  477. * @param Interrupt: IT flag to be cleared
  478. * should be a value or a combination of the following:
  479. * LAN8742_WOL_IT
  480. * LAN8742_ENERGYON_IT
  481. * LAN8742_AUTONEGO_COMPLETE_IT
  482. * LAN8742_REMOTE_FAULT_IT
  483. * LAN8742_LINK_DOWN_IT
  484. * LAN8742_AUTONEGO_LP_ACK_IT
  485. * LAN8742_PARALLEL_DETECTION_FAULT_IT
  486. * LAN8742_AUTONEGO_PAGE_RECEIVED_IT
  487. * @retval LAN8742_STATUS_OK if OK
  488. * LAN8742_STATUS_READ_ERROR if cannot read register
  489. */
  490. int32_t LAN8742_ClearIT(lan8742_Object_t *pObj, uint32_t Interrupt)
  491. {
  492. uint32_t readval = 0;
  493. int32_t status = LAN8742_STATUS_OK;
  494. if(pObj->IO.ReadReg(pObj->DevAddr, LAN8742_ISFR, &readval) < 0)
  495. {
  496. status = LAN8742_STATUS_READ_ERROR;
  497. }
  498. return status;
  499. }
  500. /**
  501. * @brief Get IT Flag status.
  502. * @param pObj: Pointer to device object.
  503. * @param Interrupt: IT Flag to be checked,
  504. * should be a value or a combination of the following:
  505. * LAN8742_WOL_IT
  506. * LAN8742_ENERGYON_IT
  507. * LAN8742_AUTONEGO_COMPLETE_IT
  508. * LAN8742_REMOTE_FAULT_IT
  509. * LAN8742_LINK_DOWN_IT
  510. * LAN8742_AUTONEGO_LP_ACK_IT
  511. * LAN8742_PARALLEL_DETECTION_FAULT_IT
  512. * LAN8742_AUTONEGO_PAGE_RECEIVED_IT
  513. * @retval 1 IT flag is SET
  514. * 0 IT flag is RESET
  515. * LAN8742_STATUS_READ_ERROR if cannot read register
  516. */
  517. int32_t LAN8742_GetITStatus(lan8742_Object_t *pObj, uint32_t Interrupt)
  518. {
  519. uint32_t readval = 0;
  520. int32_t status = 0;
  521. if(pObj->IO.ReadReg(pObj->DevAddr, LAN8742_ISFR, &readval) >= 0)
  522. {
  523. status = ((readval & Interrupt) == Interrupt);
  524. }
  525. else
  526. {
  527. status = LAN8742_STATUS_READ_ERROR;
  528. }
  529. return status;
  530. }
  531. /**
  532. * @}
  533. */
  534. /**
  535. * @}
  536. */
  537. /**
  538. * @}
  539. */
  540. /**
  541. * @}
  542. */