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.

你可能感兴趣的:(rtx定时器)