1#ifndef _CRIS_DELAY_H
2#define _CRIS_DELAY_H
3
4/*
5 * Copyright (C) 1998, 1999, 2000, 2001 Axis Communications AB
6 *
7 * Delay routines, using a pre-computed "loops_per_second" value.
8 */
9
10#include <linux/config.h>
11#include <linux/linkage.h>
12
13#ifdef CONFIG_SMP
14#include <asm/smp.h>
15#endif
16
17extern void __do_delay(void);	/* Special register call calling convention */
18
19extern __inline__ void __delay(int loops)
20{
21	__asm__ __volatile__ (
22			      "move.d %0,$r9\n\t"
23			      "beq 2f\n\t"
24			      "subq 1,$r9\n\t"
25			      "1:\n\t"
26			      "bne 1b\n\t"
27			      "subq 1,$r9\n"
28			      "2:"
29			      : : "g" (loops) : "r9");
30}
31
32
33/* Use only for very small delays ( < 1 msec).  */
34
35extern unsigned long loops_per_usec; /* arch/cris/mm/init.c */
36
37extern __inline__ void udelay(unsigned long usecs)
38{
39	__delay(usecs * loops_per_usec);
40}
41
42#endif /* defined(_CRIS_DELAY_H) */
43
44
45
46