rtx定时器

2013-11-07
--luoqindong
<1> OS_ID os_tmr_create (
    U16 tcnt,      /* Length of the timer. */
    U16 info );    /* Argument to the callback function. */
    
    返回值:
    成功时返回定时器的ID号,失败时返回NULL


    该函数用于创建一个定时器,定时时间到会调用os_tmr_call函数,将info作为参数传到该函数.调用os_tmr_call函数后,
  定时器会被删除.


<2> void os_tmr_call (
    U16 info );    /* Identification of an expired timer. */
    定时器的回调函数, info为传给os_tmr_create的info参数.
  该函数在rtx_conf.c文件中定义,用户需要在该函数中添加自己的代码.
    该函数在sys tick中断处理函数中被调用,所以不用在该函数中调用os_开头的系统函数,可以调用isr_开头的函数.
    例子:
    void os_tmr_call (U16 info) 
    {
      switch (info) {
      case 1:          /* The supervised task is locked, */
                     /* recovery actions required.     */
        break;
      case 2:          /* The second task is locked.     */


        break;
        ..
      }
    }
 
<3> OS_ID os_tmr_kill (
    OS_ID timer );    /* ID of the timer to kill */


    返回值:
    定时器删除成功返回NULL, 删除失败返回timer参数.
    
    该函数用于删除一个定时器,如果在定时器链表中没有找到该定时器(如定时时间到,已经被内核删除),返回传进来的timer参数,
    删除成功返回NULL.
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值