| 81 | }; |
| 82 | |
| 83 | static struct rt_object *ofw_parse_object(struct rt_ofw_node *np, const char *cells_name) |
| 84 | { |
| 85 | const struct ofw_obj_cmp_list *item; |
| 86 | struct rt_object *obj = rt_ofw_data(np), *ret_obj = RT_NULL; |
| 87 | RT_BITMAP_DECLARE(idx_mask, RT_ARRAY_SIZE(ofw_obj_cmp_list)) = {}; |
| 88 | |
| 89 | for (int i = 0; i < RT_ARRAY_SIZE(ofw_obj_cmp_list); ++i) |
| 90 | { |
| 91 | item = &ofw_obj_cmp_list[i]; |
| 92 | |
| 93 | if (!rt_ofw_prop_read_bool(np, item->cells_name)) |
| 94 | { |
| 95 | rt_bitmap_set_bit(idx_mask, i); |
| 96 | } |
| 97 | } |
| 98 | |
| 99 | while (!ret_obj) |
| 100 | { |
| 101 | int i = 0; |
| 102 | |
| 103 | /* Is print ? */ |
| 104 | if (!((rt_uint32_t)(obj->name[0] - 0x20) < 0x5f)) |
| 105 | { |
| 106 | break; |
| 107 | } |
| 108 | |
| 109 | rt_bitmap_for_each_clear_bit(idx_mask, i, RT_ARRAY_SIZE(ofw_obj_cmp_list)) |
| 110 | { |
| 111 | item = &ofw_obj_cmp_list[i]; |
| 112 | |
| 113 | if (!rt_strncmp(item->obj_name, obj->name, RT_NAME_MAX)) |
| 114 | { |
| 115 | if (!rt_strcmp(item->cells_name, cells_name)) |
| 116 | { |
| 117 | ret_obj = obj; |
| 118 | break; |
| 119 | } |
| 120 | |
| 121 | obj = (struct rt_object *)((rt_ubase_t)obj + item->obj_size); |
| 122 | break; |
| 123 | } |
| 124 | } |
| 125 | |
| 126 | if (i >= RT_ARRAY_SIZE(ofw_obj_cmp_list)) |
| 127 | { |
| 128 | LOG_E("Invalid rt_object = %s", obj->name); |
| 129 | |
| 130 | break; |
| 131 | } |
| 132 | } |
| 133 | |
| 134 | return ret_obj; |
| 135 | } |
| 136 | |
| 137 | struct rt_object *rt_ofw_parse_object(struct rt_ofw_node *np, const char *obj_name, const char *cells_name) |
| 138 | { |
no test coverage detected