drv_eth.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /*
  2. * Copyright (c) 2006-2021, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2021-06-16 songchao first version
  9. * 2021-08-13 songchao add more device info
  10. */
  11. #ifndef __DRV_ETH_H__
  12. #define __DRV_ETH_H__
  13. #include <rtthread.h>
  14. #include <netif/ethernetif.h>
  15. #include "fsl_phy.h"
  16. #include "imx6ull.h"
  17. #include "drv_common.h"
  18. #ifdef __cplusplus
  19. extern "C" {
  20. #endif
  21. #define MAX_ADDR_LEN 6
  22. struct rt_imx6ul_ethps
  23. {
  24. /* inherit from ethernet device */
  25. struct eth_device parent;
  26. /* interface address info, hw address */
  27. rt_uint8_t dev_addr[MAX_ADDR_LEN];
  28. /* ETH_Speed */
  29. uint32_t ETH_Speed;
  30. /* ETH_Duplex_Mode */
  31. uint32_t ETH_Mode;
  32. rt_bool_t phy_link_status;
  33. const char *mac_name;
  34. const char *irq_name;
  35. enum _imx_interrupts irq_num;
  36. uint8_t phy_num;
  37. const ENET_Type *enet_phy_base_addr;
  38. ENET_Type *enet_virtual_base_addr;
  39. uint32_t mac_num;
  40. enet_buffer_config_t buffConfig;
  41. enet_config_t config;
  42. enet_handle_t handle;
  43. struct imx6ull_iomuxc gpio[9];
  44. GPIO_Type *phy_base_addr;
  45. uint32_t phy_gpio_pin;
  46. uint32_t phy_id;
  47. };
  48. int32_t get_instance_by_base(void *base);
  49. #ifdef __cplusplus
  50. }
  51. #endif
  52. #endif /* __DRV_ETH_H__ */