Dzmitry Sankouski | 3154725 | 2023-03-07 13:21:11 +0300 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
| 2 | /* |
| 3 | * Copyright (c) 2015 Google, Inc |
| 4 | * (C) Copyright 2015 |
| 5 | * Bernecker & Rainer Industrieelektronik GmbH - http://www.br-automation.com |
| 6 | * (C) Copyright 2023 Dzmitry Sankouski <dsankouski@gmail.com> |
| 7 | */ |
| 8 | |
Dzmitry Sankouski | 3154725 | 2023-03-07 13:21:11 +0300 | [diff] [blame] | 9 | #define FLIPPED_DIRECTION 1 |
| 10 | #define NORMAL_DIRECTION 0 |
| 11 | |
| 12 | /** |
Dzmitry Sankouski | 39c1fa2 | 2023-03-07 13:21:14 +0300 | [diff] [blame] | 13 | * struct console_simple_priv - Private data for this driver |
| 14 | * |
| 15 | * @video_fontdata font graphical representation data |
| 16 | */ |
| 17 | struct console_simple_priv { |
| 18 | struct video_fontdata *fontdata; |
| 19 | }; |
| 20 | |
| 21 | /** |
Dzmitry Sankouski | 3154725 | 2023-03-07 13:21:11 +0300 | [diff] [blame] | 22 | * Checks if bits per pixel supported. |
| 23 | * |
| 24 | * @param bpix framebuffer bits per pixel. |
| 25 | * |
| 26 | * @returns 0, if supported, or else -ENOSYS. |
| 27 | */ |
| 28 | int check_bpix_support(int bpix); |
| 29 | |
| 30 | /** |
| 31 | * Fill 1 pixel in framebuffer, and go to next one. |
| 32 | * |
| 33 | * @param dstp a pointer to pointer to framebuffer. |
| 34 | * @param value value to write to framebuffer. |
| 35 | * @param pbytes framebuffer bytes per pixel. |
| 36 | * @param step framebuffer pointer increment. Usually is equal to pbytes, |
| 37 | * and may be negative to control filling direction. |
| 38 | */ |
| 39 | void fill_pixel_and_goto_next(void **dstp, u32 value, int pbytes, int step); |
| 40 | |
| 41 | /** |
| 42 | * Fills 1 character in framebuffer vertically. Vertically means we're filling char font data rows |
| 43 | * across the lines. |
| 44 | * |
| 45 | * @param pfont a pointer to character font data. |
| 46 | * @param line a pointer to pointer to framebuffer. It's a point for upper left char corner |
| 47 | * @param vid_priv driver private data. |
Dzmitry Sankouski | 39c1fa2 | 2023-03-07 13:21:14 +0300 | [diff] [blame] | 48 | * @fontdata font graphical representation data |
Dzmitry Sankouski | 3154725 | 2023-03-07 13:21:11 +0300 | [diff] [blame] | 49 | * @param direction controls character orientation. Can be normal or flipped. |
| 50 | * When normal: When flipped: |
| 51 | *|-----------------------------------------------| |
| 52 | *| line stepping | | |
| 53 | *| | | stepping -> | |
| 54 | *| * | | * * * | |
| 55 | *| * * v | * | |
| 56 | *| * | * | |
| 57 | *| * | * * ^ | |
| 58 | *| * * * | * | | |
| 59 | *| | | | |
| 60 | *| stepping -> | line stepping | |
| 61 | *|---!!we're starting from upper left char corner| |
| 62 | *|-----------------------------------------------| |
| 63 | * |
| 64 | * @returns 0, if success, or else error code. |
| 65 | */ |
| 66 | int fill_char_vertically(uchar *pfont, void **line, struct video_priv *vid_priv, |
Dzmitry Sankouski | 39c1fa2 | 2023-03-07 13:21:14 +0300 | [diff] [blame] | 67 | struct video_fontdata *fontdata, bool direction); |
Dzmitry Sankouski | 3154725 | 2023-03-07 13:21:11 +0300 | [diff] [blame] | 68 | |
| 69 | /** |
| 70 | * Fills 1 character in framebuffer horizontally. |
| 71 | * Horizontally means we're filling char font data columns across the lines. |
| 72 | * |
| 73 | * @param pfont a pointer to character font data. |
| 74 | * @param line a pointer to pointer to framebuffer. It's a point for upper left char corner |
| 75 | * @param vid_priv driver private data. |
Dzmitry Sankouski | 39c1fa2 | 2023-03-07 13:21:14 +0300 | [diff] [blame] | 76 | * @fontdata font graphical representation data |
Dzmitry Sankouski | 3154725 | 2023-03-07 13:21:11 +0300 | [diff] [blame] | 77 | * @param direction controls character orientation. Can be normal or flipped. |
| 78 | * When normal: When flipped: |
| 79 | *|-----------------------------------------------| |
| 80 | *| * | line stepping | |
| 81 | *| ^ * * * * * | | | |
| 82 | *| | * * | v * * | |
| 83 | *| | | * * * * * | |
| 84 | *| line stepping | * | |
| 85 | *| | | |
| 86 | *| stepping -> | <- stepping | |
| 87 | *|---!!we're starting from upper left char corner| |
| 88 | *|-----------------------------------------------| |
| 89 | * |
| 90 | * @returns 0, if success, or else error code. |
| 91 | */ |
| 92 | int fill_char_horizontally(uchar *pfont, void **line, struct video_priv *vid_priv, |
Dzmitry Sankouski | 39c1fa2 | 2023-03-07 13:21:14 +0300 | [diff] [blame] | 93 | struct video_fontdata *fontdata, bool direction); |
Dzmitry Sankouski | 3154725 | 2023-03-07 13:21:11 +0300 | [diff] [blame] | 94 | |
| 95 | /** |
Simon Glass | 37db20d | 2023-10-01 19:13:21 -0600 | [diff] [blame] | 96 | * draw_cursor_vertically() - Draw a simple vertical cursor |
| 97 | * |
| 98 | * @line: pointer to framebuffer buffer: upper left cursor corner |
| 99 | * @vid_priv: driver private data |
| 100 | * @height: height of the cursor in pixels |
| 101 | * @param direction controls cursor orientation. Can be normal or flipped. |
| 102 | * When normal: When flipped: |
| 103 | *|-----------------------------------------------| |
| 104 | *| * | line stepping | |
| 105 | *| ^ * * * * * | | | |
| 106 | *| | * * | v * * | |
| 107 | *| | | * * * * * | |
| 108 | *| line stepping | * | |
| 109 | *| | | |
| 110 | *| stepping -> | <<- stepping | |
| 111 | *|---!!we're starting from upper left char corner| |
| 112 | *|-----------------------------------------------| |
| 113 | * |
| 114 | * Return: 0, if success, or else error code. |
| 115 | */ |
| 116 | int draw_cursor_vertically(void **line, struct video_priv *vid_priv, |
| 117 | uint height, bool direction); |
| 118 | |
| 119 | /** |
Dzmitry Sankouski | 3154725 | 2023-03-07 13:21:11 +0300 | [diff] [blame] | 120 | * console probe function. |
| 121 | * |
| 122 | * @param dev a pointer to device. |
| 123 | * |
| 124 | * @returns 0, if success, or else error code. |
| 125 | */ |
| 126 | int console_probe(struct udevice *dev); |
Dzmitry Sankouski | e7ee1fd | 2023-03-07 13:21:16 +0300 | [diff] [blame] | 127 | |
| 128 | /** |
| 129 | * Internal function to be used in as ops. |
| 130 | * See details in video_console.h get_font_size function |
| 131 | **/ |
| 132 | const char *console_simple_get_font_size(struct udevice *dev, uint *sizep); |
| 133 | |
| 134 | /** |
| 135 | * Internal function to be used in as ops. |
| 136 | * See details in video_console.h get_font function |
| 137 | **/ |
| 138 | int console_simple_get_font(struct udevice *dev, int seq, struct vidfont_info *info); |
| 139 | |
| 140 | /** |
| 141 | * Internal function to be used in as ops. |
| 142 | * See details in video_console.h select_font function |
| 143 | **/ |
| 144 | int console_simple_select_font(struct udevice *dev, const char *name, uint size); |