synopGMAC_network_interface.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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. #ifndef SYNOP_GMAC_NETWORK_INTERFACE_H
  10. #define SYNOP_GMAC_NETWORK_INTERFACE_H 1
  11. #include "synopGMAC_plat.h"
  12. #include "synopGMAC_Host.h"
  13. #include "synopGMAC_Dev.h"
  14. //#include <common.h>
  15. //#include <net.h>
  16. //#include <linux/stddef.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. //s32 synopGMAC_linux_xmit_frames(struct ifnet *);
  24. struct net_device_stats * synopGMAC_linux_get_stats(struct synopGMACNetworkAdapter *);
  25. //void synopGMAC_linux_set_multicast_list(struct net_device *);
  26. //s32 synopGMAC_linux_set_mac_address(struct synopGMACNetwokrAdapter*,void *);
  27. //s32 synopGMAC_linux_change_mtu(struct net_device *,s32);
  28. //s32 synopGMAC_linux_do_ioctl(struct ifnet *,struct ifreq *,s32);
  29. //void synopGMAC_linux_tx_timeout(struct net_device *);
  30. s32 synopGMAC_test(synopGMACdevice * gmacdev_0,synopGMACdevice * gmacdev_1);
  31. void dumpreg(u64 );
  32. void dumpphyreg();
  33. /*
  34. * gethex(vp,p,n)
  35. * convert n hex digits from p to binary, result in vp,
  36. * rtn 1 on success
  37. */
  38. static int gethex(u8 *vp, char *p, int n)
  39. {
  40. u8 v;
  41. int digit;
  42. for (v = 0; n > 0; n--) {
  43. if (*p == 0)
  44. return (0);
  45. if (*p >= '0' && *p <= '9')
  46. digit = *p - '0';
  47. else if (*p >= 'a' && *p <= 'f')
  48. digit = *p - 'a' + 10;
  49. else if (*p >= 'A' && *p <= 'F')
  50. digit = *p - 'A' + 10;
  51. else
  52. return (0);
  53. v <<= 4;
  54. v |= digit;
  55. p++;
  56. }
  57. *vp = v;
  58. return (1);
  59. }
  60. #endif /* End of file */