xadapter.h 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. /*
  2. * Copyright (C) 2007 - 2019 Xilinx, Inc.
  3. * Copyright (C) 2021 WangHuachen.
  4. * All rights reserved.
  5. *
  6. * Redistribution and use in source and binary forms, with or without modification,
  7. * are permitted provided that the following conditions are met:
  8. *
  9. * 1. Redistributions of source code must retain the above copyright notice,
  10. * this list of conditions and the following disclaimer.
  11. * 2. Redistributions in binary form must reproduce the above copyright notice,
  12. * this list of conditions and the following disclaimer in the documentation
  13. * and/or other materials provided with the distribution.
  14. * 3. The name of the author may not be used to endorse or promote products
  15. * derived from this software without specific prior written permission.
  16. *
  17. * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
  18. * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  19. * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
  20. * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  21. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
  22. * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  23. * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  24. * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
  25. * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
  26. * OF SUCH DAMAGE.
  27. *
  28. * This file is part of the lwIP TCP/IP stack.
  29. *
  30. */
  31. #ifndef __XADAPTER_H_
  32. #define __XADAPTER_H_
  33. #ifdef __cplusplus
  34. extern "C" {
  35. #endif
  36. #include "lwipopts.h"
  37. #if !NO_SYS
  38. #ifdef OS_IS_XILKERNEL
  39. #include "xmk.h"
  40. #endif
  41. #include "lwip/sys.h"
  42. #endif
  43. #include "lwip/netif.h"
  44. #include "lwip/ip.h"
  45. #include "netif/xtopology.h"
  46. #include <netif/ethernetif.h>
  47. struct xemac_s {
  48. enum xemac_types type;
  49. int topology_index;
  50. void *state;
  51. #if 0
  52. sys_sem_t sem_rx_data_available;
  53. #else
  54. struct eth_device *rt_eth_device;
  55. #endif
  56. #if defined(OS_IS_FREERTOS) && defined(__arm__) && !defined(ARMR5)
  57. TimerHandle_t xTimer;
  58. #endif
  59. };
  60. enum ethernet_link_status {
  61. ETH_LINK_UNDEFINED = 0,
  62. ETH_LINK_UP,
  63. ETH_LINK_DOWN,
  64. ETH_LINK_NEGOTIATING
  65. };
  66. void eth_link_detect(struct netif *netif);
  67. void lwip_raw_init();
  68. int xemacif_input(struct netif *netif);
  69. void xemacif_input_thread(struct netif *netif);
  70. struct netif * xemac_add(struct netif *netif,
  71. ip_addr_t *ipaddr, ip_addr_t *netmask, ip_addr_t *gw,
  72. unsigned char *mac_ethernet_address,
  73. unsigned mac_baseaddr);
  74. #if defined (__arm__) || defined (__aarch64__)
  75. void xemacpsif_resetrx_on_no_rxdata(struct netif *netif);
  76. #endif
  77. /* global lwip debug variable used for debugging */
  78. extern int lwip_runtime_debug;
  79. #ifdef __cplusplus
  80. }
  81. #endif
  82. #endif