Nikita Kiryanov | 904672e | 2014-12-08 17:14:45 +0200 | [diff] [blame] | 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 | #ifndef CONFIG_CONSOLE_SCROLL_LINES |
| 9 | #define CONFIG_CONSOLE_SCROLL_LINES 1 |
| 10 | #endif |
| 11 | |
Hannes Petermaier | 604c7d4 | 2015-03-27 08:01:38 +0100 | [diff] [blame^] | 12 | struct 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 | */ |
| 31 | void console_calc_rowcol(struct console_t *pcons, u32 sizex, u32 sizey); |
Nikita Kiryanov | 904672e | 2014-12-08 17:14:45 +0200 | [diff] [blame] | 32 | /** |
| 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 Petermaier | 604c7d4 | 2015-03-27 08:01:38 +0100 | [diff] [blame^] | 39 | * @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 Kiryanov | 904672e | 2014-12-08 17:14:45 +0200 | [diff] [blame] | 42 | */ |
Hannes Petermaier | 604c7d4 | 2015-03-27 08:01:38 +0100 | [diff] [blame^] | 43 | void lcd_init_console(void *address, int vl_cols, int vl_rows, int vl_rot); |
Nikita Kiryanov | 904672e | 2014-12-08 17:14:45 +0200 | [diff] [blame] | 44 | /** |
| 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 | */ |
| 51 | void 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 | */ |
| 60 | void 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 | */ |
| 70 | void 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 | */ |
| 77 | int 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 | */ |
| 84 | int 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 | */ |
| 91 | void 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 | */ |
| 98 | void 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 | */ |
| 106 | void lcd_printf(const char *fmt, ...); |