コード例 #1
0
ファイル: main.c プロジェクト: brians444/tiva-ads1246-lwip
void task_lwip(void)
{
	if(HWREGBITW(&g_ulFlags, FLAG_SYSTICK) == 1) {
	      HWREGBITW(&g_ulFlags, FLAG_SYSTICK) = 0;

	      if( (g_ulTickCounter - last_arp_time) * TICK_MS >= ARP_TMR_INTERVAL) {
	    	  etharp_tmr();
	    	  last_arp_time = g_ulTickCounter;
	      }

	      if( (g_ulTickCounter - last_tcp_time) * TICK_MS >= TCP_TMR_INTERVAL) {
	    	  tcp_tmr();
	    	  last_tcp_time = g_ulTickCounter;
	      }

	      if( (g_ulTickCounter - last_dhcp_coarse_time) * TICK_MS >= DHCP_COARSE_TIMER_MSECS) {
		dhcp_coarse_tmr();
		last_dhcp_coarse_time = g_ulTickCounter;
	      }

	      if( (g_ulTickCounter - last_dhcp_fine_time) * TICK_MS >= DHCP_FINE_TIMER_MSECS) {
		dhcp_fine_tmr();
		last_dhcp_fine_time = g_ulTickCounter;
	      }
	    }


}
コード例 #2
0
void
timer_callback(XTtcPs * TimerInstance)
{
	/* we need to call tcp_fasttmr & tcp_slowtmr at intervals specified
	 * by lwIP. It is not important that the timing is absoluetly accurate.
	 */
	static int odd = 1;
#if LWIP_DHCP==1
    static int dhcp_timer = 0;
#endif
    TcpFastTmrFlag = 1;
	odd = !odd;
	if (odd) {
#if LWIP_DHCP==1
		dhcp_timer++;
		dhcp_timoutcntr--;
#endif
		TcpSlowTmrFlag = 1;
#if LWIP_DHCP==1
		dhcp_fine_tmr();
		if (dhcp_timer >= 120) {
			dhcp_coarse_tmr();
			dhcp_timer = 0;
		}
#endif
	}
	platform_clear_interrupt(TimerInstance);
}
コード例 #3
0
ファイル: ps2ip.c プロジェクト: ylyking/ps2sdk
static void TimerThread(void* pvArg)
{
	while (1)
	{
		//TCP timer.
		tcp_tmr();

		//ARP timer.
		iTimerARP+=TCP_TMR_INTERVAL;
		if	(iTimerARP>=ARP_TMR_INTERVAL)
		{
			iTimerARP-=ARP_TMR_INTERVAL;
			etharp_tmr();
		}

#if		defined(PS2IP_DHCP)

		//DHCP timer.

		iTimerDHCP+=TCP_TMR_INTERVAL;
		if ((iTimerDHCP-TCP_TMR_INTERVAL)/DHCP_FINE_TIMER_MSECS!=iTimerDHCP/DHCP_FINE_TIMER_MSECS)
		{
			dhcp_fine_tmr();
		}

		if (iTimerDHCP>=DHCP_COARSE_TIMER_SECS*1000)
		{
			iTimerDHCP-=DHCP_COARSE_TIMER_SECS*1000;
			dhcp_coarse_tmr();
		}
#endif

		DelayThread(TCP_TMR_INTERVAL*250);	/* Note: The IOP's DelayThread() function isn't accurate, and the actual timming accuracy is about 25% of the specified value. */
	}
}
コード例 #4
0
ファイル: netconf.c プロジェクト: yallawalla/stm32
/**
  * @brief  LwIP periodic tasks
  * @param  localtime the current LocalTime value
  * @retval None
  */
