1 //<MStar Software> 2 //****************************************************************************** 3 // MStar Software 4 // Copyright (c) 2010 - 2012 MStar Semiconductor, Inc. All rights reserved. 5 // All software, firmware and related documentation herein ("MStar Software") are 6 // intellectual property of MStar Semiconductor, Inc. ("MStar") and protected by 7 // law, including, but not limited to, copyright law and international treaties. 8 // Any use, modification, reproduction, retransmission, or republication of all 9 // or part of MStar Software is expressly prohibited, unless prior written 10 // permission has been granted by MStar. 11 // 12 // By accessing, browsing and/or using MStar Software, you acknowledge that you 13 // have read, understood, and agree, to be bound by below terms ("Terms") and to 14 // comply with all applicable laws and regulations: 15 // 16 // 1. MStar shall retain any and all right, ownership and interest to MStar 17 // Software and any modification/derivatives thereof. 18 // No right, ownership, or interest to MStar Software and any 19 // modification/derivatives thereof is transferred to you under Terms. 20 // 21 // 2. You understand that MStar Software might include, incorporate or be 22 // supplied together with third party`s software and the use of MStar 23 // Software may require additional licenses from third parties. 24 // Therefore, you hereby agree it is your sole responsibility to separately 25 // obtain any and all third party right and license necessary for your use of 26 // such third party`s software. 27 // 28 // 3. MStar Software and any modification/derivatives thereof shall be deemed as 29 // MStar`s confidential information and you agree to keep MStar`s 30 // confidential information in strictest confidence and not disclose to any 31 // third party. 32 // 33 // 4. MStar Software is provided on an "AS IS" basis without warranties of any 34 // kind. Any warranties are hereby expressly disclaimed by MStar, including 35 // without limitation, any warranties of merchantability, non-infringement of 36 // intellectual property rights, fitness for a particular purpose, error free 37 // and in conformity with any international standard. You agree to waive any 38 // claim against MStar for any loss, damage, cost or expense that you may 39 // incur related to your use of MStar Software. 40 // In no event shall MStar be liable for any direct, indirect, incidental or 41 // consequential damages, including without limitation, lost of profit or 42 // revenues, lost or damage of data, and unauthorized system use. 43 // You agree that this Section 4 shall still apply without being affected 44 // even if MStar Software has been modified by MStar in accordance with your 45 // request or instruction for your use, except otherwise agreed by both 46 // parties in writing. 47 // 48 // 5. If requested, MStar may from time to time provide technical supports or 49 // services in relation with MStar Software to you for your use of 50 // MStar Software in conjunction with your or your customer`s product 51 // ("Services"). 52 // You understand and agree that, except otherwise agreed by both parties in 53 // writing, Services are provided on an "AS IS" basis and the warranty 54 // disclaimer set forth in Section 4 above shall apply. 55 // 56 // 6. Nothing contained herein shall be construed as by implication, estoppels 57 // or otherwise: 58 // (a) conferring any license or right to use MStar name, trademark, service 59 // mark, symbol or any other identification; 60 // (b) obligating MStar or any of its affiliates to furnish any person, 61 // including without limitation, you and your customers, any assistance 62 // of any kind whatsoever, or any information; or 63 // (c) conferring any license or right under any intellectual property right. 64 // 65 // 7. These terms shall be governed by and construed in accordance with the laws 66 // of Taiwan, R.O.C., excluding its conflict of law rules. 67 // Any and all dispute arising out hereof or related hereto shall be finally 68 // settled by arbitration referred to the Chinese Arbitration Association, 69 // Taipei in accordance with the ROC Arbitration Law and the Arbitration 70 // Rules of the Association by three (3) arbitrators appointed in accordance 71 // with the said Rules. 72 // The place of arbitration shall be in Taipei, Taiwan and the language shall 73 // be English. 74 // The arbitration award shall be final and binding to both parties. 75 // 76 //****************************************************************************** 77 //<MStar Software> 78 //////////////////////////////////////////////////////////////////////////////// 79 // 80 // Copyright (c) 2008-2009 MStar Semiconductor, Inc. 81 // All rights reserved. 82 // 83 // Unless otherwise stipulated in writing, any and all information contained 84 // herein regardless in any format shall remain the sole proprietary of 85 // MStar Semiconductor Inc. and be kept in strict confidence 86 // ("MStar Confidential Information") by the recipient. 87 // Any unauthorized act including without limitation unauthorized disclosure, 88 // copying, use, reproduction, sale, distribution, modification, disassembling, 89 // reverse bEngineering and compiling of the contents of MStar Confidential 90 // Information is unlawful and strictly prohibited. MStar hereby reserves the 91 // rights to any and all damages, losses, costs and expenses resulting therefrom. 92 // 93 //////////////////////////////////////////////////////////////////////////////// 94 95 #ifndef _HALADVSOUND_H_ 96 #define _HALADVSOUND_H_ 97 98 #include "MsTypes.h" 99 100 101 #ifdef __cplusplus 102 extern "C" 103 { 104 #endif 105 106 typedef enum 107 { 108 SRS_TBHDX_SPEAKERSIZE_40HZ,///0 109 SRS_TBHDX_SPEAKERSIZE_50HZ,///1 110 SRS_TBHDX_SPEAKERSIZE_60HZ,///2 111 SRS_TBHDX_SPEAKERSIZE_70HZ,///3 112 SRS_TBHDX_SPEAKERSIZE_80HZ,///4 113 SRS_TBHDX_SPEAKERSIZE_90HZ,///5 114 SRS_TBHDX_SPEAKERSIZE_100HZ,///6 115 SRS_TBHDX_SPEAKERSIZE_110HZ,///7 116 SRS_TBHDX_SPEAKERSIZE_120HZ,///8 117 SRS_TBHDX_SPEAKERSIZE_130HZ,///9 118 SRS_TBHDX_SPEAKERSIZE_140HZ,///10 119 SRS_TBHDX_SPEAKERSIZE_150HZ,///11 120 SRS_TBHDX_SPEAKERSIZE_160HZ,///12 121 SRS_TBHDX_SPEAKERSIZE_170HZ,///13 122 SRS_TBHDX_SPEAKERSIZE_180HZ,///14 123 SRS_TBHDX_SPEAKERSIZE_190HZ,///15 124 SRS_TBHDX_SPEAKERSIZE_200HZ,///16 125 SRS_TBHDX_SPEAKERSIZE_210HZ,///17 126 SRS_TBHDX_SPEAKERSIZE_220HZ,///18 127 SRS_TBHDX_SPEAKERSIZE_230HZ,///19 128 SRS_TBHDX_SPEAKERSIZE_240HZ,///20 129 SRS_TBHDX_SPEAKERSIZE_250HZ,///21 130 SRS_TBHDX_SPEAKERSIZE_300HZ,///22 131 SRS_TBHDX_SPEAKERSIZE_400HZ,///23 132 SRS_TBHDX_SPEAKERSIZE_500HZ,///24 133 SRS_TBHDX_SPEAKERSIZE_600HZ,///25 134 SRS_TBHDX_SPEAKERSIZE_CUSTOM, 135 SRS_TBHDX_SPEAKERSIZE_SIZES, 136 SRS_TBHDX_SPEAKERSIZE_UNUSED = 0x7FFFFFFF 137 } SRSTBHDXSpeakerSize; 138 #define AUDIO_USE_SOUND_EFFECT_PL2 0 //ID = 0 139 #define AUDIO_USE_SOUND_EFFECT_BBE 0 //ID = 1 140 #define AUDIO_USE_SOUND_EFFECT_SRS 0 //ID = 2 141 #define AUDIO_USE_SOUND_EFFECT_VDS 0 //ID = 3 142 #define AUDIO_USE_SOUND_EFFECT_VSPK 0 //ID = 4 143 #define AUDIO_USE_SOUND_EFFECT_SUPVOICE 0 //ID = 5 144 #define AUDIO_USE_SOUND_EFFECT_TSHD 1 //ID = 6 145 #define AUDIO_USE_SOUND_EFFECT_XEN 0 //ID = 7 146 #define AUDIO_USE_SOUND_EFFECT_TSHDVIQ 0 //ID = 8 147 #define AUDIO_USE_SOUND_EFFECT_ADV 0 //ID = 9 148 #define AUDIO_USE_SOUND_EFFECT_DBX 1 //ID = 10 149 #define AUDIO_USE_SOUND_EFFECT_THEATERSOUND 0 //ID = 11 150 #define AUDIO_USE_SOUND_EFFECT_PURESND 0 //ID = 12 151 #if(AUDIO_USE_SOUND_EFFECT_DBX==1) 152 typedef struct _DBXTV_PARAMS 153 { 154 MS_U32 DVCOnOff; 155 MS_U32 DVCFreq; 156 MS_U32 DVCHiLevel; 157 MS_U32 DVCHiRMSTime; 158 MS_U32 DVCHiAvgAttTime; 159 MS_U32 DVCHiAvgRelTime; 160 MS_U32 DVCHiAttRat; 161 MS_U32 DVCHiRelRat; 162 MS_U32 DVCHiAttThr; 163 MS_U32 DVCHiRelThr; 164 MS_U32 DVCHiAttDel; 165 MS_U32 DVCHiRelDel; 166 MS_U32 DVCHiGate; 167 MS_U32 DVCHiGain; 168 MS_U32 DVCHiHold; 169 MS_U32 DVCHiRMS; 170 MS_U32 DVCHiRMSTimeConst; 171 MS_U32 DVCHiAvgAttTimeConst; 172 MS_U32 DVCHiAvgRelTimeConst; 173 MS_U32 DVCHiAvgAttTCNormal; 174 MS_U32 DVCHiAvgAttTCFast; 175 MS_U32 DVCHiAvgRelTCNormal; 176 MS_U32 DVCHiAvgRelTCFast; 177 MS_U32 DVCLoLevel; 178 MS_U32 DVCLoRMSTime; 179 MS_U32 DVCLoAvgAttTime; 180 MS_U32 DVCLoAvgRelTime; 181 MS_U32 DVCLoAttRat; 182 MS_U32 DVCLoRelRat; 183 MS_U32 DVCLoAttThr; 184 MS_U32 DVCLoRelThr; 185 MS_U32 DVCLoAttDel; 186 MS_U32 DVCLoRelDel; 187 MS_U32 DVCLoGate; 188 MS_U32 DVCLoGain; 189 MS_U32 DVCLoHold; 190 MS_U32 DVCLoRMS; 191 MS_U32 DVCLoRMSTimeConst; 192 MS_U32 DVCLoAvgAttTimeConst; 193 MS_U32 DVCLoAvgRelTimeConst; 194 MS_U32 DVCLoAvgAttTCNormal; 195 MS_U32 DVCLoAvgAttTCFast; 196 MS_U32 DVCLoAvgRelTCNormal; 197 MS_U32 DVCLoAvgRelTCFast; 198 MS_U32 DVCMuteOnOff; 199 MS_U32 DVCMuteTime; 200 MS_U32 DVCMuteLevel; 201 MS_U32 DVCMuteDetect; 202 MS_U32 DVCMuteHold; 203 MS_U32 DVCHold; 204 MS_U32 DVCOrder; 205 MS_U32 DVCCoupling; 206 MS_U32 DVCHoldTime; 207 MS_U32 DVCHoldTC; 208 MS_U32 DPPOnOff; 209 MS_U32 DPPThresh; 210 MS_U32 DPPAvgTime; 211 MS_U32 DPPSumRMS; 212 MS_U32 DPPDifRMS; 213 MS_U32 DPPProtect; 214 MS_U32 DPPGain; 215 MS_U32 DPPHPBypass; 216 MS_U32 DPPFreq; 217 MS_U32 DPPEQBypass; 218 MS_U32 DPPGL; 219 MS_U32 DPPGM; 220 MS_U32 DPPGH; 221 MS_U32 DPPFL; 222 MS_U32 DPPFH; 223 MS_U32 DPPRMSTime; 224 MS_U32 DPPRMSTimeConstSum; 225 MS_U32 DPPRMSTimeConstDif; 226 MS_U32 DPPCenter; 227 MS_U32 DPPAvgTimeConst; 228 MS_U32 IWBypass; 229 MS_U32 IWSpaceGain; 230 MS_U32 IWClip; 231 MS_U32 EQBypass; 232 MS_U32 EQNumBands; 233 MS_U32 BEOnOff; 234 MS_U32 BEFreq; 235 MS_U32 BEMaxGain; 236 MS_U32 BEOrder; 237 MS_U32 BEHPFFreq; 238 MS_U32 BELevel; 239 MS_U32 BERMSTime; 240 MS_U32 BEAvgAttTime; 241 MS_U32 BEAvgRelTime; 242 MS_U32 BEGainRat; 243 MS_U32 BEGain; 244 MS_U32 BERMS; 245 MS_U32 BERMSTimeConst; 246 MS_U32 BEAvgAttTimeConst; 247 MS_U32 BEAvgRelTimeConst; 248 MS_U32 BEPeakThreshLin; 249 } DBXTV_PARAMS; 250 251 /** Coefficients structure. 252 This defines the DSP coefficients that get copied from the preset to 253 the DSP PM memory. 254 */ 255 typedef struct _DBXTV_COEFS 256 { 257 MS_S32 DVClpfL1coef[5]; 258 MS_S32 DVChpfL1coef[5]; 259 MS_S32 DPPeqlcoef[5]; 260 MS_S32 DPPeqlmcoef[5]; 261 MS_S32 DPPeqhmcoef[5]; 262 MS_S32 DPPeqhcoef[5]; 263 MS_S32 DPPhpfdifcoef[5]; 264 MS_S32 IWEQCoefs[5]; 265 MS_S32 DEQCoefs0[5]; 266 MS_S32 DEQCoefs1[5]; 267 MS_S32 DEQCoefs2[5]; 268 MS_S32 DEQCoefs3[5]; 269 MS_S32 DEQCoefs4[5]; 270 MS_S32 DEQCoefs5[5]; 271 MS_S32 DEQCoefs6[5]; 272 MS_S32 DVCBELPF1Coefs[5]; 273 MS_S32 DVCBELPF2Coefs[5]; 274 MS_S32 DVCBEHPF1Coefs[5]; 275 MS_S32 DVCBEHPF2Coefs[5]; 276 MS_S32 BEHPFCoefs[5]; 277 } DBXTV_COEFS; 278 279 280 /** DM structure */ 281 typedef union _DBXTV_DM 282 { 283 MS_U32 Data[95]; 284 DBXTV_PARAMS Params; 285 } DBXTV_DM; 286 287 /** PM structure */ 288 typedef union _DBXTV_PM 289 { 290 MS_U32 Data[100]; 291 DBXTV_COEFS Coefs; 292 } DBXTV_PM; 293 294 295 /** Total Sonics preset length in DM */ 296 #define TOTSON_LENGTH_DM (sizeof(DBXTV_DM)/4) 297 /** Total Sonics preset length in PM */ 298 #define TOTSON_LENGTH_PM (sizeof(DBXTV_PM)/4) 299 300 301 /* Lengths of presets (in words) */ 302 /* Note if the DM structure is changed, these values will need to be updated */ 303 #define DVC_LENGTH_DM (54) 304 #define DVC_LENGTH_PM (10) 305 #define DPP_LENGTH_DM (20) 306 #define DPP_LENGTH_PM (25) 307 #define IW_LENGTH_DM (3) 308 #define IW_LENGTH_PM (5) 309 #define EQ_LENGTH_DM (2) 310 #define EQ_LENGTH_PM (35) 311 #define BE_LENGTH_DM (16) 312 #define BE_LENGTH_PM (25) 313 314 /* Offsets of presets (in words) */ 315 /* Note if the DM structure is changed, these values will need to be updated */ 316 #define DVC_OFFSET_DM (0) 317 #define DVC_OFFSET_PM (0) 318 #define DPP_OFFSET_DM (54) 319 #define DPP_OFFSET_PM (10) 320 #define IW_OFFSET_DM (74) 321 #define IW_OFFSET_PM (35) 322 #define EQ_OFFSET_DM (77) 323 #define EQ_OFFSET_PM (40) 324 #define BE_OFFSET_DM (79) 325 #define BE_OFFSET_PM (75) 326 327 /* Offsets for DVCOnOff, DPPOnOff, IWBypass, EQBypass, BEOnOff (in words) */ 328 /* Note if the DM structure is changed, these values will need to be updated */ 329 #define DM_OFFSET_DVCOnOff (0) 330 #define DM_OFFSET_DPPOnOff (54) 331 #define DM_OFFSET_IWBypass (74) 332 #define DM_OFFSET_EQBypass (77) 333 #define DM_OFFSET_BEOnOff (79) 334 #define DM_OFFSET_DVCHiLevel (2) 335 #define DM_OFFSET_DVCLoLevel (23) 336 337 #define Enable_DVC (1<<0) 338 #define Enable_DPP (1<<1) 339 #define Enable_IW (1<<2) 340 #define Enable_EQ (1<<3) 341 #define Enable_BE (1<<4) 342 #define Enable_All (Enable_DVC | Enable_DPP | Enable_IW | Enable_EQ | Enable_BE) 343 #endif 344 345 //SRS APOLLO 346 typedef enum 347 { 348 HAL_APOLLO_EN, 349 HAL_TSHD_EN, 350 HAL_TRUBASS_FRONT_EN, 351 HAL_DEFINITION_FRONT_EN, 352 HAL_DIALOG_CLARITY_EN, 353 HAL_SURROUND_LEVEL_CTRL, 354 HAL_TSHD_INPUT_GAIN, 355 HAL_DEFINITION_FRONT_CTRL, 356 HAL_DIALOG_CLARITY_CTRL, 357 HAL_TRUBASS_FRONT_CTRL, 358 HAL_LOW_END_FRONT_SPEAKER_FREQ, 359 HAL_HL_EN, 360 HAL_HL_LIMIT_LEVEL, 361 HAL_HL_BOOST_GAIN, 362 HAL_APOLLO_HEADROOM_GAIN, 363 HAL_AEQ_PEQ_EN, 364 HAL_AEQ_HPF_EN, 365 HAL_AEQ_GEQ_EN, 366 HAL_VIQ_EN, 367 HAL_VIQ_MODE, 368 HAL_VIQ_VOL_REF_LEVEL, 369 HAL_VIQ_MAX_GAIN, 370 HAL_VIQ_NOISE_MNGR_THLD, 371 HAL_VIQ_CALIBRATE, 372 } HAL_ADVAUDIO_SRSAPOLLOTYPE; 373 374 //===================================================== 375 // Declare audio function here. 376 //===================================================== 377 void HAL_SOUND_AseSetBinAddress(MS_U8 u8Index, MS_U32 BinAddr); 378 void HAL_SOUND_VDS_Enable(MS_U8 u8enVDS); 379 void HAL_SOUND_VSPK_Enable(MS_U8 u8enVSPK); 380 void HAL_SOUND_SRS_SetTsxtPara(MS_U8 u8mode, MS_U8 u8value); 381 void HAL_SOUND_SRS_SetTshdPara(MS_U8 u8mode, MS_U8 u8value); 382 void HAL_SOUND_SRS_Enable(MS_U8 u8enSRS); 383 void HAL_SOUND_TSHD_Enable(MS_U8 u8enSRS); 384 void HAL_SOUND_VSPK_SetWMod(MS_U8 u8VSPK_WMode); 385 void HAL_SOUND_VSPK_SetSMod(MS_U8 u8VSPK_SMode); 386 void HAL_SOUND_BBE_SetBbeMode(MS_U8 u8EnBBE, MS_U8 u8BBEMode); 387 void HAL_SOUND_SetPara(MS_U8 u8Addr1, MS_U8 u8Addr2, MS_U8 u8Value1, MS_U8 u8Value2, MS_U8 u8Value3); 388 void HAL_SOUND_SRS_DC(MS_U8 u8SRSenDC); 389 void HAL_SOUND_SRS_TruBass(MS_U8 u8SRSenTruBass); 390 void HAL_SOUND_TSHD_TruBass(MS_U8 u8TSHDenTruBass); 391 void HAL_SOUND_TSHD_Definition(MS_U8 u8TSHDenDefinition); 392 void HAL_SOUND_TSHD_Clarity(MS_U8 u8TSHDenClarity); 393 void HAL_SOUND_TSHD_TruSurr(MS_U8 u8TSHDenTruSurr); 394 void HAL_SOUND_TSHD_Limiter(MS_U8 u8TSHDenLimiter); 395 void HAL_SOUND_TSHD_SRS3D(MS_U8 u8TSHDenSRS3D); 396 void HAL_SOUND_TruVolume_Enable(MS_U8 u8TSHDenTVol); 397 void HAL_SOUND_ADV_SetPara(MS_U8 u8mode, MS_U8 u8value); 398 void HAL_SOUND_ADSY_SetPara(MS_U8 u8mode, MS_U8 u8value); 399 void HAL_SOUND_SRS_APOLLO_SetPara(MS_U8 u8mode, MS_U32 u32param, MS_U16 u16value2); 400 401 MS_BOOL HAL_ADVSOUND_ProcessEnable(AUDIO_DSP_CODE_TYPE type); 402 MS_BOOL HAL_ADVSOUND_SubProcessEnable(ADVFUNC proc, MS_BOOL enable); 403 MS_BOOL HAL_ADVSOUND_SetParam(ADVSND_PARAM param, MS_U32 u32param, MS_U16 u16value2); 404 void HAL_AUDIO_COPY_Parameter(ADVSND_PARAM type, void* Parameter_ptr, MS_U32 size); 405 MS_BOOL HAL_SOUND_DBX_Enable(MS_BOOL u8enDBX); 406 MS_BOOL HAL_SET_DBX_MODE(MS_U8 u8enMODE); 407 int HAL_Copy(MS_U32 *ptr_data, unsigned int Address, unsigned int Length); 408 void HAL_DBXTV_SetMode(EN_DBXTV_TotSonMode enTotSonMode, EN_DBXTV_TotVolMode enTotVolMode, EN_DBXTV_TotSurMode enTotSurMode,MS_U32 enable); 409 void HAL_SOUND_DBX_COPY_DM(MS_U32 *DM_ptr,MS_U32 size); 410 void HAL_SOUND_DBX_COPY_PARAMETERS_FROM_APP(ADVSND_PARAM type, MS_U32 *Parameter_ptr,MS_U32 size); 411 void Hal_DBXTV_SetVolPath(AUDIO_OUTPUT_TYPE path); 412 413 #define u32param_normalize(u32value, u32param, iwl, Q24H, Q24L) {\ 414 u32value = u32param/(1<<iwl);\ 415 if(u32value > 8388607)\ 416 {\ 417 u32value = 8388607;\ 418 }\ 419 Q24H=(unsigned short )((u32value>>16) & 0xFFFF);\ 420 Q24L=(unsigned short )(u32value & 0xFFFF);\ 421 } 422 423 #ifdef __cplusplus 424 } 425 #endif 426 #endif //_DRVADVSOUND_H_ 427