1 /* $Id: delay.h,v 1.11 2001/01/02 08:15:32 davem 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 #ifdef CONFIG_SMP
13 #include <linux/sched.h>
14 #include <asm/smp.h>
15 #endif
16
17 extern __inline__ void __delay(unsigned long loops)
18 {
19 __asm__ __volatile__("
20 b,pt %%xcc, 1f
21 cmp %0, 0
22 .align 32
23 1:
24 bne,pt %%xcc, 1b
25 subcc %0, 1, %0
26 " : "=&r" (loops)
27 : "" (loops)
28 : "cc");
29 }
30
31 extern __inline__ void __udelay(unsigned long usecs, unsigned long lps)
32 {
33 usecs *= 0x00000000000010c6UL; /* 2**32 / 1000000 */
34
35 __asm__ __volatile__("
36 mulx %1, %2, %0
37 srlx %0, 32, %0
38 " : "=r" (usecs)
39 : "r" (usecs), "r" (lps));
40
41 __delay(usecs * HZ);
42 }
43
44 #ifdef CONFIG_SMP
45 #define __udelay_val cpu_data[smp_processor_id()].udelay_val
46 #else
47 #define __udelay_val loops_per_jiffy
48 #endif
49
50 #define udelay(usecs) __udelay((usecs),__udelay_val)
51
52 #endif /* defined(__SPARC64_DELAY_H) */
53
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more
information.