compat.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #ifndef _LINUX_COMPAT_H_
  2. #define _LINUX_COMPAT_H_
  3. #define __user
  4. #define __iomem
  5. #define ndelay(x) udelay(1)
  6. #define printk printf
  7. #define KERN_EMERG
  8. #define KERN_ALERT
  9. #define KERN_CRIT
  10. #define KERN_ERR
  11. #define KERN_WARNING
  12. #define KERN_NOTICE
  13. #define KERN_INFO
  14. #define KERN_DEBUG
  15. #define kmalloc(size, flags) malloc(size)
  16. #define kzalloc(size, flags) calloc(size, 1)
  17. #define vmalloc(size) malloc(size)
  18. #define kfree(ptr) free(ptr)
  19. #define vfree(ptr) free(ptr)
  20. #define DECLARE_WAITQUEUE(...) do { } while (0)
  21. #define add_wait_queue(...) do { } while (0)
  22. #define remove_wait_queue(...) do { } while (0)
  23. #define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
  24. /*
  25. * ..and if you can't take the strict
  26. * types, you can specify one yourself.
  27. *
  28. * Or not use min/max at all, of course.
  29. */
  30. #define min_t(type,x,y) \
  31. ({ type __x = (x); type __y = (y); __x < __y ? __x: __y; })
  32. #define max_t(type,x,y) \
  33. ({ type __x = (x); type __y = (y); __x > __y ? __x: __y; })
  34. #ifndef BUG
  35. #define BUG() do { \
  36. printf("U-Boot BUG at %s:%d!\n", __FILE__, __LINE__); \
  37. } while (0)
  38. #define BUG_ON(condition) do { if (condition) BUG(); } while(0)
  39. #endif /* BUG */
  40. #define likely(x) __builtin_expect(!!(x), 1)
  41. #define unlikely(x) __builtin_expect(!!(x), 0)
  42. #define PAGE_SIZE 4096
  43. #endif