void hello_world_main (void) {
	HelloWorld* app = NULL;
	HelloWorld* _tmp0_ = NULL;
	HelloWorld* _tmp1_ = NULL;
	gboolean _tmp2_ = FALSE;
	_tmp0_ = hello_world_new ();
	app = _tmp0_;
	_tmp1_ = app;
	_tmp2_ = hello_world_init (_tmp1_);
	if (!_tmp2_) {
		FILE* _tmp3_ = NULL;
		_tmp3_ = stdout;
		fputs ("failed to initialize!\n", _tmp3_);
	} else {
		HelloWorld* _tmp4_ = NULL;
		gboolean _tmp5_ = FALSE;
		_tmp4_ = app;
		_tmp5_ = hello_world_load_media (_tmp4_);
		if (!_tmp5_) {
			FILE* _tmp6_ = NULL;
			_tmp6_ = stdout;
			fputs ("Failed to load media!\n", _tmp6_);
		} else {
			HelloWorld* _tmp7_ = NULL;
			_tmp7_ = app;
			hello_world_run (_tmp7_);
		}
	}
	_hello_world_unref0 (app);
}
Example #2
0
void uip_sys_init(void)
{

    uip_init();         //uip init
    sys_thread_new("uip",uip_tcpip_thread, RT_NULL, RT_LWIP_TCPTHREAD_STACKSIZE, RT_LWIP_TCPTHREAD_PRIORITY);
    hello_world_init(); //
}
Example #3
0
/*****************************************************************************
 函 数 名  : uip_app_init
 功能描述  : the uip appliacation function
 输入参数  : void  
 输出参数  : 无
 返 回 值  : 
 调用函数  : 
 被调函数  : 
 
 修改历史      :
  1.日    期   : 2017年4月17日
    作    者   : QSWWD
    修改内容   : 新生成函数

*****************************************************************************/
void uip_app_init(void)
{
	uip_ipaddr_t ipaddr;
	uip_ipaddr(ipaddr, 8,8,8,8);
	
	/*	hello_world_init();*/
	

	
	/*
	  resolv_init();
	  uip_ipaddr(ipaddr, 195,54,122,204);
	  resolv_conf(ipaddr);
	  resolv_query("www.sics.se");*/

	example1_init();
	example2_init();
	telnetd_init();
	smtp_init();
	uip_ipaddr(ipaddr, 127,0,0,1);
	smtp_configure("localhost", ipaddr);
	SMTP_SEND("*****@*****.**", NULL, "*****@*****.**",
		  "Testing SMTP from uIP",
		  "Test message sent by uIP\r\n");	
	hello_world_init();
	httpd_init();
	
#if UIP_UDP
	my_udp8899_init();
	dhcpc_init(&uip_ethaddr,6);
	resolv_init();
    resolv_conf(ipaddr);
    resolv_query("www.baidu.com");	
#endif
}
void hello_world_main (void) {
	HelloWorld* app = NULL;
	HelloWorld* _tmp0_ = NULL;
	_tmp0_ = hello_world_new ();
	app = _tmp0_;
	hello_world_init (app);
	hello_world_run (app);
	_hello_world_unref0 (app);
}
Example #5
0
File: main.c Project: gstroe/Arm
/**
 * Initialize demo application
 */
