synopGMAC_network_interface.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. /** \file
  2. * Header file for the nework dependent functionality.
  3. * The function prototype listed here are linux dependent.
  4. *
  5. * \internal
  6. * ---------------------------REVISION HISTORY-------------------
  7. * Synopsys 01/Aug/2007 Created
  8. */
  9. /*
  10. * File : synopGMAC_network_interface.h
  11. * This file is part of RT-Thread RTOS
  12. * COPYRIGHT (C) chinesebear
  13. *
  14. * This program is free software; you can redistribute it and/or modify
  15. * it under the terms of the GNU General Public License as published by
  16. * the Free Software Foundation; either version 2 of the License, or
  17. * (at your option) any later version.
  18. *
  19. * This program is distributed in the hope that it will be useful,
  20. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  21. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  22. * GNU General Public License for more details.
  23. *
  24. * You should have received a copy of the GNU General Public License along
  25. * with this program; if not, write to the Free Software Foundation, Inc.,
  26. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  27. *
  28. * Change Logs:
  29. * Date Author Notes
  30. * 2017-08-24 chinesebear first version
  31. */
  32. #ifndef SYNOP_GMAC_NETWORK_INTERFACE_H
  33. #define SYNOP_GMAC_NETWORK_INTERFACE_H 1
  34. #include <lwip/sys.h>
  35. #include <netif/ethernetif.h>
  36. #include "synopGMAC_plat.h"
  37. #include "synopGMAC_Host.h"
  38. #include "synopGMAC_Dev.h"
  39. //#include <common.h>
  40. //#include <net.h>
  41. //#include <linux/stddef.h>
  42. #define NET_IF_TIMEOUT (10*HZ)
  43. #define CHECK_TIME (HZ)
  44. s32 synopGMAC_init_network_interface(char* xname,u64 synopGMACMappedAddr);
  45. void synopGMAC_exit_network_interface(void);
  46. s32 synopGMAC_linux_open(struct eth_device *);
  47. s32 synopGMAC_linux_close(struct eth_device *);
  48. //s32 synopGMAC_linux_xmit_frames(struct ifnet *);
  49. struct net_device_stats * synopGMAC_linux_get_stats(struct synopGMACNetworkAdapter *);
  50. //void synopGMAC_linux_set_multicast_list(struct net_device *);
  51. //s32 synopGMAC_linux_set_mac_address(struct synopGMACNetwokrAdapter*,void *);
  52. //s32 synopGMAC_linux_change_mtu(struct net_device *,s32);
  53. //s32 synopGMAC_linux_do_ioctl(struct ifnet *,struct ifreq *,s32);
  54. //void synopGMAC_linux_tx_timeout(struct net_device *);
  55. s32 synopGMAC_test(synopGMACdevice * gmacdev_0,synopGMACdevice * gmacdev_1);
  56. void dumpreg(u64 );
  57. void dumpphyreg();
  58. /*
  59. * gethex(vp,p,n)
  60. * convert n hex digits from p to binary, result in vp,
  61. * rtn 1 on success
  62. */
  63. static int gethex(u8 *vp, char *p, int n)
  64. {
  65. u8 v;
  66. int digit;
  67. for (v = 0; n > 0; n--) {
  68. if (*p == 0)
  69. return (0);
  70. if (*p >= '0' && *p <= '9')
  71. digit = *p - '0';
  72. else if (*p >= 'a' && *p <= 'f')
  73. digit = *p - 'a' + 10;
  74. else if (*p >= 'A' && *p <= 'F')
  75. digit = *p - 'A' + 10;
  76. else
  77. return (0);
  78. v <<= 4;
  79. v |= digit;
  80. p++;
  81. }
  82. *vp = v;
  83. return (1);
  84. }
  85. #endif /* End of file */