Palacios Public Git Repository

To checkout Palacios execute

  git clone http://v3vee.org/palacios/palacios.web/palacios.git
This will give you the master branch. You probably want the devel branch or one of the release branches. To switch to the devel branch, simply execute
  cd palacios
  git checkout --track -b devel origin/devel
The other branches are similar.


Merge branch 'devel'
[palacios.git] / kitten / include / lwk / delay.h
1 #ifndef _LWK_DELAY_H
2 #define _LWK_DELAY_H
3
4 /*
5  * Copyright (C) 1993 Linus Torvalds
6  *
7  * Delay routines, using a pre-computed "loops_per_jiffy" value.
8  */
9
10 extern unsigned long loops_per_jiffy;
11
12 #include <arch/delay.h>
13
14 /*
15  * Using udelay() for intervals greater than a few milliseconds can
16  * risk overflow for high loops_per_jiffy (high bogomips) machines. The
17  * mdelay() provides a wrapper to prevent this.  For delays greater
18  * than MAX_UDELAY_MS milliseconds, the wrapper is used.  Architecture
19  * specific values can be defined in asm-???/delay.h as an override.
20  * The 2nd mdelay() definition ensures GCC will optimize away the 
21  * while loop for the common cases where n <= MAX_UDELAY_MS  --  Paul G.
22  */
23
24 #ifndef MAX_UDELAY_MS
25 #define MAX_UDELAY_MS   5
26 #endif
27
28 #ifdef notdef
29 #define mdelay(n) (\
30         {unsigned long __ms=(n); while (__ms--) udelay(1000);})
31 #else
32 #define mdelay(n) (\
33         (__builtin_constant_p(n) && (n)<=MAX_UDELAY_MS) ? udelay((n)*1000) : \
34         ({unsigned long __ms=(n); while (__ms--) udelay(1000);}))
35 #endif
36
37 #ifndef ndelay
38 #define ndelay(x)       udelay(((x)+999)/1000)
39 #endif
40
41 void calibrate_delay(void);
42 void msleep(unsigned int msecs);
43 unsigned long msleep_interruptible(unsigned int msecs);
44
45 static inline void ssleep(unsigned int seconds)
46 {
47         msleep(seconds * 1000);
48 }
49
50 #endif /* defined(_LWK_DELAY_H) */