synopGMAC_network_interface.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /*
  2. * Copyright (c) 2006-2022, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2017-08-24 chinesebear first version
  9. */
  10. #ifndef SYNOP_GMAC_NETWORK_INTERFACE_H
  11. #define SYNOP_GMAC_NETWORK_INTERFACE_H 1
  12. #include <lwip/sys.h>
  13. #include <netif/ethernetif.h>
  14. #include "synopGMAC_plat.h"
  15. #include "synopGMAC_Host.h"
  16. #include "synopGMAC_Dev.h"
  17. //#include <common.h>
  18. //#include <net.h>
  19. //#include <linux/stddef.h>
  20. #define NET_IF_TIMEOUT (10*HZ)
  21. #define CHECK_TIME (HZ)
  22. s32 synopGMAC_init_network_interface(char* xname,u64 synopGMACMappedAddr);
  23. void synopGMAC_exit_network_interface(void);
  24. s32 synopGMAC_linux_open(struct eth_device *);
  25. s32 synopGMAC_linux_close(struct eth_device *);
  26. //s32 synopGMAC_linux_xmit_frames(struct ifnet *);
  27. struct net_device_stats * synopGMAC_linux_get_stats(struct synopGMACNetworkAdapter *);
  28. //void synopGMAC_linux_set_multicast_list(struct net_device *);
  29. //s32 synopGMAC_linux_set_mac_address(struct synopGMACNetwokrAdapter*,void *);
  30. //s32 synopGMAC_linux_change_mtu(struct net_device *,s32);
  31. //s32 synopGMAC_linux_do_ioctl(struct ifnet *,struct ifreq *,s32);
  32. //void synopGMAC_linux_tx_timeout(struct net_device *);
  33. s32 synopGMAC_test(synopGMACdevice * gmacdev_0,synopGMACdevice * gmacdev_1);
  34. void dumpreg(u64 );
  35. void dumpphyreg();
  36. /*
  37. * gethex(vp,p,n)
  38. * convert n hex digits from p to binary, result in vp,
  39. * rtn 1 on success
  40. */
  41. static int gethex(u8 *vp, char *p, int n)
  42. {
  43. u8 v;
  44. int digit;
  45. for (v = 0; n > 0; n--) {
  46. if (*p == 0)
  47. return (0);
  48. if (*p >= '0' && *p <= '9')
  49. digit = *p - '0';
  50. else if (*p >= 'a' && *p <= 'f')
  51. digit = *p - 'a' + 10;
  52. else if (*p >= 'A' && *p <= 'F')
  53. digit = *p - 'A' + 10;
  54. else
  55. return (0);
  56. v <<= 4;
  57. v |= digit;
  58. p++;
  59. }
  60. *vp = v;
  61. return (1);
  62. }
  63. #endif /* End of file */