hv_drv_Audio.h 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298
  1. /*
  2. * @file hv_drv_audio.h
  3. * @brief Header file of audio module.
  4. *
  5. * @verbatim
  6. * ==============================================================================
  7. * ##### How to use #####
  8. * ==============================================================================
  9. * (+) Use Hv_Drv_Audio_??Init()
  10. *
  11. * @endverbatim
  12. * @author HiView SoC Software Team
  13. * @version 1.0.0
  14. * @date 2022-08-18
  15. */
  16. #ifndef __SDK_DRIVER_AUDIO_H__
  17. #define __SDK_DRIVER_AUDIO_H__
  18. #include "hv_comm_DataType.h"
  19. #include "hv_comm_DataBase.h"
  20. #include "hv_comm_Define.h"
  21. #define _AUDIO_FLAG_ENABLE 1
  22. #define _AUDIO_FLAG_DISABLE 0
  23. #define _AUDIO_MAX_VOLUME 100
  24. typedef enum _AudioCkRef
  25. {
  26. CLK_27M = 0,
  27. CLK_HDMI = 1,
  28. CLK_DP = 2,
  29. CLK_CK_MAX = 3
  30. }AudioCkRef;
  31. /**
  32. * @brief Audio PLL reset.
  33. */
  34. VOID Hv_Drv_Audio_PllReset(VOID);
  35. /**
  36. * @brief set reset.
  37. */
  38. VOID Hv_Drv_Audio_SetReset(VOID);
  39. /**
  40. * @brief set VCO to 27M and fs to 48K.
  41. */
  42. VOID Hv_Drv_Audio_ManualDefaultClock(VOID);
  43. /**
  44. * @brief Check Lock PLL State.
  45. */
  46. Status Hv_Drv_Audio_GetClockLockState(VOID);
  47. /**
  48. * @brief Lock PLL.
  49. */
  50. VOID Hv_Drv_Audio_ClockLock(VOID);
  51. /**
  52. * @brief change new FS's PLL configures.
  53. */
  54. VOID Hv_Drv_Audio_ChangeClock(VOID);
  55. /**
  56. * @brief set PLL configures.
  57. */
  58. VOID Hv_Drv_Audio_SetAudioClock(VOID);
  59. /**
  60. * @brief initialize audio Pll.
  61. */
  62. VOID Hv_Drv_Audio_PllInit(VOID);
  63. /**
  64. * @brief initialize audio GPIO.
  65. */
  66. VOID Hv_Drv_Audio_GpioInit(VOID);
  67. /**
  68. * @brief initialize audio RX IP.
  69. */
  70. VOID Hv_Drv_Audio_RxInit(VOID);
  71. /**
  72. * @brief initialize audio TX IP.
  73. */
  74. VOID Hv_Drv_Audio_TxInit(VOID);
  75. /**
  76. * @brief initialize audio DAC IP.
  77. */
  78. VOID Hv_Drv_Audio_DacInit(VOID);
  79. /**
  80. * @brief initialize audio HW IP.
  81. */
  82. VOID Hv_Drv_Audio_HwInit(VOID);
  83. /**
  84. * @brief initialize audio DM IP.
  85. */
  86. VOID Hv_Drv_Audio_DmInit(VOID);
  87. /**
  88. * @brief initialize audio Interrupt.
  89. */
  90. VOID Hv_Drv_Audio_InterruptInit(VOID);
  91. /**
  92. * @brief initialize audio Path.
  93. */
  94. VOID Hv_Drv_Audio_PathInit(VOID);
  95. /**
  96. * @brief set audio source.
  97. * @param[in] uiRxOutIndex: HDMI1/HDMI2/DP1/DP2.
  98. */
  99. Status Hv_Drv_Audio_SetSource(UINT32 uiRxOutIndex, ChannelType enChannelType);
  100. /**
  101. * @brief get headset volume value from datebase.
  102. * @return 0-100 value.
  103. */
  104. UINT32 Hv_Drv_Audio_GetHeadsetVolume(VOID);
  105. /**
  106. * @brief get speaker volume value from datebase.
  107. * @return 0-100 value.
  108. */
  109. UINT32 Hv_Drv_Audio_GetSpeakerVolume(VOID);
  110. /**
  111. * @brief set 0-100 value to driver.
  112. * @param[in] uiDacVolumeValue: 0-100.
  113. */
  114. Status Hv_Drv_Audio_SetHeadsetVolume(UINT32 uiDacVolumeValue);
  115. /**
  116. * @brief set 0-100 value to driver.
  117. * @param[in] uiDacVolumeValue: 0-100.
  118. */
  119. Status Hv_Drv_Audio_SetSpeakerVolume(UINT32 uiDacVolumeValue);
  120. /**
  121. * @brief Set DAC Mute Bit.
  122. */
  123. void Hv_Drv_Audio_SetMuteBit(UINT32 uiBitMsk);
  124. /**
  125. * @brief Clear DAC Mute Bit.
  126. */
  127. void Hv_Drv_Audio_ClearMuteBit(UINT32 uiBitMsk);
  128. /**
  129. * @brief mute audio DAC from UI.
  130. */
  131. VOID Hv_Drv_Audio_DACMute(UINT32 uiBitMsk);
  132. /**
  133. * @brief unmute audio DAC from UI.
  134. */
  135. VOID Hv_Drv_Audio_DACUnMute(UINT32 uiBitMsk);
  136. /**
  137. * @brief mute audio path from channel manager.
  138. */
  139. VOID Hv_Drv_Audio_TXMute(UINT32 uiBitMsk);
  140. /**
  141. * @brief unmute audio path from channel manager.
  142. */
  143. VOID Hv_Drv_Audio_TXUnMute(UINT32 uiBitMsk);
  144. #ifdef HV_PROJECT_CONFIG_AUDIO_EQ
  145. /**
  146. * @brief set default value to s_tAudioEqData.
  147. * @param[in] uiEQMode: Rock/Pop/Live/Dance/Club/Powerful MODE.
  148. */
  149. VOID Hv_Drv_Audio_SetEQDefaultValue(UINT32 uiEQMode);
  150. /**
  151. * @brief set 0-100 value to driver.
  152. * @param[in] : uiEQMode: Rock/Pop/Live/Dance/Club/Powerful MODE.
  153. */
  154. VOID Hv_Drv_Audio_GetLpf0DataAndSetRegs(UINT32 uiEQMode);
  155. /**
  156. * @brief set 0-100 value to driver.
  157. * @param[in] uiEQMode: Rock/Pop/Live/Dance/Club/Powerful MODE.
  158. */
  159. VOID Hv_Drv_Audio_GetHpf0DataAndSetRegs(UINT32 uiEQMode);
  160. /**
  161. * @brief set 0-100 value to driver.
  162. * @param[in] uiEQMode: Rock/Pop/Live/Dance/Club/Powerful MODE.
  163. */
  164. VOID Hv_Drv_Audio_GetBpf0DataAndSetRegs(UINT32 uiEQMode);
  165. /**
  166. * @brief set 0-100 value to driver.
  167. * @param[in] uiEQMode: Rock/Pop/Live/Dance/Club/Powerful MODE.
  168. */
  169. VOID Hv_Drv_Audio_GetBpf1DataAndSetRegs(UINT32 uiEQMode);
  170. /**
  171. * @brief set 0-100 value to driver.
  172. * @param[in] uiEQMode: Rock/Pop/Live/Dance/Club/Powerful MODE.
  173. */
  174. VOID Hv_Drv_Audio_GetBpf2DataAndSetRegs(UINT32 uiEQMode);
  175. /**
  176. * @brief set 0-100 value to driver.
  177. * @param[in] uiEQMode: Rock/Pop/Live/Dance/Club/Powerful MODE.
  178. */
  179. VOID Hv_Drv_Audio_GetBpf3DataAndSetRegs(UINT32 uiEQMode);
  180. /**
  181. * @brief set 0-100 value to driver.
  182. * @param[in] uiEQMode: Rock/Pop/Live/Dance/Club/Powerful MODE.
  183. */
  184. VOID Hv_Drv_Audio_GetBpf4DataAndSetRegs(UINT32 uiEQMode);
  185. /**
  186. * @brief set 0-100 value to driver.
  187. * @param[in] uiEQMode: Rock/Pop/Live/Dance/Club/Powerful MODE.
  188. */
  189. VOID Hv_Drv_Audio_SetLpf0DataAndSetRegs(UINT32 uiEQMode, AudioLpfData stAudioLpfData);
  190. /**
  191. * @brief set 0-100 value to driver.
  192. * @param[in] uiEQMode: Rock/Pop/Live/Dance/Club/Powerful MODE.
  193. */
  194. VOID Hv_Drv_Audio_SetHpf0DataAndSetRegs(UINT32 uiEQMode, AudioHpfData stAudioHpfData);
  195. /**
  196. * @brief set 0-100 value to driver.
  197. * @param[in] uiEQMode: Rock/Pop/Live/Dance/Club/Powerful MODE.
  198. */
  199. VOID Hv_Drv_Audio_SetBpf0DataAndSetRegs(UINT32 uiEQMode, AudioBpfData stAudioBpfData);
  200. /**
  201. * @brief set 0-100 value to driver.
  202. * @param[in] uiEQMode: Rock/Pop/Live/Dance/Club/Powerful MODE.
  203. */
  204. VOID Hv_Drv_Audio_SetBpf1DataAndSetRegs(UINT32 uiEQMode, AudioBpfData stAudioBpfData);
  205. /**
  206. * @brief set 0-100 value to driver.
  207. * @param[in] uiEQMode: Rock/Pop/Live/Dance/Club/Powerful MODE.
  208. */
  209. VOID Hv_Drv_Audio_SetBpf2DataAndSetRegs(UINT32 uiEQMode, AudioBpfData stAudioBpfData);
  210. /**
  211. * @brief set 0-100 value to driver.
  212. * @param[in] uiEQMode: Rock/Pop/Live/Dance/Club/Powerful MODE.
  213. */
  214. VOID Hv_Drv_Audio_SetBpf3DataAndSetRegs(UINT32 uiEQMode, AudioBpfData stAudioBpfData);
  215. /**
  216. * @brief set 0-100 value to driver.
  217. * @param[in] uiEQMode: Rock/Pop/Live/Dance/Club/Powerful MODE.
  218. */
  219. VOID Hv_Drv_Audio_SetBpf4DataAndSetRegs(UINT32 uiEQMode, AudioBpfData stAudioBpfData);
  220. #endif
  221. /**
  222. * @brief set DDR size value in DM register.
  223. */
  224. VOID Hv_Drv_Audio_SetSoundDelayDDRSize(UINT32 uiDelayTime);
  225. /**
  226. * @brief set DDR Address value in DM register.
  227. */
  228. VOID Hv_Drv_Audio_SetSoundDelayDDRAddress(VOID);
  229. /**
  230. * @brief enalbe the DM write module.
  231. */
  232. VOID Hv_Drv_Audio_DmWriteEnable(VOID);
  233. /**
  234. * @brief enalbe the DM read module.
  235. */
  236. VOID Hv_Drv_Audio_DmReadEnable(VOID *pvArg, USHORT16 usTimerId);
  237. /**
  238. * @brief disalbe the DM module.
  239. */
  240. VOID Hv_Drv_Audio_DmDisable(VOID);
  241. /**
  242. * @brief audio spdif out.
  243. */
  244. VOID Hv_Drv_Audio_SetSpdifOutMode(BOOL bAudioSpdifOut);
  245. #endif