adc_hw.h 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  1. #ifndef _ADC_HW_H_
  2. #define _ADC_HW_H_
  3. /**
  4. * @brief Clear ADC interrupt bits.
  5. *
  6. * This function clears specific interrupt vector bits (0xbe150026[15:0]) according to request.
  7. *
  8. * @param usValue Request bits for clear.
  9. *
  10. */
  11. void ADC_Clear_Interrupt(UINT16 usValue);
  12. /**
  13. * @brief Setup interrupt mask bits.
  14. *
  15. * This function sets mask bits(0xbe150028[15:0]) for masking interrupt vector bits.
  16. *
  17. * @param bStatus Whether current status can be set request value or not.
  18. * @param usValue Mask value for setting.
  19. *
  20. */
  21. void ADC_Interrupt(BOOL bStatus, UINT16 usValue);
  22. #ifdef CONFIG_DDC_CI_SUPPORT
  23. /**
  24. * @brief Get phase value for DCC/CI tool.
  25. *
  26. * This function reads user phase setting from previous OSD setup, and restore for DCC/CI usage.
  27. *
  28. * @param Phase Record OSD phase value.
  29. *
  30. */
  31. void DRV_ADC_Get_DDCCI_OSDPhase(UINT8 *Phase);
  32. /**
  33. * @brief Get clock value for DCC/CI tool.
  34. *
  35. * This function reads user clock setting from previous OSD setup, and restore for DCC/CI usage.
  36. *
  37. * @param Clock Record OSD clock value.
  38. *
  39. */
  40. void DRV_ADC_Get_DDCCI_OSDClock(UINT8 *Clock);
  41. #endif
  42. /**
  43. * @brief Set phase values directly.
  44. *
  45. * This function sets RGB PLL phase values directly.
  46. *
  47. */
  48. void ADC_SetPhaseDirdect (UINT8 ucPhaseValue);
  49. /**
  50. * @brief Set phase value without interrupt interference.
  51. *
  52. * This function stops interrupt before setting phase value, and then recovers interrupt
  53. * after phase setting is finished.
  54. *
  55. * @param scPhaseValue Requested phase value.
  56. *
  57. */
  58. void DRV_ADC_SetPhase(INT8 scPhaseValue);
  59. /**
  60. * @brief Get phase value.
  61. *
  62. * This function reads current phase setting value.
  63. *
  64. * @param bPhase Save current phase setting value.
  65. *
  66. */
  67. void DRV_ADC_GetPhase(UINT8 *bPhase);
  68. /**
  69. * @brief Set gain setting into HW registers.
  70. *
  71. * This function writes referenced channel gain control registers according to requested color type.
  72. * For R channel gain control, [7:6] = 0x60[1:0] , [5:0] = 0x61[5:0];
  73. * For G channel gain control, [7:6] = 0x63[1:0] , [5:0] = 0x64[5:0];
  74. * For B channel gain control, [7:6] = 0x66[1:0] , [5:0] = 0x67[5:0];
  75. *
  76. * @param ucColor Requested color type.
  77. * @param uwValue Channel gain control value for setting.
  78. *
  79. */
  80. void ADC_SetGainDirdect(UINT8 ucColor, UINT32 uwValue);
  81. /**
  82. * @brief Set gain setting on referenced channel.
  83. *
  84. * This function sets referenced channel gain according to requested color type.
  85. *
  86. * @param ucColor Requested color type.
  87. * @param scColorGain Channel gain control value for setting.
  88. *
  89. */
  90. void DRV_ADC_SetGain(UINT8 ucColor, UINT32 scColorGain);
  91. /**
  92. * @brief Get current gain setting on referenced channel.
  93. *
  94. * This function reads referenced channel gain control registers according to requested color type.
  95. * For R channel gain control, [7:6] = 0x60[1:0] , [5:0] = 0x61[5:0];
  96. * For G channel gain control, [7:6] = 0x63[1:0] , [5:0] = 0x64[5:0];
  97. * For B channel gain control, [7:6] = 0x66[1:0] , [5:0] = 0x67[5:0];
  98. *
  99. * @param ucColor Requested color type.
  100. * @return Reference channel gain control value of R, G or B channel.
  101. *
  102. */
  103. UINT16 ADC_GetGain(UINT8 ucColor);
  104. /**
  105. * @brief Set digital offset setting into HW registers.
  106. *
  107. * This function writes referenced channel digital offset registers according to requested color type.
  108. *
  109. * @param ucColor Requested color type.
  110. * @param uwValue Reference channel gain offset value of R, G or B channel.
  111. *
  112. */
  113. void ADC_SetOffsetDirdect(UINT8 ucColor, UINT32 uwValue);
  114. /**
  115. * @brief Set digital offset on referenced channel.
  116. *
  117. * This function sets referenced channel digital offset according to requested color type.
  118. *
  119. * @param ucColor Requested color type.
  120. * @param scColorOffset Reference channel gain offset value of R, G or B channel.
  121. *
  122. */
  123. void DRV_ADC_SetOffset(UINT8 ucColor, INT16 scColorOffset);
  124. /**
  125. * @brief Get current digital offset on referenced channel.
  126. *
  127. * This function reads referenced channel digital offset registers according to requested color type.
  128. * For R channel digital offset, [7:0] = 0x14b[1:0];
  129. * For G channel digital offset, [7:6] = 0x14d[1:0] , [5:0] = 0x14c[7:2];
  130. * For B channel digital offset, [7:4] = 0x14e[3:0] , [3:0] = 0x14d[5:2];
  131. *
  132. * @param ucColor Requested color type.
  133. * @return Reference channel gain offset value of R, G or B channel.
  134. *
  135. */
  136. UINT16 ADC_GetOffset(UINT8 ucColor);
  137. /**
  138. * @brief Set horizontal total.
  139. *
  140. * This function sets PLL clock divider for horizontal total calcultaion.
  141. *
  142. * @param usHTotal Requested horizontal total value.
  143. *
  144. */
  145. void DRV_ADC_SetHTotal(UINT16 usHTotal);
  146. /**
  147. * @brief Set PLL related settings.
  148. *
  149. * This function sets PLL related registers using timing information after detection.
  150. *
  151. * @param ucPixelClock Input pixel clock value according to pixel_clk of timing table multiply smapling rate.
  152. * @param usHTotal Input Horizontal total value according to h_total of timing table multiply smapling rate.
  153. *
  154. */
  155. void ADC_PllSetting(UINT8 ucPixelClock, UINT16 usHTotal);
  156. /**
  157. * @brief Reset PLL in specific sequence.
  158. *
  159. * This function resets PLL by setting block registers in specific sequence.
  160. *
  161. * @param ucPixelClock Input pixel clock value according to pixel_clk of timing table multiply smapling rate.
  162. * @param usHTotal Input Horizontal total value according to h_total of timing table multiply smapling rate.
  163. *
  164. */
  165. void ADC_CheckPllResetSequence(UINT8 ucPixelClock, UINT16 usHTotal);
  166. /**
  167. * @brief Reset all digital blocks.
  168. *
  169. * This function toggles reset for reseting all digital blocks(0x00[0]).
  170. *
  171. */
  172. void ADC_Coast_Gen_Backup(void);
  173. /**
  174. * @brief Software reset SOG.
  175. *
  176. * This function toggles software reset for SOG digital circuit (0x1a[2]).
  177. *
  178. */
  179. void ADC_SOG_Slicer_Backup(void);
  180. /**
  181. * @brief Transform the option of input pin into its reference value of Y or G channel selection.
  182. *
  183. * This function transfers the Y option of input source into referenced channel value.
  184. * The channel value would be adopted to setup Y channel select(0x122[2:0]) or G channel select(0x51[2:0]).
  185. *
  186. * @param iPin Requested input pin option.
  187. * @return Reference value of Y or G channel selection.
  188. *
  189. */
  190. UINT32 ADC_InputSrcPinYvalue(UINT32 iPin);
  191. /**
  192. * @brief Setup requested YC channel depending on the pin assignment of the board.
  193. *
  194. * This function sets input channel Y/C pins according to board. It also turns off
  195. * non-related power and function.
  196. *
  197. * @param iInputSource Requested input channel for YC initial setting.
  198. *
  199. */
  200. void DRV_ADC_YCInitSetting(INT32 iInputSource);
  201. /**
  202. * @brief Provide 100MHz PLL clock to CVD2.
  203. *
  204. * This function divides its PLL clock to 100MHZ approximately according to setting
  205. * PLL clock divider. The output clock would be used by CVD2.
  206. *
  207. */
  208. void DRV_ADC_PLL100MHzToCVD2(void);
  209. /**
  210. * @brief Provide PLL divider power control to CVD2.
  211. *
  212. * This function provides an interface to reset pll divider when there is abnormal clock
  213. * status found on CVD2. It turn on/off the pll divider for reseting this block, including
  214. * dual loop divider(0xbe150147[5]) and ADC_PLL reference divider reset(0xbe00012f[1]).
  215. *
  216. * @param Enable Whether to turn on PLL divider power or not.
  217. *
  218. */
  219. void DRV_ADC_Pll_Divider_Power(BOOL Enable);
  220. /**
  221. * @brief Sets sharing video bandgap of Ypp.
  222. *
  223. * This function provides an interface for setting Ypp sharing bandgap(0xbe15003d[0]). This bandgap would
  224. * be adopted in YPP, PC, AV, and HDMI input sources, so the other modules could control this sharing bandgap
  225. * according to this interface.
  226. *
  227. * @param Enable Whether to turn on the Ypp sharing bandgap.
  228. *
  229. */
  230. void DRV_ADC_YppShareBandGap_Power(BOOL Enable);
  231. #endif