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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [linux/] [linux-2.4/] [include/] [asm-sparc64/] [delay.h] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1276 phoenix
/* $Id: delay.h,v 1.1.1.1 2004-04-15 03:00:53 phoenix Exp $
2
 * delay.h: Linux delay routines on the V9.
3
 *
4
 * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu).
5
 */
6
 
7
#ifndef __SPARC64_DELAY_H
8
#define __SPARC64_DELAY_H
9
 
10
#include <linux/config.h>
11
#include <linux/param.h>
12
 
13
#ifndef __ASSEMBLY__
14
 
15
#ifdef CONFIG_SMP
16
#include <asm/smp.h>
17
#else
18
extern unsigned long loops_per_jiffy;
19
#endif 
20
 
21
extern __inline__ void __delay(unsigned long loops)
22
{
23
        __asm__ __volatile__(
24
"       b,pt    %%xcc, 1f\n"
25
"        cmp    %0, 0\n"
26
"       .align  32\n"
27
"1:\n"
28
"       bne,pt  %%xcc, 1b\n"
29
"        subcc  %0, 1, %0\n"
30
        : "=&r" (loops)
31
        : "0" (loops)
32
        : "cc");
33
}
34
 
35
extern __inline__ void __udelay(unsigned long usecs, unsigned long lps)
36
{
37
        usecs *= 0x00000000000010c6UL;          /* 2**32 / 1000000 */
38
 
39
        __asm__ __volatile__(
40
"       mulx    %1, %2, %0\n"
41
"       srlx    %0, 32, %0\n"
42
        : "=r" (usecs)
43
        : "r" (usecs), "r" (lps));
44
 
45
        __delay(usecs * HZ);
46
}
47
 
48
extern __inline__ void __ndelay(unsigned long usecs, unsigned long lps)
49
{
50
        usecs *= 0x0000000000000005UL;          /* 2**32 / 10000 */
51
 
52
        __asm__ __volatile__(
53
"       mulx    %1, %2, %0\n"
54
"       srlx    %0, 32, %0\n"
55
        : "=r" (usecs)
56
        : "r" (usecs), "r" (lps));
57
 
58
        __delay(usecs * HZ);
59
}
60
 
61
#ifdef CONFIG_SMP
62
#define __udelay_val cpu_data[smp_processor_id()].udelay_val
63
#else
64
#define __udelay_val loops_per_jiffy
65
#endif
66
 
67
#define udelay(usecs) __udelay((usecs),__udelay_val)
68
#define ndelay(usecs) __ndelay((usecs),__udelay_val)
69
 
70
#endif /* !__ASSEMBLY__ */
71
 
72
#endif /* defined(__SPARC64_DELAY_H) */

powered by: WebSVN 2.1.0

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