[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
why udelay in not valid in rt context?
Hi all,
I found udelay may cause dead in rtl , And Yodaiken said that udelay cannot
be used in rtl context in a thread of Jun 18.(I paste the thread below.)
But after examined the code of udelay I did not found any special operation.
As far as I see, the code is nothing more than a busy loop, and it only use
a piece of data in Linux ,the current_cpu_data.loops_per_sec.
Who can ponit out where the mistake is? thanks a lot.
#define udelay(n) (__builtin_constant_p(n) ? \
__const_udelay((n) * 0x10c6ul) : \
__udelay(n))
inline void __const_udelay(unsigned long xloops)
{
int d0;
__asm__("mull %0"
:"=d" (xloops), "=&a" (d0)
:"1" (xloops),"0" (current_cpu_data.loops_per_sec));
__delay(xloops);
}
void __udelay(unsigned long usecs)
{
__const_udelay(usecs * 0x000010c6); /* 2**32 / 1000000 */
}
This is the thread I mentioned.
On Sat, Jun 17, 2000 at 11:52:57PM +0800, Zaimin Zhong wrote:
> Hi!
>
> Sorry to waste the bandwidth, but I could not link following functions
>
> check_region()
> request_region()
> udelay()
These are exported kernel functions and are linked in dynamically by insmod
but
live in kernel space and cannot be statically linked.
(BTW: they cannot be used in RT threads or interrupt handlers).
>
> statically into my RTL module. Which libary must be linked when above
> functions are called.
>
dyd