void LwIP_Periodic_Handle(__IO uint32_t localtime)
{
#if LWIP_TCP
    /* TCP periodic process every 250 ms */
    if (localtime - TCPTimer >= TCP_TMR_INTERVAL) {
        TCPTimer =  localtime;
        tcp_tmr();
    }
#endif

    /* ARP periodic process every 5s */
    if ((localtime - ARPTimer) >= ARP_TMR_INTERVAL) {
        ARPTimer =  localtime;
        etharp_tmr();
    }

#ifdef USE_DHCP
    /* Fine DHCP periodic process every 500ms */
    if (localtime - DHCPfineTimer >= DHCP_FINE_TIMER_MSECS) {
        DHCPfineTimer =  localtime;
        dhcp_fine_tmr();
        if ((DHCP_state != DHCP_ADDRESS_ASSIGNED)&&(DHCP_state != DHCP_TIMEOUT)) {
            /* process DHCP state machine */
            LwIP_DHCP_Process_Handle();
        }
    }

    /* DHCP Coarse periodic process every 60s */
    if (localtime - DHCPcoarseTimer >= DHCP_COARSE_TIMER_MSECS) {
        DHCPcoarseTimer =  localtime;
        dhcp_coarse_tmr();
    }

#endif
}
コード例 #5
0
ファイル: Ifx_Lwip.c プロジェクト: miaozhendaoren/EthUdp297
/** \brief Polling the timer event flags */
void Ifx_Lwip_pollTimerFlags(void)
{
    Ifx_Lwip *lwip       = &Ifx_g_Lwip;
    uint32    timerFlags = __swap(&lwip->timerFlags, 0);

    if (timerFlags & IFX_LWIP_FLAG_DHCP_COARSE)
    {
        dhcp_coarse_tmr();
    }

    if (timerFlags & IFX_LWIP_FLAG_DHCP_FINE)
    {
        dhcp_fine_tmr();
    }

    if (timerFlags & IFX_LWIP_FLAG_TCP_FAST)
    {
        tcp_fasttmr();
    }

    if (timerFlags & IFX_LWIP_FLAG_TCP_SLOW)
    {
        tcp_slowtmr();
    }

    if (timerFlags & IFX_LWIP_FLAG_ARP)
    {
        etharp_tmr();
    }

    if (timerFlags & IFX_LWIP_FLAG_LINK)
    {}
}
コード例 #6
0
void
timer_callback()
{
    static int odd = 1;
#if LWIP_DHCP==1
    static int dhcp_timer = 0;
#endif
    TcpFastTmrFlag = 1;

	odd = !odd;
	if (odd) {
		TxPerfConnMonCntr++;
#if LWIP_DHCP==1
		dhcp_timer++;
		dhcp_timoutcntr--;
#endif
		TcpSlowTmrFlag = 1;
#if LWIP_DHCP==1
		dhcp_fine_tmr();
		if (dhcp_timer >= 120) {
			dhcp_coarse_tmr();
			dhcp_timer = 0;
		}
#endif
	}
}
コード例 #7
0
void
timer_callback(XScuTimer * TimerInstance)
{
#if LWIP_DHCP==1
    static int dhcp_timer = 0;
#endif
	/* we need to call tcp_fasttmr & tcp_slowtmr at intervals specified by lwIP.
	 * It is not important that the timing is absoluetly accurate.
	 */
	static int odd = 1;
	TcpFastTmrFlag = 1;
	odd = !odd;
	if (odd) {
#if LWIP_DHCP==1
		dhcp_timer++;
		dhcp_timoutcntr--;
#endif
		TxPerfConnMonCntr++;
		TcpSlowTmrFlag = 1;
#if LWIP_DHCP==1
		dhcp_fine_tmr();
		if (dhcp_timer >= 120) {
			dhcp_coarse_tmr();
			dhcp_timer = 0;
		}
#endif
	}
	XScuTimer_ClearInterruptStatus(TimerInstance);
}
コード例 #8
0
ファイル: lwip_lib.c プロジェクト: kslemb/ARM-K
/* This function is similar to the 'tcpip_thread' function defined in the tcpip.c module */
void lwip_process_timers (void)
{
	unsigned int CurrentTickCnt;
#if LWIP_TCP
	static unsigned int lwip_tcp_timer = 0;
#endif

#if LWIP_ARP
	static unsigned int lwip_arp_timer = 0;
#endif
	CurrentTickCnt = TickGet ();

#if LWIP_DHCP
	static unsigned int lwip_DHCP_fine_timer = 0;
	static unsigned int lwip_DHCP_coarce_timer = 0;
#endif

#if LWIP_AUTOIP
	static unsigned int lwip_autoip_timer = 0;
#endif

#if LWIP_ARP
	/* Process the ARP timer */
	if(TickGetDiff (CurrentTickCnt, lwip_arp_timer) >= TICKS_IN_MS(ARP_TMR_INTERVAL)) {
		lwip_arp_timer = CurrentTickCnt;
		etharp_tmr();
	}
#endif

#if LWIP_TCP
	/* Process the TCP timer */
	if (TickGetDiff (CurrentTickCnt, lwip_tcp_timer) >= TICKS_IN_MS(TCP_TMR_INTERVAL)) {
        	lwip_tcp_timer = CurrentTickCnt;
		/* Increment fast (incremented every 250ms) and slow (incremented every 500ms) tcp timers */
		tcp_tmr ();
	}
#endif

#if LWIP_DHCP
	/* Process the DHCP Coarce timer */
	if (TickGetDiff (CurrentTickCnt, lwip_DHCP_coarce_timer) >= TICKS_IN_MS(DHCP_COARSE_TIMER_MSECS)) {
	        lwip_DHCP_coarce_timer = CurrentTickCnt;
		dhcp_coarse_tmr ();
	}

	/* Process the DHCP Fine timer */
	if (TickGetDiff (CurrentTickCnt, lwip_DHCP_fine_timer) >= TICKS_IN_MS(DHCP_FINE_TIMER_MSECS)) {
		lwip_DHCP_fine_timer = CurrentTickCnt;
		dhcp_fine_tmr ();
	}
#endif

#if LWIP_AUTOIP
	/* Process the DHCP Fine timer */
	if (TickGetDiff (CurrentTickCnt, lwip_autoip_timer) >= TICKS_IN_MS(AUTOIP_TMR_INTERVAL)) {
		lwip_autoip_timer = CurrentTickCnt;
		autoip_tmr ();
	}
#endif
}
コード例 #9
0
ファイル: timers.c プロジェクト: BuFran/canshark
/**
 * Timer callback function that calls dhcp_coarse_tmr() and reschedules itself.
 *
 * @param arg unused argument
 */
static void dhcp_timer_coarse(void *arg)
{
    LWIP_UNUSED_ARG(arg);
    LWIP_DEBUGF(TIMERS_DEBUG, ("tcpip: dhcp_coarse_tmr()\n"));
    dhcp_coarse_tmr();
    sys_timeout(DHCP_COARSE_TIMER_MSECS, dhcp_timer_coarse, NULL);
}
コード例 #10
0
ファイル: ps2ip.c プロジェクト: AzagraMac/PS2_SDK
static void
Timer(void* pvArg)
{

	//TCP timer.

	tcp_tmr();

	//ARP timer.

	iTimerARP+=TCP_TMR_INTERVAL;
	if	(iTimerARP>=ARP_TMR_INTERVAL)
	{
		iTimerARP-=ARP_TMR_INTERVAL;
		etharp_tmr();
	}
	
#if		defined(PS2IP_DHCP)

	//DHCP timer.

	iTimerDHCP+=TCP_TMR_INTERVAL;
	if ((iTimerDHCP-TCP_TMR_INTERVAL)/DHCP_FINE_TIMER_MSECS!=iTimerDHCP/DHCP_FINE_TIMER_MSECS)
	{
		dhcp_fine_tmr();
	}

	if (iTimerDHCP>=DHCP_COARSE_TIMER_SECS*1000)
	{
		iTimerDHCP-=DHCP_COARSE_TIMER_SECS*1000;
		dhcp_coarse_tmr();
	}
#endif
}
コード例 #11
0
ファイル: main.c プロジェクト: matao1314/STM32_lwIP
//LWIP查询
void LWIP_Polling(void){
	
	// if(timer_expired(&input_time,5)) //接收包,周期处理函数
 // {
    ethernetif_input(&enc28j60_netif); 
 // }
  if(timer_expired(&last_tcp_time,TCP_TMR_INTERVAL/CLOCKTICKS_PER_MS))//TCP处理定时器处理函数
  {
	 tcp_tmr();
  }
  if(timer_expired(&last_arp_time,ARP_TMR_INTERVAL/CLOCKTICKS_PER_MS))//ARP处理定时器
  {
	etharp_tmr();
  }
	if(timer_expired(&last_ipreass_time,IP_TMR_INTERVAL/CLOCKTICKS_PER_MS)){ //IP重新组装定时器
		ip_reass_tmr();
  }
  #if LWIP_DHCP>0			   					
  if(timer_expired(&last_dhcp_fine_time,DHCP_FINE_TIMER_MSECS/CLOCKTICKS_PER_MS))
  {
	 dhcp_fine_tmr();
  }
  if(timer_expired(&last_dhcp_coarse_time,DHCP_COARSE_TIMER_MSECS/CLOCKTICKS_PER_MS))
  {
	dhcp_coarse_tmr();
  }  
  #endif
  
}
コード例 #12
0
ファイル: netconf.c プロジェクト: sun182/therme
/**
  * @brief  LwIP periodic tasks
  * @param  localtime the current LocalTime value
  * @retval None
  */
