2009-06-12 22:01:00 +08:00
|
|
|
#ifndef _ASM_SCORE_DELAY_H
|
|
|
|
#define _ASM_SCORE_DELAY_H
|
|
|
|
|
2009-12-17 18:31:23 +08:00
|
|
|
#include <asm-generic/param.h>
|
|
|
|
|
2009-06-12 22:01:00 +08:00
|
|
|
static inline void __delay(unsigned long loops)
|
|
|
|
{
|
2009-06-19 13:53:49 +08:00
|
|
|
/* 3 cycles per loop. */
|
2009-06-12 22:01:00 +08:00
|
|
|
__asm__ __volatile__ (
|
2009-06-19 13:53:49 +08:00
|
|
|
"1:\tsubi\t%0, 3\n\t"
|
2009-06-12 22:01:00 +08:00
|
|
|
"cmpz.c\t%0\n\t"
|
2009-06-19 13:53:49 +08:00
|
|
|
"ble\t1b\n\t"
|
2009-06-12 22:01:00 +08:00
|
|
|
: "=r" (loops)
|
|
|
|
: "0" (loops));
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void __udelay(unsigned long usecs)
|
|
|
|
{
|
2009-06-19 13:53:49 +08:00
|
|
|
unsigned long loops_per_usec;
|
|
|
|
|
|
|
|
loops_per_usec = (loops_per_jiffy * HZ) / 1000000;
|
|
|
|
|
|
|
|
__delay(usecs * loops_per_usec);
|
2009-06-12 22:01:00 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
#define udelay(usecs) __udelay(usecs)
|
|
|
|
|
|
|
|
#endif /* _ASM_SCORE_DELAY_H */
|