lcd.h 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. /*
  2. * Copyright (c) 2006-2023, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2022-03-05 bernard first version.
  9. */
  10. #ifndef RT_LCD_H__
  11. #define RT_LCD_H__
  12. #include <stdint.h>
  13. /* ioctls
  14. 0x46 is 'F' */
  15. #define FBIOGET_VSCREENINFO 0x4600
  16. #define FBIOPUT_VSCREENINFO 0x4601
  17. #define FBIOGET_FSCREENINFO 0x4602
  18. #define FBIOGET_PIXELINFO 0x4603
  19. #define FBIOGETCMAP 0x4604
  20. #define FBIOPUTCMAP 0x4605
  21. #define FBIOPAN_DISPLAY 0x4606
  22. #define FBIO_CURSOR 0x4608
  23. /* #define FBIOGET_MONITORSPEC 0x460C */
  24. /* #define FBIOPUT_MONITORSPEC 0x460D */
  25. /* #define FBIOSWITCH_MONIBIT 0x460E */
  26. #define FBIOGET_CON2FBMAP 0x460F
  27. #define FBIOPUT_CON2FBMAP 0x4610
  28. #define FBIOBLANK 0x4611 /* arg: 0 or vesa level + 1 */
  29. #define FBIOGET_VBLANK 0x4612
  30. #define FBIO_ALLOC 0x4613
  31. #define FBIO_FREE 0x4614
  32. #define FBIOGET_GLYPH 0x4615
  33. #define FBIOGET_HWCINFO 0x4616
  34. #define FBIOPUT_MODEINFO 0x4617
  35. #define FBIOGET_DISPINFO 0x4618
  36. #define FBIO_WAITFORVSYNC 0x4620
  37. struct fb_bitfield
  38. {
  39. uint32_t offset; /* beginning of bitfield */
  40. uint32_t length; /* length of bitfield */
  41. uint32_t msb_right; /* != 0 : Most significant bit is */
  42. /* right */
  43. };
  44. struct fb_var_screeninfo
  45. {
  46. uint32_t xres; /* visible resolution */
  47. uint32_t yres;
  48. uint32_t xres_virtual; /* virtual resolution */
  49. uint32_t yres_virtual;
  50. uint32_t xoffset; /* offset from virtual to visible */
  51. uint32_t yoffset; /* resolution */
  52. uint32_t bits_per_pixel; /* guess what */
  53. uint32_t grayscale; /* 0 = color, 1 = grayscale, */
  54. /* >1 = FOURCC */
  55. struct fb_bitfield red; /* bitfield in fb mem if true color, */
  56. struct fb_bitfield green; /* else only length is significant */
  57. struct fb_bitfield blue;
  58. struct fb_bitfield transp; /* transparency */
  59. uint32_t nonstd; /* != 0 Non standard pixel format */
  60. uint32_t activate; /* see FB_ACTIVATE_* */
  61. uint32_t height; /* height of picture in mm */
  62. uint32_t width; /* width of picture in mm */
  63. uint32_t accel_flags; /* (OBSOLETE) see fb_info.flags */
  64. /* Timing: All values in pixclocks, except pixclock (of course) */
  65. uint32_t pixclock; /* pixel clock in ps (pico seconds) */
  66. uint32_t left_margin; /* time from sync to picture */
  67. uint32_t right_margin; /* time from picture to sync */
  68. uint32_t upper_margin; /* time from sync to picture */
  69. uint32_t lower_margin;
  70. uint32_t hsync_len; /* length of horizontal sync */
  71. uint32_t vsync_len; /* length of vertical sync */
  72. uint32_t sync; /* see FB_SYNC_* */
  73. uint32_t vmode; /* see FB_VMODE_* */
  74. uint32_t rotate; /* angle we rotate counter clockwise */
  75. uint32_t colorspace; /* colorspace for FOURCC-based modes */
  76. uint32_t reserved[4]; /* Reserved for future compatibility */
  77. };
  78. struct fb_fix_screeninfo
  79. {
  80. char id[16]; /* identification string eg "TT Builtin" */
  81. unsigned long smem_start; /* Start of frame buffer mem */
  82. /* (physical address) */
  83. uint32_t smem_len; /* Length of frame buffer mem */
  84. uint32_t type; /* see FB_TYPE_* */
  85. uint32_t type_aux; /* Interleave for interleaved Planes */
  86. uint32_t visual; /* see FB_VISUAL_* */
  87. uint16_t xpanstep; /* zero if no hardware panning */
  88. uint16_t ypanstep; /* zero if no hardware panning */
  89. uint16_t ywrapstep; /* zero if no hardware ywrap */
  90. uint32_t line_length; /* length of a line in bytes */
  91. unsigned long mmio_start; /* Start of Memory Mapped I/O */
  92. /* (physical address) */
  93. uint32_t mmio_len; /* Length of Memory Mapped I/O */
  94. uint32_t accel; /* Indicate to driver which */
  95. /* specific chip/card we have */
  96. uint16_t capabilities; /* see FB_CAP_* */
  97. uint16_t reserved[2]; /* Reserved for future compatibility */
  98. };
  99. struct fb_cmap
  100. {
  101. uint32_t start; /* First entry */
  102. uint32_t len; /* Number of entries */
  103. uint16_t *red; /* Red values */
  104. uint16_t *green;
  105. uint16_t *blue;
  106. uint16_t *transp; /* transparency, can be NULL */
  107. };
  108. struct fb_con2fbmap
  109. {
  110. uint32_t console;
  111. uint32_t framebuffer;
  112. };
  113. /* VESA Blanking Levels */
  114. #define VESA_NO_BLANKING 0
  115. #define VESA_VSYNC_SUSPEND 1
  116. #define VESA_HSYNC_SUSPEND 2
  117. #define VESA_POWERDOWN 3
  118. enum
  119. {
  120. FB_BLANK_UNBLANK = VESA_NO_BLANKING, /* screen: unblanked, hsync: on, vsync: on */
  121. FB_BLANK_NORMAL = VESA_NO_BLANKING + 1, /* screen: blanked, hsync: on, vsync: on */
  122. FB_BLANK_VSYNC_SUSPEND = VESA_VSYNC_SUSPEND + 1, /* screen: blanked, hsync: on, vsync: off */
  123. FB_BLANK_HSYNC_SUSPEND = VESA_HSYNC_SUSPEND + 1, /* screen: blanked, hsync: off, vsync: on */
  124. FB_BLANK_POWERDOWN = VESA_POWERDOWN + 1, /* screen: blanked, hsync: off, vsync: off */
  125. };
  126. #endif