Wolfgang Denk | 2f9b7e4 | 2005-08-17 12:55:25 +0200 | [diff] [blame] | 1 | #ifndef _LINUX_COMPAT_H_ |
| 2 | #define _LINUX_COMPAT_H_ |
| 3 | |
| 4 | #define __user |
| 5 | #define __iomem |
| 6 | |
| 7 | #define ndelay(x) udelay(1) |
| 8 | |
| 9 | #define printk printf |
| 10 | |
| 11 | #define KERN_EMERG |
| 12 | #define KERN_ALERT |
| 13 | #define KERN_CRIT |
| 14 | #define KERN_ERR |
| 15 | #define KERN_WARNING |
| 16 | #define KERN_NOTICE |
| 17 | #define KERN_INFO |
| 18 | #define KERN_DEBUG |
| 19 | |
| 20 | #define kmalloc(size, flags) malloc(size) |
William Juul | 9e9c2c1 | 2007-11-09 13:32:30 +0100 | [diff] [blame] | 21 | #define kzalloc(size, flags) calloc(size, 1) |
Stefan Roese | e0860d4 | 2009-05-12 14:29:39 +0200 | [diff] [blame] | 22 | #define vmalloc(size) malloc(size) |
| 23 | #define kfree(ptr) free(ptr) |
| 24 | #define vfree(ptr) free(ptr) |
| 25 | |
| 26 | #define DECLARE_WAITQUEUE(...) do { } while (0) |
| 27 | #define add_wait_queue(...) do { } while (0) |
| 28 | #define remove_wait_queue(...) do { } while (0) |
William Juul | 52c0796 | 2007-10-31 13:53:06 +0100 | [diff] [blame] | 29 | |
Stefan Roese | e0860d4 | 2009-05-12 14:29:39 +0200 | [diff] [blame] | 30 | #define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) |
Wolfgang Denk | 2f9b7e4 | 2005-08-17 12:55:25 +0200 | [diff] [blame] | 31 | |
| 32 | /* |
| 33 | * ..and if you can't take the strict |
| 34 | * types, you can specify one yourself. |
| 35 | * |
| 36 | * Or not use min/max at all, of course. |
| 37 | */ |
| 38 | #define min_t(type,x,y) \ |
| 39 | ({ type __x = (x); type __y = (y); __x < __y ? __x: __y; }) |
| 40 | #define max_t(type,x,y) \ |
| 41 | ({ type __x = (x); type __y = (y); __x > __y ? __x: __y; }) |
| 42 | |
Stefan Roese | 42fbddd | 2006-09-07 11:51:23 +0200 | [diff] [blame] | 43 | #ifndef BUG |
Wolfgang Denk | 2f9b7e4 | 2005-08-17 12:55:25 +0200 | [diff] [blame] | 44 | #define BUG() do { \ |
| 45 | printf("U-Boot BUG at %s:%d!\n", __FILE__, __LINE__); \ |
| 46 | } while (0) |
| 47 | |
| 48 | #define BUG_ON(condition) do { if (condition) BUG(); } while(0) |
Stefan Roese | 42fbddd | 2006-09-07 11:51:23 +0200 | [diff] [blame] | 49 | #endif /* BUG */ |
Wolfgang Denk | 2f9b7e4 | 2005-08-17 12:55:25 +0200 | [diff] [blame] | 50 | |
Mike Frysinger | 1f19e3f | 2012-04-26 02:34:44 +0000 | [diff] [blame] | 51 | #define WARN_ON(x) if (x) {printf("WARNING in %s line %d\n" \ |
| 52 | , __FILE__, __LINE__); } |
| 53 | |
Wolfgang Denk | 2f9b7e4 | 2005-08-17 12:55:25 +0200 | [diff] [blame] | 54 | #define PAGE_SIZE 4096 |
| 55 | #endif |