hi_comm_aio.h 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560
  1. /******************************************************************************
  2. Copyright (C), 2001-2018, Hisilicon Tech. Co., Ltd.
  3. ******************************************************************************
  4. File Name : hi_comm_aio.h
  5. Version : Initial Draft
  6. Author : Hisilicon multimedia software group
  7. Created : 2009/5/5
  8. Description :
  9. History :
  10. 1.Date : 2009/5/5
  11. Author : p00123320
  12. Modification: Created file
  13. ******************************************************************************/
  14. #ifndef __HI_COMM_AIO_H__
  15. #define __HI_COMM_AIO_H__
  16. #include "hi_common.h"
  17. #include "hi_errno.h"
  18. #ifdef __cplusplus
  19. #if __cplusplus
  20. extern "C"{
  21. #endif
  22. #endif /* End of #ifdef __cplusplus */
  23. #define MAX_AUDIO_FRAME_NUM 300 /*max count of audio frame in Buffer */
  24. #define MAX_AUDIO_POINT_BYTES 4 /*max bytes of one sample point(now 32bit max)*/
  25. #define MAX_VOICE_POINT_NUM 480 /*max sample per frame for voice encode */
  26. #define MAX_AUDIO_POINT_NUM 2048 /*max sample per frame for all encoder(aacplus:2048)*/
  27. #define MAX_AO_POINT_NUM 4096 /* from h3;support 4096 framelen*/
  28. #define MIN_AUDIO_POINT_NUM 80 /*min sample per frame*/
  29. #define MAX_AI_POINT_NUM 2048 /*max sample per frame for all encoder(aacplus:2048)*/
  30. /*max length of audio frame by bytes, one frame contain many sample point */
  31. #define MAX_AUDIO_FRAME_LEN (MAX_AUDIO_POINT_BYTES*MAX_AO_POINT_NUM)
  32. /*max length of audio stream by bytes */
  33. #define MAX_AUDIO_STREAM_LEN MAX_AUDIO_FRAME_LEN
  34. #define MAX_AI_USRFRM_DEPTH 30 /*max depth of user frame buf */
  35. #define MAX_AUDIO_FILE_PATH_LEN 256
  36. #define MAX_AUDIO_FILE_NAME_LEN 256
  37. /*The VQE EQ Band num.*/
  38. #define VQE_EQ_BAND_NUM 10
  39. #define VQE_DRC_SECNUM 5
  40. #define AI_RECORDVQE_MASK_HPF 0x1
  41. #define AI_RECORDVQE_MASK_RNR 0x2
  42. #define AI_RECORDVQE_MASK_HDR 0x4
  43. #define AI_RECORDVQE_MASK_DRC 0x8
  44. #define AI_RECORDVQE_MASK_EQ 0x10
  45. #define AI_RECORDVQE_MASK_AGC 0x20
  46. #define AI_TALKVQE_MASK_HPF 0x1
  47. #define AI_TALKVQE_MASK_AEC 0x2
  48. #define AI_TALKVQE_MASK_AGC 0x8
  49. #define AI_TALKVQE_MASK_EQ 0x10
  50. #define AI_TALKVQE_MASK_ANR 0x20
  51. #define AO_VQE_MASK_HPF 0x1
  52. #define AO_VQE_MASK_ANR 0x2
  53. #define AO_VQE_MASK_AGC 0x4
  54. #define AO_VQE_MASK_EQ 0x8
  55. typedef enum hiAUDIO_SAMPLE_RATE_E
  56. {
  57. AUDIO_SAMPLE_RATE_8000 = 8000, /* 8K samplerate*/
  58. AUDIO_SAMPLE_RATE_12000 = 12000, /* 12K samplerate*/
  59. AUDIO_SAMPLE_RATE_11025 = 11025, /* 11.025K samplerate*/
  60. AUDIO_SAMPLE_RATE_16000 = 16000, /* 16K samplerate*/
  61. AUDIO_SAMPLE_RATE_22050 = 22050, /* 22.050K samplerate*/
  62. AUDIO_SAMPLE_RATE_24000 = 24000, /* 24K samplerate*/
  63. AUDIO_SAMPLE_RATE_32000 = 32000, /* 32K samplerate*/
  64. AUDIO_SAMPLE_RATE_44100 = 44100, /* 44.1K samplerate*/
  65. AUDIO_SAMPLE_RATE_48000 = 48000, /* 48K samplerate*/
  66. AUDIO_SAMPLE_RATE_64000 = 64000, /* 64K samplerate*/
  67. AUDIO_SAMPLE_RATE_96000 = 96000, /* 96K samplerate*/
  68. AUDIO_SAMPLE_RATE_BUTT,
  69. } AUDIO_SAMPLE_RATE_E;
  70. typedef enum hiAUDIO_BIT_WIDTH_E
  71. {
  72. AUDIO_BIT_WIDTH_8 = 0, /* 8bit width */
  73. AUDIO_BIT_WIDTH_16 = 1, /* 16bit width*/
  74. AUDIO_BIT_WIDTH_24 = 2, /* 24bit width*/
  75. AUDIO_BIT_WIDTH_BUTT,
  76. } AUDIO_BIT_WIDTH_E;
  77. typedef enum hiAIO_MODE_E
  78. {
  79. AIO_MODE_I2S_MASTER = 0, /* AIO I2S master mode */
  80. AIO_MODE_I2S_SLAVE, /* AIO I2S slave mode */
  81. AIO_MODE_PCM_SLAVE_STD, /* AIO PCM slave standard mode */
  82. AIO_MODE_PCM_SLAVE_NSTD, /* AIO PCM slave non-standard mode */
  83. AIO_MODE_PCM_MASTER_STD, /* AIO PCM master standard mode */
  84. AIO_MODE_PCM_MASTER_NSTD, /* AIO PCM master non-standard mode */
  85. AIO_MODE_BUTT
  86. } AIO_MODE_E;
  87. typedef enum
  88. {
  89. AIO_I2STYPE_INNERCODEC = 0, /* AIO I2S connect inner audio CODEC */
  90. AIO_I2STYPE_INNERHDMI, /* AIO I2S connect Inner HDMI */
  91. AIO_I2STYPE_EXTERN, /* AIO I2S connect extern hardware */
  92. } AIO_I2STYPE_E;
  93. typedef enum hiAIO_SOUND_MODE_E
  94. {
  95. AUDIO_SOUND_MODE_MONO =0,/*mono*/
  96. AUDIO_SOUND_MODE_STEREO =1,/*stereo*/
  97. AUDIO_SOUND_MODE_BUTT
  98. } AUDIO_SOUND_MODE_E;
  99. /*
  100. An example of the packing scheme for G726-32 codewords is as shown, and bit A3 is the least significant bit of the first codeword:
  101. RTP G726-32:
  102. 0 1
  103. 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
  104. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
  105. |B B B B|A A A A|D D D D|C C C C| ...
  106. |0 1 2 3|0 1 2 3|0 1 2 3|0 1 2 3|
  107. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
  108. MEDIA G726-32:
  109. 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
  110. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
  111. |A A A A|B B B B|C C C C|D D D D| ...
  112. |3 2 1 0|3 2 1 0|3 2 1 0|3 2 1 0|
  113. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
  114. */
  115. typedef enum hiG726_BPS_E
  116. {
  117. G726_16K = 0, /* G726 16kbps, see RFC3551.txt 4.5.4 G726-16 */
  118. G726_24K, /* G726 24kbps, see RFC3551.txt 4.5.4 G726-24 */
  119. G726_32K, /* G726 32kbps, see RFC3551.txt 4.5.4 G726-32 */
  120. G726_40K, /* G726 40kbps, see RFC3551.txt 4.5.4 G726-40 */
  121. MEDIA_G726_16K, /* G726 16kbps for ASF ... */
  122. MEDIA_G726_24K, /* G726 24kbps for ASF ... */
  123. MEDIA_G726_32K, /* G726 32kbps for ASF ... */
  124. MEDIA_G726_40K, /* G726 40kbps for ASF ... */
  125. G726_BUTT,
  126. } G726_BPS_E;
  127. typedef enum hiADPCM_TYPE_E
  128. {
  129. /* see DVI4 diiffers in three respects from the IMA ADPCM at RFC3551.txt 4.5.1 DVI4 */
  130. ADPCM_TYPE_DVI4 = 0, /* 32kbps ADPCM(DVI4) for RTP */
  131. ADPCM_TYPE_IMA, /* 32kbps ADPCM(IMA),NOTICE:point num must be 161/241/321/481 */
  132. ADPCM_TYPE_ORG_DVI4,
  133. ADPCM_TYPE_BUTT,
  134. } ADPCM_TYPE_E;
  135. #define AI_EXPAND 0x01
  136. #define AI_CUT 0x02
  137. typedef struct hiAIO_ATTR_S
  138. {
  139. AUDIO_SAMPLE_RATE_E enSamplerate; /* sample rate */
  140. AUDIO_BIT_WIDTH_E enBitwidth; /* bitwidth */
  141. AIO_MODE_E enWorkmode; /* master or slave mode */
  142. AUDIO_SOUND_MODE_E enSoundmode; /* momo or steror */
  143. HI_U32 u32EXFlag; /* expand 8bit to 16bit,use AI_EXPAND(only valid for AI 8bit),use AI_CUT(only valid for extern Codec for 24bit) */
  144. HI_U32 u32FrmNum; /* frame num in buf[2,MAX_AUDIO_FRAME_NUM] */
  145. HI_U32 u32PtNumPerFrm; /* point num per frame (80/160/240/320/480/1024/2048)
  146. (ADPCM IMA should add 1 point, AMR only support 160) */
  147. HI_U32 u32ChnCnt; /* channle number on FS, valid value:1/2/4/8 */
  148. HI_U32 u32ClkSel; /* 0: AI and AO clock is separate
  149. 1: AI and AO clock is inseparate, AI use AO's clock
  150. */
  151. AIO_I2STYPE_E enI2sType; /* i2s type */
  152. } AIO_ATTR_S;
  153. typedef struct hiAI_CHN_PARAM_S
  154. {
  155. HI_U32 u32UsrFrmDepth;
  156. } AI_CHN_PARAM_S;
  157. typedef struct hiAUDIO_FRAME_S
  158. {
  159. AUDIO_BIT_WIDTH_E enBitwidth; /*audio frame bitwidth*/
  160. AUDIO_SOUND_MODE_E enSoundmode; /*audio frame momo or stereo mode*/
  161. HI_U8* u64VirAddr[2];
  162. HI_U64 u64PhyAddr[2];
  163. HI_U64 u64TimeStamp; /*audio frame timestamp*/
  164. HI_U32 u32Seq; /*audio frame seq*/
  165. HI_U32 u32Len; /*data lenth per channel in frame*/
  166. HI_U32 u32PoolId[2];
  167. } AUDIO_FRAME_S;
  168. typedef struct hiAEC_FRAME_S
  169. {
  170. AUDIO_FRAME_S stRefFrame; /* AEC reference audio frame */
  171. HI_BOOL bValid; /* whether frame is valid */
  172. HI_BOOL bSysBind; /* whether is sysbind */
  173. } AEC_FRAME_S;
  174. typedef struct hiAUDIO_FRAME_INFO_S
  175. {
  176. AUDIO_FRAME_S *pstFrame;/*frame ptr*/
  177. HI_U32 u32Id; /*frame id*/
  178. } AUDIO_FRAME_INFO_S;
  179. typedef struct hiAUDIO_STREAM_S
  180. {
  181. HI_U8 ATTRIBUTE *pStream; /* the virtual address of stream */
  182. HI_U64 ATTRIBUTE u64PhyAddr; /* the physics address of stream */
  183. HI_U32 u32Len; /* stream lenth, by bytes */
  184. HI_U64 u64TimeStamp; /* frame time stamp*/
  185. HI_U32 u32Seq; /* frame seq,if stream is not a valid frame,u32Seq is 0*/
  186. } AUDIO_STREAM_S;
  187. typedef struct hiAO_CHN_STATE_S
  188. {
  189. HI_U32 u32ChnTotalNum; /* total number of channel buffer */
  190. HI_U32 u32ChnFreeNum; /* free number of channel buffer */
  191. HI_U32 u32ChnBusyNum; /* busy number of channel buffer */
  192. } AO_CHN_STATE_S;
  193. typedef enum hiAUDIO_TRACK_MODE_E
  194. {
  195. AUDIO_TRACK_NORMAL = 0,
  196. AUDIO_TRACK_BOTH_LEFT = 1,
  197. AUDIO_TRACK_BOTH_RIGHT = 2,
  198. AUDIO_TRACK_EXCHANGE = 3,
  199. AUDIO_TRACK_MIX = 4,
  200. AUDIO_TRACK_LEFT_MUTE = 5,
  201. AUDIO_TRACK_RIGHT_MUTE = 6,
  202. AUDIO_TRACK_BOTH_MUTE = 7,
  203. AUDIO_TRACK_BUTT
  204. } AUDIO_TRACK_MODE_E;
  205. typedef enum hiAUDIO_FADE_RATE_E
  206. {
  207. AUDIO_FADE_RATE_1 = 0,
  208. AUDIO_FADE_RATE_2 = 1,
  209. AUDIO_FADE_RATE_4 = 2,
  210. AUDIO_FADE_RATE_8 = 3,
  211. AUDIO_FADE_RATE_16 = 4,
  212. AUDIO_FADE_RATE_32 = 5,
  213. AUDIO_FADE_RATE_64 = 6,
  214. AUDIO_FADE_RATE_128 = 7,
  215. AUDIO_FADE_RATE_BUTT
  216. } AUDIO_FADE_RATE_E;
  217. typedef struct hiAUDIO_FADE_S
  218. {
  219. HI_BOOL bFade;
  220. AUDIO_FADE_RATE_E enFadeInRate;
  221. AUDIO_FADE_RATE_E enFadeOutRate;
  222. } AUDIO_FADE_S;
  223. /**Defines the configure parameters of AEC.*/
  224. typedef struct hiAI_AEC_CONFIG_S
  225. {
  226. HI_BOOL bUsrMode; /* mode 0: auto mode 1: mannual.*/
  227. HI_S8 s8CngMode; /* cozy noisy mode: 0 close, 1 open, recommend 1*/
  228. HI_S8 s8NearAllPassEnergy; /* the far-end energy threshold for judging whether unvarnished transmission: 0 -59dBm0, 1 -49dBm0, 2 -39dBm0, recommend 1 */
  229. HI_S8 s8NearCleanSupEnergy; /* the energy threshold for compelling reset of near-end signal: 0 12dB, 1 15dB, 2 18dB, recommend 2 */
  230. HI_S16 s16DTHnlSortQTh; /* the threshold of judging single or double talk, recommend 16384, [0, 32767] */
  231. HI_S16 s16EchoBandLow; /* voice processing band1, low frequency parameter, [1, 63) for 8k, [1, 127) for 16k, recommend 10 */
  232. HI_S16 s16EchoBandHigh; /* voice processing band1, high frequency parameter, (s16EchoBandLow, 63] for 8k, (s16EchoBandLow, 127] for 16k, recommend 41 */
  233. /* s16EchoBandHigh must be greater than s16EchoBandLow */
  234. HI_S16 s16EchoBandLow2; /* voice processing band2, low frequency parameter, [1, 63) for 8k, [1, 127) for 16k, recommend 47 */
  235. HI_S16 s16EchoBandHigh2; /* voice processing band2, high frequency parameter, (s16EchoBandLow2, 63] for 8k, (s16EchoBandLow2, 127] for 16k, recommend 72 */
  236. /* s16EchoBandHigh2 must be greater than s16EchoBandLow2 */
  237. HI_S16 s16ERLBand[6]; /* ERL protect area, [1, 63] for 8k, [1, 127] for 16k, frequency band calculated by s16ERLBand * 62.5 */
  238. /* besides, s16ERLBand[n+1] should be greater than s16ERLBand[n] */
  239. HI_S16 s16ERL[7]; /* ERL protect value of ERL protect area, the smaller its value, the more strength its protect ability,[0, 18]*/
  240. HI_S16 s16VioceProtectFreqL; /* protect area of near-end low frequency, [1, 63) for 8k, [1, 127) for 16k, recommend 3 */
  241. HI_S16 s16VioceProtectFreqL1; /* protect area of near-end low frequency1, (s16VioceProtectFreqL, 63] for 8k, (s16VioceProtectFreqL, 127] for 16k, recommend 6 */
  242. HI_S32 s32Reserved; /* s16VioceProtectFreqL1 must be greater than s16VioceProtectFreqL */
  243. } AI_AEC_CONFIG_S;
  244. /**Defines the configure parameters of ANR.*/
  245. typedef struct hiAUDIO_ANR_CONFIG_S
  246. {
  247. HI_BOOL bUsrMode; /* mode 0: auto, mode 1: manual.*/
  248. HI_S16 s16NrIntensity; /* noise reduce intensity, range: [0, 25] */
  249. HI_S16 s16NoiseDbThr; /* noise threshold, range: [30, 60] */
  250. HI_S8 s8SpProSwitch; /* switch for music probe, range: [0:close, 1:open] */
  251. HI_S32 s32Reserved;
  252. } AUDIO_ANR_CONFIG_S;
  253. /**Defines the configure parameters of AGC.*/
  254. typedef struct hiAUDIO_AGC_CONFIG_S
  255. {
  256. HI_BOOL bUsrMode; /* mode 0: auto, mode 1: manual.*/
  257. HI_S8 s8TargetLevel; /* target voltage level, range: [-40, -1]dB */
  258. HI_S8 s8NoiseFloor; /* noise floor, range: TalkVqe/AoVqe[-65, -20]dB, RecordVqe[-50, -20]dB */
  259. HI_S8 s8MaxGain; /* max gain, range: [0, 30]dB */
  260. HI_S8 s8AdjustSpeed; /* adjustable speed, range: [0, 10]dB/s */
  261. HI_S8 s8ImproveSNR; /* switch for improving SNR, range: [0:close, 1:upper limit 3dB, 2:upper limit 6dB] */
  262. HI_S8 s8UseHighPassFilt; /* switch for using high pass filt, range: [0:close, 1:80Hz, 2:120Hz, 3:150:Hz, 4:300Hz: 5:500Hz] */
  263. HI_S8 s8OutputMode; /* output mode, mute when lower than noise floor, range: [0:close, 1:open] */
  264. HI_S16 s16NoiseSupSwitch; /* switch for noise suppression, range: [0:close, 1:open] */
  265. HI_S32 s32Reserved;
  266. } AUDIO_AGC_CONFIG_S;
  267. /**Defines the configure parameters of HPF.*/
  268. typedef enum hiAUDIO_HPF_FREQ_E
  269. {
  270. AUDIO_HPF_FREQ_80 = 80, /* 80Hz */
  271. AUDIO_HPF_FREQ_120 = 120, /* 120Hz */
  272. AUDIO_HPF_FREQ_150 = 150, /* 150Hz */
  273. AUDIO_HPF_FREQ_BUTT,
  274. } AUDIO_HPF_FREQ_E;
  275. typedef struct hiAUDIO_HPF_CONFIG_S
  276. {
  277. HI_BOOL bUsrMode; /* mode 0: auto mode 1: mannual.*/
  278. AUDIO_HPF_FREQ_E enHpfFreq; /*freq to be processed,value:HiFiVqe/TalkVqe/AoVqe(80Hz,120Hz,150Hz), RecordVqe(80Hz)*/
  279. } AUDIO_HPF_CONFIG_S;
  280. typedef struct hiAI_RNR_CONFIG_S
  281. {
  282. HI_BOOL bUsrMode; /* mode 0: auto, mode 1: mannual.*/
  283. HI_S32 s32NrMode; /*mode 0: floor noise; 1:ambient noise */
  284. HI_S32 s32MaxNrLevel; /*max NR level range:[2,20]dB*/
  285. HI_S32 s32NoiseThresh; /*noise threshold, range:[-80, -20]*/
  286. } AI_RNR_CONFIG_S;
  287. typedef struct hiAUDIO_EQ_CONFIG_S
  288. {
  289. HI_S8 s8GaindB[VQE_EQ_BAND_NUM]; /*EQ band, include 100,200,250,350,500,800,1.2k,2.5k,4k,8k in turn,
  290. range:TalkVqe/AoVqe[-100, 20], RecordVqe[-50, 20]*/
  291. HI_S32 s32Reserved;
  292. } AUDIO_EQ_CONFIG_S;
  293. /**Defines the configure parameters of UPVQE work state.*/
  294. typedef enum hiVQE_WORKSTATE_E
  295. {
  296. VQE_WORKSTATE_COMMON = 0, /* common environment, Applicable to the family of voice calls. */
  297. VQE_WORKSTATE_MUSIC = 1, /* music environment , Applicable to the family of music environment. */
  298. VQE_WORKSTATE_NOISY = 2, /* noisy environment , Applicable to the noisy voice calls. */
  299. } VQE_WORKSTATE_E;
  300. /**Defines record type*/
  301. typedef enum hiVQE_RECORD_TYPE
  302. {
  303. VQE_RECORD_NORMAL = 0, /*<double micphone recording. */
  304. VQE_RECORD_BUTT,
  305. } VQE_RECORD_TYPE;
  306. /* HDR Set CODEC GAIN Function Handle type */
  307. typedef HI_S32 (*pFuncGainCallBack)(HI_S32 s32SetGain);
  308. typedef struct hiAI_HDR_CONFIG_S
  309. {
  310. HI_BOOL bUsrMode; /* mode 0: auto mode 1: mannual.*/
  311. HI_S32 s32MinGaindB; /* the minimum of MIC(AI) CODEC gain, [0, 120]*/
  312. HI_S32 s32MaxGaindB; /* the maximum of MIC(AI) CODEC gain, [0, 120]*/
  313. HI_S32 s32MicGaindB; /* the current gain of MIC(AI) CODEC,[s32MinGaindB, s32MaxGaindB]*/
  314. HI_S32 s32MicGainStepdB; /* the step size of gain adjustment, [1, 3], recommemd 2 */
  315. pFuncGainCallBack pcallback; /* the callback function pointer of CODEC gain adjustment */
  316. } AI_HDR_CONFIG_S;
  317. typedef struct hiAI_DRC_CONFIG_S
  318. {
  319. HI_BOOL bUsrMode; /* enable user mode or not,default 0: disable user mode,1: user mode.*/
  320. HI_S16 s16AttackTime; /*time of signal change from large to small (ms), range:HiFiVqe[10, 250]ms, RecordVqe[10, 126]ms*/
  321. HI_S16 s16ReleaseTime; /*time of signal change from small to large (ms), range:HiFiVqe[10, 250]ms, RecordVqe[10, 126]ms*/
  322. HI_S16 s16OldLevDb[VQE_DRC_SECNUM]; /*old curve level(dB) ,default[0, -472, -792, -960, -1280],range:[-1440, 0]ms,store from big to small,scale:Q4*/
  323. HI_S16 s16NewLevDb[VQE_DRC_SECNUM]; /*new curve level(dB) ,default[0, -174, -410, -608, -1021],range:[-1440, 0]ms,store from big to small,scale:Q4*/
  324. } AI_DRC_CONFIG_S;
  325. /**Defines the configure parameters of Record VQE.*/
  326. typedef struct hiAI_RECORDVQE_CONFIG_S
  327. {
  328. HI_U32 u32OpenMask;
  329. HI_S32 s32WorkSampleRate; /* Sample Rate:16KHz/48KHz*/
  330. HI_S32 s32FrameSample; /* VQE frame length:80-4096 */
  331. VQE_WORKSTATE_E enWorkstate;
  332. HI_S32 s32InChNum;
  333. HI_S32 s32OutChNum;
  334. VQE_RECORD_TYPE enRecordType;
  335. AUDIO_HPF_CONFIG_S stHpfCfg;
  336. AI_RNR_CONFIG_S stRnrCfg;
  337. AI_HDR_CONFIG_S stHdrCfg;
  338. AI_DRC_CONFIG_S stDrcCfg;
  339. AUDIO_EQ_CONFIG_S stEqCfg;
  340. AUDIO_AGC_CONFIG_S stAgcCfg;
  341. } AI_RECORDVQE_CONFIG_S;
  342. /**Defines the configure parameters of Talk VQE.*/
  343. typedef struct hiAI_TALKVQE_CONFIG_S
  344. {
  345. HI_U32 u32OpenMask;
  346. HI_S32 s32WorkSampleRate; /* Sample Rate: 8KHz/16KHz. default: 8KHz*/
  347. HI_S32 s32FrameSample; /* VQE frame length: 80-4096 */
  348. VQE_WORKSTATE_E enWorkstate;
  349. AUDIO_HPF_CONFIG_S stHpfCfg;
  350. AI_AEC_CONFIG_S stAecCfg;
  351. AUDIO_ANR_CONFIG_S stAnrCfg;
  352. AUDIO_AGC_CONFIG_S stAgcCfg;
  353. AUDIO_EQ_CONFIG_S stEqCfg;
  354. } AI_TALKVQE_CONFIG_S;
  355. typedef struct hiAO_VQE_CONFIG_S
  356. {
  357. HI_U32 u32OpenMask;
  358. HI_S32 s32WorkSampleRate; /* Sample Rate: 8KHz/16KHz/48KHz. default: 8KHz*/
  359. HI_S32 s32FrameSample; /* VQE frame length: 80-4096 */
  360. VQE_WORKSTATE_E enWorkstate;
  361. AUDIO_HPF_CONFIG_S stHpfCfg;
  362. AUDIO_ANR_CONFIG_S stAnrCfg;
  363. AUDIO_AGC_CONFIG_S stAgcCfg;
  364. AUDIO_EQ_CONFIG_S stEqCfg;
  365. } AO_VQE_CONFIG_S;
  366. /*Defines the configure parameters of AI saving file.*/
  367. typedef struct hiAUDIO_SAVE_FILE_INFO_S
  368. {
  369. HI_BOOL bCfg;
  370. HI_CHAR aFilePath[MAX_AUDIO_FILE_PATH_LEN];
  371. HI_CHAR aFileName[MAX_AUDIO_FILE_NAME_LEN];
  372. HI_U32 u32FileSize; /*in KB*/
  373. } AUDIO_SAVE_FILE_INFO_S;
  374. /*Defines whether the file is saving or not .*/
  375. typedef struct hiAUDIO_FILE_STATUS_S
  376. {
  377. HI_BOOL bSaving;
  378. } AUDIO_FILE_STATUS_S;
  379. /**Defines audio clksel type*/
  380. typedef enum hiAUDIO_CLKSEL_E
  381. {
  382. AUDIO_CLKSEL_BASE = 0, /*<Audio base clk. */
  383. AUDIO_CLKSEL_SPARE, /*<Audio spare clk. */
  384. AUDIO_CLKSEL_BUTT,
  385. } AUDIO_CLKSEL_E;
  386. /*Defines audio mode parameter.*/
  387. typedef struct hiAUDIO_MOD_PARAM_S
  388. {
  389. AUDIO_CLKSEL_E enClkSel;
  390. } AUDIO_MOD_PARAM_S;
  391. typedef enum hiEN_AIO_ERR_CODE_E
  392. {
  393. AIO_ERR_VQE_ERR = 65 , /*vqe error*/
  394. } EN_AIO_ERR_CODE_E;
  395. /* invlalid device ID */
  396. #define HI_ERR_AI_INVALID_DEVID HI_DEF_ERR(HI_ID_AI, EN_ERR_LEVEL_ERROR, EN_ERR_INVALID_DEVID)
  397. /* invlalid channel ID */
  398. #define HI_ERR_AI_INVALID_CHNID HI_DEF_ERR(HI_ID_AI, EN_ERR_LEVEL_ERROR, EN_ERR_INVALID_CHNID)
  399. /* at lease one parameter is illagal ,eg, an illegal enumeration value */
  400. #define HI_ERR_AI_ILLEGAL_PARAM HI_DEF_ERR(HI_ID_AI, EN_ERR_LEVEL_ERROR, EN_ERR_ILLEGAL_PARAM)
  401. /* using a NULL point */
  402. #define HI_ERR_AI_NULL_PTR HI_DEF_ERR(HI_ID_AI, EN_ERR_LEVEL_ERROR, EN_ERR_NULL_PTR)
  403. /* try to enable or initialize system,device or channel, before configing attribute */
  404. #define HI_ERR_AI_NOT_CONFIG HI_DEF_ERR(HI_ID_AI, EN_ERR_LEVEL_ERROR, EN_ERR_NOT_CONFIG)
  405. /* operation is not supported by NOW */
  406. #define HI_ERR_AI_NOT_SUPPORT HI_DEF_ERR(HI_ID_AI, EN_ERR_LEVEL_ERROR, EN_ERR_NOT_SUPPORT)
  407. /* operation is not permitted ,eg, try to change stati attribute */
  408. #define HI_ERR_AI_NOT_PERM HI_DEF_ERR(HI_ID_AI, EN_ERR_LEVEL_ERROR, EN_ERR_NOT_PERM)
  409. /* the devide is not enabled */
  410. #define HI_ERR_AI_NOT_ENABLED HI_DEF_ERR(HI_ID_AI, EN_ERR_LEVEL_ERROR, EN_ERR_UNEXIST)
  411. /* failure caused by malloc memory */
  412. #define HI_ERR_AI_NOMEM HI_DEF_ERR(HI_ID_AI, EN_ERR_LEVEL_ERROR, EN_ERR_NOMEM)
  413. /* failure caused by malloc buffer */
  414. #define HI_ERR_AI_NOBUF HI_DEF_ERR(HI_ID_AI, EN_ERR_LEVEL_ERROR, EN_ERR_NOBUF)
  415. /* no data in buffer */
  416. #define HI_ERR_AI_BUF_EMPTY HI_DEF_ERR(HI_ID_AI, EN_ERR_LEVEL_ERROR, EN_ERR_BUF_EMPTY)
  417. /* no buffer for new data */
  418. #define HI_ERR_AI_BUF_FULL HI_DEF_ERR(HI_ID_AI, EN_ERR_LEVEL_ERROR, EN_ERR_BUF_FULL)
  419. /* system is not ready,had not initialed or loaded*/
  420. #define HI_ERR_AI_SYS_NOTREADY HI_DEF_ERR(HI_ID_AI, EN_ERR_LEVEL_ERROR, EN_ERR_SYS_NOTREADY)
  421. #define HI_ERR_AI_BUSY HI_DEF_ERR(HI_ID_AI, EN_ERR_LEVEL_ERROR, EN_ERR_BUSY)
  422. /* vqe err */
  423. #define HI_ERR_AI_VQE_ERR HI_DEF_ERR(HI_ID_AI, EN_ERR_LEVEL_ERROR, AIO_ERR_VQE_ERR)
  424. /* invlalid device ID */
  425. #define HI_ERR_AO_INVALID_DEVID HI_DEF_ERR(HI_ID_AO, EN_ERR_LEVEL_ERROR, EN_ERR_INVALID_DEVID)
  426. /* invlalid channel ID */
  427. #define HI_ERR_AO_INVALID_CHNID HI_DEF_ERR(HI_ID_AO, EN_ERR_LEVEL_ERROR, EN_ERR_INVALID_CHNID)
  428. /* at lease one parameter is illagal ,eg, an illegal enumeration value */
  429. #define HI_ERR_AO_ILLEGAL_PARAM HI_DEF_ERR(HI_ID_AO, EN_ERR_LEVEL_ERROR, EN_ERR_ILLEGAL_PARAM)
  430. /* using a NULL point */
  431. #define HI_ERR_AO_NULL_PTR HI_DEF_ERR(HI_ID_AO, EN_ERR_LEVEL_ERROR, EN_ERR_NULL_PTR)
  432. /* try to enable or initialize system,device or channel, before configing attribute */
  433. #define HI_ERR_AO_NOT_CONFIG HI_DEF_ERR(HI_ID_AO, EN_ERR_LEVEL_ERROR, EN_ERR_NOT_CONFIG)
  434. /* operation is not supported by NOW */
  435. #define HI_ERR_AO_NOT_SUPPORT HI_DEF_ERR(HI_ID_AO, EN_ERR_LEVEL_ERROR, EN_ERR_NOT_SUPPORT)
  436. /* operation is not permitted ,eg, try to change stati attribute */
  437. #define HI_ERR_AO_NOT_PERM HI_DEF_ERR(HI_ID_AO, EN_ERR_LEVEL_ERROR, EN_ERR_NOT_PERM)
  438. /* the devide is not enabled */
  439. #define HI_ERR_AO_NOT_ENABLED HI_DEF_ERR(HI_ID_AO, EN_ERR_LEVEL_ERROR, EN_ERR_UNEXIST)
  440. /* failure caused by malloc memory */
  441. #define HI_ERR_AO_NOMEM HI_DEF_ERR(HI_ID_AO, EN_ERR_LEVEL_ERROR, EN_ERR_NOMEM)
  442. /* failure caused by malloc buffer */
  443. #define HI_ERR_AO_NOBUF HI_DEF_ERR(HI_ID_AO, EN_ERR_LEVEL_ERROR, EN_ERR_NOBUF)
  444. /* no data in buffer */
  445. #define HI_ERR_AO_BUF_EMPTY HI_DEF_ERR(HI_ID_AO, EN_ERR_LEVEL_ERROR, EN_ERR_BUF_EMPTY)
  446. /* no buffer for new data */
  447. #define HI_ERR_AO_BUF_FULL HI_DEF_ERR(HI_ID_AO, EN_ERR_LEVEL_ERROR, EN_ERR_BUF_FULL)
  448. /* system is not ready,had not initialed or loaded*/
  449. #define HI_ERR_AO_SYS_NOTREADY HI_DEF_ERR(HI_ID_AO, EN_ERR_LEVEL_ERROR, EN_ERR_SYS_NOTREADY)
  450. #define HI_ERR_AO_BUSY HI_DEF_ERR(HI_ID_AO, EN_ERR_LEVEL_ERROR, EN_ERR_BUSY)
  451. /* vqe err */
  452. #define HI_ERR_AO_VQE_ERR HI_DEF_ERR(HI_ID_AO, EN_ERR_LEVEL_ERROR, AIO_ERR_VQE_ERR)
  453. #ifdef __cplusplus
  454. #if __cplusplus
  455. }
  456. #endif
  457. #endif /* End of #ifdef __cplusplus */
  458. #endif /* End of #ifndef __HI_COMM_AI_H__ */