flatdevtree_env.h 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /*
  2. * This file adds the header file glue so that the shared files
  3. * flatdevicetree.[ch] can compile and work in the powerpc bootwrapper.
  4. *
  5. * strncmp & strchr copied from <file:lib/strings.c>
  6. * Copyright (C) 1991, 1992 Linus Torvalds
  7. *
  8. * Maintained by: Mark A. Greer <mgreer@mvista.com>
  9. */
  10. #ifndef _PPC_BOOT_FLATDEVTREE_ENV_H_
  11. #define _PPC_BOOT_FLATDEVTREE_ENV_H_
  12. #include <stdarg.h>
  13. #include <stddef.h>
  14. #include "types.h"
  15. #include "string.h"
  16. #include "stdio.h"
  17. #include "ops.h"
  18. #define be16_to_cpu(x) (x)
  19. #define cpu_to_be16(x) (x)
  20. #define be32_to_cpu(x) (x)
  21. #define cpu_to_be32(x) (x)
  22. #define be64_to_cpu(x) (x)
  23. #define cpu_to_be64(x) (x)
  24. static inline int strncmp(const char *cs, const char *ct, size_t count)
  25. {
  26. signed char __res = 0;
  27. while (count) {
  28. if ((__res = *cs - *ct++) != 0 || !*cs++)
  29. break;
  30. count--;
  31. }
  32. return __res;
  33. }
  34. static inline char *strchr(const char *s, int c)
  35. {
  36. for (; *s != (char)c; ++s)
  37. if (*s == '\0')
  38. return NULL;
  39. return (char *)s;
  40. }
  41. #endif /* _PPC_BOOT_FLATDEVTREE_ENV_H_ */