这篇教程C++ uip_periodic函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中uip_periodic函数的典型用法代码示例。如果您正苦于以下问题:C++ uip_periodic函数的具体用法?C++ uip_periodic怎么用?C++ uip_periodic使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了uip_periodic函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: uIPManagement_ManageConnections/** Manages the currently open network connections, including TCP and (if enabled) UDP. */static void uIPManagement_ManageConnections(void){ /* Poll TCP connections for more data to send back to the host */ for (uint8_t i = 0; i < UIP_CONNS; i++) { uip_poll_conn(&uip_conns[i]); /* If a response was generated, send it */ if (uip_len > 0) { /* Add destination MAC to outgoing packet */ uip_arp_out(); /* Split and send the outgoing packet */ uip_split_output(); } } /* Manage open connections for timeouts */ if (timer_expired(&ConnectionTimer)) { timer_reset(&ConnectionTimer); LEDs_SetAllLEDs(LEDMASK_USB_BUSY); for (uint8_t i = 0; i < UIP_CONNS; i++) { /* Run periodic connection management for each TCP connection */ uip_periodic(i); /* If a response was generated, send it */ if (uip_len > 0) { /* Add destination MAC to outgoing packet */ uip_arp_out(); /* Split and send the outgoing packet */ uip_split_output(); } } #if defined(ENABLE_DHCP_CLIENT) for (uint8_t i = 0; i < UIP_UDP_CONNS; i++) { /* Run periodic connection management for each UDP connection */ uip_udp_periodic(i); /* If a response was generated, send it */ if (uip_len > 0) { /* Add destination MAC to outgoing packet */ uip_arp_out(); /* Split and send the outgoing packet */ uip_split_output(); } } #endif LEDs_SetAllLEDs(LEDMASK_USB_READY); } /* Manage ARP cache refreshing */ if (timer_expired(&ARPTimer)) { timer_reset(&ARPTimer); uip_arp_timer(); }}
开发者ID:davidk,项目名称:lufa-lib,代码行数:70,
示例2: vuIP_Taskvoid vuIP_Task( void *pvParameters ){portBASE_TYPE i;unsigned long ulNewEvent = 0UL;unsigned long ulUIP_Events = 0UL; ( void ) pvParameters; /* Initialise the uIP stack. */ prvInitialise_uIP(); /* Initialise the MAC. */ vInitEmac(); while( lEMACWaitForLink() != pdPASS ) { vTaskDelay( uipINIT_WAIT ); } for( ;; ) { if( ( ulUIP_Events & uipETHERNET_RX_EVENT ) != 0UL ) { /* Is there received data ready to be processed? */ uip_len = ( unsigned short ) ulEMACRead(); if( ( uip_len > 0 ) && ( uip_buf != NULL ) ) { /* Standard uIP loop taken from the uIP manual. */ if( xHeader->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(); vEMACWrite(); } } else if( xHeader->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 ) { vEMACWrite(); } } } else { ulUIP_Events &= ~uipETHERNET_RX_EVENT; } } if( ( ulUIP_Events & uipPERIODIC_TIMER_EVENT ) != 0UL ) { ulUIP_Events &= ~uipPERIODIC_TIMER_EVENT; 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(); vEMACWrite(); } } } /* Call the ARP timer function every 10 seconds. */ if( ( ulUIP_Events & uipARP_TIMER_EVENT ) != 0 ) { ulUIP_Events &= ~uipARP_TIMER_EVENT; uip_arp_timer(); } if( ulUIP_Events == pdFALSE ) { xQueueReceive( xEMACEventQueue, &ulNewEvent, portMAX_DELAY ); ulUIP_Events |= ulNewEvent; } }}
开发者ID:AlexShiLucky,项目名称:freertos,代码行数:95,
示例3: vuIP_Taskvoid vuIP_Task( void *pvParameters ){long i;unsigned long ulNewEvent = 0UL, ulUIP_Events = 0UL;unsigned short usPacketLength; /* Just to prevent compiler warnings about the unused parameter. */ ( void ) pvParameters; /* Initialise the uIP stack, configuring for web server usage. */ prvInitialise_uIP(); /* Initialise the MAC and PHY. */ vEMACInit(); for( ;; ) { /* Is there received data ready to be processed? */ usPacketLength = usEMACRead(); /* Statements to be executed if data has been received on the Ethernet. */ if( ( usPacketLength > 0U ) && ( uip_buf != NULL ) ) { uip_len = usPacketLength; if( xHeader->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(); vEMACWrite(); } } else if( xHeader->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 ) { vEMACWrite(); } } } else { /* Clear the RX event latched in ulUIP_Events - if one was latched. */ ulUIP_Events &= ~uipETHERNET_RX_EVENT; } /* Statements to be executed if the TCP/IP period timer has expired. */ if( ( ulUIP_Events & uipPERIODIC_TIMER_EVENT ) != 0UL ) { ulUIP_Events &= ~uipPERIODIC_TIMER_EVENT; if( uip_buf != NULL ) { 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(); vEMACWrite(); } } } } /* Statements to be executed if the ARP timer has expired. */ if( ( ulUIP_Events & uipARP_TIMER_EVENT ) != 0 ) { ulUIP_Events &= ~uipARP_TIMER_EVENT; uip_arp_timer(); } /* If all latched events have been cleared - block until another event occurs. */ if( ulUIP_Events == pdFALSE ) { xQueueReceive( xEMACEventQueue, &ulNewEvent, portMAX_DELAY ); ulUIP_Events |= ulNewEvent; } }}
开发者ID:Leowardi,项目名称:FreeRTOS,代码行数:97,
示例4: vuIP_Taskvoid vuIP_Task( void *pvParameters ){portBASE_TYPE i;uip_ipaddr_t xIPAddr;struct timer periodic_timer, arp_timer;extern void ( vEMAC_ISR_Wrapper )( void ); /* Create the semaphore used by the ISR to wake this task. */ vSemaphoreCreateBinary( xEMACSemaphore ); /* Initialise the uIP stack. */ timer_set( &periodic_timer, configTICK_RATE_HZ / 2 ); timer_set( &arp_timer, configTICK_RATE_HZ * 10 ); uip_init(); uip_ipaddr( xIPAddr, uipIP_ADDR0, uipIP_ADDR1, uipIP_ADDR2, uipIP_ADDR3 ); uip_sethostaddr( xIPAddr ); httpd_init(); /* Initialise the MAC. */ while( Init_EMAC() != pdPASS ) { vTaskDelay( uipINIT_WAIT ); } portENTER_CRITICAL(); { MAC_INTENABLE = INT_RX_DONE; VICIntEnable |= 0x00200000; VICVectAddr21 = ( portLONG ) vEMAC_ISR_Wrapper; prvSetMACAddress(); } portEXIT_CRITICAL(); for( ;; ) { /* Is there received data ready to be processed? */ uip_len = uiGetEMACRxData( uip_buf ); if( uip_len > 0 ) { /* Standard uIP loop taken from the uIP manual. */ if( xHeader->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(); prvENET_Send(); } } else if( xHeader->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 ) { prvENET_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(); prvENET_Send(); } } /* Call the ARP timer function every 10 seconds. */ if( timer_expired( &arp_timer ) ) { timer_reset( &arp_timer ); uip_arp_timer(); } } else { /* We did not receive a packet, and there was no periodic processing to perform. Block for a fixed period. If a packet is received during this period we will be woken by the ISR//.........这里部分代码省略.........
开发者ID:aeste,项目名称:freertos,代码行数:101,
示例5: vuIP_Taskvoid vuIP_Task( void *pvParameters ){portBASE_TYPE i;uip_ipaddr_t xIPAddr;struct timer periodic_timer, arp_timer; /* Create the semaphore used by the ISR to wake this task. */ vSemaphoreCreateBinary( xSemaphore ); /* Initialise the uIP stack. */ timer_set( &periodic_timer, configTICK_RATE_HZ / 2 ); timer_set( &arp_timer, configTICK_RATE_HZ * 10 ); uip_init(); uip_ipaddr( xIPAddr, uipIP_ADDR0, uipIP_ADDR1, uipIP_ADDR2, uipIP_ADDR3 ); uip_sethostaddr( xIPAddr ); uip_ipaddr( xIPAddr, uipNET_MASK0, uipNET_MASK1, uipNET_MASK2, uipNET_MASK3 ); uip_setnetmask( xIPAddr ); uip_ipaddr( xIPAddr, uipGATEWAY_ADDR0, uipGATEWAY_ADDR1, uipGATEWAY_ADDR2, uipGATEWAY_ADDR3 ); uip_setdraddr( xIPAddr ); httpd_init(); /* Initialise the MAC. */ ENET_InitClocksGPIO(); ENET_Init(); portENTER_CRITICAL(); { ENET_Start(); prvSetMACAddress(); VIC_Config( ENET_ITLine, VIC_IRQ, 1 ); VIC_ITCmd( ENET_ITLine, ENABLE ); ENET_DMA->ISR = uipDMI_RX_CURRENT_DONE; ENET_DMA->IER = uipDMI_RX_CURRENT_DONE; } portEXIT_CRITICAL(); while(1) { /* Is there received data ready to be processed? */ uip_len = ENET_HandleRxPkt( uip_buf ); if( uip_len > 0 ) { /* Standard uIP loop taken from the uIP manual. */ if( xHeader->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(); prvENET_Send(); } } else if( xHeader->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 ) { prvENET_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(); prvENET_Send(); } } /* Call the ARP timer function every 10 seconds. */ if( timer_expired( &arp_timer ) ) { timer_reset( &arp_timer ); uip_arp_timer(); } } else { /* We did not receive a packet, and there was no periodic//.........这里部分代码省略.........
开发者ID:svn2github,项目名称:freertos,代码行数:101,
示例6: uip_main/***************************************************************************** 函 数 名 : uip_main 功能描述 : uip main looplock function 输入参数 : void 输出参数 : 无 返 回 值 : 调用函数 : 被调函数 : 修改历史 : 1.日 期 : 2017年4月17日 作 者 : QSWWD 修改内容 : 新生成函数*****************************************************************************/void uip_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); uip_init(); uip_ipaddr(ipaddr, 192,168,1,6); uip_sethostaddr(ipaddr); uip_ipaddr(ipaddr, 192,168,1,1); uip_setdraddr(ipaddr); uip_ipaddr(ipaddr, 255,255,255,0); uip_setnetmask(ipaddr); /*MAC*/ memcpy(&uip_ethaddr,eth_mac_addr(),6); /*app initialize*/ uip_app_init(); //main loop while(1) { uip_len = tapdev_read(uip_buf); 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(uip_buf,uip_len); } } 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(uip_buf,uip_len); } } } 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(uip_buf,uip_len); } }#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(uip_buf,uip_len); } }#endif /* UIP_UDP */ /* Call the ARP timer function every 10 seconds. */ if(timer_expired(&arp_timer)) //.........这里部分代码省略.........
开发者ID:haikong,项目名称:haikong.github.io,代码行数:101,
示例7: vuIP_Taskvoid vuIP_Task( void *pvParameters ){portBASE_TYPE i;uip_ipaddr_t xIPAddr;struct timer periodic_timer, arp_timer; /* Initialise the uIP stack. */ timer_set( &periodic_timer, configTICK_RATE_HZ / 2 ); timer_set( &arp_timer, configTICK_RATE_HZ * 10 ); uip_init(); uip_ipaddr( xIPAddr, uipIP_ADDR0, uipIP_ADDR1, uipIP_ADDR2, uipIP_ADDR3 ); uip_sethostaddr( xIPAddr ); httpd_init(); /* Initialise the MAC. */ do { vTaskDelay( uipINIT_WAIT ); xEMACSemaphore = xEMACInit(); } while( xEMACSemaphore == NULL ); for( ;; ) { /* Is there received data ready to be processed? */ uip_len = ulEMACPoll(); if( uip_len > 0 ) { /* Standard uIP loop taken from the uIP manual. */ if( xHeader->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(); lEMACSend(); } } else if( xHeader->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 ) { lEMACSend(); } } } 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(); lEMACSend(); } } /* Call the ARP timer function every 10 seconds. */ if( timer_expired( &arp_timer ) ) { timer_reset( &arp_timer ); uip_arp_timer(); } } else { /* We did not receive a packet, and there was no periodic processing to perform. Block for a fixed period. If a packet is received during this period we will be woken by the ISR giving us the Semaphore. */ xSemaphoreTake( xEMACSemaphore, configTICK_RATE_HZ / 2 ); } } }}
开发者ID:Dzenik,项目名称:FreeRTOS_TEST,代码行数:93,
示例8: elua_uip_mainloop// This gets called on both Ethernet RX interrupts and timer requests,// but it's called only from the Ethernet interrupt handlervoid elua_uip_mainloop(){ u32 temp, packet_len; // Increment uIP timers temp = platform_eth_get_elapsed_time(); periodic_timer += temp; arp_timer += temp; // Check for an RX packet and read it if( ( packet_len = platform_eth_get_packet_nb( uip_buf, sizeof( uip_buf ) ) ) > 0 ) { // Set uip_len for uIP stack usage. uip_len = ( unsigned short )packet_len; // Process incoming IP packets here. 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(); device_driver_send(); } } // Process incoming ARP packets here. 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 ) device_driver_send(); } } // Process TCP/IP Periodic Timer here. // Also process the "force interrupt" events (platform_eth_force_interrupt) if( periodic_timer >= UIP_PERIODIC_TIMER_MS ) { periodic_timer = 0; uip_set_forced_poll( 0 ); } else uip_set_forced_poll( 1 ); for( temp = 0; temp < UIP_CONNS; temp ++ ) { uip_periodic( temp ); // 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(); device_driver_send(); } }#if UIP_UDP for( temp = 0; temp < UIP_UDP_CONNS; temp ++ ) { uip_udp_periodic( temp ); // 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(); device_driver_send(); } }#endif // UIP_UDP // Process ARP Timer here. if( arp_timer >= UIP_ARP_TIMER_MS ) { arp_timer = 0; uip_arp_timer(); } }
开发者ID:BackupTheBerlios,项目名称:elua-svn,代码行数:92,
示例9: main/*---------------------------------------------------------------------------*/intmain(void){ int i; uip_ipaddr_t ipaddr; struct uip_timer periodic_timer, arp_timer; timer_set(&periodic_timer, CLOCK_SECOND / 2); timer_set(&arp_timer, CLOCK_SECOND * 10); network_device_init(); uip_init(); uip_ipaddr(ipaddr, 192,168,0,2); uip_sethostaddr(ipaddr); httpd_init(); while(1) { uip_len = network_device_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(); network_device_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) { network_device_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(); network_device_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(); network_device_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;}
开发者ID:AVB-USER-6667,项目名称:sc_xtcp,代码行数:77,
示例10: main/*---------------------------------------------------------------------------*/intmain(void){ EEPROM_main(); int i; uip_ipaddr_t ipaddr; struct timer periodic_timer, arp_timer; memcpy (&uip_ethaddr.addr[0], &eeprom.MAC[0], 6); AVR_init(); egpio_init(); clock_init(); mbuf_init(); adlc_init(); GICR = (1 << INT0); timer_set(&periodic_timer, CLOCK_SECOND / 2); timer_set(&arp_timer, CLOCK_SECOND * 10); nic_init(); uip_ipaddr(ipaddr, eeprom.IPAddr[0],eeprom.IPAddr[1],eeprom.IPAddr[2],eeprom.IPAddr[3]); uip_sethostaddr(ipaddr); uip_ipaddr(ipaddr, eeprom.Gateway[0],eeprom.Gateway[1],eeprom.Gateway[2],eeprom.Gateway[3]); uip_setdraddr(ipaddr); uip_ipaddr(ipaddr, eeprom.Subnet[0],eeprom.Subnet[1],eeprom.Subnet[2],eeprom.Subnet[3]); uip_setnetmask(ipaddr); telnetd_init(); aun_init(); internet_init(); egpio_write (EGPIO_STATUS_GREEN); while(1) {// check the econet for complete packets adlc_poller(); aun_poller (); uip_len = nic_poll(); 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. */ maybe_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) { nic_send(NULL); } } } else if(timer_expired(&periodic_timer)) { timer_reset(&periodic_timer); for(i = 0; i < UIP_CONNS; i++) { uip_periodic(i); maybe_send(); }#if UIP_UDP for(i = 0; i < UIP_UDP_CONNS; i++) { uip_udp_periodic(i); maybe_send(); }#endif /* UIP_UDP */ /* Call the ARP timer function every 10 seconds. */ if(timer_expired(&arp_timer)) { timer_reset(&arp_timer); uip_arp_timer(); } } }}
开发者ID:BackupTheBerlios,项目名称:ecobridge,代码行数:88,
示例11: main/*-----------------------------------------------------------------------------------*/intmain(void){ idata u8_t i, arptimer; idata u16_t j;// idata int i; InitGraphic();//putchar(0,62,0); //while(1) for(i=0;i<100;i++) { putstring(6,0, "Welcome to http://shop34480016.taobao.com www.dianshijin.cn"); } init_uart(); printu("starting....../r/n"); /* Initialize the device driver. */ // rtl8019as_init(); dev_init(); uip_arp_init(); /* Initialize the uIP TCP/IP stack. */ uip_init(); printu("11111111111111111111111/r/n"); /* Initialize the HTTP server. */// httpd_init(); tcp_server_init(); arptimer = 0; printu("222222222222222222222222222/r/n"); while(1) { /* Let the tapdev network device driver read an entire IP packet into the uip_buf. If it must wait for more than 0.5 seconds, it will return with the return value 0. If so, we know that it is time to call upon the uip_periodic(). Otherwise, the tapdev has received an IP packet that is to be processed by uIP. */ uip_len = dev_poll(); for(j=0;j<500;j++);/* if(uip_len > 0) { printuf("--------------- uip_len = 0x%x", uip_len); printuf("%x ----------/r/n", uip_len); for(i=0;i<uip_len;i++) { printuf("%x ", uip_buf[i]); if((i+1)%16==0) printu("/r/n"); } printu("/r/n"); }*/ if(uip_len == 0) { 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(); dev_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(); dev_send(); } }#endif /* UIP_UDP */ /* Call the ARP timer function every 10 seconds. */ if(++arptimer == 20) { uip_arp_timer(); arptimer = 0; } } else { 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(); dev_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) { dev_send(); }//.........这里部分代码省略.........
开发者ID:clbx1996,项目名称:Smart_Home,代码行数:101,
示例12: main/****************************************************************************** Main Control Loop** *****************************************************************************/int main(void){ //led PB4 // Pins als Ausg C++ uip_poll函数代码示例 C++ uip_ntohs函数代码示例
|