2009-08-07 10:52:40 delay function in user space
Harbhajan Singh (INDIA)
Message: 78516
Hi,
Is there any delay function available in user space like udelay and mdelay.
there are usleep and msleep functions, but i need to put only the delay in user space.
Thank you.
QuoteReplyEditDelete
2009-08-07 11:02:45 Re: delay function in user space
Robin Getz (UNITED STATES)
Message: 78517
Harbhajan:
What are you trying to do? You may be able to use nanosleep() - but - that will yeild to the kernel, and other processes will be scheduled in. - it is a min delay - not an actual delay.
-Robin
QuoteReplyEditDelete
2009-08-07 11:06:17 delay function in user space
Michael Hennerich (GERMANY)
Message: 78519
I've used something like this before ....
void mydelay(unsigned int delay)
{
clock_t goal = delay * CLOCKS_PER_SEC / 1000 + clock();
while (goal > clock()) ;
}
QuoteReplyEditDelete
2009-08-07 11:08:25 Re: delay function in user space
Harbhajan Singh (INDIA)
Message: 78520
Dear Robin,
I am using the i2c driver calls from the user space. for some register setting i need to poll the bit of register whether it is set properly or not. so instead of polling i can put some delay instead of doing the kernel activity (i2c read and poll)
Is there any way?
Thank you.
QuoteReplyEditDelete
2009-08-07 11:17:42 Re: delay function in user space
Robin Getz (UNITED STATES)
Message: 78521
Harbhajan:
use nanosleep.
-Robin
QuoteReplyEditDelete
2009-08-07 12:00:19 Re: delay function in user space
Harbhajan Singh (INDIA)
Message: 78522
Hi Robin and Micheal,
Thank you.