我是靠谱客的博主 受伤草莓,这篇文章主要介绍LwIP之定时事件,现在分享给大家,希望可以做个参考。

先看一下定时事件数据结构

/* 定时回调函数指针 */
typedef void (*sys_timeout_handler)(void *arg);

/* 定时器事件 */
struct sys_timeo 
{
  struct sys_timeo *next;        //下一个定时事件
  u32_t time;                    //定时时间
  sys_timeout_handler h;         //定时回调函数
  void *arg;                     //定时回调参数
};

 

所有的定时事件最终被串接在一个链表上

/* 定时事件队列 */
static struct sys_timeo *next_timeout;

 

下面看一下定时机制的实现代码

/* 初始化定时事件 */
void sys_timeouts_init(void)
{
	/* 启动IP重组定时事件 */
  sys_timeout(IP_TMR_INTERVAL, ip_reass_timer, NULL);

	/* 启动ARP定时事件 */
  sys_timeout(ARP_TMR_INTERVAL, arp_timer, NULL);
}

/* 启动定时事件 */
void sys_

最后

以上就是受伤草莓最近收集整理的关于LwIP之定时事件的全部内容,更多相关LwIP之定时事件内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(149)

评论列表共有 0 条评论

立即
投稿
返回
顶部