vidconsole_internal.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * Copyright (c) 2015 Google, Inc
  4. * (C) Copyright 2015
  5. * Bernecker & Rainer Industrieelektronik GmbH - http://www.br-automation.com
  6. * (C) Copyright 2023 Dzmitry Sankouski <dsankouski@gmail.com>
  7. */
  8. #define FLIPPED_DIRECTION 1
  9. #define NORMAL_DIRECTION 0
  10. /**
  11. * struct console_simple_priv - Private data for this driver
  12. *
  13. * @video_fontdata font graphical representation data
  14. */
  15. struct console_simple_priv {
  16. struct video_fontdata *fontdata;
  17. };
  18. /**
  19. * Checks if bits per pixel supported.
  20. *
  21. * @param bpix framebuffer bits per pixel.
  22. *
  23. * @returns 0, if supported, or else -ENOSYS.
  24. */
  25. int check_bpix_support(int bpix);
  26. /**
  27. * Fill 1 pixel in framebuffer, and go to next one.
  28. *
  29. * @param dstp a pointer to pointer to framebuffer.
  30. * @param value value to write to framebuffer.
  31. * @param pbytes framebuffer bytes per pixel.
  32. * @param step framebuffer pointer increment. Usually is equal to pbytes,
  33. * and may be negative to control filling direction.
  34. */
  35. void fill_pixel_and_goto_next(void **dstp, u32 value, int pbytes, int step);
  36. /**
  37. * Fills 1 character in framebuffer vertically. Vertically means we're filling char font data rows
  38. * across the lines.
  39. *
  40. * @param pfont a pointer to character font data.
  41. * @param line a pointer to pointer to framebuffer. It's a point for upper left char corner
  42. * @param vid_priv driver private data.
  43. * @fontdata font graphical representation data
  44. * @param direction controls character orientation. Can be normal or flipped.
  45. * When normal: When flipped:
  46. *|-----------------------------------------------|
  47. *| line stepping | |
  48. *| | | stepping -> |
  49. *| * | | * * * |
  50. *| * * v | * |
  51. *| * | * |
  52. *| * | * * ^ |
  53. *| * * * | * | |
  54. *| | | |
  55. *| stepping -> | line stepping |
  56. *|---!!we're starting from upper left char corner|
  57. *|-----------------------------------------------|
  58. *
  59. * @returns 0, if success, or else error code.
  60. */
  61. int fill_char_vertically(uchar *pfont, void **line, struct video_priv *vid_priv,
  62. struct video_fontdata *fontdata, bool direction);
  63. /**
  64. * Fills 1 character in framebuffer horizontally.
  65. * Horizontally means we're filling char font data columns across the lines.
  66. *
  67. * @param pfont a pointer to character font data.
  68. * @param line a pointer to pointer to framebuffer. It's a point for upper left char corner
  69. * @param vid_priv driver private data.
  70. * @fontdata font graphical representation data
  71. * @param direction controls character orientation. Can be normal or flipped.
  72. * When normal: When flipped:
  73. *|-----------------------------------------------|
  74. *| * | line stepping |
  75. *| ^ * * * * * | | |
  76. *| | * * | v * * |
  77. *| | | * * * * * |
  78. *| line stepping | * |
  79. *| | |
  80. *| stepping -> | <- stepping |
  81. *|---!!we're starting from upper left char corner|
  82. *|-----------------------------------------------|
  83. *
  84. * @returns 0, if success, or else error code.
  85. */
  86. int fill_char_horizontally(uchar *pfont, void **line, struct video_priv *vid_priv,
  87. struct video_fontdata *fontdata, bool direction);
  88. /**
  89. * console probe function.
  90. *
  91. * @param dev a pointer to device.
  92. *
  93. * @returns 0, if success, or else error code.
  94. */
  95. int console_probe(struct udevice *dev);
  96. /**
  97. * Internal function to be used in as ops.
  98. * See details in video_console.h get_font_size function
  99. **/
  100. const char *console_simple_get_font_size(struct udevice *dev, uint *sizep);
  101. /**
  102. * Internal function to be used in as ops.
  103. * See details in video_console.h get_font function
  104. **/
  105. int console_simple_get_font(struct udevice *dev, int seq, struct vidfont_info *info);
  106. /**
  107. * Internal function to be used in as ops.
  108. * See details in video_console.h select_font function
  109. **/
  110. int console_simple_select_font(struct udevice *dev, const char *name, uint size);