diff options
author | David Gibson <david@gibson.dropbear.id.au> | 2007-10-16 13:58:25 +1000 |
---|---|---|
committer | Jon Loeliger <jdl@freescale.com> | 2007-10-16 07:41:37 -0500 |
commit | 333542fabf8720b881e992a5abca32ef4bcb841a (patch) | |
tree | 98efc3d886cbc5b5c999b40b8c05737d4e740b0c /tests/rw_tree1.c | |
parent | 121acdec91f269b3efb4b5ac45820f0d1a3b37a1 (diff) | |
download | dtc-333542fabf8720b881e992a5abca32ef4bcb841a.zip dtc-333542fabf8720b881e992a5abca32ef4bcb841a.tar.gz dtc-333542fabf8720b881e992a5abca32ef4bcb841a.tar.bz2 |
libfdt: Add functions for handling the "compatible" property
This patch adds functions for dealing with the compatible property.
fdt_node_check_compatible() can be used to determine whether a node is
compatible with a given string and fdt_node_offset_by_compatible()
locates nodes with a given compatible string.
Testcases for these functions are also included.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'tests/rw_tree1.c')
-rw-r--r-- | tests/rw_tree1.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/tests/rw_tree1.c b/tests/rw_tree1.c index 7835362..d063947 100644 --- a/tests/rw_tree1.c +++ b/tests/rw_tree1.c @@ -72,18 +72,23 @@ int main(int argc, char *argv[]) CHECK(fdt_add_mem_rsv(fdt, TEST_ADDR_1, TEST_SIZE_1)); CHECK(fdt_add_mem_rsv(fdt, TEST_ADDR_2, TEST_SIZE_2)); + CHECK(fdt_setprop_string(fdt, 0, "compatible", "test_tree1")); CHECK(fdt_setprop_typed(fdt, 0, "prop-int", TEST_VALUE_1)); CHECK(fdt_setprop_string(fdt, 0, "prop-str", TEST_STRING_1)); OFF_CHECK(offset, fdt_add_subnode(fdt, 0, "subnode@1")); + CHECK(fdt_setprop_string(fdt, offset, "compatible", "subnode1")); CHECK(fdt_setprop_typed(fdt, offset, "prop-int", TEST_VALUE_1)); OFF_CHECK(offset, fdt_add_subnode(fdt, offset, "subsubnode")); + CHECK(fdt_setprop(fdt, offset, "compatible", + "subsubnode1\0subsubnode", 23)); CHECK(fdt_setprop_typed(fdt, offset, "prop-int", TEST_VALUE_1)); OFF_CHECK(offset, fdt_add_subnode(fdt, 0, "subnode@2")); CHECK(fdt_setprop_typed(fdt, offset, "prop-int", TEST_VALUE_2)); OFF_CHECK(offset, fdt_add_subnode(fdt, offset, "subsubnode@0")); - + CHECK(fdt_setprop(fdt, offset, "compatible", + "subsubnode2\0subsubnode", 23)); CHECK(fdt_setprop_typed(fdt, offset, "prop-int", TEST_VALUE_2)); CHECK(fdt_pack(fdt)); |