hv_drv_Od.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. /**
  2. * @file hv_drv_Od.h
  3. * @brief Header file of od module.
  4. *
  5. * @verbatim
  6. * ==============================================================================
  7. * ##### How to use #####
  8. * ==============================================================================
  9. *
  10. * @endverbatim
  11. *
  12. * @author HiView SoC Software Team
  13. * @version 0.0.0
  14. * @date 2022-04-17
  15. */
  16. #ifndef _HV_DRV_OD_H_
  17. #define _HV_DRV_OD_H_
  18. #include "hv_comm_DataType.h"
  19. /**
  20. * @brief OD LUT表的大小
  21. */
  22. typedef enum _ODLutSize
  23. {
  24. OD_LUT_SIZE_33x33 = 0,
  25. OD_LUT_SIZE_17x17 = 1,
  26. OD_LUT_SIZE_MAX
  27. } ODLutSize;
  28. typedef enum _ODCompressRatio
  29. {
  30. OD_CPR_5_83 = 0,
  31. OD_CPR_4_23,
  32. } ODCompressRatio;
  33. typedef enum _ODLutSel
  34. {
  35. OD_SEL_LUT0 = 0,
  36. OD_SEL_LUT1 = 1,
  37. OD_SEL_LUT0_LUT1 = 3,
  38. OD_SEL_MAX
  39. } ODLutSel;
  40. typedef enum _ODLutAccessMode
  41. {
  42. OD_ACCESS_RGB = 0,
  43. OD_ACCESS_SYNC = 1,
  44. } ODLutAccessMode;
  45. typedef enum _ODResolution
  46. {
  47. OD_UHD = 0,
  48. OD_QHD = 1,
  49. OD_FHD = 2,
  50. } ODResolution;
  51. typedef struct _HvDrvODInitParams
  52. {
  53. UCHAR8 ucODLutMode; //0:only lut0; 1:only lut1; 3:lut0&lut1
  54. UCHAR8 ucODMatrixSize; //0:33x33; 1:17x17
  55. UCHAR8 ucODRGBMode; //0:RGB mode, 1:Sync mode
  56. UCHAR8 ucCprRatio; //0-5.83x, 1-4.23x
  57. UINT32 uiCprDmaAddr; //ODCPR ddr start address
  58. const UINT32 *puiODLut0Addr; //OD lut for lower framerate
  59. const UINT32 *puiODLut1Addr; //OD lut for upper framerate
  60. USHORT16 usHact; //Hactive from panel
  61. USHORT16 usVact; //Vactive from panel
  62. } HvDrvODInitParams;
  63. /**
  64. * @brief OD使能控制.
  65. * @param[in] bEnable 控制标志,HV_TRUE-enable od,HV_FALSE-disable od
  66. * @return None
  67. */
  68. VOID Hv_Drv_OD_Enable(BOOL bEnable);
  69. /**
  70. * @brief ODCPR使能控制.
  71. * @param[in] bEnable 控制标志,HV_TRUE-enable od,HV_FALSE-disable od
  72. * @return None
  73. */
  74. VOID Hv_Drv_ODCPR_Enable(BOOL bEnable);
  75. /**
  76. * @brief 获取当前OD功能是否使能,用于判断以避免重复使能.
  77. * @return HV_TRUE: 当OD和ODCPR都已经使能时返回,HV_FALSE: 当OD和ODCPRR任一未使能时返回
  78. */
  79. BOOL Hv_Drv_OD_GetEnableStatus(VOID);
  80. /**
  81. * @brief OD初始化,包括寄存器设定和lut表载入.
  82. * @param[in] pstODInitParam point to od init params structure
  83. * @return None
  84. */
  85. VOID Hv_Drv_OD_Init(HvDrvODInitParams *pstODInitParam);
  86. /**
  87. * @brief OD强度控制,根据od的级别刷入对应的lut表.
  88. * @param[in] ucLevel OD级别, 默认0为关
  89. * @return None
  90. */
  91. VOID Hv_Drv_OD_SetLevel(UCHAR8 ucLevel);
  92. /**
  93. * @brief 设置延迟开OD的标记,当在配置OD使能时需调用本接口,会先开启ODCPR待有缓存帧后再开启OD,以避免画面闪烁
  94. * @param[in] None
  95. * @return None
  96. */
  97. VOID Hv_Drv_OD_SetOdOpenDelayFlag(VOID);
  98. /**
  99. * @brief 清除延迟开OD的标记,当在帧中断中打开OD后要调用本接口
  100. * @param[in] None
  101. * @return None
  102. */
  103. VOID Hv_Drv_OD_ClearOdOpenDelayFlag(VOID);
  104. /**
  105. * @brief 获取延迟开OD的标记,在帧中断处理中会读取本标记来决定是否开启OD
  106. * @param[in] None
  107. * @return bool
  108. */
  109. BOOL Hv_Drv_OD_GetOdOpenDelayFlag(VOID);
  110. /**
  111. * @brief OD 动态CRC校验.
  112. * @param[in] bEnable flag of TRUE or FALSE.
  113. * @return None
  114. */
  115. VOID Hv_Drv_OD_DynamicCrcEnable(BOOL bEnable);
  116. /**
  117. * @brief OD 动态CRC校验标志位.
  118. * @return flag
  119. */
  120. BOOL Hv_Drv_OD_GetDynamicCrcFailFlag(VOID);
  121. /**
  122. * @brief 获取ODCPR CRC是否已经工作,延迟1-2帧再去获取crc状态
  123. * @param[in] None
  124. * @return bool
  125. */
  126. BOOL Hv_Drv_OD_GetDynamicCrcWorkStatus(void);
  127. /**
  128. * @brief OD axi reset.
  129. * @param[in] bRst flag of TRUE or FALSE.
  130. * @return None
  131. */
  132. VOID Hv_Drv_OD_OdAxiRst(BOOL bRst);
  133. /**
  134. * @brief Write OD table
  135. * @param[in] pucOdTable Pointer of od lut table.
  136. * @param[in] usTableSize Length of od lut table.
  137. * @param[in] ucWhichLut Indicates lut0 or lut1.
  138. * @return None
  139. */
  140. Status Hv_Drv_OD_SetTable(UCHAR8 *pucOdTable, USHORT16 usTableSize, UCHAR8 ucWhichLut);
  141. VOID Hv_Drv_OD_GatingBypass(BOOL bEn);
  142. #endif