OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [linux/] [linux-2.4/] [arch/] [x86_64/] [lib/] [delay.c] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1275 phoenix
/*
2
 *      Precise Delay Loops for i386
3
 *
4
 *      Copyright (C) 1993 Linus Torvalds
5
 *      Copyright (C) 1997 Martin Mares <mj@atrey.karlin.mff.cuni.cz>
6
 *
7
 *      The __delay function must _NOT_ be inlined as its execution time
8
 *      depends wildly on alignment on many x86 processors.
9
 */
10
 
11
#include <linux/config.h>
12
#include <linux/sched.h>
13
#include <linux/delay.h>
14
#include <asm/delay.h>
15
 
16
#ifdef CONFIG_SMP
17
#include <asm/smp.h>
18
#endif
19
 
20
void __delay(unsigned long loops)
21
{
22
        unsigned long bclock, now;
23
 
24
        rdtscl(bclock);
25
        do
26
        {
27
                rep_nop();
28
                rdtscl(now);
29
        }
30
        while((now-bclock) < loops);
31
}
32
 
33
inline void __const_udelay(unsigned long xloops)
34
{
35
        __delay(((xloops * current_cpu_data.loops_per_jiffy) >> 32) * HZ);
36
}
37
 
38
void __udelay(unsigned long usecs)
39
{
40
        __const_udelay(usecs * 0x000010c6);  /* 2**32 / 1000000 */
41
}
42
 
43
void __ndelay(unsigned long usecs)
44
{
45
       __const_udelay(usecs * 0x00005);  /* 2**32 / 1000000000 (rounded up) */
46
}
47
 

powered by: WebSVN 2.1.0

© copyright 1999-2025 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.