1.忙等待延时2s
unsigned long delay =jiffies +2*HZ;
while(time_before(jiffies,delay));
2.延时100个jiffies ,jiffies=1s/HZ ,HZ是内核里的一个常数,通常为100或1000
unsigned long delay =jiffies +100;
while(time_before(jiffies,delay));
3.延时n毫秒 mdelay(n) 或
unsigned long delay =jiffies +n*HZ/1000;
while(time_before(jiffies,delay));
4.头文件
#include
阅读(1195) | 评论(0) | 转发(0) |