* add p cc
[mascara-docs.git] / i386 / linux / linux-2.3.21 / include / asm-ppc / delay.h
blob239e0d3ace8208b380323508b52bfc279db8d2cf
1 #ifndef _PPC_DELAY_H
2 #define _PPC_DELAY_H
4 /*
5 * Copyright 1996, Paul Mackerras.
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version
10 * 2 of the License, or (at your option) any later version.
13 extern unsigned long loops_per_sec;
15 extern __inline__ void __delay(unsigned int loops)
17 if (loops != 0)
18 __asm__ __volatile__("mtctr %0; 1: bdnz 1b" : :
19 "r" (loops) : "ctr");
22 extern __inline__ void udelay(unsigned long usecs)
24 unsigned long loops;
26 /* compute (usecs * 2^32 / 10^6) * loops_per_sec / 2^32 */
27 usecs *= 0x10c6; /* 2^32 / 10^6 */
28 __asm__("mulhwu %0,%1,%2" : "=r" (loops) :
29 "r" (usecs), "r" (loops_per_sec));
30 __delay(loops);
33 #endif /* defined(_PPC_DELAY_H) */