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
)
18 __asm__
__volatile__("mtctr %0; 1: bdnz 1b" : :
22 extern __inline__
void udelay(unsigned long usecs
)
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
));
33 #endif /* defined(_PPC_DELAY_H) */