linux kernel阶段读取dtsi配置方法

  • Post author:
  • Post category:linux


linux kernel阶段读取dtsi配置方法参考:

struct device_node *node;

const char *param_enable;

int ret = 0;

node = of_find_node_by_path(“/chosen”);

if (node) {


if (of_property_read_string(node, “func_enable”, &param_enable) == 0) {


if (strnstr(param_enable, “a_type”, 4))

ret = 1;

else if (strnstr(param_enable, “b_type”, 4))

ret = 2;

}

of_node_put(node);

} else {


pr_notice(“%s: Can’t find chosen node\n”, __func__);

}

return ret;

}



版权声明:本文为a2591748032原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。