static void _app_init(void)
{
	printf("P: hello-world application init\n\r");
	hello_world_init();

#ifdef __DHCPC_H__
	printf("P: DHCPC Init\n\r");
	dhcpc_init(MacAddress.addr, 6);
#endif
}
Example #6
0
void IpStack_Thread_init( void )
{
	DRV_Uart_Error eUart_Error;
	DRV_Uart_Cfg tUart0Settings;
	DRV_SoftTimer_Error eSofTimerError;
	DRV_SoftTimer_Cfg sParam;
	uip_ipaddr_t addr;
	 struct uip_udp_conn *c;

	IpStack_Thread_Data.iEtape =  kETAPE_Init;

	//Uart open
	tUart0Settings.RXCallBack=NULL;
	tUart0Settings.eBaudRate = BR115200;
	tUart0Settings.cEndOfBuff='\r';
	tUart0Settings.eParity = PARNone;
	tUart0Settings.eSLIPModeEnable=1;
	tUart0Settings.eStopBit = SB_1;
	tUart0Settings.iRXNbChar = 0;
	eUart_Error = DRV_Uart_Open("/dev/ttyUSB0",&IpStack_Thread_Data.hUart,&tUart0Settings);

	//Soft Timer open
    sParam.tType=TimeOut;
    sParam.uiValue = 10;
    eSofTimerError = DRV_SoftTimer_Open("timer1PStack",&IpStack_Thread_Data.hTimer,&sParam);
    DRV_SoftTimer_Start(IpStack_Thread_Data.hTimer);

    //uiP Stack init
    uip_init();
	uip_ipaddr(IpStack_Thread_Data.ipaddr, 192,168,2,3);
	uip_sethostaddr(IpStack_Thread_Data.ipaddr);

	//telnetd_init();
	httpd_init();
	hello_world_init();
	telnetd_init();

	uip_ipaddr(&addr, 192,168,2,1);
	 c = uip_udp_new(&addr, HTONS(12345));
	 LIB_Trace_Printf(1,"IpStack init Done\n");

}
Example #7
0
File: main.c Project: kevinxusz/uip
/*---------------------------------------------------------------------------*/
int
main(void)
{
  int i;
  uip_ipaddr_t ipaddr;
  struct timer periodic_timer, arp_timer;

  timer_set(&periodic_timer, CLOCK_SECOND / 2);
  timer_set(&arp_timer, CLOCK_SECOND * 10);
  
  tapdev_init();
  uip_init();

  uip_ipaddr(ipaddr, 192,168,0,2);
  uip_sethostaddr(ipaddr);
  uip_ipaddr(ipaddr, 192,168,0,1);
  uip_setdraddr(ipaddr);
  uip_ipaddr(ipaddr, 255,255,255,0);
  uip_setnetmask(ipaddr);

  //httpd_init();
  
  /*  telnetd_init();*/
  
  hello_world_init();

  /*  {
      u8_t mac[6] = {1,2,3,4,5,6};
      dhcpc_init(&mac, 6);
      }*/
  
  /*uip_ipaddr(ipaddr, 127,0,0,1);
  smtp_configure("localhost", ipaddr);
  SMTP_SEND("*****@*****.**", NULL, "*****@*****.**",
	    "Testing SMTP from uIP",
	    "Test message sent by uIP\r\n");*/

  /*
    webclient_init();
    resolv_init();
    uip_ipaddr(ipaddr, 195,54,122,204);
    resolv_conf(ipaddr);
    resolv_query("www.sics.se");*/

#if CUTEST //cutest
  RunAllTests();
  exit(0);
#else //cutest
  
  while(1) {
    uip_len = tapdev_read();
    if(uip_len > 0) {
      if(BUF->type == htons(UIP_ETHTYPE_IP)) {
	uip_arp_ipin();
	uip_input();
	/* If the above function invocation resulted in data that
	   should be sent out on the network, the global variable
	   uip_len is set to a value > 0. */
	if(uip_len > 0) {
	  uip_arp_out();
	  tapdev_send();
	}
      } else if(BUF->type == htons(UIP_ETHTYPE_ARP)) {
	uip_arp_arpin();
	/* If the above function invocation resulted in data that
	   should be sent out on the network, the global variable
	   uip_len is set to a value > 0. */
	if(uip_len > 0) {
	  tapdev_send();
	}
      }

    } else if(timer_expired(&periodic_timer)) {
      timer_reset(&periodic_timer);
      for(i = 0; i < UIP_CONNS; i++) {
	uip_periodic(i);
	/* If the above function invocation resulted in data that
	   should be sent out on the network, the global variable
	   uip_len is set to a value > 0. */
	if(uip_len > 0) {
	  uip_arp_out();
	  tapdev_send();
	}
      }

#if UIP_UDP
      for(i = 0; i < UIP_UDP_CONNS; i++) {
	uip_udp_periodic(i);
	/* If the above function invocation resulted in data that
	   should be sent out on the network, the global variable
	   uip_len is set to a value > 0. */
	if(uip_len > 0) {
	  uip_arp_out();
	  tapdev_send();
	}
      }
#endif /* UIP_UDP */
      
      /* Call the ARP timer function every 10 seconds. */
      if(timer_expired(&arp_timer)) {
	timer_reset(&arp_timer);
	uip_arp_timer();
      }
    }
  }
  return 0;

#endif //cutest
}
Example #8
0
int main(void)
{


	network_init();

	#if MY_DEBUG
	uartInit();
	uartSetBaudRate(9600);
	rprintfInit(uartSendByte);
	#endif

	int i;
	uip_ipaddr_t ipaddr; 
	struct timer periodic_timer, arp_timer;

	clock_init();

	timer_set(&periodic_timer, CLOCK_SECOND / 2);
	timer_set(&arp_timer, CLOCK_SECOND * 10);

	uip_init();
	
	struct uip_eth_addr mac = {UIP_ETHADDR0, UIP_ETHADDR1, UIP_ETHADDR2, UIP_ETHADDR3, UIP_ETHADDR4, UIP_ETHADDR5};

	uip_setethaddr(mac);

    hello_world_init();

#ifdef __DHCPC_H__
	dhcpc_init(&mac, 6);
#else
    uip_ipaddr(ipaddr, 192,168,0,1); 
	uip_sethostaddr(ipaddr);
    uip_ipaddr(ipaddr, 192,168,0,1);
    uip_setdraddr(ipaddr);
    uip_ipaddr(ipaddr, 255,255,255,0);
    uip_setnetmask(ipaddr);
#endif /*__DHCPC_H__*/


	while(1){
		uip_len = network_read(); 
		if(uip_len > 0) {
			if(BUF->type == htons(UIP_ETHTYPE_IP)){  
				uip_arp_ipin();
				uip_input();
				if(uip_len > 0) {
					uip_arp_out();
					network_send();
				}
			}else if(BUF->type == htons(UIP_ETHTYPE_ARP)){
				uip_arp_arpin();
				if(uip_len > 0){
					network_send();
				}
			}

		}else if(timer_expired(&periodic_timer)) {
			timer_reset(&periodic_timer);

			for(i = 0; i < UIP_CONNS; i++) {
				uip_periodic(i);
				if(uip_len > 0) {
					uip_arp_out();
					network_send();
				}
			}

			#if UIP_UDP
			for(i = 0; i < UIP_UDP_CONNS; i++) {
				uip_udp_periodic(i);
				if(uip_len > 0) {
					uip_arp_out();
					network_send();
				}
			}
			#endif /* UIP_UDP */

			if(timer_expired(&arp_timer)) {
				timer_reset(&arp_timer);
				uip_arp_timer();
			}
		}
	}
	return 0;
}