T-Kernel 里 sleep API

T-Kernel 里有类似于 msleep() 的函数。

tk_slp_tsk ( TMO tmout ) ;

• TMO: Timeout time Time base 1 millisecond, 32-bit or higher signed integer (INT)

typedef INT TMO;

这里tk_slp_tsk可以指定tmout的值,表示睡眠的时间,单位是毫秒。

如果指定-1的话,必须有其他任务来唤醒该睡眠任务。


另外,下面函数也可以等待,但是是忙等。

参考:

http://www.t-engine.org/wp-content/themes/wp.vicuna/pdf/specifications/en_US/TEF020-S001-01.00.01_en.pdf

5.5.2    Micro wait
 - void WaitUsec( UINT usec )
    - void WaitNsec( UINT nsec )
        - usec   Wait time (microseconds)
        - nsec   Wait time (nanoseconds)
      Performs a micro wait for the specified interval.
      These waits occur in an ordinary busy loop, and as such are easily influenced by the runtime
      environment, such as execution in RAM, execution in ROM, memory cache on or off, etc. These
      wait times are therefore not very accurate.
      These waits are not the same as an OS WAIT state. The system state remains as RUN state.

相关的头文件参考:

tk/syslib.h

参考:http://monoist.atmarkit.co.jp/mn/articles/0608/08/news102_3.html



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值