2 * Precise Delay Loops for x86-64
4 * Copyright (C) 1993 Linus Torvalds
5 * Copyright (C) 1997 Martin Mares <mj@atrey.karlin.mff.cuni.cz>
7 * The __delay function must _NOT_ be inlined as its execution time
8 * depends wildly on alignment on many x86 processors.
11 #include <linux/module.h>
12 #include <linux/sched.h>
13 #include <linux/delay.h>
14 #include <asm/delay.h>
21 int read_current_timer(unsigned long *timer_value
)
23 rdtscll(*timer_value
);
27 void __delay(unsigned long loops
)
37 while((now
-bclock
) < loops
);
39 EXPORT_SYMBOL(__delay
);
41 inline void __const_udelay(unsigned long xloops
)
43 __delay(((xloops
* HZ
*
44 cpu_data(raw_smp_processor_id()).loops_per_jiffy
) >> 32) + 1);
46 EXPORT_SYMBOL(__const_udelay
);
48 void __udelay(unsigned long usecs
)
50 __const_udelay(usecs
* 0x000010c7); /* 2**32 / 1000000 (rounded up) */
52 EXPORT_SYMBOL(__udelay
);
54 void __ndelay(unsigned long nsecs
)
56 __const_udelay(nsecs
* 0x00005); /* 2**32 / 1000000000 (rounded up) */
58 EXPORT_SYMBOL(__ndelay
);
This page took 0.201649 seconds and 6 git commands to generate.