dhcp_timer.c
来自「lwip tcp/ip 协议栈 adsp BF533 DSP 移植 用 visu」· C语言 代码 · 共 34 行
C
34 行
//
// dhcp_timer.c
//
// A small thread that runs once every DHCP_FINE_TIMER_MSECS to call the
// DHCP timer functions
//
#include "lwip/opt.h"
#include "lwip/sys.h"
#include "lwip/dhcp.h"
#include "netif/dhcp_timer.h"
static void dhcp_timer_thread(void* arg)
{
static int coarse_timer = (DHCP_COARSE_TIMER_SECS * 1000);
sys_sem_t sem = sys_sem_new(0);
while (1) {
dhcp_fine_tmr();
coarse_timer -= DHCP_FINE_TIMER_MSECS;
if (coarse_timer <= 0) {
dhcp_coarse_tmr();
coarse_timer = (DHCP_COARSE_TIMER_SECS * 1000);
}
sys_sem_wait_timeout(sem, DHCP_FINE_TIMER_MSECS);
}
}
void dhcp_timer_init()
{
sys_thread_new(dhcp_timer_thread, NULL, TCPIP_THREAD_PRIO);
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?