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) |
| 21 | #define kfree(ptr) free(ptr) |
| 22 | |
| 23 | /* |
| 24 | * ..and if you can't take the strict |
| 25 | * types, you can specify one yourself. |
| 26 | * |
| 27 | * Or not use min/max at all, of course. |
| 28 | */ |
| 29 | #define min_t(type,x,y) \ |
| 30 | ({ type __x = (x); type __y = (y); __x < __y ? __x: __y; }) |
| 31 | #define max_t(type,x,y) \ |
| 32 | ({ type __x = (x); type __y = (y); __x > __y ? __x: __y; }) |
| 33 | |
Stefan Roese | 42fbddd | 2006-09-07 11:51:23 +0200 | [diff] [blame^] | 34 | #ifndef BUG |
Wolfgang Denk | 2f9b7e4 | 2005-08-17 12:55:25 +0200 | [diff] [blame] | 35 | #define BUG() do { \ |
| 36 | printf("U-Boot BUG at %s:%d!\n", __FILE__, __LINE__); \ |
| 37 | } while (0) |
| 38 | |
| 39 | #define BUG_ON(condition) do { if (condition) BUG(); } while(0) |
Stefan Roese | 42fbddd | 2006-09-07 11:51:23 +0200 | [diff] [blame^] | 40 | #endif /* BUG */ |
Wolfgang Denk | 2f9b7e4 | 2005-08-17 12:55:25 +0200 | [diff] [blame] | 41 | |
| 42 | #define likely(x) __builtin_expect(!!(x), 1) |
| 43 | #define unlikely(x) __builtin_expect(!!(x), 0) |
| 44 | |
| 45 | #define PAGE_SIZE 4096 |
| 46 | #endif |