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

Function ofw_dts

components/drivers/ofw/ofw.c:677–728  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

675
676#ifdef RT_USING_MSH
677static void ofw_dts(int argc, char**argv)
678{
679 if (ofw_node_root)
680 {
681 if (argc == 1)
682 {
683 rt_ofw_node_dump_dts(ofw_node_root, RT_TRUE);
684 }
685 else if (argv[1][0] == '/')
686 {
687 struct rt_ofw_node *np = rt_ofw_find_node_by_path(argv[1]);
688
689 if (np)
690 {
691 rt_ofw_node_dump_dts(np, RT_FALSE);
692 }
693 else
694 {
695 rt_kprintf("%s not found.\n", argv[1]);
696 }
697 }
698 else if (argc >= 2 && !rt_strcmp(argv[1], "list") && argv[2][0] == '/')
699 {
700 struct rt_ofw_node *np = rt_ofw_find_node_by_path(argv[2]);
701
702 if (np)
703 {
704 const char *split = np == ofw_node_root ? "" : "/";
705
706 np = np->child;
707
708 while (np)
709 {
710 rt_kprintf("%s%s%s\n", argv[2], split, np->full_name);
711 np = np->sibling;
712 }
713 }
714 else
715 {
716 rt_kprintf("%s not found.\n", argv[2]);
717 }
718 }
719 else
720 {
721 rt_kprintf("Usage: %s {list} {path}\n", __func__);
722 }
723 }
724 else
725 {
726 rt_kprintf("\"/\" path not found.");
727 }
728}
729MSH_CMD_EXPORT(ofw_dts, dump the dts or node for this platform);
730#endif /* RT_USING_MSH */
731#endif /* RT_USING_CONSOLE */

Callers

nothing calls this directly

Calls 4

rt_ofw_node_dump_dtsFunction · 0.85
rt_ofw_find_node_by_pathFunction · 0.85
rt_kprintfFunction · 0.85
rt_strcmpFunction · 0.85

Tested by

no test coverage detected