lcd_console.h 2.6 KB

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