xref: /openbmc/u-boot/include/lcd_console.h (revision cbd2fba1)
1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /*
3  * Copyright (C) 2014, Compulab Ltd - http://compulab.co.il/
4  */
5 
6 /* By default we scroll by a single line */
7 
8 struct console_t {
9 	short curr_col, curr_row;
10 	short cols, rows;
11 	void *fbbase;
12 	u32 lcdsizex, lcdsizey, lcdrot;
13 	void (*fp_putc_xy)(struct console_t *pcons, ushort x, ushort y, char c);
14 	void (*fp_console_moverow)(struct console_t *pcons,
15 				   u32 rowdst, u32 rowsrc);
16 	void (*fp_console_setrow)(struct console_t *pcons, u32 row, int clr);
17 };
18 
19 /**
20  * console_calc_rowcol() - calculate available rows / columns wihtin a given
21  * screen-size based on used VIDEO_FONT.
22  *
23  * @pcons: Pointer to struct console_t
24  * @sizex: size X of the screen in pixel
25  * @sizey: size Y of the screen in pixel
26  */
27 void console_calc_rowcol(struct console_t *pcons, u32 sizex, u32 sizey);
28 /**
29  * lcd_init_console() - Initialize lcd console parameters
30  *
31  * Setup the address of console base, and the number of rows and columns the
32  * console has.
33  *
34  * @address: Console base address
35  * @vl_rows: Number of rows in the console
36  * @vl_cols: Number of columns in the console
37  * @vl_rot: Rotation of display in degree (0 - 90 - 180 - 270) counterlockwise
38  */
39 void lcd_init_console(void *address, int vl_cols, int vl_rows, int vl_rot);
40 /**
41  * lcd_set_col() - Set the number of the current lcd console column
42  *
43  * Set the number of the console column where the cursor is.
44  *
45  * @col: Column number
46  */
47 void lcd_set_col(short col);
48 
49 /**
50  * lcd_set_row() - Set the number of the current lcd console row
51  *
52  * Set the number of the console row where the cursor is.
53  *
54  * @row: Row number
55  */
56 void lcd_set_row(short row);
57 
58 /**
59  * lcd_position_cursor() - Position the cursor on the screen
60  *
61  * Position the cursor at the given coordinates on the screen.
62  *
63  * @col: Column number
64  * @row: Row number
65  */
66 void lcd_position_cursor(unsigned col, unsigned row);
67 
68 /**
69  * lcd_get_screen_rows() - Get the total number of screen rows
70  *
71  * @return: Number of screen rows
72  */
73 int lcd_get_screen_rows(void);
74 
75 /**
76  * lcd_get_screen_columns() - Get the total number of screen columns
77  *
78  * @return: Number of screen columns
79  */
80 int lcd_get_screen_columns(void);
81 
82 /**
83  * lcd_putc() - Print to screen a single character at the location of the cursor
84  *
85  * @c: The character to print
86  */
87 void lcd_putc(const char c);
88 
89 /**
90  * lcd_puts() - Print to screen a string at the location of the cursor
91  *
92  * @s: The string to print
93  */
94 void lcd_puts(const char *s);
95 
96 /**
97  * lcd_printf() - Print to screen a formatted string at location of the cursor
98  *
99  * @fmt: The formatted string to print
100  * @...: The arguments for the formatted string
101  */
102 void lcd_printf(const char *fmt, ...);
103