void LwIP_Periodic_Handle(__IO uint32_t localtime)
{

  /* TCP periodic process every 250 ms */
  if (localtime - TCPTimer >= TCP_TMR_INTERVAL)
  {
    TCPTimer =  localtime;
    tcp_tmr();
  }
  /* ARP periodic process every 5s */
  if (localtime - ARPTimer >= ARP_TMR_INTERVAL)
  {
    ARPTimer =  localtime;
    etharp_tmr();
  }

#if LWIP_DHCP
  /* Fine DHCP periodic process every 500ms */
  if (localtime - DHCPfineTimer >= DHCP_FINE_TIMER_MSECS)
  {
    DHCPfineTimer =  localtime;
    dhcp_fine_tmr();
  }
  /* DHCP Coarse periodic process every 60s */
  if (localtime - DHCPcoarseTimer >= DHCP_COARSE_TIMER_MSECS)
  {
    DHCPcoarseTimer =  localtime;
    dhcp_coarse_tmr();
  }
#endif

}
コード例 #13
0
ファイル: main.c プロジェクト: AndreMiras/EFM32-Library
/**************************************************************************//**
 * @brief SysTick_Handler
 * Interrupt Service Routine for system tick counter.
 *****************************************************************************/
void SysTick_Handler(void)
{
  ++g_ulLocalTimer;
  ++tick_count;

  /*Service the host timer.*/
#if HOST_TMR_INTERVAL
  if ((g_ulLocalTimer - g_ulHostTimer) >= HOST_TMR_INTERVAL)
  {
    g_ulHostTimer = g_ulLocalTimer;
  }
#endif

  /* Service the ARP timer.*/
#if LWIP_ARP
  if ((g_ulLocalTimer - g_ulARPTimer) >= ARP_TMR_INTERVAL)
  {
    g_ulARPTimer = g_ulLocalTimer;
    etharp_tmr();
  }
#endif

  /* Service the TCP timer.*/
  if ((g_ulLocalTimer - g_ulTCPTimer) >= TCP_TMR_INTERVAL)
  {
    g_ulTCPTimer = g_ulLocalTimer;
    tcp_tmr();
  }

  /* Service the AutoIP timer.*/
#if LWIP_AUTOIP
  if ((g_ulLocalTimer - g_ulAutoIPTimer) >= AUTOIP_TMR_INTERVAL)
  {
    g_ulAutoIPTimer = g_ulLocalTimer;
    autoip_tmr();
  }
#endif

  /* Service the DCHP Coarse Timer. */
#if LWIP_DHCP
  if ((g_ulLocalTimer - g_ulDHCPCoarseTimer) >= DHCP_COARSE_TIMER_MSECS)
  {
    g_ulDHCPCoarseTimer = g_ulLocalTimer;
    dhcp_coarse_tmr();
  }
#endif

  /* Service the DCHP Fine Timer.*/
#if LWIP_DHCP
  if ((g_ulLocalTimer - g_ulDHCPFineTimer) >= DHCP_FINE_TIMER_MSECS)
  {
    g_ulDHCPFineTimer = g_ulLocalTimer;
    dhcp_fine_tmr();
  }
#endif
}
コード例 #14
0
ファイル: test_dhcp.c プロジェクト: NCTU-ivan/embarc_osp
static void tick_lwip(void)
{
  tick++;
  if (tick % 5 == 0) {
    dhcp_fine_tmr();
  }
  if (tick % 600 == 0) {
    dhcp_coarse_tmr();
  }
}
コード例 #15
0
void
timer_callback(XScuTimer * TimerInstance)
{
	/* we need to call tcp_fasttmr & tcp_slowtmr at intervals specified
	 * by lwIP. It is not important that the timing is absoluetly accurate.
	 */
	static int odd = 1;
#if LWIP_DHCP==1
    static int dhcp_timer = 0;
#endif

	odd = !odd;
#ifndef USE_SOFTETH_ON_ZYNQ
	ResetRxCntr++;
#endif
	tcp_fasttmr();
	if (odd) {
#if LWIP_DHCP==1
		dhcp_timer++;
		dhcp_timoutcntr--;
#endif
		tcp_slowtmr();
#if LWIP_DHCP==1
		dhcp_fine_tmr();
		if (dhcp_timer >= 120) {
			dhcp_coarse_tmr();
			dhcp_timer = 0;
		}
#endif
	}

	/* For providing an SW alternative for the SI #692601. Under heavy
	 * Rx traffic if at some point the Rx path becomes unresponsive, the
	 * following API call will ensures a SW reset of the Rx path. The
	 * API xemacpsif_resetrx_on_no_rxdata is called every 100 milliseconds.
	 * This ensures that if the above HW bug is hit, in the worst case,
	 * the Rx path cannot become unresponsive for more than 100
	 * milliseconds.
	 */
#ifndef USE_SOFTETH_ON_ZYNQ
	if (ResetRxCntr >= RESET_RX_CNTR_LIMIT) {
		xemacpsif_resetrx_on_no_rxdata(echo_netif);
		ResetRxCntr = 0;
	}
#endif
	XScuTimer_ClearInterruptStatus(TimerInstance);
}
コード例 #16
0
/*
 * 函数名:LwIP_Periodic_Handle
 * 描述  :lwip协议栈要求周期调用一些函数
 			tcp_tmr  etharp_tmr   dhcp_fine_tmr dhcp_coarse_tmr	 		
 * 输入  :无
 * 输出  : 无
 * 调用  :外部调用
 */
