]>
git.ipfire.org Git - thirdparty/u-boot.git/blob - drivers/video/vidconsole_internal.h
1 /* SPDX-License-Identifier: GPL-2.0+ */
3 * Copyright (c) 2015 Google, Inc
5 * Bernecker & Rainer Industrieelektronik GmbH - http://www.br-automation.com
6 * (C) Copyright 2023 Dzmitry Sankouski <dsankouski@gmail.com>
12 #define FLIPPED_DIRECTION 1
13 #define NORMAL_DIRECTION 0
16 * struct console_simple_priv - Private data for this driver
18 * @video_fontdata font graphical representation data
20 struct console_simple_priv
{
21 struct video_fontdata
*fontdata
;
25 * Checks if bits per pixel supported.
27 * @param bpix framebuffer bits per pixel.
29 * @returns 0, if supported, or else -ENOSYS.
31 int check_bpix_support(int bpix
);
34 * Fill 1 pixel in framebuffer, and go to next one.
36 * @param dstp a pointer to pointer to framebuffer.
37 * @param value value to write to framebuffer.
38 * @param pbytes framebuffer bytes per pixel.
39 * @param step framebuffer pointer increment. Usually is equal to pbytes,
40 * and may be negative to control filling direction.
42 void fill_pixel_and_goto_next(void **dstp
, u32 value
, int pbytes
, int step
);
45 * Fills 1 character in framebuffer vertically. Vertically means we're filling char font data rows
48 * @param pfont a pointer to character font data.
49 * @param line a pointer to pointer to framebuffer. It's a point for upper left char corner
50 * @param vid_priv driver private data.
51 * @fontdata font graphical representation data
52 * @param direction controls character orientation. Can be normal or flipped.
53 * When normal: When flipped:
54 *|-----------------------------------------------|
63 *| stepping -> | line stepping |
64 *|---!!we're starting from upper left char corner|
65 *|-----------------------------------------------|
67 * @returns 0, if success, or else error code.
69 int fill_char_vertically(uchar
*pfont
, void **line
, struct video_priv
*vid_priv
,
70 struct video_fontdata
*fontdata
, bool direction
);
73 * Fills 1 character in framebuffer horizontally.
74 * Horizontally means we're filling char font data columns across the lines.
76 * @param pfont a pointer to character font data.
77 * @param line a pointer to pointer to framebuffer. It's a point for upper left char corner
78 * @param vid_priv driver private data.
79 * @fontdata font graphical representation data
80 * @param direction controls character orientation. Can be normal or flipped.
81 * When normal: When flipped:
82 *|-----------------------------------------------|
83 *| * | line stepping |
87 *| line stepping | * |
89 *| stepping -> | <- stepping |
90 *|---!!we're starting from upper left char corner|
91 *|-----------------------------------------------|
93 * @returns 0, if success, or else error code.
95 int fill_char_horizontally(uchar
*pfont
, void **line
, struct video_priv
*vid_priv
,
96 struct video_fontdata
*fontdata
, bool direction
);
99 * draw_cursor_vertically() - Draw a simple vertical cursor
101 * @line: pointer to framebuffer buffer: upper left cursor corner
102 * @vid_priv: driver private data
103 * @height: height of the cursor in pixels
104 * @param direction controls cursor orientation. Can be normal or flipped.
105 * When normal: When flipped:
106 *|-----------------------------------------------|
107 *| * | line stepping |
111 *| line stepping | * |
113 *| stepping -> | <<- stepping |
114 *|---!!we're starting from upper left char corner|
115 *|-----------------------------------------------|
117 * Return: 0, if success, or else error code.
119 int draw_cursor_vertically(void **line
, struct video_priv
*vid_priv
,
120 uint height
, bool direction
);
123 * console probe function.
125 * @param dev a pointer to device.
127 * @returns 0, if success, or else error code.
129 int console_probe(struct udevice
*dev
);
132 * Internal function to be used in as ops.
133 * See details in video_console.h get_font_size function
135 const char *console_simple_get_font_size(struct udevice
*dev
, uint
*sizep
);
138 * Internal function to be used in as ops.
139 * See details in video_console.h get_font function
141 int console_simple_get_font(struct udevice
*dev
, int seq
, struct vidfont_info
*info
);
144 * Internal function to be used in as ops.
145 * See details in video_console.h select_font function
147 int console_simple_select_font(struct udevice
*dev
, const char *name
, uint size
);
150 * Internal function to convert Unicode code points to code page 437.
151 * Used by video consoles using bitmap fonts.
153 * @param codepoint Unicode code point
154 * @returns code page 437 character.
156 static inline u8
console_utf_to_cp437(int codepoint
)
158 if (CONFIG_IS_ENABLED(CHARSET
)) {
159 utf_to_cp(&codepoint
, codepage_437
);