这篇教程C++ uip_input函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中uip_input函数的典型用法代码示例。如果您正苦于以下问题:C++ uip_input函数的具体用法?C++ uip_input怎么用?C++ uip_input使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了uip_input函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: UIP_TASK_Handler/////////////////////////////////////////////////////////////////////////////// The uIP Task is executed each mS/////////////////////////////////////////////////////////////////////////////static void UIP_TASK_Handler(void *pvParameters){ int i; struct timer periodic_timer, arp_timer; // take over exclusive access to UIP functions MUTEX_UIP_TAKE; // init uIP timers timer_set(&periodic_timer, CLOCK_SECOND / 2); timer_set(&arp_timer, CLOCK_SECOND * 10); // init the network driver network_device_init(); // init uIP uip_init(); uip_arp_init(); // set my ethernet address unsigned char *mac_addr = network_device_mac_addr(); { int i; for(i=0; i<6; ++i) uip_ethaddr.addr[i] = mac_addr[i]; } // enable dhcp mode (can be changed during runtime) UIP_TASK_DHCP_EnableSet(dhcp_enabled); // release exclusive access to UIP functions MUTEX_UIP_GIVE;#if 0 // wait until HW config has been loaded do { vTaskDelay(1 / portTICK_RATE_MS); } while( !SEQ_FILE_HW_ConfigLocked() );#endif // Initialise the xLastExecutionTime variable on task entry portTickType xLastExecutionTime = xTaskGetTickCount(); // endless loop while( 1 ) {#if 0 do { vTaskDelayUntil(&xLastExecutionTime, 1 / portTICK_RATE_MS); } while( TASK_MSD_EnableGet() ); // don't service ethernet if MSD mode enabled for faster transfer speed#else vTaskDelayUntil(&xLastExecutionTime, 1 / portTICK_RATE_MS);#endif // take over exclusive access to UIP functions MUTEX_UIP_TAKE; if( !(clock_time_tick() % 100) ) { // each 100 mS: check availablility of network device#if defined(MIOS32_BOARD_MBHP_CORE_LPC17) || defined(MIOS32_BOARD_LPCXPRESSO) network_device_check(); // TK: on STM32 no auto-detection for MBSEQ for best performance if no MBHP_ETH module connected // the user has to reboot MBSEQ to restart module detection#endif } if( network_device_available() ) { 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. *///.........这里部分代码省略.........
开发者ID:JKcompute,项目名称:395_midi_controller,代码行数:101,
示例2: 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 = ( long ) 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:granthuu,项目名称:fsm_software,代码行数:101,
示例3: uip_taskvoid uip_task( void *pvParameters ){portBASE_TYPE i;uip_ipaddr_t xIPAddr;struct timer periodic_timer, arp_timer;extern void ( vEMAC_ISR_Wrapper )( void ); ( void ) pvParameters; /* 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, configIP_ADDR0, configIP_ADDR1, configIP_ADDR2, configIP_ADDR3 ); uip_sethostaddr( xIPAddr ); uip_ipaddr( xIPAddr, configNET_MASK0, configNET_MASK1, configNET_MASK2, configNET_MASK3 ); uip_setnetmask( xIPAddr ); network_init(); /* Create the semaphore used to wake the uIP task. */ vSemaphoreCreateBinary( xEMACSemaphore ); /* Initialise the MAC. */ while( lEMACInit() != pdPASS ) { vTaskDelay( uipINIT_WAIT ); } portENTER_CRITICAL(); { LPC_EMAC->IntEnable = ( INT_RX_DONE | INT_TX_DONE ); /* Set the interrupt priority to the max permissible to cause some interrupt nesting. */ NVIC_SetPriority( ENET_IRQn, configEMAC_INTERRUPT_PRIORITY ); /* Enable the interrupt. */ NVIC_EnableIRQ( ENET_IRQn ); prvSetMACAddress(); } portEXIT_CRITICAL(); for( ;; ) { /* Is there received data ready to be processed? */ uip_len = ulGetEMACRxData(); 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(); vSendEMACTxData( uip_len ); } } 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 ) { vSendEMACTxData( uip_len ); } } } else { if( timer_expired( &periodic_timer ) && ( uip_buf != NULL ) ) { 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(); vSendEMACTxData( uip_len ); } } for( i = 0; i < UIP_UDP_CONNS; i++ ) { uip_udp_periodic( i );//.........这里部分代码省略.........
开发者ID:jsr38,项目名称:makebed,代码行数:101,
示例4: 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,
示例5: 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,
示例6: main/****************************************************************************** Main Control Loop** *****************************************************************************/int main(void){ unsigned char i; unsigned char arptimer=0; // PORTB PB5 als Ausgang (in use LED) DDRB=(1<<PB5); PORTB=(1<<PB5); init_sensors(); // init NIC device driver nic_init(); // init uIP uip_init(); // init app example1_init(); // init ARP cache uip_arp_init(); // init periodic timer initTimer(); sei(); // initialisierendes lesen der Temperatur(en) read_temp_sensors(); while(1) { if(minInt==1){ minInt=0; read_temp_sensors(); } // look for a packet uip_len = nic_poll(); if(uip_len == 0) { // if timed out, call periodic function for each connection //if(timerCounter > TIMERCOUNTER_PERIODIC_TIMEOUT) if(tInt) { tInt = 0; //timerCounter = 0; for(i = 0; i < UIP_CONNS; i++) { uip_periodic(i); // transmit a packet, if one is ready if(uip_len > 0) { uip_arp_out(); nic_send(); } } /* Call the ARP timer function every 10 seconds. */ if(++arptimer == 20) { uip_arp_timer(); arptimer = 0; } } } else // packet received { // process an IP packet if(BUF->type == htons(UIP_ETHTYPE_IP)) { // add the source to the ARP cache // also correctly set the ethernet packet length before processing uip_arp_ipin(); uip_input(); // transmit a packet, if one is ready if(uip_len > 0) { uip_arp_out(); nic_send(); } } // process an ARP packet else if(BUF->type == htons(UIP_ETHTYPE_ARP)) { uip_arp_arpin(); // transmit a packet, if one is ready if(uip_len > 0) nic_send();//.........这里部分代码省略.........
开发者ID:jbohren-forks,项目名称:cnc-msl,代码行数:101,
示例7: 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,
示例8: main/*----------------------------------------------------------------------------*/ intmain(void){ int i; // Renesas -- uip_ipaddr_t ipaddr; struct timer periodic_timer, arp_timer; struct uip_eth_addr my_mac; uint32_t ch = 0; // Renesas ++ InitialiseLCD(); DisplayuIPDemo(); timer_init(); timer_set(&periodic_timer, CLOCK_SECOND / 2); timer_set(&arp_timer, CLOCK_SECOND * 10); Exosite_Get_MAC((unsigned char *)&my_mac); // Renesas -- network_device_init(); /* Wait until Ether device initailize succesfully. Make sure Ethernet cable is plugged in. */ while (R_ETHER_ERROR == R_Ether_Open(ch, (uint8_t*)&my_mac)); // Renesas ++ set Ethernet address uip_setethaddr(my_mac); uip_init(); // Renesas -- //uip_ipaddr(ipaddr, 192,168,0,2); //uip_sethostaddr(ipaddr); dhcpc_init(&my_mac, 6); if (!Exosite_Init(APP_NAME, APP_VERSION)) DisplayLCD(LCD_LINE8, "==NEED CIK=="); while (1) { // Renesas -- uip_len = network_device_read(); uip_len = R_Ether_Read(ch, (void *)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(); // Renesas -- network_device_send(); R_Ether_Write(ch, (void *)uip_buf, (uint32_t)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) { // Renesas -- network_device_send(); R_Ether_Write(ch, (void *)uip_buf, (uint32_t)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(); // Renesas -- network_device_send(); R_Ether_Write(ch, (void *)uip_buf, (uint32_t)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(); // Renesas -- network_device_send(); R_Ether_Write(ch, (void *)uip_buf, (uint32_t)uip_len); } }//.........这里部分代码省略.........
开发者ID:Ascenix,项目名称:uip_rx62n_cloud,代码行数:101,
示例9: mainint main(void){ network_init(); //CLKPR = (1<<CLKPCE); //Change prescaler //CLKPR = (1<<CLKPS0); //Use prescaler 2 //clock_prescale_set(clock_div_2); enc28j60Write(ECOCON, 1 & 0x7); //Get a 25MHz signal from enc28j60 #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); telnetd_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;}
开发者ID:hokim72,项目名称:AVR-Common,代码行数:92,
示例10: main//.........这里部分代码省略......... printf("Setting ip to %u.%u.%u.%u /r/n", myip[0], myip[1], myip[2], myip[3]); resolv_init(); uip_ipaddr(ipaddr, dnsip[0], dnsip[1], dnsip[2], dnsip[3]); resolv_conf(ipaddr); webclient_init(); printf("Stokerbot NG R3 ready - Firmware %u.%u .../r/n", SBNG_VERSION_MAJOR, SBNG_VERSION_MINOR);// fprintf(&lcd_str, "?y2?x00Firmware %u.%u ready.", SBNG_VERSION_MAJOR, SBNG_VERSION_MINOR);// SPILCD_init(); wdt_reset(); while (1) { //Only one event may fire per loop, listed in order of importance //If an event is skipped, it will be run next loop if (tickDiff(timer_Count) >= 1) { timer_Count = tick; wdt_reset(); //sikre at watchdog resetter os hvis timer systemet fejler, vi n C++ uip_ip6addr函数代码示例 C++ uip_init函数代码示例
|