diff options
author | Simon Glass <sjg@chromium.org> | 2022-10-06 17:36:03 +0300 |
---|---|---|
committer | Anatolij Gustschin <agust@denx.de> | 2022-10-30 10:43:24 +0300 |
commit | a032e4b55ea717fb931dd0d4754cf72b9bafe2f4 (patch) | |
tree | 503fc51df906b9bb0920be7d241af3495fc1883b /include | |
parent | db2c8ed3a5850e64fcf612d099ce7b22c480a752 (diff) | |
download | u-boot-a032e4b55ea717fb931dd0d4754cf72b9bafe2f4.tar.xz |
video: Move console colours to the video uclass
At present these are attached to vidconsole which means that the video
uclass requires that a console is enabled. This is not the intention.
The colours are a reasonable way of indexing common colours in any case,
so move them to the video uclass instead.
Rename vid_console_color() to video_index_to_colour() now that it is more
generic. Also fix the inconsistent spelling in these functions.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/video.h | 35 | ||||
-rw-r--r-- | include/video_console.h | 37 |
2 files changed, 35 insertions, 37 deletions
diff --git a/include/video.h b/include/video.h index 43e2c89977..1c30aea73c 100644 --- a/include/video.h +++ b/include/video.h @@ -131,6 +131,41 @@ struct video_ops { #define video_get_ops(dev) ((struct video_ops *)(dev)->driver->ops) +/** enum colour_idx - the 16 colors supported by consoles */ +enum colour_idx { + VID_BLACK = 0, + VID_RED, + VID_GREEN, + VID_BROWN, + VID_BLUE, + VID_MAGENTA, + VID_CYAN, + VID_LIGHT_GRAY, + VID_GRAY, + VID_LIGHT_RED, + VID_LIGHT_GREEN, + VID_YELLOW, + VID_LIGHT_BLUE, + VID_LIGHT_MAGENTA, + VID_LIGHT_CYAN, + VID_WHITE, + + VID_COLOUR_COUNT +}; + +/** + * video_index_to_colour() - convert a color code to a pixel's internal + * representation + * + * The caller has to guarantee that the color index is less than + * VID_COLOR_COUNT. + * + * @priv private data of the console device + * @idx color index + * Return: color value + */ +u32 video_index_to_colour(struct video_priv *priv, unsigned int idx); + /** * video_reserve() - Reserve frame-buffer memory for video devices * diff --git a/include/video_console.h b/include/video_console.h index 5921767fbf..72edd41919 100644 --- a/include/video_console.h +++ b/include/video_console.h @@ -15,30 +15,6 @@ struct video_priv; #define VID_TO_PIXEL(x) ((x) / VID_FRAC_DIV) #define VID_TO_POS(x) ((x) * VID_FRAC_DIV) -/* - * The 16 colors supported by the console - */ -enum color_idx { - VID_BLACK = 0, - VID_RED, - VID_GREEN, - VID_BROWN, - VID_BLUE, - VID_MAGENTA, - VID_CYAN, - VID_LIGHT_GRAY, - VID_GRAY, - VID_LIGHT_RED, - VID_LIGTH_GREEN, - VID_YELLOW, - VID_LIGHT_BLUE, - VID_LIGHT_MAGENTA, - VID_LIGHT_CYAN, - VID_WHITE, - - VID_COLOR_COUNT -}; - /** * struct vidconsole_priv - uclass-private data about a console device * @@ -243,19 +219,6 @@ int vidconsole_put_string(struct udevice *dev, const char *str); void vidconsole_position_cursor(struct udevice *dev, unsigned col, unsigned row); -/** - * vid_console_color() - convert a color code to a pixel's internal - * representation - * - * The caller has to guarantee that the color index is less than - * VID_COLOR_COUNT. - * - * @priv private data of the console device - * @idx color index - * Return: color value - */ -u32 vid_console_color(struct video_priv *priv, unsigned int idx); - #ifdef CONFIG_VIDEO_COPY /** * vidconsole_sync_copy() - Sync back to the copy framebuffer |