synopGMAC_network_interface.h 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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 "synopGMAC_plat.h"
  35. #include "synopGMAC_Host.h"
  36. #include "synopGMAC_Dev.h"
  37. //#include <common.h>
  38. //#include <net.h>
  39. //#include <linux/stddef.h>
  40. #define NET_IF_TIMEOUT (10*HZ)
  41. #define CHECK_TIME (HZ)
  42. s32 synopGMAC_init_network_interface(char* xname,u64 synopGMACMappedAddr);
  43. void synopGMAC_exit_network_interface(void);
  44. s32 synopGMAC_linux_open(struct eth_device *);
  45. s32 synopGMAC_linux_close(struct eth_device *);
  46. //s32 synopGMAC_linux_xmit_frames(struct ifnet *);
  47. struct net_device_stats * synopGMAC_linux_get_stats(struct synopGMACNetworkAdapter *);
  48. //void synopGMAC_linux_set_multicast_list(struct net_device *);
  49. //s32 synopGMAC_linux_set_mac_address(struct synopGMACNetwokrAdapter*,void *);
  50. //s32 synopGMAC_linux_change_mtu(struct net_device *,s32);
  51. //s32 synopGMAC_linux_do_ioctl(struct ifnet *,struct ifreq *,s32);
  52. //void synopGMAC_linux_tx_timeout(struct net_device *);
  53. s32 synopGMAC_test(synopGMACdevice * gmacdev_0,synopGMACdevice * gmacdev_1);
  54. void dumpreg(u64 );
  55. void dumpphyreg();
  56. /*
  57. * gethex(vp,p,n)
  58. * convert n hex digits from p to binary, result in vp,
  59. * rtn 1 on success
  60. */
  61. static int gethex(u8 *vp, char *p, int n)
  62. {
  63. u8 v;
  64. int digit;
  65. for (v = 0; n > 0; n--) {
  66. if (*p == 0)
  67. return (0);
  68. if (*p >= '0' && *p <= '9')
  69. digit = *p - '0';
  70. else if (*p >= 'a' && *p <= 'f')
  71. digit = *p - 'a' + 10;
  72. else if (*p >= 'A' && *p <= 'F')
  73. digit = *p - 'A' + 10;
  74. else
  75. return (0);
  76. v <<= 4;
  77. v |= digit;
  78. p++;
  79. }
  80. *vp = v;
  81. return (1);
  82. }
  83. #endif /* End of file */