void LwIP_Periodic_Handle(__IO uint32_t localtime)
{
	//err_t  err;
	
	if(localtime - INPUT_Timer >= INPUT_TMR_INTERVAL)
		{
		    /* Read a received packet from the Ethernet buffers and send it to the lwIP for handling */
			ethernetif_input(&enc28j60); 			//轮询是否接收到数据
			//	err = ethernetif_input(&enc28j60); //轮询是否接收到数据

			//		if (err !=ERR_OK  ) 
			//		{
			//			
			//
			//			}
		}

	  /* TCP periodic process every 250 ms */
	  if (localtime - TCPTimer >= TCP_TMR_INTERVAL)
	  {
	    TCPTimer =  localtime;
	    tcp_tmr();		 //每250ms调用一次
	  }
	  /* ARP periodic process every 5s */
	  if (localtime - ARPTimer >= ARP_TMR_INTERVAL)
	  {
	    ARPTimer =  localtime;
	    etharp_tmr();	  //每5s调用一次
	  }

#if LWIP_DHCP
	  /* Fine DHCP periodic process every 500ms */
	  if (localtime - DHCPfineTimer >= DHCP_FINE_TIMER_MSECS)
	  {
	    DHCPfineTimer =  localtime;
	    dhcp_fine_tmr();
	  }
	  /* DHCP Coarse periodic process every 60s */
	  if (localtime - DHCPcoarseTimer >= DHCP_COARSE_TIMER_MSECS)
	  {
	    DHCPcoarseTimer =  localtime;
	    dhcp_coarse_tmr();
	  }
#endif

}
コード例 #17
0
ファイル: network.c プロジェクト: Stadtpirat/open-p3go
void net_poll(void) {

	u64 now = gettb();

	gelicif_input(&eth);
	if ((now - last_arp_time) >= (ARP_TMR_INTERVAL*TICKS_PER_MS)) {
		etharp_tmr();
		last_arp_time = now;
	}
#if LWIP_TCP
	if ((now - last_tcp_time) >= (TCP_TMR_INTERVAL*TICKS_PER_MS)) {
		tcp_tmr();
		last_tcp_time = now;
	}
#endif
	if ((now - last_dhcp_coarse_time) >= (DHCP_COARSE_TIMER_SECS*TICKS_PER_SEC)) {
		dhcp_coarse_tmr();
		last_dhcp_coarse_time = now;
	}
	if ((now - last_dhcp_fine_time) >= (DHCP_FINE_TIMER_MSECS*TICKS_PER_MS)) {
		dhcp_fine_tmr();
		last_dhcp_fine_time = now;
	}
}
コード例 #18
0
ファイル: ethernet.c プロジェクト: KrystianD/kdhome
void ethProcess()
{
	static uint32_t lastCheck = 0;

	if (ticks - lastCheck >= 1000) {
		lastCheck = ticks;

		// TProvHeader header;
		// provPrepareHeader(&header);
		
		// header.type = PROVIDER_TYPE_CONTROL;
		// header.cmd = 0;
		// provSendPacket(&header, sizeof(header));

		if (dodump)
			enc28j60Dump();
	}

	static uint32_t lastARPTime = 0;
	if (ticks - lastARPTime >= ARP_TMR_INTERVAL)
	{
		lastARPTime = ticks;
		etharp_tmr();
	}

	static uint32_t lastDHCPTime1 = 0;
	if (ticks - lastDHCPTime1 >= DHCP_COARSE_TIMER_MSECS)
	{
		lastDHCPTime1 = ticks;
		dhcp_coarse_tmr();
	}

	static uint32_t lastDHCPTime2 = 0;
	if (ticks - lastDHCPTime2 >= DHCP_FINE_TIMER_MSECS)
	{
		lastDHCPTime2 = ticks;
		dhcp_fine_tmr();
	}

	if (IO_IS_LOW(INT_ETH))
	{
		uint8_t eir = enc28j60ReadControl(EIR);
		myprintf("eir 0x%02x\r\n", eir);
		if (eir & EIR_LINKIF)
		{
			uint16_t phir = enc28j60ReadPhyWord(PHIR);
			if (phir & PHIR_PLNKIF)
			{
				uint16_t stat = enc28j60ReadPhyWord(PHSTAT2);
				if (stat & PHSTAT2_LSTAT) // link is up
				{
					myprintf("LINK UP\r\n");
					netif_set_up(&eth_netif);
					dhcp_start(&eth_netif);
				}
				else // link is down or was for a period
				{
					myprintf("LINK DOWN\r\n");
					dhcp_stop(&eth_netif);
					netif_set_down(&eth_netif);
				}
			}
			myprintf("phir: 0x%04x\r\n", phir);
		}
		enc28j60_if_input(&eth_netif);
	}
}
コード例 #19
0
/*..........................................................................*/
QState LwIPMgr_running(LwIPMgr *me, QEvt const *e) {
    switch (e->sig) {
        case Q_ENTRY_SIG: {
#if (LWIP_DHCP != 0)
            dhcp_start(me->netif);              /* start DHCP if configured */
            /* NOTE: If LWIP_AUTOIP is configured in lwipopts.h and
            * LWIP_DHCP_AUTOIP_COOP is set as well, the DHCP process will
            * start AutoIP after DHCP fails for 59 seconds.
            */
#elif (LWIP_AUTOIP != 0)
            autoip_start(me->netif);          /* start AutoIP if configured */
#endif
            QTimeEvt_postEvery(&me->te_LWIP_SLOW_TICK, (QActive *)me,
                (LWIP_SLOW_TICK_MS * BSP_TICKS_PER_SEC) / 1000U);
            return Q_HANDLED();
        }
        case Q_EXIT_SIG: {
            QTimeEvt_disarm(&me->te_LWIP_SLOW_TICK);
            return Q_HANDLED();
        }

        case SEND_UDP_SIG: {
            if (me->upcb->remote_port != 0U) {
                struct pbuf *p = pbuf_new((u8_t *)((TextEvt const *)e)->text,
                                     strlen(((TextEvt const *)e)->text) + 1U);
                if (p != (struct pbuf *)0) {
                    udp_send(me->upcb, p);
                    pbuf_free(p);                   /* don't leak the pbuf! */
                }
            }
            return Q_HANDLED();
        }

        case LWIP_RX_READY_SIG: {
            eth_driver_read();
            return Q_HANDLED();
        }
        case LWIP_TX_READY_SIG: {
            eth_driver_write();
            return Q_HANDLED();
        }
        case LWIP_SLOW_TICK_SIG: {
                                                 /* has IP address changed? */
            if (me->ip_addr != me->netif->ip_addr.addr) {
                me->ip_addr = me->netif->ip_addr.addr; /* save the IP addr. */
                BSP_displyIP(ntohl(me->ip_addr));
            }

#if LWIP_TCP
            me->tcp_tmr += LWIP_SLOW_TICK_MS;
            if (me->tcp_tmr >= TCP_TMR_INTERVAL) {
                me->tcp_tmr = 0;
                tcp_tmr();
            }
#endif
#if LWIP_ARP
            me->arp_tmr += LWIP_SLOW_TICK_MS;
            if (me->arp_tmr >= ARP_TMR_INTERVAL) {
                me->arp_tmr = 0;
                etharp_tmr();
            }
#endif
#if LWIP_DHCP
            me->dhcp_fine_tmr += LWIP_SLOW_TICK_MS;
            if (me->dhcp_fine_tmr >= DHCP_FINE_TIMER_MSECS) {
                me->dhcp_fine_tmr = 0;
                dhcp_fine_tmr();
            }
            me->dhcp_coarse_tmr += LWIP_SLOW_TICK_MS;
            if (me->dhcp_coarse_tmr >= DHCP_COARSE_TIMER_MSECS) {
                me->dhcp_coarse_tmr = 0;
                dhcp_coarse_tmr();
            }
#endif
#if LWIP_AUTOIP
            me->auto_ip_tmr += LWIP_SLOW_TICK_MS;
            if (me->auto_ip_tmr >= AUTOIP_TMR_INTERVAL) {
                me->auto_ip_tmr = 0;
                autoip_tmr();
            }
#endif
            return Q_HANDLED();
        }
        case LWIP_RX_OVERRUN_SIG: {
            LINK_STATS_INC(link.err);
            return Q_HANDLED();
        }
    }
    return Q_SUPER(&QHsm_top);
}
コード例 #20
0
static void
lwIPServiceTimers(void)
{
    //
    // Service the host timer.
    //
#if HOST_TMR_INTERVAL
    if((g_ui32LocalTimer - g_ui32HostTimer) >= HOST_TMR_INTERVAL)
    {
        g_ui32HostTimer = g_ui32LocalTimer;
        lwIPHostTimerHandler();
    }
#endif

    //
    // Service the ARP timer.
    //
#if LWIP_ARP
    if((g_ui32LocalTimer - g_ui32ARPTimer) >= ARP_TMR_INTERVAL)
    {
        g_ui32ARPTimer = g_ui32LocalTimer;
        etharp_tmr();
    }
#endif

    //
    // Service the TCP timer.
    //
#if LWIP_TCP
    if((g_ui32LocalTimer - g_ui32TCPTimer) >= TCP_TMR_INTERVAL)
    {
        g_ui32TCPTimer = g_ui32LocalTimer;
        tcp_tmr();
    }
#endif

    //
    // Service the AutoIP timer.
    //
#if LWIP_AUTOIP
    if((g_ui32LocalTimer - g_ui32AutoIPTimer) >= AUTOIP_TMR_INTERVAL)
    {
        g_ui32AutoIPTimer = g_ui32LocalTimer;
        autoip_tmr();
    }
#endif

    //
    // Service the DCHP Coarse Timer.
    //
#if LWIP_DHCP
    if((g_ui32LocalTimer - g_ui32DHCPCoarseTimer) >= DHCP_COARSE_TIMER_MSECS)
    {
        g_ui32DHCPCoarseTimer = g_ui32LocalTimer;
        dhcp_coarse_tmr();
    }
#endif

    //
    // Service the DCHP Fine Timer.
    //
#if LWIP_DHCP
    if((g_ui32LocalTimer - g_ui32DHCPFineTimer) >= DHCP_FINE_TIMER_MSECS)
    {
        g_ui32DHCPFineTimer = g_ui32LocalTimer;
        dhcp_fine_tmr();
    }
#endif

    //
    // Service the IP Reassembly Timer
    //
#if IP_REASSEMBLY
    if((g_ui32LocalTimer - g_ui32IPReassemblyTimer) >= IP_TMR_INTERVAL)
    {
        g_ui32IPReassemblyTimer = g_ui32LocalTimer;
        ip_reass_tmr();
    }
#endif

    //
    // Service the IGMP Timer
    //
#if LWIP_IGMP
    if((g_ui32LocalTimer - g_ui32IGMPTimer) >= IGMP_TMR_INTERVAL)
    {
        g_ui32IGMPTimer = g_ui32LocalTimer;
        igmp_tmr();
    }
#endif

    //
    // Service the DNS Timer
    //
#if LWIP_DNS
    if((g_ui32LocalTimer - g_ui32DNSTimer) >= DNS_TMR_INTERVAL)
    {
        g_ui32DNSTimer = g_ui32LocalTimer;
        dns_tmr();
    }
#endif

    //
    // Service the link timer.
    //
#if LWIP_AUTOIP || LWIP_DHCP
    if((g_ui32LocalTimer - g_ui32LinkTimer) >= LINK_TMR_INTERVAL)
    {
        g_ui32LinkTimer = g_ui32LocalTimer;
        lwIPLinkDetect();
    }
#endif
}
コード例 #21
0
/*..........................................................................*/
QState LwIPMgr_running(LwIPMgr *me, QEvent const *e) {
    switch (e->sig) {
        case Q_ENTRY_SIG: {
            QTimeEvt_postEvery(&me->te_LWIP_SLOW_TICK, (QActive *)me,
                (LWIP_SLOW_TICK_MS * BSP_TICKS_PER_SEC) / 1000);
            return Q_HANDLED();
        }
        case Q_EXIT_SIG: {
            QTimeEvt_disarm(&me->te_LWIP_SLOW_TICK);
            return Q_HANDLED();
        }

        case SEND_UDP_SIG: {
            if (me->upcb->remote_port != (uint16_t)0) {
                struct pbuf *p = pbuf_new((u8_t *)((TextEvt const *)e)->text,
                                      strlen(((TextEvt const *)e)->text) + 1);
                if (p != (struct pbuf *)0) {
                    udp_send(me->upcb, p);
                    printf("Sent: %s\n", ((TextEvt const *)e)->text);
                    pbuf_free(p);                   /* don't leak the pbuf! */
                }
            }
            return Q_HANDLED();
        }

        case LWIP_RX_READY_SIG: {
            eth_driver_read();
            return Q_HANDLED();
        }
        case LWIP_TX_READY_SIG: {
            eth_driver_write();
            return Q_HANDLED();
        }
        case LWIP_SLOW_TICK_SIG: {
                                                 /* has IP address changed? */
            if (me->ip_addr != me->netif->ip_addr.addr) {
                TextEvt *te;
                uint32_t ip_net;    /* IP address in the network byte order */

                me->ip_addr = me->netif->ip_addr.addr; /* save the IP addr. */
                ip_net  = ntohl(me->ip_addr);
                    /* publish the text event to display the new IP address */
                te = Q_NEW(TextEvt, DISPLAY_IPADDR_SIG);
                snprintf(te->text, Q_DIM(te->text), "%d.%d.%d.%d",
                         ((ip_net) >> 24) & 0xFF,
                         ((ip_net) >> 16) & 0xFF,
                         ((ip_net) >> 8)  & 0xFF,
                         ip_net           & 0xFF);
                QF_PUBLISH((QEvent *)te, me);
            }

#if LWIP_TCP
            me->tcp_tmr += LWIP_SLOW_TICK_MS;
            if (me->tcp_tmr >= TCP_TMR_INTERVAL) {
                me->tcp_tmr = 0;
                tcp_tmr();
            }
#endif
#if LWIP_ARP
            me->arp_tmr += LWIP_SLOW_TICK_MS;
            if (me->arp_tmr >= ARP_TMR_INTERVAL) {
                me->arp_tmr = 0;
                etharp_tmr();
            }
#endif
#if LWIP_DHCP
            me->dhcp_fine_tmr += LWIP_SLOW_TICK_MS;
            if (me->dhcp_fine_tmr >= DHCP_FINE_TIMER_MSECS) {
                me->dhcp_fine_tmr = 0;
                dhcp_fine_tmr();
            }
            me->dhcp_coarse_tmr += LWIP_SLOW_TICK_MS;
            if (me->dhcp_coarse_tmr >= DHCP_COARSE_TIMER_MSECS) {
                me->dhcp_coarse_tmr = 0;
                dhcp_coarse_tmr();
            }
#endif
#if LWIP_AUTOIP
            me->auto_ip_tmr += LWIP_SLOW_TICK_MS;
            if (me->auto_ip_tmr >= AUTOIP_TMR_INTERVAL) {
                me->auto_ip_tmr = 0;
                autoip_tmr();
            }
#endif
            return Q_HANDLED();
        }
        case LWIP_RX_OVERRUN_SIG: {
            LINK_STATS_INC(link.err);
            return Q_HANDLED();
        }
    }
コード例 #22
0
ファイル: main.c プロジェクト: hokim72/XIL_EDK
void network_thread(void *p)
{
    struct netif *netif;
    struct ip_addr ipaddr, netmask, gw;
#if LWIP_DHCP==1
    int mscnt = 0;
#endif
    /* the mac address of the board. this should be unique per board */
    unsigned char mac_ethernet_address[] = { 0x00, 0x0a, 0x35, 0x00, 0x01, 0x02 };

    netif = &server_netif;

#if LWIP_DHCP==0
    /* initliaze IP addresses to be used */
    IP4_ADDR(&ipaddr,  192, 168,   1, 10);
    IP4_ADDR(&netmask, 255, 255, 255,  0);
    IP4_ADDR(&gw,      192, 168,   1,  1);
#endif

    /* print out IP settings of the board */
    print("\r\n\r\n");
    print("-----lwIP Socket Mode Demo Application ------\r\n");

#if LWIP_DHCP==0
    print_ip_settings(&ipaddr, &netmask, &gw);
    /* print all application headers */
#endif

#if LWIP_DHCP==1
	ipaddr.addr = 0;
	gw.addr = 0;
	netmask.addr = 0;
#endif
    /* Add network interface to the netif_list, and set it as default */
    if (!xemac_add(netif, &ipaddr, &netmask, &gw, mac_ethernet_address, PLATFORM_EMAC_BASEADDR)) {
        xil_printf("Error adding N/W interface\r\n");
        return;
    }
    netif_set_default(netif);

    /* specify that the network if is up */
    netif_set_up(netif);

    /* start packet receive thread - required for lwIP operation */
    sys_thread_new("xemacif_input_thread", (void(*)(void*))xemacif_input_thread, netif,
            THREAD_STACKSIZE,
            DEFAULT_THREAD_PRIO);

#if LWIP_DHCP==1
    dhcp_start(netif);
    while (1) {
#ifdef OS_IS_FREERTOS
		vTaskDelay(DHCP_FINE_TIMER_MSECS / portTICK_RATE_MS);
#else
		sleep(DHCP_FINE_TIMER_MSECS);
#endif
		dhcp_fine_tmr();
		mscnt += DHCP_FINE_TIMER_MSECS;
		if (mscnt >= DHCP_COARSE_TIMER_SECS*1000) {
			dhcp_coarse_tmr();
			mscnt = 0;
		}
	}
#else
    print_headers();
    launch_app_threads();
#ifdef OS_IS_FREERTOS
    vTaskDelete(NULL);
#endif
#endif
    return;
}
コード例 #23
0
ファイル: lwip_high_level.c プロジェクト: Pidbip/lwip-avr
void lwIPServiceTimers(void)
{
    //
    // Service the host timer.
    //
#if HOST_TMR_INTERVAL
    if((g_ulLocalTimer - g_ulHostTimer) >= HOST_TMR_INTERVAL)
    {
        g_ulHostTimer = g_ulLocalTimer;
        lwIPHostTimerHandler();
    }
#endif

    //
    // Service the ARP timer.
    //
#if LWIP_ARP
    if((g_ulLocalTimer - g_ulARPTimer) >= ARP_TMR_INTERVAL)
    {
        g_ulARPTimer = g_ulLocalTimer;
        etharp_tmr();
    }
#endif

    //
    // Service the TCP timer.
    //
    if((g_ulLocalTimer - g_ulTCPTimer) >= TCP_TMR_INTERVAL)
    {
        g_ulTCPTimer = g_ulLocalTimer;
        tcp_tmr();
    }

    //
    // Service the AutoIP timer.
    //
#if LWIP_AUTOIP
    if((g_ulLocalTimer - g_ulAutoIPTimer) >= AUTOIP_TMR_INTERVAL)
    {
        g_ulAutoIPTimer = g_ulLocalTimer;
        autoip_tmr();
    }
#endif

    //
    // Service the DCHP Coarse Timer.
    //
#if LWIP_DHCP
    if((g_ulLocalTimer - g_ulDHCPCoarseTimer) >= DHCP_COARSE_TIMER_MSECS)
    {
        g_ulDHCPCoarseTimer = g_ulLocalTimer;
        dhcp_coarse_tmr();
    }
#endif

    //
    // Service the DCHP Fine Timer.
    //
#if LWIP_DHCP
    if((g_ulLocalTimer - g_ulDHCPFineTimer) >= DHCP_FINE_TIMER_MSECS)
    {
        g_ulDHCPFineTimer = g_ulLocalTimer;
        dhcp_fine_tmr();
    }
#endif
}
コード例 #24
0
ファイル: lwip_drv.cpp プロジェクト: bratkov/tmos
//*****************************************************************************
//
//! Service the lwIP timers.
//!
//! This function services all of the lwIP periodic timers, including TCP and
//! Host timers.  This should be called from the lwIP context, which may be
//! the Ethernet interrupt (in the case of a non-RTOS system) or the lwIP
//! thread, in the event that an RTOS is used.
//!
//! \return None.
//
//*****************************************************************************
static void lwIPServiceTimers(struct netif *netif)
{
	LWIP_DRIVER_DATA* drv_data = (LWIP_DRIVER_DATA*)netif;
	MAC_Type* mac = (MAC_Type*)netif->state;
    //
    // Service the MDIX timer.
    //
    if(drv_data->timer_main > drv_data->timer_mdix)
    {
        //
        // See if there has not been a link for 2 seconds.
        //
        if((EthernetPHYRead(mac, PHY_MR1) & PHY_MR1_LINK) == 0)
        {
            // There has not been a link for 2 seconds, so flip the MDI/MDIX
            // switch.  This is handled automatically by Fury rev A2, but is
            // harmless.
            //
        	mac->MDIX  ^= MAC_MDIX_EN;
       	    if (netif->flags & NETIF_FLAG_LINK_UP)
			{
#if LWIP_DHCP
                autoip_stop(netif);
                dhcp_start(netif);
#endif
				netif_set_link_down(netif);
			}
		}
		else
			netif_set_link_up(netif);
        //
        // Reset the MDIX timer.
        //
    	drv_data->timer_mdix = drv_data->timer_main + 2048;
    }

    //
    // Service the host timer.
    //
#if HOST_TMR_INTERVAL
    if(drv_data->timer_main > drv_data->timer_host )
    {
    	drv_data->timer_host = drv_data->timer_main + HOST_TMR_INTERVAL;
        lwIPHostTimerHandler();
    }
#endif

    //
    // Service the ARP timer.
    //
#if LWIP_ARP
    if(drv_data->timer_main > drv_data->timer_arp)
    {
    	drv_data->timer_arp = drv_data->timer_main + ARP_TMR_INTERVAL;
        etharp_tmr();
    }
#endif

    //
    // Service the TCP timer.
    //
#if LWIP_TCP
    if(drv_data->timer_main > drv_data->timer_tcp)
    {
    	drv_data->timer_tcp = drv_data->timer_main + TCP_TMR_INTERVAL;
        tcp_tmr();
    }
#endif

    //
    // Service the AutoIP timer.
    //
#if LWIP_AUTOIP
    if(drv_data->timer_main - drv_data->timer_autoIP)
    {
    	drv_data->timer_autoIP = drv_data->timer_main + AUTOIP_TMR_INTERVAL;
        autoip_tmr();
    }
#endif

    //
    // Service the DCHP Coarse Timer.
    //
#if LWIP_DHCP
    if(drv_data->timer_main > drv_data->timer_DHCPCoarse)
    {
    	drv_data->timer_DHCPCoarse = drv_data->timer_main + DHCP_COARSE_TIMER_MSECS;
        dhcp_coarse_tmr();
    }
#endif

    //
    // Service the DCHP Fine Timer.
    //
#if LWIP_DHCP
    if(drv_data->timer_main > drv_data->timer_DHCPFine)
    {
    	drv_data->timer_DHCPFine = drv_data->timer_main + DHCP_FINE_TIMER_MSECS;
        dhcp_fine_tmr();
    }
#endif
}
コード例 #25
0
static void
lwIPServiceTimers(void)
{
    //
    // Service the MDIX timer.
    //
    if((EthernetPHYRead(ETH_BASE, PHY_MR1) & PHY_MR1_LINK) == 0)
    {
        //
        // See if there has not been a link for 2 seconds.
        //
        if((g_ulLocalTimer - g_ulMDIXTimer) >= 2000)
        {
            //
            // There has not been a link for 2 seconds, so flip the MDI/MDIX
            // switch.  This is handled automatically by Fury rev A2, but is
            // harmless.
            //
            HWREG(ETH_BASE + MAC_O_MDIX) ^= MAC_MDIX_EN;

            //
            // Reset the MDIX timer.
            //
            g_ulMDIXTimer = g_ulLocalTimer;
        }
    }
    else
    {
        //
        // There is a link, so reset the MDIX timer.
        //
        g_ulMDIXTimer = g_ulLocalTimer;
    }

    //
    // Service the host timer.
    //
#if HOST_TMR_INTERVAL
    if((g_ulLocalTimer - g_ulHostTimer) >= HOST_TMR_INTERVAL)
    {
        g_ulHostTimer = g_ulLocalTimer;
        lwIPHostTimerHandler();
    }
#endif

    //
    // Service the ARP timer.
    //
#if LWIP_ARP
    if((g_ulLocalTimer - g_ulARPTimer) >= ARP_TMR_INTERVAL)
    {
        g_ulARPTimer = g_ulLocalTimer;
        etharp_tmr();
    }
#endif

    //
    // Service the TCP timer.
    //
#if LWIP_TCP
    if((g_ulLocalTimer - g_ulTCPTimer) >= TCP_TMR_INTERVAL)
    {
        g_ulTCPTimer = g_ulLocalTimer;
        tcp_tmr();
    }
#endif

    //
    // Service the AutoIP timer.
    //
#if LWIP_AUTOIP
    if((g_ulLocalTimer - g_ulAutoIPTimer) >= AUTOIP_TMR_INTERVAL)
    {
        g_ulAutoIPTimer = g_ulLocalTimer;
        autoip_tmr();
    }
#endif

    //
    // Service the DCHP Coarse Timer.
    //
#if LWIP_DHCP
    if((g_ulLocalTimer - g_ulDHCPCoarseTimer) >= DHCP_COARSE_TIMER_MSECS)
    {
        g_ulDHCPCoarseTimer = g_ulLocalTimer;
        dhcp_coarse_tmr();
    }
#endif

    //
    // Service the DCHP Fine Timer.
    //
#if LWIP_DHCP
    if((g_ulLocalTimer - g_ulDHCPFineTimer) >= DHCP_FINE_TIMER_MSECS)
    {
        g_ulDHCPFineTimer = g_ulLocalTimer;
        dhcp_fine_tmr();
    }
#endif

    //
    // Service the IP Reassembly Timer
    //
#if IP_REASSEMBLY
    if((g_ulLocalTimer - g_ulIPReassemblyTimer) >= IP_TMR_INTERVAL)
    {
        g_ulIPReassemblyTimer = g_ulLocalTimer;
        ip_reass_tmr();
    }
#endif

    //
    // Service the IGMP Timer
    //
#if LWIP_IGMP
    if((g_ulLocalTimer - g_ulIGMPTimer) >= IGMP_TMR_INTERVAL)
    {
        g_ulIGMPTimer = g_ulLocalTimer;
        igmp_tmr();
    }
#endif

    //
    // Service the DNS Timer
    //
#if LWIP_DNS
    if((g_ulLocalTimer - g_ulDNSTimer) >= DNS_TMR_INTERVAL)
    {
        g_ulDNSTimer = g_ulLocalTimer;
        dns_tmr();
    }
#endif
}
コード例 #26
0
ファイル: dhcp_config.c プロジェクト: mbattyani/stm32-bsp
/**
  * @brief  DHCP Process
* @param  argument: network interface
  * @retval None
  */
void dhcp_process(void const * argument)
{
  struct netif *netif = (struct netif *) argument;
  struct ip_addr ipaddr;
  struct ip_addr netmask;
  struct ip_addr gw;
  uint32_t IPaddress = 0;
  int mscnt =0;
  netif->ip_addr.addr = 0;
  netif->netmask.addr = 0;
  netif->gw.addr = 0;
  dhcp_start(netif);
  
  DHCP_state = DHCP_WAIT_ADDRESS;

  
  // int DHCP_state = DHCP_START;
  while( 1 )
    {
      osDelay(DHCP_FINE_TIMER_MSECS);
      dhcp_fine_tmr();
      
      mscnt += DHCP_FINE_TIMER_MSECS;
      if (mscnt >= DHCP_COARSE_TIMER_SECS*1000) {
        dhcp_coarse_tmr();
        mscnt = 0;
      }
      
      switch (DHCP_state)
        {
        case DHCP_WAIT_ADDRESS:
          {        
            /* Read the new IP address */
            IPaddress = netif->ip_addr.addr;
            
            if (IPaddress!=0) 
              {
                dhcp_renew(netif);
                DHCP_state = DHCP_ADDRESS_ASSIGNED;
                
#if 1             
                uint8_t iptab[4];
                char iptxt[80];
                
                iptab[0] = (uint8_t)(IPaddress >> 24);
                iptab[1] = (uint8_t)(IPaddress >> 16);
                iptab[2] = (uint8_t)(IPaddress >> 8);
                iptab[3] = (uint8_t)(IPaddress);
                
                
                sprintf(iptxt, "IP address assigned by a DHCP server: %d.%d.%d.%d", iptab[3], iptab[2], iptab[1], iptab[0]);       
                WriteConsole ("address IP affecté\n");
#endif        
                return;
              }
            else
              {
                /* DHCP timeout */
                if (netif->dhcp->tries > MAX_DHCP_TRIES)
                  {
                    DHCP_state = DHCP_TIMEOUT;
                    
                    /* Stop DHCP */
                    dhcp_stop(netif);
                    
                    /* Static address used */
                    IP4_ADDR(&ipaddr, IP_ADDR0 ,IP_ADDR1 , IP_ADDR2 , IP_ADDR3 );
                    IP4_ADDR(&netmask, NETMASK_ADDR0, NETMASK_ADDR1, NETMASK_ADDR2, NETMASK_ADDR3);
                    IP4_ADDR(&gw, GW_ADDR0, GW_ADDR1, GW_ADDR2, GW_ADDR3);
                    netif_set_addr(netif, &ipaddr , &netmask, &gw);
                    
                return;                    
                    
#if CONSOLE          
                    char iptxt[80];
                    sprintf((char*)iptxt, "%Static IP address  : d.%d.%d.%d", IP_ADDR0, IP_ADDR1, IP_ADDR2, IP_ADDR3);
                    WriteConsole("DHCP timeout !!\n");
                    WriteConsole(iptxt);      
#endif            
                  }
                else
                  netif->dhcp->tries++;
              }
          }
          break;
          
        default: break;
        }
コード例 #27
0
ファイル: ethernet.c プロジェクト: jkramarz/kdhome
void ethProcess()
{
	static uint32_t lastCheck = 0;

	if (ticks - lastCheck >= 1000) {
		lastCheck = ticks;

		TByteBuffer b;
		if (ethPrepareBuffer(&b, 2))
		{
			uint16_t type = 0x0000;
			BYTEBUFFER_APPEND(&b, type);
			ethSendPacket(&b);
			ethFreeBuffer(&b);
		}

		if (dodump)
			enc28j60Dump();
	}

	static uint32_t lastARPTime = 0;
	if (ticks - lastARPTime >= ARP_TMR_INTERVAL)
	{
		lastARPTime = ticks;
		etharp_tmr();
	}

	static uint32_t lastDHCPTime1 = 0;
	if (ticks - lastDHCPTime1 >= DHCP_COARSE_TIMER_MSECS)
	{
		lastDHCPTime1 = ticks;
		dhcp_coarse_tmr();
	}

	static uint32_t lastDHCPTime2 = 0;
	if (ticks - lastDHCPTime2 >= DHCP_FINE_TIMER_MSECS)
	{
		lastDHCPTime2 = ticks;
		dhcp_fine_tmr();
	}

	if (IO_IS_LOW(INT_ETH))
	{
		uint8_t eir = enc28j60ReadControl(EIR);
		myprintf("eir 0x%02x\r\n", eir);
		if (eir & EIR_LINKIF)
		{
			uint16_t phir = enc28j60ReadPhyWord(PHIR);
			if (phir & PHIR_PLNKIF)
			{
				uint16_t stat = enc28j60ReadPhyWord(PHSTAT2);
				if (stat & PHSTAT2_LSTAT) // link is up
				{
					myprintf("LINK UP\r\n");
					netif_set_up(&eth_netif);
					dhcp_start(&eth_netif);
				}
				else // link is down or was for a period
				{
					myprintf("LINK DOWN\r\n");
					dhcp_stop(&eth_netif);
					netif_set_down(&eth_netif);
				}
			}
			myprintf("phir: 0x%04x\r\n", phir);
		}
		enc28j60_if_input(&eth_netif);
	}
}
コード例 #28
0
ファイル: lwip_setup.c プロジェクト: drbokko/86Duino
static void
dhcp_coarse_tmr_cb(void *ctx)
{
        dhcp_coarse_tmr();
}