synopGMAC_network_interface.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. * 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. #define NET_IF_TIMEOUT (10*HZ)
  18. #define CHECK_TIME (HZ)
  19. s32 synopGMAC_init_network_interface(char* xname,u64 synopGMACMappedAddr);
  20. void synopGMAC_exit_network_interface(void);
  21. s32 synopGMAC_linux_open(struct eth_device *);
  22. s32 synopGMAC_linux_close(struct eth_device *);
  23. struct net_device_stats * synopGMAC_linux_get_stats(struct synopGMACNetworkAdapter *);
  24. s32 synopGMAC_test(synopGMACdevice * gmacdev_0,synopGMACdevice * gmacdev_1);
  25. void dumpreg(u64 );
  26. void dumpphyreg();
  27. /*
  28. * gethex(vp,p,n)
  29. * convert n hex digits from p to binary, result in vp,
  30. * rtn 1 on success
  31. */
  32. static int gethex(u8 *vp, char *p, int n)
  33. {
  34. u8 v;
  35. int digit;
  36. for (v = 0; n > 0; n--) {
  37. if (*p == 0)
  38. return (0);
  39. if (*p >= '0' && *p <= '9')
  40. digit = *p - '0';
  41. else if (*p >= 'a' && *p <= 'f')
  42. digit = *p - 'a' + 10;
  43. else if (*p >= 'A' && *p <= 'F')
  44. digit = *p - 'A' + 10;
  45. else
  46. return (0);
  47. v <<= 4;
  48. v |= digit;
  49. p++;
  50. }
  51. *vp = v;
  52. return (1);
  53. }
  54. #endif /* End of file */