LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Max. Value that could be passed to an udelay() function (https://www.linuxquestions.org/questions/linux-newbie-8/max-value-that-could-be-passed-to-an-udelay-function-720387/)

ananth86coolguy 04-20-2009 06:00 AM

Max. Value that could be passed to an udelay() function
 
Hi
Is there any limit in the value that we pass as argument to an udelay() function???i.e can we specify something like this:udelay(2000)??

With Regds
Ananth

jf.argentino 04-20-2009 08:38 AM

It's at least the unsigned long max value, 2000 would be OK, more over, depending on your kernel, this value could be rounded (up or down, don't remember) to the closest jiffy value.

jf.argentino 04-20-2009 08:44 AM

Oh sorry, I was thinking about usleep... So in fact that's true, you must use the good delay function, depending on the time you want to sleep: ndelay for ns, udelay for us and mdealy for ms scale, so use "mdelay (2)" instead. BUT it's a busy waiting, that means that noting else can be done during this time, you'd better use (if possible) one of the "sleep" family functions. look here: http://lwn.net/Kernel/LDD3/ chapter 7


All times are GMT -5. The time now is 02:51 PM.