diff options
author | Simon Glass <sjg@chromium.org> | 2023-08-14 16:40:33 -0600 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2023-08-25 13:54:33 -0400 |
commit | 2dee81fe5f4a6427ba48fe17ff017930ddf3b4e4 (patch) | |
tree | 5c5b7430be7aebda1bef1dfec42dfea806ee48e8 /test | |
parent | 6e648fa781eea9ae0c5e130217ffeabbd45d9385 (diff) | |
download | u-boot-2dee81fe5f4a6427ba48fe17ff017930ddf3b4e4.tar.gz u-boot-2dee81fe5f4a6427ba48fe17ff017930ddf3b4e4.tar.bz2 u-boot-2dee81fe5f4a6427ba48fe17ff017930ddf3b4e4.zip |
expo: cedit: Support writing settings to a file
Support writing settings from an expo into a file in FDT format. It
consists of a single node with a two properties for each sceneitem,
one with tag ID chosen by the user and another for its text value.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'test')
-rw-r--r-- | test/boot/cedit.c | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/test/boot/cedit.c b/test/boot/cedit.c index f3411f734f..1dd78c6415 100644 --- a/test/boot/cedit.c +++ b/test/boot/cedit.c @@ -7,6 +7,8 @@ #include <common.h> #include <cedit.h> #include <expo.h> +#include <mapmem.h> +#include <dm/ofnode.h> #include <test/ut.h> #include "bootstd_common.h" #include <test/cedit-test.h> @@ -51,3 +53,46 @@ static int cedit_base(struct unit_test_state *uts) return 0; } BOOTSTD_TEST(cedit_base, 0); + +/* Check the cedit write_fdt commands */ +static int cedit_fdt(struct unit_test_state *uts) +{ + struct video_priv *vid_priv; + extern struct expo *cur_exp; + ulong addr = 0x1000; + struct ofprop prop; + struct scene *scn; + oftree tree; + ofnode node; + void *fdt; + int i; + + console_record_reset_enable(); + ut_assertok(run_command("cedit load hostfs - cedit.dtb", 0)); + + ut_asserteq(ID_SCENE1, cedit_prepare(cur_exp, &vid_priv, &scn)); + + ut_assertok(run_command("cedit write_fdt hostfs - settings.dtb", 0)); + ut_assertok(run_commandf("load hostfs - %lx settings.dtb", addr)); + ut_assert_nextlinen("1024 bytes read"); + + fdt = map_sysmem(addr, 1024); + tree = oftree_from_fdt(fdt); + node = ofnode_find_subnode(oftree_root(tree), CEDIT_NODE_NAME); + + ut_asserteq(ID_CPU_SPEED_1, + ofnode_read_u32_default(node, "cpu-speed", 0)); + ut_asserteq_str("2 GHz", ofnode_read_string(node, "cpu-speed-str")); + ut_assert(ofnode_valid(node)); + + /* There should only be 4 properties */ + for (i = 0, ofnode_first_property(node, &prop); ofprop_valid(&prop); + i++, ofnode_next_property(&prop)) + ; + ut_asserteq(4, i); + + ut_assert_console_end(); + + return 0; +} +BOOTSTD_TEST(cedit_fdt, 0); |