lcd_console.h 2.7 KB

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