blob: 2e0f56f9903a24259c18b58e151206cd02fda941 [file] [log] [blame]
Nikita Kiryanovf6ebf6a2014-12-08 17:14:45 +02001/*
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#ifndef CONFIG_CONSOLE_SCROLL_LINES
9#define CONFIG_CONSOLE_SCROLL_LINES 1
10#endif
11
Hannes Petermaiera3c8e862015-03-27 08:01:38 +010012struct console_t {
13 short curr_col, curr_row;
14 short cols, rows;
15 void *fbbase;
16 u32 lcdsizex, lcdsizey, lcdrot;
17 void (*fp_putc_xy)(struct console_t *pcons, ushort x, ushort y, char c);
18 void (*fp_console_moverow)(struct console_t *pcons,
19 u32 rowdst, u32 rowsrc);
20 void (*fp_console_setrow)(struct console_t *pcons, u32 row, int clr);
21};
22
23/**
24 * console_calc_rowcol() - calculate available rows / columns wihtin a given
25 * screen-size based on used VIDEO_FONT.
26 *
27 * @pcons: Pointer to struct console_t
28 * @sizex: size X of the screen in pixel
29 * @sizey: size Y of the screen in pixel
30 */
31void console_calc_rowcol(struct console_t *pcons, u32 sizex, u32 sizey);
Nikita Kiryanovf6ebf6a2014-12-08 17:14:45 +020032/**
33 * lcd_init_console() - Initialize lcd console parameters
34 *
35 * Setup the address of console base, and the number of rows and columns the
36 * console has.
37 *
38 * @address: Console base address
Hannes Petermaiera3c8e862015-03-27 08:01:38 +010039 * @vl_rows: Number of rows in the console
40 * @vl_cols: Number of columns in the console
41 * @vl_rot: Rotation of display in degree (0 - 90 - 180 - 270) counterlockwise
Nikita Kiryanovf6ebf6a2014-12-08 17:14:45 +020042 */
Hannes Petermaiera3c8e862015-03-27 08:01:38 +010043void lcd_init_console(void *address, int vl_cols, int vl_rows, int vl_rot);
Nikita Kiryanovf6ebf6a2014-12-08 17:14:45 +020044/**
45 * lcd_set_col() - Set the number of the current lcd console column
46 *
47 * Set the number of the console column where the cursor is.
48 *
49 * @col: Column number
50 */
51void lcd_set_col(short col);
52
53/**
54 * lcd_set_row() - Set the number of the current lcd console row
55 *
56 * Set the number of the console row where the cursor is.
57 *
58 * @row: Row number
59 */
60void lcd_set_row(short row);
61
62/**
63 * lcd_position_cursor() - Position the cursor on the screen
64 *
65 * Position the cursor at the given coordinates on the screen.
66 *
67 * @col: Column number
68 * @row: Row number
69 */
70void lcd_position_cursor(unsigned col, unsigned row);
71
72/**
73 * lcd_get_screen_rows() - Get the total number of screen rows
74 *
75 * @return: Number of screen rows
76 */
77int lcd_get_screen_rows(void);
78
79/**
80 * lcd_get_screen_columns() - Get the total number of screen columns
81 *
82 * @return: Number of screen columns
83 */
84int lcd_get_screen_columns(void);
85
86/**
87 * lcd_putc() - Print to screen a single character at the location of the cursor
88 *
89 * @c: The character to print
90 */
91void lcd_putc(const char c);
92
93/**
94 * lcd_puts() - Print to screen a string at the location of the cursor
95 *
96 * @s: The string to print
97 */
98void lcd_puts(const char *s);
99
100/**
101 * lcd_printf() - Print to screen a formatted string at location of the cursor
102 *
103 * @fmt: The formatted string to print
104 * @...: The arguments for the formatted string
105 */
106void lcd_printf(const char *fmt, ...);