drv_eth.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /*
  2. * Copyright (c) 2006-2018, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2018-12-25 zylx first version
  9. */
  10. #ifndef __DRV_ETH_H__
  11. #define __DRV_ETH_H__
  12. #include <rtthread.h>
  13. #include <rthw.h>
  14. #include <rtdevice.h>
  15. #include <board.h>
  16. /* The PHY basic control register */
  17. #define PHY_BASIC_CONTROL_REG 0x00U
  18. #define PHY_RESET_MASK (1<<15)
  19. #define PHY_AUTO_NEGOTIATION_MASK (1<<12)
  20. /* The PHY basic status register */
  21. #define PHY_BASIC_STATUS_REG 0x01U
  22. #define PHY_LINKED_STATUS_MASK (1<<2)
  23. #define PHY_AUTONEGO_COMPLETE_MASK (1<<5)
  24. /* The PHY ID one register */
  25. #define PHY_ID1_REG 0x02U
  26. /* The PHY ID two register */
  27. #define PHY_ID2_REG 0x03U
  28. /* The PHY auto-negotiate advertise register */
  29. #define PHY_AUTONEG_ADVERTISE_REG 0x04U
  30. #ifdef PHY_USING_LAN8720A
  31. /* The PHY interrupt source flag register. */
  32. #define PHY_INTERRUPT_FLAG_REG 0x1DU
  33. /* The PHY interrupt mask register. */
  34. #define PHY_INTERRUPT_MSAK_REG 0x1EU
  35. #define PHY_LINK_DOWN_MASK (1<<4)
  36. #define PHY_AUTO_NEGO_COMPLETE_MASK (1<<6)
  37. /* The PHY status register. */
  38. #define PHY_Status_REG 0x1FU
  39. #define PHY_10M_MASK (1<<2)
  40. #define PHY_100M_MASK (1<<3)
  41. #define PHY_FULL_DUPLEX_MASK (1<<4)
  42. #endif /* PHY_USING_LAN8720A */
  43. #ifdef PHY_USING_DM9161CEP
  44. #define PHY_Status_REG 0x11U
  45. #define PHY_10M_MASK ((1<<12) || (1<<13))
  46. #define PHY_100M_MASK ((1<<14) || (1<<15))
  47. #define PHY_FULL_DUPLEX_MASK ((1<<15) || (1<<13))
  48. /* The PHY interrupt source flag register. */
  49. #define PHY_INTERRUPT_FLAG_REG 0x15U
  50. /* The PHY interrupt mask register. */
  51. #define PHY_INTERRUPT_MSAK_REG 0x15U
  52. #define PHY_LINK_CHANGE_FLAG (1<<2)
  53. #define PHY_LINK_CHANGE_MASK (1<<9)
  54. #define PHY_INT_MASK 0
  55. #endif /* PHY_USING_DM9161CEP */
  56. #endif /* __DRV_ETH_H__ */