blob: 061a6a41bbd54250009223b065530fd507df5eba [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
Nikita Kiryanovf6ebf6a2014-12-08 17:14:45 +02002/*
3 * Copyright (C) 2014, Compulab Ltd - http://compulab.co.il/
Nikita Kiryanovf6ebf6a2014-12-08 17:14:45 +02004 */
5
6/* By default we scroll by a single line */
Nikita Kiryanovf6ebf6a2014-12-08 17:14:45 +02007
Hannes Petermaiera3c8e862015-03-27 08:01:38 +01008struct 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 */
27void console_calc_rowcol(struct console_t *pcons, u32 sizex, u32 sizey);
Nikita Kiryanovf6ebf6a2014-12-08 17:14:45 +020028/**
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
Hannes Petermaiera3c8e862015-03-27 08:01:38 +010035 * @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
Nikita Kiryanovf6ebf6a2014-12-08 17:14:45 +020038 */
Hannes Petermaiera3c8e862015-03-27 08:01:38 +010039void lcd_init_console(void *address, int vl_cols, int vl_rows, int vl_rot);
Nikita Kiryanovf6ebf6a2014-12-08 17:14:45 +020040/**
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 */
47void 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 */
56void 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 */
66void 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 */
73int 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 */
80int 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 */
87void 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 */
94void 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 */
102void lcd_printf(const char *fmt, ...);