Blame view
arch/sh/lib64/udelay.c
1.18 KB
1da177e4c Linux-2.6.12-rc2 |
1 |
/* |
a23ba4357 sh: comment tidyi... |
2 |
* arch/sh/lib64/udelay.c |
1da177e4c Linux-2.6.12-rc2 |
3 4 5 6 7 8 9 10 11 12 |
* * Delay routines, using a pre-computed "loops_per_jiffy" value. * * Copyright (C) 2000, 2001 Paolo Alberelli * Copyright (C) 2003, 2004 Paul Mundt * * This file is subject to the terms and conditions of the GNU General Public * License. See the file "COPYING" in the main directory of this archive * for more details. */ |
1da177e4c Linux-2.6.12-rc2 |
13 14 |
#include <linux/sched.h> #include <asm/param.h> |
1da177e4c Linux-2.6.12-rc2 |
15 16 17 18 19 20 21 |
/* * Use only for very small delays (< 1 msec). * * The active part of our cycle counter is only 32-bits wide, and * we're treating the difference between two marks as signed. On * a 1GHz box, that's about 2 seconds. */ |
7b9726a7a sh: Fix up the sh... |
22 |
void __delay(unsigned long loops) |
1da177e4c Linux-2.6.12-rc2 |
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
{ long long dummy; __asm__ __volatile__("gettr tr0, %1 \t" "pta $+4, tr0 \t" "addi %0, -1, %0 \t" "bne %0, r63, tr0 \t" "ptabs %1, tr0 \t":"=r"(loops), "=r"(dummy) :"0"(loops)); } |
ef9f89996 sh: Kill off unus... |
38 |
void __const_udelay(unsigned long xloops) |
1da177e4c Linux-2.6.12-rc2 |
39 |
{ |
7b9726a7a sh: Fix up the sh... |
40 |
__delay(xloops * (HZ * cpu_data[raw_smp_processor_id()].loops_per_jiffy)); |
1da177e4c Linux-2.6.12-rc2 |
41 |
} |
7b9726a7a sh: Fix up the sh... |
42 |
void __udelay(unsigned long usecs) |
1da177e4c Linux-2.6.12-rc2 |
43 |
{ |
7b9726a7a sh: Fix up the sh... |
44 |
__const_udelay(usecs * 0x000010c6); /* 2**32 / 1000000 */ |
1da177e4c Linux-2.6.12-rc2 |
45 |
} |
7b9726a7a sh: Fix up the sh... |
46 |
void __ndelay(unsigned long nsecs) |
1da177e4c Linux-2.6.12-rc2 |
47 |
{ |
7b9726a7a sh: Fix up the sh... |
48 |
__const_udelay(nsecs * 0x00000005); |
1da177e4c Linux-2.6.12-rc2 |
49 |
} |