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

Function rt_ofw_get_cpu_state_node

components/drivers/ofw/base.c:956–995  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

954}
955
956struct rt_ofw_node *rt_ofw_get_cpu_state_node(struct rt_ofw_node *cpu_np, int index)
957{
958 struct rt_ofw_cell_args args;
959 struct rt_ofw_node *np = RT_NULL, *state_np;
960 rt_err_t err = rt_ofw_parse_phandle_cells(cpu_np, "power-domains", "#power-domain-cells", 0, &args);
961
962 if (!err)
963 {
964 state_np = rt_ofw_parse_phandle(args.data, "domain-idle-states", index);
965
966 rt_ofw_node_put(args.data);
967
968 if (state_np)
969 {
970 np = state_np;
971 }
972 }
973
974 if (!np)
975 {
976 int count = 0;
977 rt_uint32_t phandle;
978 const fdt32_t *cell;
979 struct rt_ofw_prop *prop;
980
981 rt_ofw_foreach_prop_u32(cpu_np, "cpu-idle-states", prop, cell, phandle)
982 {
983 if (count == index)
984 {
985 np = rt_ofw_find_node_by_phandle((rt_phandle)phandle);
986
987 break;
988 }
989
990 ++count;
991 }
992 }
993
994 return np;
995}
996
997rt_uint64_t rt_ofw_get_cpu_id(struct rt_ofw_node *cpu_np)
998{

Callers

nothing calls this directly

Calls 4

rt_ofw_parse_phandleFunction · 0.85
rt_ofw_node_putFunction · 0.85

Tested by

no test coverage detected