compat.h 972 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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 kfree(ptr) free(ptr)
  17. /*
  18. * ..and if you can't take the strict
  19. * types, you can specify one yourself.
  20. *
  21. * Or not use min/max at all, of course.
  22. */
  23. #define min_t(type,x,y) \
  24. ({ type __x = (x); type __y = (y); __x < __y ? __x: __y; })
  25. #define max_t(type,x,y) \
  26. ({ type __x = (x); type __y = (y); __x > __y ? __x: __y; })
  27. #ifndef BUG
  28. #define BUG() do { \
  29. printf("U-Boot BUG at %s:%d!\n", __FILE__, __LINE__); \
  30. } while (0)
  31. #define BUG_ON(condition) do { if (condition) BUG(); } while(0)
  32. #endif /* BUG */
  33. #define likely(x) __builtin_expect(!!(x), 1)
  34. #define unlikely(x) __builtin_expect(!!(x), 0)
  35. #define PAGE_SIZE 4096
  36. #endif