drv_lcd_v2.h 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. /* Copyright (C) 2018 RDA Technologies Limited and/or its affiliates("RDA").
  2. * All rights reserved.
  3. *
  4. * This software is supplied "AS IS" without any warranties.
  5. * RDA assumes no responsibility or liability for the use of the software,
  6. * conveys no license or title under any patent, copyright, or mask work
  7. * right to the product. RDA reserves the right to make changes in the
  8. * software without notification. RDA also make no representation or
  9. * warranty that such application will be suitable for the specified use
  10. * without further testing or modification.
  11. */
  12. #ifndef _DRV_LCD_V2_H_
  13. #define _DRV_LCD_V2_H_
  14. #include "drv_lcd_defs.h"
  15. #include "osi_compiler.h"
  16. OSI_EXTERN_C_BEGIN
  17. /**
  18. * \brief opaque data struct for LCD
  19. */
  20. typedef struct drvLcd drvLcd_t;
  21. /**
  22. * \brief initialize LCD module
  23. */
  24. void drvLcdInitV2(void);
  25. /**
  26. * \brief get LCD driver instance by name
  27. *
  28. * \param name LCD driver name
  29. * \return
  30. * - LCD instance
  31. * - NULL on invalid parameter
  32. */
  33. drvLcd_t *drvLcdGetByname(unsigned name);
  34. /**
  35. * \brief open LCD instance
  36. *
  37. * When it is the first time to open the LCD, it will probe the panel.
  38. *
  39. * After open, pixel data can be send to panel. However, unless back light
  40. * id enabled, picture can't be seen on panel.
  41. *
  42. * \param d LCD driver instance
  43. * \return
  44. * - true on success
  45. * - false on invalid parameter, or invalid panel
  46. */
  47. bool drvLcdOpenV2(drvLcd_t *d);
  48. /**
  49. * \brief open LCD instance
  50. *
  51. * Usually, it is not needed to be called. For power saving, \p drvLcdSleep
  52. * and \p drvLcdWakeup should be called.
  53. *
  54. * \param d LCD driver instance
  55. */
  56. void drvLcdCloseV2(drvLcd_t *d);
  57. /**
  58. * \brief LCD enter sleep mode
  59. *
  60. * When LCD is not in sleep, system can't sleep also.
  61. *
  62. * \param d LCD driver instance
  63. * \return
  64. * - true on success
  65. * - false on invalid parameter
  66. */
  67. bool drvLcdSleep(drvLcd_t *d);
  68. /**
  69. * \brief LCD exit sleep mode
  70. *
  71. * \param d LCD driver instance
  72. * \return
  73. * - true on success
  74. * - false on invalid parameter
  75. */
  76. bool drvLcdWakeup(drvLcd_t *d);
  77. /**
  78. * \brief turn on or off back light of LCD
  79. *
  80. * \param d LCD instance
  81. * \param enabled true to turn on back light, false to turn off
  82. */
  83. void drvLcdSetBackLightEnable(drvLcd_t *d, bool enabled);
  84. /**
  85. * \brief get panel information
  86. *
  87. * When the panel is invalid, it will return false.
  88. *
  89. * After direction transform is changed, the width and height of panel
  90. * may be swapped.
  91. *
  92. * \param d LCD driver instance
  93. * \param info output panel information
  94. * \return
  95. * - true on success
  96. * - false on invalid parameter or panel invalid
  97. */
  98. bool drvLcdGetPanelInfo(drvLcd_t *d, drvLcdPanelInfo_t *info);
  99. /**
  100. * \brief set screen direction
  101. *
  102. * \param d LCD driver instance
  103. * \param dir direction
  104. */
  105. void drvLcdSetDirection(drvLcd_t *d, drvLcdDirection_t dir);
  106. /**
  107. * \brief flush LCD display
  108. *
  109. * When \p sync is false, this will return immediate after data transfer is
  110. * started. Otherwise, this will wait data transfer is finished.
  111. *
  112. * When previous data transfer is on-going, it will wait previous data
  113. * transfer finish anyway.
  114. *
  115. * Dcache clean will be performed inside.
  116. *
  117. * \param d LCD driver instance
  118. * \param layers layers definition
  119. * \param sync true to wait data transfer done
  120. * \return
  121. * - true on success
  122. * - false on invalid parameter
  123. */
  124. bool drvLcdFlush(drvLcd_t *d, const drvLcdLayers_t *layers, bool sync);
  125. /**
  126. * \brief fill solid color in screen ROI
  127. *
  128. * When \p screen_roi is NULL, fill full screen.
  129. *
  130. * \param d LCD driver instance
  131. * \param color color in RGB565
  132. * \param screen_roi screen ROI, NULL for full screen
  133. * \param sync true to wait data transfer done
  134. * \return
  135. * - true on success
  136. * - false on invalid parameter
  137. */
  138. bool drvLcdFill(drvLcd_t *d, uint16_t color, const drvLcdArea_t *screen_roi, bool sync);
  139. /**
  140. * \brief blend layers to memory
  141. *
  142. * It will reuse the hardware resource, and not bind to LCD. It will wait
  143. * previous data transfer done.
  144. *
  145. * There is only "sync" version, that it, it will always wait data transfer
  146. * done before return.
  147. *
  148. * Dcache clean for layer buffers and dcache invalidate for outptu will be
  149. * performed inside. Caller should take care alignment of \p buf, to avoid
  150. * invalidate other varaiables.
  151. *
  152. * The output format is fixed to RGB565. \p buf should point to the original
  153. * pixel of blended layer ROI. The unit of \p stride is pixel, not bytes.
  154. *
  155. * \param layers layers definition
  156. * \param buf output buffer
  157. * \param stride output buffer stride in pixel
  158. * \return
  159. * - true on success
  160. * - false on invalid parameter
  161. *
  162. */
  163. bool drvLcdBlend(const drvLcdLayers_t *layers, void *buf, unsigned stride);
  164. /**
  165. * \brief wait on-going data transfer done
  166. */
  167. void drvLcdWaitTransferDone(void);
  168. typedef enum
  169. {
  170. LPS_CONSTRAINT_NONE = (0),
  171. LPS_CONSTRATNT_AUDIO = (1 << 0),
  172. LPS_CONSTRAINT_LCD = (1 << 1),
  173. } LPS_CONSTRAINT_TYPE;
  174. void drvSwitchLCDPower(bool enabled, LPS_CONSTRAINT_TYPE type);
  175. OSI_EXTERN_C_END
  176. #endif