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

Function fdt_next_node

components/drivers/ofw/libfdt/fdt.c:247–285  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

245}
246
247int fdt_next_node(const void *fdt, int offset, int *depth)
248{
249 int nextoffset = 0;
250 uint32_t tag;
251
252 if (offset >= 0)
253 if ((nextoffset = fdt_check_node_offset_(fdt, offset)) < 0)
254 return nextoffset;
255
256 do {
257 offset = nextoffset;
258 tag = fdt_next_tag(fdt, offset, &nextoffset);
259
260 switch (tag) {
261 case FDT_PROP:
262 case FDT_NOP:
263 break;
264
265 case FDT_BEGIN_NODE:
266 if (depth)
267 (*depth)++;
268 break;
269
270 case FDT_END_NODE:
271 if (depth && ((--(*depth)) < 0))
272 return nextoffset;
273 break;
274
275 case FDT_END:
276 if ((nextoffset >= 0)
277 || ((nextoffset == -FDT_ERR_TRUNCATED) && !depth))
278 return -FDT_ERR_NOTFOUND;
279 else
280 return nextoffset;
281 }
282 } while (tag != FDT_BEGIN_NODE);
283
284 return offset;
285}
286
287int fdt_first_subnode(const void *fdt, int offset)
288{

Callers 10

fdt_find_max_phandleFunction · 0.70
fdt_get_pathFunction · 0.70
fdt_node_end_offset_Function · 0.70
fdt_first_subnodeFunction · 0.70
fdt_next_subnodeFunction · 0.70

Calls 2

fdt_check_node_offset_Function · 0.85
fdt_next_tagFunction · 0.70

Tested by

no test coverage detected