mirror of
https://github.com/u-boot/u-boot.git
synced 2025-04-22 20:58:22 +00:00
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>
This commit is contained in:
parent
f80ebb2fe1
commit
8d0f890a0b
2 changed files with 41 additions and 6 deletions
32
boot/cedit.c
32
boot/cedit.c
|
@ -6,6 +6,8 @@
|
||||||
* Written by Simon Glass <sjg@chromium.org>
|
* Written by Simon Glass <sjg@chromium.org>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#define LOG_CATEGORY LOGC_EXPO
|
||||||
|
|
||||||
#include <common.h>
|
#include <common.h>
|
||||||
#include <cedit.h>
|
#include <cedit.h>
|
||||||
#include <cli.h>
|
#include <cli.h>
|
||||||
|
@ -47,18 +49,15 @@ int cedit_arange(struct expo *exp, struct video_priv *vpriv, uint scene_id)
|
||||||
return 0;
|
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;
|
struct video_priv *vid_priv;
|
||||||
uint scene_id;
|
|
||||||
struct udevice *dev;
|
struct udevice *dev;
|
||||||
struct scene *scn;
|
struct scene *scn;
|
||||||
bool done;
|
uint scene_id;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
cli_ch_init(cch);
|
|
||||||
|
|
||||||
/* For now we only support a video console */
|
/* For now we only support a video console */
|
||||||
ret = uclass_first_device_err(UCLASS_VIDEO, &dev);
|
ret = uclass_first_device_err(UCLASS_VIDEO, &dev);
|
||||||
if (ret)
|
if (ret)
|
||||||
|
@ -93,6 +92,27 @@ int cedit_run(struct expo *exp)
|
||||||
if (ret)
|
if (ret)
|
||||||
return log_msg_ret("dim", 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;
|
done = false;
|
||||||
do {
|
do {
|
||||||
struct expo_action act;
|
struct expo_action act;
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
#define __CEDIT_H
|
#define __CEDIT_H
|
||||||
|
|
||||||
struct expo;
|
struct expo;
|
||||||
|
struct scene;
|
||||||
struct video_priv;
|
struct video_priv;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -30,4 +31,18 @@ int cedit_arange(struct expo *exp, struct video_priv *vid_priv, uint scene_id);
|
||||||
*/
|
*/
|
||||||
int cedit_run(struct expo *exp);
|
int cedit_run(struct expo *exp);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* cedit_prepare() - Prepare to run a cedit
|
||||||
|
*
|
||||||
|
* Set up the video device, select the first scene and highlight the first item.
|
||||||
|
* This ensures that all menus have a selected item.
|
||||||
|
*
|
||||||
|
* @exp: Expo to use
|
||||||
|
* @vid_privp: Set to private data for the video device
|
||||||
|
* @scnp: Set to the first scene
|
||||||
|
* Return: scene ID of first scene if OK, -ve on error
|
||||||
|
*/
|
||||||
|
int cedit_prepare(struct expo *exp, struct video_priv **vid_privp,
|
||||||
|
struct scene **scnp);
|
||||||
|
|
||||||
#endif /* __CEDIT_H */
|
#endif /* __CEDIT_H */
|
||||||
|
|
Loading…
Add table
Reference in a new issue