summaryrefslogtreecommitdiff
path: root/include/lcd_console.h
blob: 2e0f56f9903a24259c18b58e151206cd02fda941 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
/*
 * Copyright (C) 2014, Compulab Ltd - http://compulab.co.il/
 *
 * SPDX-License-Identifier:	GPL-2.0+
 */

/* By default we scroll by a single line */
#ifndef CONFIG_CONSOLE_SCROLL_LINES
#define CONFIG_CONSOLE_SCROLL_LINES 1
#endif

struct console_t {
	short curr_col, curr_row;
	short cols, rows;
	void *fbbase;
	u32 lcdsizex, lcdsizey, lcdrot;
	void (*fp_putc_xy)(struct console_t *pcons, ushort x, ushort y, char c);
	void (*fp_console_moverow)(struct console_t *pcons,
				   u32 rowdst, u32 rowsrc);
	void (*fp_console_setrow)(struct console_t *pcons, u32 row, int clr);
};

/**
 * console_calc_rowcol() - calculate available rows / columns wihtin a given
 * screen-size based on used VIDEO_FONT.
 *
 * @pcons: Pointer to struct console_t
 * @sizex: size X of the screen in pixel
 * @sizey: size Y of the screen in pixel
 */
void console_calc_rowcol(struct console_t *pcons, u32 sizex, u32 sizey);
/**
 * lcd_init_console() - Initialize lcd console parameters
 *
 * Setup the address of console base, and the number of rows and columns the
 * console has.
 *
 * @address: Console base address
 * @vl_rows: Number of rows in the console
 * @vl_cols: Number of columns in the console
 * @vl_rot: Rotation of display in degree (0 - 90 - 180 - 270) counterlockwise
 */
void lcd_init_console(void *address, int vl_cols, int vl_rows, int vl_rot);
/**
 * lcd_set_col() - Set the number of the current lcd console column
 *
 * Set the number of the console column where the cursor is.
 *
 * @col: Column number
 */
void lcd_set_col(short col);

/**
 * lcd_set_row() - Set the number of the current lcd console row
 *
 * Set the number of the console row where the cursor is.
 *
 * @row: Row number
 */
void lcd_set_row(short row);

/**
 * lcd_position_cursor() - Position the cursor on the screen
 *
 * Position the cursor at the given coordinates on the screen.
 *
 * @col: Column number
 * @row: Row number
 */
void lcd_position_cursor(unsigned col, unsigned row);

/**
 * lcd_get_screen_rows() - Get the total number of screen rows
 *
 * @return: Number of screen rows
 */
int lcd_get_screen_rows(void);

/**
 * lcd_get_screen_columns() - Get the total number of screen columns
 *
 * @return: Number of screen columns
 */
int lcd_get_screen_columns(void);

/**
 * lcd_putc() - Print to screen a single character at the location of the cursor
 *
 * @c: The character to print
 */
void lcd_putc(const char c);

/**
 * lcd_puts() - Print to screen a string at the location of the cursor
 *
 * @s: The string to print
 */
void lcd_puts(const char *s);

/**
 * lcd_printf() - Print to screen a formatted string at location of the cursor
 *
 * @fmt: The formatted string to print
 * @...: The arguments for the formatted string
 */
void lcd_printf(const char *fmt, ...);