MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / rt_fdt_unflatten_single

Function rt_fdt_unflatten_single

components/drivers/ofw/fdt.c:1036–1071  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1034}
1035
1036struct rt_ofw_node *rt_fdt_unflatten_single(void *fdt)
1037{
1038 int root_off;
1039 struct fdt_info *header;
1040 struct rt_ofw_node *root = RT_NULL;
1041
1042 if (fdt && (root_off = fdt_path_offset(fdt, "/")) >= 0)
1043 {
1044 root = rt_calloc(1, sizeof(struct fdt_info) + sizeof(struct rt_ofw_node));
1045 }
1046
1047 if (root)
1048 {
1049 header = (void *)root + sizeof(struct rt_ofw_node);
1050
1051 rt_strncpy(header->name, "/", sizeof("/"));
1052
1053 header->fdt = fdt;
1054
1055 header->rsvmap = (struct fdt_reserve_entry *)((void *)fdt + fdt_off_mem_rsvmap(fdt));
1056 header->rsvmap_nr = fdt_num_mem_rsv(fdt);
1057
1058 if (!fdt_unflatten_single(root, root_off))
1059 {
1060 root->name = (const char *)header;
1061 }
1062 else
1063 {
1064 rt_ofw_node_destroy(root);
1065
1066 root = RT_NULL;
1067 }
1068 }
1069
1070 return root;
1071}

Callers 1

rt_fdt_unflattenFunction · 0.85

Calls 6

rt_callocFunction · 0.85
rt_strncpyFunction · 0.85
fdt_unflatten_singleFunction · 0.85
rt_ofw_node_destroyFunction · 0.85
fdt_path_offsetFunction · 0.50
fdt_num_mem_rsvFunction · 0.50

Tested by

no test coverage detected