diff options
author | Simon Glass <sjg@chromium.org> | 2023-08-14 16:40:27 -0600 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2023-08-25 13:54:33 -0400 |
commit | 8d0f890a0b9b0f7bf0b529f18f81a45ec6f64eb1 (patch) | |
tree | c1bd74a67e3b4340b9969c37dfee3941480741d2 /boot/cedit.c | |
parent | f80ebb2fe10b8e31226424d46adbedd86768a9df (diff) | |
download | u-boot-8d0f890a0b9b0f7bf0b529f18f81a45ec6f64eb1.tar.gz u-boot-8d0f890a0b9b0f7bf0b529f18f81a45ec6f64eb1.tar.bz2 u-boot-8d0f890a0b9b0f7bf0b529f18f81a45ec6f64eb1.zip |
expo: Add a function to prepare a cedit
Split out the code which prepares the cedit for use, so we can call it
from a test.
Add a log category while we are here.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'boot/cedit.c')
-rw-r--r-- | boot/cedit.c | 32 |
1 files changed, 26 insertions, 6 deletions
diff --git a/boot/cedit.c b/boot/cedit.c index 2d16086bad..6c10b21145 100644 --- a/boot/cedit.c +++ b/boot/cedit.c @@ -6,6 +6,8 @@ * Written by Simon Glass <sjg@chromium.org> */ +#define LOG_CATEGORY LOGC_EXPO + #include <common.h> #include <cedit.h> #include <cli.h> @@ -47,18 +49,15 @@ int cedit_arange(struct expo *exp, struct video_priv *vpriv, uint scene_id) return 0; } -int cedit_run(struct expo *exp) +int cedit_prepare(struct expo *exp, struct video_priv **vid_privp, + struct scene **scnp) { - struct cli_ch_state s_cch, *cch = &s_cch; struct video_priv *vid_priv; - uint scene_id; struct udevice *dev; struct scene *scn; - bool done; + uint scene_id; int ret; - cli_ch_init(cch); - /* For now we only support a video console */ ret = uclass_first_device_err(UCLASS_VIDEO, &dev); if (ret) @@ -93,6 +92,27 @@ int cedit_run(struct expo *exp) if (ret) return log_msg_ret("dim", ret); + *vid_privp = vid_priv; + *scnp = scn; + + return scene_id; +} + +int cedit_run(struct expo *exp) +{ + struct cli_ch_state s_cch, *cch = &s_cch; + struct video_priv *vid_priv; + uint scene_id; + struct scene *scn; + bool done; + int ret; + + cli_ch_init(cch); + ret = cedit_prepare(exp, &vid_priv, &scn); + if (ret < 0) + return log_msg_ret("prep", ret); + scene_id = ret; + done = false; do { struct expo_action act; |