blob: e1338bf489f8a1934c1c1e669d3db5db48d712be [file] [log] [blame]
Wolfgang Denk932394a2005-08-17 12:55:25 +02001#ifndef _LINUX_COMPAT_H_
2#define _LINUX_COMPAT_H_
3
Wolfgang Denk932394a2005-08-17 12:55:25 +02004#define ndelay(x) udelay(1)
5
6#define printk printf
7
8#define KERN_EMERG
9#define KERN_ALERT
10#define KERN_CRIT
11#define KERN_ERR
12#define KERN_WARNING
13#define KERN_NOTICE
14#define KERN_INFO
15#define KERN_DEBUG
16
17#define kmalloc(size, flags) malloc(size)
William Juul5e1dae52007-11-09 13:32:30 +010018#define kzalloc(size, flags) calloc(size, 1)
Stefan Roese0a572652009-05-12 14:29:39 +020019#define vmalloc(size) malloc(size)
20#define kfree(ptr) free(ptr)
21#define vfree(ptr) free(ptr)
William Juulcfa460a2007-10-31 13:53:06 +010022
Stefan Roese0a572652009-05-12 14:29:39 +020023#define DECLARE_WAITQUEUE(...) do { } while (0)
24#define add_wait_queue(...) do { } while (0)
25#define remove_wait_queue(...) do { } while (0)
26
27#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
Wolfgang Denk932394a2005-08-17 12:55:25 +020028
29/*
30 * ..and if you can't take the strict
31 * types, you can specify one yourself.
32 *
33 * Or not use min/max at all, of course.
34 */
35#define min_t(type,x,y) \
36 ({ type __x = (x); type __y = (y); __x < __y ? __x: __y; })
37#define max_t(type,x,y) \
38 ({ type __x = (x); type __y = (y); __x > __y ? __x: __y; })
39
Stefan Roese887e2ec2006-09-07 11:51:23 +020040#ifndef BUG
Wolfgang Denk932394a2005-08-17 12:55:25 +020041#define BUG() do { \
42 printf("U-Boot BUG at %s:%d!\n", __FILE__, __LINE__); \
43} while (0)
44
45#define BUG_ON(condition) do { if (condition) BUG(); } while(0)
Stefan Roese887e2ec2006-09-07 11:51:23 +020046#endif /* BUG */
Wolfgang Denk932394a2005-08-17 12:55:25 +020047
Mike Frysinger6777a3c2012-04-26 02:34:44 +000048#define WARN_ON(x) if (x) {printf("WARNING in %s line %d\n" \
49 , __FILE__, __LINE__); }
50
Wolfgang Denk932394a2005-08-17 12:55:25 +020051#define PAGE_SIZE 4096
52#endif