lcd_console.h 2.6 KB

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