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