在线咨询
eetop公众号 创芯大讲堂 创芯人才网
切换到宽版

EETOP 创芯网论坛 (原名:电子顶级开发网)

手机号码,快捷登录

手机号码,快捷登录

找回密码

  登录   注册  

快捷导航
搜帖子
查看: 3453|回复: 1

FPGA,xilinx,edk利用lwip协议实现以太网数据传输,xemac_add()处停止,没有报错

[复制链接]
发表于 2016-1-11 09:23:13 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?注册

x
本帖最后由 huoyanchang 于 2016-1-11 09:28 编辑

运行时老是停在xemac_add(echo_netif, &ipaddr, &netmask,&gw, mac_ethernet_address,PLATFORM_EMAC_BASEADDR)部分,在debug下调试,没有报错,也没有现象,求大神解救




  1. #include <stdio.h>

  2. #include "xparameters.h"

  3. #include "netif/xadapter.h"

  4. #include "platform.h"
  5. #include "platform_config.h"
  6. #ifdef __arm__
  7. #include "xil_printf.h"
  8. #endif

  9. /* defined by each RAW mode application */
  10. void print_app_header();
  11. int start_application();
  12. int transfer_data();

  13. /* missing declaration in lwIP */
  14. void lwip_init();

  15. static struct netif server_netif;
  16. struct netif *echo_netif;

  17. void
  18. print_ip(char *msg, struct ip_addr *ip)
  19. {
  20.         print(msg);
  21.         xil_printf("%d.%d.%d.%d\n\r", ip4_addr1(ip), ip4_addr2(ip),
  22.                         ip4_addr3(ip), ip4_addr4(ip));
  23. }

  24. void
  25. print_ip_settings(struct ip_addr *ip, struct ip_addr *mask, struct ip_addr *gw)
  26. {

  27.         print_ip("Board IP: ", ip);
  28.         print_ip("Netmask : ", mask);
  29.         print_ip("Gateway : ", gw);
  30. }

  31. int main()
  32. {
  33.         struct ip_addr ipaddr, netmask, gw;

  34.         /* the mac address of the board. this should be unique per board */
  35.         unsigned char mac_ethernet_address[] =
  36.         { 0x00, 0x0a, 0x35, 0x00, 0x01, 0x02 };

  37.         echo_netif = &server_netif;

  38.         init_platform();

  39.         /* initliaze IP addresses to be used */
  40.         IP4_ADDR(&ipaddr,  192, 168,   1, 10);
  41.         IP4_ADDR(&netmask, 255, 255, 255,  0);
  42.         IP4_ADDR(&gw,      192, 168,   1,  1);

  43.         print_app_header();
  44.         print_ip_settings(&ipaddr, &netmask, &gw);

  45.         lwip_init();

  46.           /* Add network interface to the netif_list, and set it as default */
  47.         if (!xemac_add(echo_netif, &ipaddr, &netmask,
  48.                                                 &gw, mac_ethernet_address,
  49.                                                 PLATFORM_EMAC_BASEADDR)) {
  50.                 xil_printf("Error adding N/W interface\n\r");
  51.                 return -1;
  52.         }
  53.         netif_set_default(echo_netif);

  54.         /* Create a new DHCP client for this interface.
  55.          * Note: you must call dhcp_fine_tmr() and dhcp_coarse_tmr() at
  56.          * the predefined regular intervals after starting the client.
  57.          */
  58.         /* dhcp_start(echo_netif); */

  59.         /* now enable interrupts */
  60.         platform_enable_interrupts();

  61.         /* specify that the network if is up */
  62.         netif_set_up(echo_netif);

  63.         /* start the application (web server, rxtest, txtest, etc..) */
  64.         start_application();

  65.         /* receive and process packets */
  66.         while (1) {
  67.                 xemacif_input(echo_netif);
  68.                 transfer_data();
  69.         }
  70.   
  71.         /* never reached */
  72.         cleanup_platform();

  73.         return 0;
  74. }



复制代码
发表于 2016-9-27 16:37:02 | 显示全部楼层
最近正在做这个,不知道你的问题解决了吗?
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

站长推荐 上一条 /2 下一条

小黑屋| 关于我们| 联系我们| 在线咨询| 隐私声明| EETOP 创芯网
( 京ICP备:10050787号 京公网安备:11010502037710 )

GMT+8, 2024-5-27 20:31 , Processed in 0.017972 second(s), 9 queries , Gzip On, Redis On.

eetop公众号 创芯大讲堂 创芯人才网
快速回复 返回顶部 返回列表