delay.h 496 字节
Newer Older
1 2 3 4 5
#ifndef _ASM_SCORE_DELAY_H
#define _ASM_SCORE_DELAY_H

static inline void __delay(unsigned long loops)
{
6
	/* 3 cycles per loop. */
7
	__asm__ __volatile__ (
8
		"1:\tsubi\t%0, 3\n\t"
9
		"cmpz.c\t%0\n\t"
10
		"ble\t1b\n\t"
11 12 13 14 15 16
		: "=r" (loops)
		: "0" (loops));
}

static inline void __udelay(unsigned long usecs)
{
17 18 19 20 21
	unsigned long loops_per_usec;

	loops_per_usec = (loops_per_jiffy * HZ) / 1000000;

	__delay(usecs * loops_per_usec);
22 23 24 25 26
}

#define udelay(usecs) __udelay(usecs)

#endif /* _ASM_SCORE_DELAY_H */