main.c

来自「凌阳单片机之以太网通讯模组模组」· C语言 代码 · 共 87 行

C
87
字号
/*=========================================================================
*  The information contained herein is the exclusive property of Sunplus Technology Co. And shall not
*  be distributed, reproduced, or disclosed in whole in part without prior written permission.
*       (C) Copyright 2003 Sunplus Technology Co. All rights reserved.
*  The entire notice above must be reproduced on all authorized copies
*=========================================================================*/

/*=========================================================================
*  Project name:       
*  Function Description: A simple web server. 
*  Environment:       SUNPLUS u'nSP IDE 1.10.0, SPCE061A EV board
*  Library Dependency:clib100.lib, SacmV25.lib
*  File List:           
*  Author:            Gong Zhigang 
*  Date:              2003-08-10 
*  E-mail:            zhigang@sunnorth.com.cn
*              
*========================================================================*/


#define MAIN
#include "config.h"

struct netif *netif;
extern u16_t tcp_tmr_timeout(void);
extern err_t ethernetif_init(struct netif *netif);
void F_MonitorLoop();

/*-----------------------------------------------------------------------------------*/
int
main(int argc, char **argv)
{
  struct ip_addr ipaddr, netmask, gw,ip;

  char ipstr[] = "lg_2000@eyou.com";
  int i=0;
  int Ret=0;
  System_Initial();
  F_InitTcpTmr();
#ifdef STATS
  stats_init();
#endif /* STATS */

  mem_init();
  memp_init();
  pbuf_init(); 
  netif_init();
  ip_init();
  tcp_init();
 // udp_init();

 // Prompt("please input gateway ip address:\r\n", IP, &gw);
  IP4_ADDR(&gw, 172,20,10,254);
 // Prompt("please input host ip address:\r\n请输入本机ip地址", IP, &ipaddr);  
  IP4_ADDR(&ipaddr, 172,20,8,115);
 // Prompt("please input net mask:\r\n", IP, &netmask);  
 IP4_ADDR(&netmask, 255,255,0,0);
  netif = netif_add(&ipaddr, &netmask, &gw, NULL, ethernetif_init, ip_input);
  netif_set_default(netif);
  httpd_init();
  //dns_init();
//  resolv(&ip,ipstr);
  while(1) {
F_MonitorLoop();
  }

 return 0;
}


void F_MonitorLoop()
{
if (netif!=NULL)
{
u16_t iTemp = lwip_timeout();
Ethernet_poll(netif);
if(iTemp & TCP_TIMEOUT)  tcp_tmr();					
}
}







⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?