libufdt_sysdeps.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /*
  2. * Copyright (C) 2016 The Android Open Source Project
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #ifndef LIBDTOVERLAY_SYSDEPS_H
  17. #define LIBDTOVERLAY_SYSDEPS_H
  18. /* Change these includes to match your platform to bring in the
  19. * equivalent types available in a normal C runtime. At least things
  20. * like uint8_t, uint64_t, and bool (with |false|, |true| keywords)
  21. * must be present.
  22. */
  23. #include <inttypes.h>
  24. //#include <stdbool.h>
  25. #include <stddef.h>
  26. #include <stdint.h>
  27. #ifdef DTO_ENABLE_DEBUG
  28. /* Print functions, used for diagnostics.
  29. *
  30. * These have no effect unless FDT_ENABLE_DEBUG is defined.
  31. */
  32. #define dto_debug(...) \
  33. do { \
  34. dto_print("DEBUG: %s():", __func__); \
  35. dto_print(__VA_ARGS__); \
  36. } while (0)
  37. #else
  38. #define dto_debug(...)
  39. #endif
  40. #define dto_error(...) \
  41. do { \
  42. dto_print("ERROR: %s():", __func__); \
  43. dto_print(__VA_ARGS__); \
  44. } while (0)
  45. int dto_print(const char *fmt, ...);
  46. void dto_qsort(void *base, size_t nmemb, size_t size,
  47. int (*compar)(const void *, const void *));
  48. void *dto_malloc(size_t size);
  49. void dto_free(void *ptr);
  50. char *dto_strdup(const char *s);
  51. char *dto_strchr(const char *s, int c);
  52. unsigned long int dto_strtoul(const char *nptr, char **endptr, int base);
  53. size_t dto_strlen(const char *s);
  54. int dto_memcmp(const void *lhs, const void *rhs, size_t n);
  55. void *dto_memcpy(void *dest, const void *src, size_t n);
  56. int dto_strcmp(const char *s1, const char *s2);
  57. int dto_strncmp(const char *s1, const char *s2, size_t n);
  58. void *dto_memchr(const void *s, int c, size_t n);
  59. void *dto_memset(void *s, int c, size_t n);
  60. #endif /* LIBDTOVERLAY_SYSDEPS_H */