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