Wolfgang Denk | 2f9b7e4 | 2005-08-17 12:55:25 +0200 | [diff] [blame] | 1 | #ifndef _LINUX_COMPAT_H_ |
| 2 | #define _LINUX_COMPAT_H_ |
| 3 | |
Wolfgang Denk | 2f9b7e4 | 2005-08-17 12:55:25 +0200 | [diff] [blame] | 4 | #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 Juul | 9e9c2c1 | 2007-11-09 13:32:30 +0100 | [diff] [blame] | 18 | #define kzalloc(size, flags) calloc(size, 1) |
Stefan Roese | e0860d4 | 2009-05-12 14:29:39 +0200 | [diff] [blame] | 19 | #define vmalloc(size) malloc(size) |
| 20 | #define kfree(ptr) free(ptr) |
| 21 | #define vfree(ptr) free(ptr) |
| 22 | |
| 23 | #define DECLARE_WAITQUEUE(...) do { } while (0) |
| 24 | #define add_wait_queue(...) do { } while (0) |
| 25 | #define remove_wait_queue(...) do { } while (0) |
William Juul | 52c0796 | 2007-10-31 13:53:06 +0100 | [diff] [blame] | 26 | |
Stefan Roese | e0860d4 | 2009-05-12 14:29:39 +0200 | [diff] [blame] | 27 | #define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) |
Wolfgang Denk | 2f9b7e4 | 2005-08-17 12:55:25 +0200 | [diff] [blame] | 28 | |
| 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 Roese | 42fbddd | 2006-09-07 11:51:23 +0200 | [diff] [blame] | 40 | #ifndef BUG |
Wolfgang Denk | 2f9b7e4 | 2005-08-17 12:55:25 +0200 | [diff] [blame] | 41 | #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 Roese | 42fbddd | 2006-09-07 11:51:23 +0200 | [diff] [blame] | 46 | #endif /* BUG */ |
Wolfgang Denk | 2f9b7e4 | 2005-08-17 12:55:25 +0200 | [diff] [blame] | 47 | |
Mike Frysinger | 1f19e3f | 2012-04-26 02:34:44 +0000 | [diff] [blame] | 48 | #define WARN_ON(x) if (x) {printf("WARNING in %s line %d\n" \ |
| 49 | , __FILE__, __LINE__); } |
| 50 | |
Wolfgang Denk | 2f9b7e4 | 2005-08-17 12:55:25 +0200 | [diff] [blame] | 51 | #define PAGE_SIZE 4096 |
| 52 | #endif |