blob: bde67fa9a5a9ec49518526d3c003d671a7b69994 [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
Simon Glass83510762016-01-18 19:52:17 -07002/*
3 * Copyright (c) 2015 Google, Inc
Simon Glass83510762016-01-18 19:52:17 -07004 */
5
6#ifndef __video_console_h
7#define __video_console_h
8
Heinrich Schuchardt5c30fbb2018-02-08 21:47:11 +01009#include <video.h>
10
Simon Glass9899eef2023-10-01 19:13:19 -060011struct abuf;
Simon Glass2d7c2682020-07-02 21:12:18 -060012struct video_priv;
13
Simon Glassf2661782016-01-14 18:10:37 -070014#define VID_FRAC_DIV 256
15
16#define VID_TO_PIXEL(x) ((x) / VID_FRAC_DIV)
17#define VID_TO_POS(x) ((x) * VID_FRAC_DIV)
18
Simon Glass37db20d2023-10-01 19:13:21 -060019enum {
20 /* cursor width in pixels */
21 VIDCONSOLE_CURSOR_WIDTH = 2,
22};
23
Simon Glass83510762016-01-18 19:52:17 -070024/**
25 * struct vidconsole_priv - uclass-private data about a console device
26 *
Simon Glassf2661782016-01-14 18:10:37 -070027 * Drivers must set up @rows, @cols, @x_charsize, @y_charsize in their probe()
28 * method. Drivers may set up @xstart_frac if desired.
29 *
Heinrich Schuchardt662f3812018-09-19 21:31:48 +020030 * @sdev: stdio device, acting as an output sink
31 * @xcur_frac: Current X position, in fractional units (VID_TO_POS(x))
32 * @ycur: Current Y position in pixels (0=top)
33 * @rows: Number of text rows
34 * @cols: Number of text columns
35 * @x_charsize: Character width in pixels
36 * @y_charsize: Character height in pixels
Simon Glassf2661782016-01-14 18:10:37 -070037 * @tab_width_frac: Tab width in fractional units
Heinrich Schuchardt662f3812018-09-19 21:31:48 +020038 * @xsize_frac: Width of the display in fractional units
Simon Glassc5b77d02016-01-14 18:10:39 -070039 * @xstart_frac: Left margin for the text console in fractional units
Heinrich Schuchardt662f3812018-09-19 21:31:48 +020040 * @last_ch: Last character written to the text console on this line
41 * @escape: TRUE if currently accumulating an ANSI escape sequence
42 * @escape_len: Length of accumulated escape sequence so far
43 * @col_saved: Saved X position, in fractional units (VID_TO_POS(x))
44 * @row_saved: Saved Y position in pixels (0=top)
45 * @escape_buf: Buffer to accumulate escape sequence
Simon Glass83510762016-01-18 19:52:17 -070046 */
47struct vidconsole_priv {
48 struct stdio_dev sdev;
Simon Glassf2661782016-01-14 18:10:37 -070049 int xcur_frac;
50 int ycur;
Simon Glass83510762016-01-18 19:52:17 -070051 int rows;
52 int cols;
Simon Glassf2661782016-01-14 18:10:37 -070053 int x_charsize;
54 int y_charsize;
55 int tab_width_frac;
56 int xsize_frac;
Simon Glassc5b77d02016-01-14 18:10:39 -070057 int xstart_frac;
Simon Glass58c733a2016-01-14 18:10:40 -070058 int last_ch;
Rob Clarka085aa12017-09-13 18:12:21 -040059 /*
60 * ANSI escape sequences are accumulated character by character,
61 * starting after the ESC char (0x1b) until the entire sequence
62 * is consumed at which point it is acted upon.
63 */
64 int escape;
65 int escape_len;
Heinrich Schuchardt662f3812018-09-19 21:31:48 +020066 int row_saved;
67 int col_saved;
Rob Clarka085aa12017-09-13 18:12:21 -040068 char escape_buf[32];
Simon Glass83510762016-01-18 19:52:17 -070069};
70
71/**
Simon Glass0e38bd82023-01-06 08:52:32 -060072 * struct vidfont_info - information about a font
73 *
74 * @name: Font name, e.g. nimbus_sans_l_regular
75 */
76struct vidfont_info {
77 const char *name;
78};
79
80/**
Simon Glass648a4992023-06-01 10:22:45 -060081 * struct vidconsole_colour - Holds colour information
82 *
83 * @colour_fg: Foreground colour (pixel value)
84 * @colour_bg: Background colour (pixel value)
85 */
86struct vidconsole_colour {
87 u32 colour_fg;
88 u32 colour_bg;
89};
90
91/**
Simon Glassb828ed72023-06-01 10:22:46 -060092 * struct vidconsole_bbox - Bounding box of text
93 *
94 * This describes the bounding box of something, measured in pixels. The x0/y0
95 * pair is inclusive; the x1/y2 pair is exclusive, meaning that it is one pixel
96 * beyond the extent of the object
97 *
98 * @valid: Values are valid (bounding box is known)
99 * @x0: left x position, in pixels from left side
100 * @y0: top y position, in pixels from top
101 * @x1: right x position + 1
102 * @y1: botton y position + 1
103 */
104struct vidconsole_bbox {
105 bool valid;
106 int x0;
107 int y0;
108 int x1;
109 int y1;
110};
111
112/**
Simon Glass83510762016-01-18 19:52:17 -0700113 * struct vidconsole_ops - Video console operations
114 *
115 * These operations work on either an absolute console position (measured
116 * in pixels) or a text row number (measured in rows, where each row consists
117 * of an entire line of text - typically 16 pixels).
118 */
119struct vidconsole_ops {
120 /**
121 * putc_xy() - write a single character to a position
122 *
123 * @dev: Device to write to
Simon Glassf2661782016-01-14 18:10:37 -0700124 * @x_frac: Fractional pixel X position (0=left-most pixel) which
125 * is the X position multipled by VID_FRAC_DIV.
Simon Glass83510762016-01-18 19:52:17 -0700126 * @y: Pixel Y position (0=top-most pixel)
127 * @ch: Character to write
Simon Glassf2661782016-01-14 18:10:37 -0700128 * @return number of fractional pixels that the cursor should move,
129 * if all is OK, -EAGAIN if we ran out of space on this line, other -ve
130 * on error
Simon Glass83510762016-01-18 19:52:17 -0700131 */
Simon Glassf2661782016-01-14 18:10:37 -0700132 int (*putc_xy)(struct udevice *dev, uint x_frac, uint y, char ch);
Simon Glass83510762016-01-18 19:52:17 -0700133
134 /**
135 * move_rows() - Move text rows from one place to another
136 *
137 * @dev: Device to adjust
138 * @rowdst: Destination text row (0=top)
139 * @rowsrc: Source start text row
140 * @count: Number of text rows to move
141 * @return 0 if OK, -ve on error
142 */
143 int (*move_rows)(struct udevice *dev, uint rowdst, uint rowsrc,
144 uint count);
145
146 /**
147 * set_row() - Set the colour of a text row
148 *
149 * Every pixel contained within the text row is adjusted
150 *
151 * @dev: Device to adjust
152 * @row: Text row to adjust (0=top)
153 * @clr: Raw colour (pixel value) to write to each pixel
154 * @return 0 if OK, -ve on error
155 */
156 int (*set_row)(struct udevice *dev, uint row, int clr);
Simon Glass58c733a2016-01-14 18:10:40 -0700157
158 /**
159 * entry_start() - Indicate that text entry is starting afresh
160 *
Simon Glass0e38bd82023-01-06 08:52:32 -0600161 * @dev: Device to adjust
162 * Returns: 0 on success, -ve on error
163 *
Simon Glass58c733a2016-01-14 18:10:40 -0700164 * Consoles which use proportional fonts need to track the position of
165 * each character output so that backspace will return to the correct
166 * place. This method signals to the console driver that a new entry
167 * line is being start (e.g. the user pressed return to start a new
168 * command). The driver can use this signal to empty its list of
169 * positions.
170 */
171 int (*entry_start)(struct udevice *dev);
Simon Glass7b9f7e42016-01-14 18:10:41 -0700172
173 /**
174 * backspace() - Handle erasing the last character
175 *
Simon Glass0e38bd82023-01-06 08:52:32 -0600176 * @dev: Device to adjust
177 * Returns: 0 on success, -ve on error
178 *
Simon Glass7b9f7e42016-01-14 18:10:41 -0700179 * With proportional fonts the vidconsole uclass cannot itself erase
180 * the previous character. This optional method will be called when
181 * a backspace is needed. The driver should erase the previous
182 * character and update the cursor position (xcur_frac, ycur) to the
183 * start of the previous character.
184 *
185 * If not implement, default behaviour will work for fixed-width
186 * characters.
187 */
188 int (*backspace)(struct udevice *dev);
Simon Glass0e38bd82023-01-06 08:52:32 -0600189
190 /**
191 * get_font() - Obtain information about a font (optional)
192 *
193 * @dev: Device to check
194 * @seq: Font number to query (0=first, 1=second, etc.)
195 * @info: Returns font information on success
196 * Returns: 0 on success, -ENOENT if no such font
197 */
198 int (*get_font)(struct udevice *dev, int seq,
199 struct vidfont_info *info);
200
201 /**
Dzmitry Sankouski4f6e3482023-03-07 13:21:15 +0300202 * get_font_size() - get the current font name and size
203 *
204 * @dev: vidconsole device
205 * @sizep: Place to put the font size (nominal height in pixels)
206 * Returns: Current font name
207 */
208 const char *(*get_font_size)(struct udevice *dev, uint *sizep);
209
210 /**
Simon Glass0e38bd82023-01-06 08:52:32 -0600211 * select_font() - Select a particular font by name / size
212 *
213 * @dev: Device to adjust
214 * @name: Font name to use (NULL to use default)
215 * @size: Font size to use (0 to use default)
216 * Returns: 0 on success, -ENOENT if no such font
217 */
218 int (*select_font)(struct udevice *dev, const char *name, uint size);
Simon Glassb828ed72023-06-01 10:22:46 -0600219
220 /**
221 * measure() - Measure the bounds of some text
222 *
223 * @dev: Device to adjust
224 * @name: Font name to use (NULL to use default)
225 * @size: Font size to use (0 to use default)
226 * @text: Text to measure
227 * @bbox: Returns bounding box of text, assuming it is positioned
228 * at 0,0
229 * Returns: 0 on success, -ENOENT if no such font
230 */
231 int (*measure)(struct udevice *dev, const char *name, uint size,
232 const char *text, struct vidconsole_bbox *bbox);
Simon Glass9e55d092023-10-01 19:13:18 -0600233
234 /**
235 * nominal() - Measure the expected width of a line of text
236 *
237 * Uses an average font width and nominal height
238 *
239 * @dev: Console device to use
240 * @name: Font name, NULL for default
241 * @size: Font size, ignored if @name is NULL
242 * @num_chars: Number of characters to use
243 * @bbox: Returns nounding box of @num_chars characters
244 * Returns: 0 if OK, -ve on error
245 */
246 int (*nominal)(struct udevice *dev, const char *name, uint size,
247 uint num_chars, struct vidconsole_bbox *bbox);
Simon Glass9899eef2023-10-01 19:13:19 -0600248
249 /**
250 * entry_save() - Save any text-entry information for later use
251 *
252 * Saves text-entry context such as a list of positions for each
253 * character in the string.
254 *
255 * @dev: Console device to use
256 * @buf: Buffer to hold saved data
257 * Return: 0 if OK, -ENOMEM if out of memory
258 */
259 int (*entry_save)(struct udevice *dev, struct abuf *buf);
260
261 /**
262 * entry_restore() - Restore text-entry information for current use
263 *
264 * Restores text-entry context such as a list of positions for each
265 * character in the string.
266 *
267 * @dev: Console device to use
268 * @buf: Buffer containing data to restore
269 * Return: 0 if OK, -ve on error
270 */
271 int (*entry_restore)(struct udevice *dev, struct abuf *buf);
Simon Glass37db20d2023-10-01 19:13:21 -0600272
273 /**
274 * set_cursor_visible() - Show or hide the cursor
275 *
276 * Shows or hides a cursor at the current position
277 *
278 * @dev: Console device to use
279 * @visible: true to show the cursor, false to hide it
280 * @x: X position in pixels
281 * @y: Y position in pixels
282 * @index: Character position (0 = at start)
283 * Return: 0 if OK, -ve on error
284 */
285 int (*set_cursor_visible)(struct udevice *dev, bool visible,
286 uint x, uint y, uint index);
Simon Glass83510762016-01-18 19:52:17 -0700287};
288
289/* Get a pointer to the driver operations for a video console device */
290#define vidconsole_get_ops(dev) ((struct vidconsole_ops *)(dev)->driver->ops)
291
292/**
Simon Glass0e38bd82023-01-06 08:52:32 -0600293 * vidconsole_get_font() - Obtain information about a font
294 *
295 * @dev: Device to check
296 * @seq: Font number to query (0=first, 1=second, etc.)
297 * @info: Returns font information on success
298 * Returns: 0 on success, -ENOENT if no such font, -ENOSYS if there is no such
299 * method
300 */
301int vidconsole_get_font(struct udevice *dev, int seq,
302 struct vidfont_info *info);
303
304/**
305 * vidconsole_select_font() - Select a particular font by name / size
306 *
307 * @dev: Device to adjust
308 * @name: Font name to use (NULL to use default)
309 * @size: Font size to use (0 to use default)
310 */
311int vidconsole_select_font(struct udevice *dev, const char *name, uint size);
312
Simon Glassb828ed72023-06-01 10:22:46 -0600313/*
314 * vidconsole_measure() - Measuring the bounding box of some text
315 *
316 * @dev: Console device to use
317 * @name: Font name, NULL for default
318 * @size: Font size, ignored if @name is NULL
319 * @text: Text to measure
320 * @bbox: Returns nounding box of text
321 * Returns: 0 if OK, -ve on error
322 */
323int vidconsole_measure(struct udevice *dev, const char *name, uint size,
324 const char *text, struct vidconsole_bbox *bbox);
325
Simon Glass0e38bd82023-01-06 08:52:32 -0600326/**
Simon Glass9e55d092023-10-01 19:13:18 -0600327 * vidconsole_nominal() - Measure the expected width of a line of text
328 *
329 * Uses an average font width and nominal height
330 *
331 * @dev: Console device to use
332 * @name: Font name, NULL for default
333 * @size: Font size, ignored if @name is NULL
334 * @num_chars: Number of characters to use
335 * @bbox: Returns nounding box of @num_chars characters
336 * Returns: 0 if OK, -ve on error
337 */
338int vidconsole_nominal(struct udevice *dev, const char *name, uint size,
339 uint num_chars, struct vidconsole_bbox *bbox);
340
341/**
Simon Glass9899eef2023-10-01 19:13:19 -0600342 * vidconsole_entry_save() - Save any text-entry information for later use
343 *
344 * Saves text-entry context such as a list of positions for each
345 * character in the string.
346 *
347 * @dev: Console device to use
348 * @buf: Buffer to hold saved data
349 * Return: 0 if OK, -ENOMEM if out of memory
350 */
351int vidconsole_entry_save(struct udevice *dev, struct abuf *buf);
352
353/**
354 * entry_restore() - Restore text-entry information for current use
355 *
356 * Restores text-entry context such as a list of positions for each
357 * character in the string.
358 *
359 * @dev: Console device to use
360 * @buf: Buffer containing data to restore
361 * Return: 0 if OK, -ve on error
362 */
363int vidconsole_entry_restore(struct udevice *dev, struct abuf *buf);
364
365/**
Simon Glass37db20d2023-10-01 19:13:21 -0600366 * vidconsole_set_cursor_visible() - Show or hide the cursor
367 *
368 * Shows or hides a cursor at the current position
369 *
370 * @dev: Console device to use
371 * @visible: true to show the cursor, false to hide it
372 * @x: X position in pixels
373 * @y: Y position in pixels
374 * @index: Character position (0 = at start)
375 * Return: 0 if OK, -ve on error
376 */
377int vidconsole_set_cursor_visible(struct udevice *dev, bool visible,
378 uint x, uint y, uint index);
379
380/**
Simon Glass648a4992023-06-01 10:22:45 -0600381 * vidconsole_push_colour() - Temporarily change the font colour
382 *
383 * @dev: Device to adjust
384 * @fg: Foreground colour to select
385 * @bg: Background colour to select
386 * @old: Place to store the current colour, so it can be restored
387 */
388void vidconsole_push_colour(struct udevice *dev, enum colour_idx fg,
389 enum colour_idx bg, struct vidconsole_colour *old);
390
391/**
392 * vidconsole_pop_colour() - Restore the original colour
393 *
394 * @dev: Device to adjust
395 * @old: Old colour to be restored
396 */
397void vidconsole_pop_colour(struct udevice *dev, struct vidconsole_colour *old);
398
399/**
Simon Glass83510762016-01-18 19:52:17 -0700400 * vidconsole_putc_xy() - write a single character to a position
401 *
402 * @dev: Device to write to
Simon Glassf2661782016-01-14 18:10:37 -0700403 * @x_frac: Fractional pixel X position (0=left-most pixel) which
404 * is the X position multipled by VID_FRAC_DIV.
Simon Glass83510762016-01-18 19:52:17 -0700405 * @y: Pixel Y position (0=top-most pixel)
406 * @ch: Character to write
Heinrich Schuchardt185f8122022-01-19 18:05:50 +0100407 * Return: number of fractional pixels that the cursor should move,
Simon Glassf2661782016-01-14 18:10:37 -0700408 * if all is OK, -EAGAIN if we ran out of space on this line, other -ve
409 * on error
Simon Glass83510762016-01-18 19:52:17 -0700410 */
411int vidconsole_putc_xy(struct udevice *dev, uint x, uint y, char ch);
412
413/**
414 * vidconsole_move_rows() - Move text rows from one place to another
415 *
416 * @dev: Device to adjust
417 * @rowdst: Destination text row (0=top)
418 * @rowsrc: Source start text row
419 * @count: Number of text rows to move
Heinrich Schuchardt185f8122022-01-19 18:05:50 +0100420 * Return: 0 if OK, -ve on error
Simon Glass83510762016-01-18 19:52:17 -0700421 */
422int vidconsole_move_rows(struct udevice *dev, uint rowdst, uint rowsrc,
423 uint count);
424
425/**
426 * vidconsole_set_row() - Set the colour of a text row
427 *
428 * Every pixel contained within the text row is adjusted
429 *
430 * @dev: Device to adjust
431 * @row: Text row to adjust (0=top)
432 * @clr: Raw colour (pixel value) to write to each pixel
Heinrich Schuchardt185f8122022-01-19 18:05:50 +0100433 * Return: 0 if OK, -ve on error
Simon Glass83510762016-01-18 19:52:17 -0700434 */
435int vidconsole_set_row(struct udevice *dev, uint row, int clr);
436
437/**
Simon Glass617d7b52023-10-01 19:13:20 -0600438 * vidconsole_entry_start() - Set the start position of a vidconsole line
439 *
440 * Marks the current cursor position as the start of a line
441 *
442 * @dev: Device to adjust
443 */
444int vidconsole_entry_start(struct udevice *dev);
445
446/**
Simon Glass83510762016-01-18 19:52:17 -0700447 * vidconsole_put_char() - Output a character to the current console position
448 *
449 * Outputs a character to the console and advances the cursor. This function
450 * handles wrapping to new lines and scrolling the console. Special
451 * characters are handled also: \n, \r, \b and \t.
452 *
453 * The device always starts with the cursor at position 0,0 (top left). It
454 * can be adjusted manually using vidconsole_position_cursor().
455 *
456 * @dev: Device to adjust
457 * @ch: Character to write
Heinrich Schuchardt185f8122022-01-19 18:05:50 +0100458 * Return: 0 if OK, -ve on error
Simon Glass83510762016-01-18 19:52:17 -0700459 */
460int vidconsole_put_char(struct udevice *dev, char ch);
461
462/**
Marek Vasute63168a2019-05-17 20:22:31 +0200463 * vidconsole_put_string() - Output a string to the current console position
464 *
465 * Outputs a string to the console and advances the cursor. This function
466 * handles wrapping to new lines and scrolling the console. Special
467 * characters are handled also: \n, \r, \b and \t.
468 *
469 * The device always starts with the cursor at position 0,0 (top left). It
470 * can be adjusted manually using vidconsole_position_cursor().
471 *
472 * @dev: Device to adjust
473 * @str: String to write
Heinrich Schuchardt185f8122022-01-19 18:05:50 +0100474 * Return: 0 if OK, -ve on error
Marek Vasute63168a2019-05-17 20:22:31 +0200475 */
476int vidconsole_put_string(struct udevice *dev, const char *str);
477
478/**
Simon Glass83510762016-01-18 19:52:17 -0700479 * vidconsole_position_cursor() - Move the text cursor
480 *
481 * @dev: Device to adjust
482 * @col: New cursor text column
483 * @row: New cursor text row
Heinrich Schuchardt185f8122022-01-19 18:05:50 +0100484 * Return: 0 if OK, -ve on error
Simon Glass83510762016-01-18 19:52:17 -0700485 */
486void vidconsole_position_cursor(struct udevice *dev, unsigned col,
487 unsigned row);
488
Simon Glass6b6dc0d2022-10-06 08:36:04 -0600489/**
Simon Glassa76b60f2023-03-10 12:47:21 -0800490 * vidconsole_clear_and_reset() - Clear the console and reset the cursor
491 *
492 * The cursor is placed at the start of the console
493 *
494 * @dev: vidconsole device to adjust
495 */
496int vidconsole_clear_and_reset(struct udevice *dev);
497
498/**
Simon Glass6b6dc0d2022-10-06 08:36:04 -0600499 * vidconsole_set_cursor_pos() - set cursor position
500 *
501 * The cursor is set to the new position and the start-of-line information is
502 * updated to the same position, so that a newline will return to @x
503 *
504 * @dev: video console device to update
505 * @x: x position from left in pixels
506 * @y: y position from top in pixels
507 */
508void vidconsole_set_cursor_pos(struct udevice *dev, int x, int y);
509
Simon Glass57a847c2022-10-06 08:36:14 -0600510/**
511 * vidconsole_list_fonts() - List the available fonts
512 *
Simon Glass0e38bd82023-01-06 08:52:32 -0600513 * @dev: vidconsole device to check
Simon Glass57a847c2022-10-06 08:36:14 -0600514 *
Simon Glass0e38bd82023-01-06 08:52:32 -0600515 * This shows a list of fonts known by this vidconsole. The list is displayed on
516 * the console (not necessarily @dev but probably)
Simon Glass57a847c2022-10-06 08:36:14 -0600517 */
Simon Glass0e38bd82023-01-06 08:52:32 -0600518void vidconsole_list_fonts(struct udevice *dev);
Simon Glass57a847c2022-10-06 08:36:14 -0600519
Simon Glass430e1672022-10-06 08:36:16 -0600520/**
Simon Glass0e38bd82023-01-06 08:52:32 -0600521 * vidconsole_get_font_size() - get the current font name and size
Simon Glass430e1672022-10-06 08:36:16 -0600522 *
523 * @dev: vidconsole device
524 * @sizep: Place to put the font size (nominal height in pixels)
Dzmitry Sankouski4f6e3482023-03-07 13:21:15 +0300525 * @name: pointer to font name, a placeholder for result
526 * Return: 0 if OK, -ENOSYS if not implemented in driver
Simon Glass430e1672022-10-06 08:36:16 -0600527 */
Dzmitry Sankouski4f6e3482023-03-07 13:21:15 +0300528int vidconsole_get_font_size(struct udevice *dev, const char **name, uint *sizep);
Simon Glass430e1672022-10-06 08:36:16 -0600529
Simon Glass8c0b5d22020-07-02 21:12:23 -0600530#ifdef CONFIG_VIDEO_COPY
531/**
532 * vidconsole_sync_copy() - Sync back to the copy framebuffer
533 *
534 * This ensures that the copy framebuffer has the same data as the framebuffer
535 * for a particular region. It should be called after the framebuffer is updated
536 *
537 * @from and @to can be in either order. The region between them is synced.
538 *
539 * @dev: Vidconsole device being updated
540 * @from: Start/end address within the framebuffer (->fb)
541 * @to: Other address within the frame buffer
Heinrich Schuchardt185f8122022-01-19 18:05:50 +0100542 * Return: 0 if OK, -EFAULT if the start address is before the start of the
Simon Glass8c0b5d22020-07-02 21:12:23 -0600543 * frame buffer start
544 */
545int vidconsole_sync_copy(struct udevice *dev, void *from, void *to);
546
547/**
548 * vidconsole_memmove() - Perform a memmove() within the frame buffer
549 *
550 * This handles a memmove(), e.g. for scrolling. It also updates the copy
551 * framebuffer.
552 *
553 * @dev: Vidconsole device being updated
554 * @dst: Destination address within the framebuffer (->fb)
555 * @src: Source address within the framebuffer (->fb)
556 * @size: Number of bytes to transfer
Heinrich Schuchardt185f8122022-01-19 18:05:50 +0100557 * Return: 0 if OK, -EFAULT if the start address is before the start of the
Simon Glass8c0b5d22020-07-02 21:12:23 -0600558 * frame buffer start
559 */
560int vidconsole_memmove(struct udevice *dev, void *dst, const void *src,
561 int size);
562#else
Dzmitry Sankouski31547252023-03-07 13:21:11 +0300563
564#include <string.h>
565
Simon Glass8c0b5d22020-07-02 21:12:23 -0600566static inline int vidconsole_sync_copy(struct udevice *dev, void *from,
567 void *to)
568{
569 return 0;
570}
571
572static inline int vidconsole_memmove(struct udevice *dev, void *dst,
573 const void *src, int size)
574{
575 memmove(dst, src, size);
576
577 return 0;
578}
579
580#endif
581
Heinrich Schuchardt5c30fbb2018-02-08 21:47:11 +0100582#endif