dtb_head.c 749 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /*
  2. * Copyright (c) 2006-2023, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. */
  6. #include "dtb_node.h"
  7. static void *dtb_root = NULL;
  8. static struct dtb_node *dtb_node_list = NULL;
  9. void *get_fdt_blob(void)
  10. {
  11. return dtb_root;
  12. }
  13. struct dtb_node *get_dtb_node_head(void)
  14. {
  15. return dtb_node_list;
  16. }
  17. rt_bool_t dtb_node_active(void)
  18. {
  19. return dtb_node_list != NULL;
  20. }
  21. int device_tree_setup(void *mem_addr)
  22. {
  23. if(mem_addr)
  24. {
  25. if ((dtb_root = dtb_node_load_from_memory(mem_addr,1)) != NULL)
  26. {
  27. dtb_node_list = dtb_node_get_dtb_list(dtb_root);
  28. if (dtb_node_list != NULL)
  29. {
  30. return -1;
  31. }
  32. }
  33. return 0;
  34. }
  35. return -1;
  36. }