dsp3_if.c
上传用户:poi891205
上传日期:2013-07-15
资源大小:9745k
文件大小:44k
源码类别:

DVD

开发平台:

C/C++

  1. /**************************************************************************
  2.  *                                                                        *
  3.  *         Copyright (c) 2002 by Sunplus Technology Co., Ltd.             *
  4.  *                                                                        *
  5.  *  This software is copyrighted by and is the property of Sunplus        *
  6.  *  Technology Co., Ltd. All rights are reserved by Sunplus Technology    *
  7.  *  Co., Ltd. This software may only be used in accordance with the       *
  8.  *  corresponding license agreement. Any unauthorized use, duplication,   *
  9.  *  distribution, or disclosure of this software is expressly forbidden.  *
  10.  *                                                                        *
  11.  *  This Copyright notice MUST not be removed or modified without prior   *
  12.  *  written consent of Sunplus Technology Co., Ltd.                       *
  13.  *                                                                        *
  14.  *  Sunplus Technology Co., Ltd. reserves the right to modify this        *
  15.  *  software without notice.                                              *
  16.  *                                                                        *
  17.  *  Sunplus Technology Co., Ltd.                                          *
  18.  *  19, Innovation First Road, Science-Based Industrial Park,             *
  19.  *  Hsin-Chu, Taiwan, R.O.C.                                              *
  20.  **************************************************************************/
  21. /*
  22. *  Terry,2004/2/17 11:08AM
  23. *  a.modify warning message
  24. */
  25. //#define USE_MIC_ECHO_PARAM
  26. #include "config.h"
  27. #include "regmap.h"
  28. #include "global.h"
  29. #include "macro.h"
  30. #include "func.h"
  31. #include "util.h"
  32. #include "stdlib.h"    //huo 2000.12.14
  33. #include "cdfunc.h"
  34. #include "cfont.h"
  35. #include "sio.h"
  36. #include "vfdfunc.h"
  37. #include "ringbuf.h"
  38. #include "ircmd.h"
  39. #include "ircode.h"
  40. #include "cd.h"
  41. #include "auctrl.h"
  42. #include "user_init.h"  //terry,2001/1/9 03:29PM
  43. #include "avd.h"
  44. #include "dvdpe.h"
  45. #include "fs96602.h"
  46. #include "osd.h"
  47. #include "framebuf.h"
  48. #include "cderr.h"
  49. #include "vpp.h"
  50. #include "user_if.h"
  51. #include "dsp3_if.h"
  52. #include "atapi_if.h"
  53. #include "dma.h" //Jeff 20010919
  54. #include "auddrv.h" //2004AUDDRV oliver 20041004 for using audio driver purpose
  55. //#include "audif.h"
  56. #include "setup.h"
  57. #include "fsGUI.h"
  58. #include "tvif.h"
  59. #include "drv.h"
  60. //#include "auddac.h"
  61. #include "iop.h"//2-7-9 9:40
  62. #include "UartTxd.h"
  63. #ifdef TUNER_T988
  64. #include "radio_t988.h"  //jinping 2-6-20 14:04
  65. #elif defined(TUNER_MV114)
  66. #include "radio_mv114.h"  //jinping 2002-7-1 20:30
  67. #endif
  68. #if defined(PT2322)||defined(PT2320)
  69. #include "audctrl.h"
  70. #endif 
  71. #if defined(TAS3001_AMP)   //use TI 3001 amplifier  jason ych add 2-8-9 10:10
  72. #include "ti3001.h"
  73. #endif 
  74. #if defined(TAS5026_AMP)   //use TI 3001 amplifier  jason ych add 2-8-9 10:10
  75. #include "ti5026.h"
  76. #endif 
  77. #ifdef SUPPORT_CDG  //Jeff 20020824
  78. #include "cdg.h"
  79. #endif
  80. #ifdef MP3_JPEG_COWORK
  81. #include "fsNav.h"
  82. #endif
  83. #ifndef DVDRELEASE
  84. //#define DSPADUIODBG
  85. #endif
  86. #ifndef DSPADUIODBG
  87. #undef printf
  88. #undef print_block
  89. #define printf(f, a...) do {} while (0)
  90. #define print_block(x,y) do {} while (0)
  91. #endif
  92. extern int check_chipinfo(int n);
  93. /**************************************************************************
  94.  *  Function Name: is_dts_force_spdif_bitstream                           
  95.  *  Purposes:                                                             
  96.  *    Should DTS SPDIF out set to raw data?                               
  97.  *  Descriptions:                                                         
  98.  *    Under some situation, SPDIF should output DTS raw bitstream only    
  99.  *  Arguments:                                                            
  100.  *    
  101.  *  Returns:                                                              
  102.  *    1 : DTS SPDIF output shuld set to raw data
  103.  *    0 : DTS SPDIF output with no restriction
  104.  *  See also:                                                             
  105.  *    
  106.  **************************************************************************/
  107. int is_dts_force_spdif_bitstream()
  108. {
  109.     if ((cd_type_loaded==CDDA && cd_subtype==CD_DTS) || (coding_mode_now&AUDIF_CODING_MODE_DTS) )
  110.     {
  111. #if defined(NO_DTS_OUTPUT) || defined(FORCE_NO_DTS_OUTPUT)
  112.         return 1;
  113. #endif
  114.         if (!check_chipinfo(2)) return 1;
  115.     }
  116.     return 0;
  117. }
  118. extern BYTE wait_dsp_port0_5(int port0,int port5,int val,UINT32 risc_waiting_dsp_tm);
  119. UINT16 oldDSPbarrier=0;
  120. extern BYTE bOutVol; //2004AUDDRV:declaration move to dspkernel.c
  121. //BYTE de_mute;
  122. INT8 audio_key;
  123. INT8 echo_level=4; //range:0~8, 0:off
  124. INT8 echo_decay=4; //range:0~8, 0:off
  125. extern INT8 mic_volume;  //2004AUDDRV:declaration move to auddrv.h
  126. #ifndef AC3_BASS_MANAGEMENT
  127. extern  BYTE    cspk_volume;
  128. extern  BYTE    fspk_volume;
  129. extern  BYTE    sspk_volume;
  130. extern  int    downmix_off;
  131. #endif
  132. #if 0 //2004AUDDRV : move to auddrv.c
  133. #ifdef USE_MIC_ECHO_PARAM
  134. // decay : 0 ~ 127
  135. // delay : 0 ~ 12000
  136. #ifdef ECHO_SPECIAL_PARA
  137. UINT16 echo_para[9][2]={
  138.         {0,0},
  139.         {76,2976},   // decay : 76/128= 0.6  , delay: 2976/44100=67ms
  140.         {79,3648},
  141.         {81,4320},
  142.         {84,4992},
  143.         {87,5664},
  144.         {89,6336},
  145.         {92,7008},
  146.         {94,7680}, 
  147. };
  148. #elif defined(SUPPORT_MIDI) //Jeff 20040303
  149. UINT16 echo_para[9][2]={
  150. {0,0},
  151. {7,12000},
  152. {15,13000},
  153. {23,12000},
  154. {31,12000},
  155. {39,12000},
  156. {47,12000},
  157. {55,12000},
  158. {63,12000},
  159. };
  160. #else//ECHO_SPECIAL_PARA
  161. UINT16 echo_para[9][2]={
  162. {0,0},
  163. {7,10000},
  164. {15,10000},
  165. {23,10000},
  166. {31,10000},
  167. {39,10000},
  168. {47,10000},
  169. {55,10000},
  170. {63,10000},
  171. };
  172. #endif//ECHO_SPECIAL_PARA
  173. #endif
  174. #endif //2004AUDDRV
  175. //terry,2004/2/11 01:22PM
  176. #ifdef VOL_80
  177. const BYTE  VolTab[17+65] = {
  178. #ifdef HIMAGE1251   //fengjl TEST 2004-03-02 14:57
  179. 0x00,   //0
  180.         0x01, 0x02, 0x03, 0x03, 0x04, //01--05
  181.         0x06, 0x07, 0x08, 0x08, 0x09,  //06--10
  182.         0x0b, 0x0c, 0x0d, 0x0d, 0x0e,   //11--15
  183.         0x10, 0x11, 0x12, 0x12, 0x13,     //16--20
  184.         0x15, 0x16, 0x17, 0x17, 0x18,    //21--25
  185.         0x1a, 0x1b, 0x1c, 0x1c, 0x1d,    //26--30
  186.         0x20, 0x21, 0x22, 0x22, 0x23,    //31--25
  187.         0x25, 0x26, 0x27, 0x27, 0x28,    //35--40
  188.         0x2a, 0x2b, 0x2c, 0x2c, 0x2a,    //41--45
  189.         0x31, 0x33, 0x35, 0x35, 0x36,    //46--50
  190.         0x39, 0x3a, 0x3b, 0x3b, 0x3c,    //51--55
  191.         0x3e, 0x3f, 0x40, 0x41, 0x43,    //56--60
  192.         0x46, 0x48, 0x4a, 0x4b, 0x4c,    //61--65
  193.         0x4f, 0x50, 0x51, 0x52, 0x54,    //66--70
  194.         0x58, 0x5a, 0x5d, 0x60, 0x65,    //71--75
  195.         0x6c, 0x70, 0x74, 0x76, 0x7a,    //76--80
  196. 0x7f,   //81
  197. #else
  198.      0x00,   //0
  199.         0x01, 0x02, 0x03, 0x04, 0x05, //01--05
  200.         0x06, 0x07, 0x08, 0x09, 0x0a,  //06--10
  201.         0x0b, 0x0c, 0x0d, 0x0e, 0x0f,   //11--15
  202.         0x10, 0x11, 0x12, 0x13, 0x14,     //16--20
  203.         0x15, 0x16, 0x17, 0x18, 0x19,    //21--25
  204.         0x1a, 0x1b, 0x1c, 0x1d, 0x1f,    //26--30
  205.         0x20, 0x21, 0x22, 0x23, 0x24,    //31--25
  206.         0x25, 0x26, 0x27, 0x28, 0x29,    //35--40
  207.         0x2a, 0x2b, 0x2c, 0x2d, 0x30,    //41--45
  208.         0x31, 0x33, 0x35, 0x36, 0x37,    //46--50
  209.         0x39, 0x3a, 0x3b, 0x3c, 0x3d,    //51--55
  210.         0x3e, 0x3f, 0x40, 0x42, 0x44,    //56--60
  211.         0x46, 0x48, 0x4a, 0x4c, 0x4d,    //61--65
  212.         0x4f, 0x50, 0x51, 0x53, 0x55,    //66--70
  213.         0x58, 0x5a, 0x5d, 0x62, 0x67,    //71--75
  214.         0x6c, 0x70, 0x74, 0x78, 0x7f,    //76--80
  215. 0x7f,   //81
  216. #endif
  217. };
  218. #elif defined(VOL_20)   //fengjl add 2004-03-08 21:33
  219. const BYTE  VolTab[22] = {
  220. 0x00,   //0
  221.         0x01,   //1
  222.         0x02,   //2
  223.         0x03,   //3
  224.         0x04,   //4
  225.         0x05,   //5
  226.         0x07,   //6
  227.         0x0a,   //7
  228.         0x0d,   //8
  229.         0x11,   //9
  230.         0x15,   //10
  231.         0x19,   //11
  232.         0x1d,   //12
  233.         0x22,   //13
  234.         0x28,   //14
  235.         0x2f,   //15
  236.         0x3f,   //16
  237.         0x4f,   //17
  238.         0x5f,   //18
  239.         0x6f,   //19
  240.         0x7f,   //20
  241.         0x7f,   //21
  242. };
  243. #else
  244. const BYTE  VolTab[17] = {
  245. 0x00,   //0
  246.         0x02,   //1
  247.         0x03,   //2
  248.         0x04,   //3
  249.         0x05,   //4
  250.         0x07,   //5
  251.         0x09,   //6
  252.         0x0c,   //7
  253.         0x11,   //8
  254.         0x16,   //9
  255.         0x1e,   //10
  256.         0x28,   //11
  257.         0x36,   //12
  258.         0x47,   //13
  259.         0x5f,   //14
  260.         0x7f,   //15
  261.         0x7f,   //16
  262. };
  263. #endif //VOL_80
  264. #ifdef GBM_DVD
  265. const BYTE  MICVolTab[9] = {
  266. 0x00,   //0
  267.         0x0f,   //1
  268.         0x16,   //2
  269.         0x20,   //3
  270.         0x36,   //4
  271.         0x47,   //5
  272.         0x55,//0x57,   //6
  273.         0x60,//0x64,   //7
  274.         0x64,//0x7f,   //8
  275. };
  276. #else//GBM_DVD
  277. const BYTE  MICVolTab[9] = {
  278. 0x00,   //0
  279.         0x0f,   //1
  280.         0x16,   //2
  281.         0x20,   //3
  282.         0x36,   //4
  283.         0x47,   //5
  284.         0x57,   //6
  285.         0x64,   //7
  286.         0x7f,   //8
  287. };
  288. #endif//GBM_DVD
  289. /**************************************************************************
  290.  *  Function Name: dsp_watchdog                           
  291.  *  Purposes:                                                             
  292.  *    DSP watch dog mechanism                             
  293.  *  Descriptions:                                                         
  294.  *    We use DSP watch dog to monitor DSP. 
  295.  *    If DSP behavier abnormally, watch dog will reset DSP.
  296.  *  Arguments:                                                            
  297.  *    
  298.  *  Returns:                                                              
  299.  *
  300.  *  See also:                                                             
  301.  *    
  302.  **************************************************************************/
  303. inline void dsp_watchdog(void)
  304. {
  305. //DSP watchdog
  306. if(dspWatchDog!=DSP_WD_INIT)
  307. {
  308. extern const UINT32 ir_invalid_state[];
  309. int reset_cnt=0;
  310. if(ir_invalid_state[IRC_RESET_DSP]&(0x01<<play_state))
  311. reset_cnt=1;
  312. if(audio_only&&(adv_search_time||video_slow))
  313. reset_cnt=0;
  314. if( (oldDSPbarrier!=AudioGetBarrier())||reset_cnt||(pe_run==0) )//terry 2003-8-6 18:02
  315. {
  316. oldDSPbarrier = AudioGetBarrier();
  317. dspWatchDog = 0;
  318. }
  319. else
  320. {
  321. dspWatchDog++;
  322. if (dspWatchDog > DSPWATCHDOG)
  323. {
  324. dspWatchDog = 0;
  325. AUDIF_Reset_DSP();//2004AUDDRV DSPReset();//reset DSP
  326. printf("reset DSPn");
  327. }
  328. }
  329. } //DSP watchdog
  330. }
  331. /**************************************************************************
  332.  *  Function Name: AudioSetEchoPara                           
  333.  *  Purposes:                                                             
  334.  *    Set Echo Parameter                             
  335.  *  Descriptions:                                                         
  336.  *    Set Echo parameter through AuioIOControl
  337.  *  Arguments:                                                            
  338.  *    x in : Echo Parameter
  339.  *  Returns:                                                              
  340.  *    1 : success 
  341.  *    0 : fail  
  342.  *   -1 : not support
  343.  *  See also:                                                             
  344.  *    
  345.  **************************************************************************/
  346. #if 0 //2004AUDDRV : move to auddrv.c
  347. #ifdef USE_MIC_ECHO_PARAM
  348. int AudioSetEchoPara(UINT16 x)
  349. {
  350.     int res;
  351.     
  352.     res = AudioSetEcho(echo_para[x][0],echo_para[x][1] );
  353.     return res;
  354. }
  355. #endif
  356. /**************************************************************************
  357.  *  Function Name: AudioSetVolume                          
  358.  *  Purposes:                                                             
  359.  *    Set Audio Volume                             
  360.  *  Descriptions:                                                         
  361.  *    Set Audio Volume through AuioIOControl
  362.  *  Arguments:                                                            
  363.  *    x in : Audio Volume
  364.  *  Returns:                                                              
  365.  *    1 : success 
  366.  *    0 : fail  
  367.  *   -1 : not support
  368.  *  See also:                                                             
  369.  *    
  370.  **************************************************************************/
  371. //freyman 2002-7-26 21:40
  372. //2002-7-27 11:53
  373. #ifdef SUPPORT_AMP
  374. int AudioSetVolume(UINT16 x)
  375. {
  376.     int res;
  377.     
  378.     res = AudioIOControl(VOLUME, x, 0);
  379.     return res;
  380. }
  381. #endif
  382. #ifdef      NO_AUD_MIC_OFF
  383. int AudioSetVolume(UINT16 x)
  384. {   
  385.     int res=AudioIOControl(VOLUME, x, 0);
  386.     
  387.     //printf("<x:%x>n",x);
  388.     if(x)
  389. x=mic_volume;
  390.     
  391.     AudioSetMICVol(x);
  392.     
  393.     return res;    
  394. }
  395. #endif
  396. #ifdef      NO_AUD_ECHO_OFF
  397. int AudioSetVolume(UINT16 x)
  398. {   
  399.     int res=AudioIOControl(VOLUME, x, 0);
  400.     
  401.     //printf("<x:%x>n",x);
  402.     if(x)
  403. x=echo_level;
  404.     
  405.     AudioSetEcho(x, x);
  406.     
  407.     return res;    
  408. }
  409. #endif
  410. #endif //2004AUDDRV
  411. /**************************************************************************
  412.  *  Function Name: dsp_AD_cmd                          
  413.  *  Purposes:                                                             
  414.  *      Set command to A/D gain channel 1 and channel 2                          
  415.  *  Descriptions:                                                         
  416.  *    
  417.  *  Arguments:                                                            
  418.  *    cmd in : 1200 for A/D gain channel 1, 1700 for A/D gain channel 2
  419.  *    cType  : parameter to A/D
  420.  *  Returns:                                                              
  421.  *    
  422.  *  See also:                                                             
  423.  *    
  424.  **************************************************************************/
  425. void dsp_AD_cmd(UINT16 cmd,UINT16 cType)
  426. {
  427. if(cType!=0)//2002-5-29 for fuss mic
  428. regs0->dsp24_port[1] = 0xffff;
  429. regs0->dsp24_port[0] = cmd | (MICVolTab[cType]);
  430.             #ifdef DSPADUIODBG
  431.             printf("AD:0x%x ", (VolTab[cType*2]));
  432.             #endif
  433. }
  434. /**************************************************************************
  435.  *  Function Name: dsp3_if_set_vol                         
  436.  *  Purposes:                                                             
  437.  *      Set Audio Volume directly (didn't through AudioIOControl)                          
  438.  *  Descriptions:                                                         
  439.  *    
  440.  *  Arguments:                                                            
  441.  *    cType in : Index for VolTab[ ]
  442.  *  Returns:                                                              
  443.  *    
  444.  *  See also:                                                             
  445.  *    
  446.  **************************************************************************/
  447. #if 0 //2004AUDDRV
  448. /*
  449. *  Terry,2004/2/11 04:58PM
  450. */
  451. //#define VOL0_IS_NO_VOICE
  452. //mute: cType=0 , port1=0
  453. //vol0: cType=0 , port1=1
  454. //BBK vol0: cType=0 , port1=1
  455. void dsp3_if_set_vol(UINT8 cType)
  456. {
  457.    printf("cType:%dn",cType);
  458.  
  459.    if (user_mute)  regs0->dsp24_port[1] = 0;
  460. //nono mark it.4-8-31 10:52
  461. #if defined(NO_DTS_OUTPUT)&&!defined(DIVIDE_AC3_DTS_SPDIF_OUTPUTS)&&!defined(EASTECH_NEW_SETUP_MENU)//4-2-12 18:36
  462.    else if(setup_DTSCD_IsSet2SPDIF_PCMAndOff()==1)
  463.    {
  464.       regs0->dsp24_port[1] = 0;
  465.       cType=0;
  466.    } 
  467. #endif
  468.    else if( ( (audio_only==1)&&((adv_search_time<4)&&(adv_search_time>(-4))) )||(cType==0))
  469.    {
  470.       if (  (cd_subtype==CD_DTS) &&(adv_search_time) )    regs0->dsp24_port[1]= 0;
  471.       else 
  472.       {
  473. #ifdef  MP3_CD_FF1_BF1_MUTE//YX822BC//nono 20020822
  474.         //mix YUXING822BC when forward||backwardX2,pressing SELECT,demute will be run.
  475.         if(adv_search_time)
  476.            regs0->dsp24_port[1] = 0;
  477.         else
  478. #endif
  479. #ifdef VOL0_IS_NO_VOICE
  480.         regs0->dsp24_port[1]=0;
  481. #else
  482. regs0->dsp24_port[1]=1;
  483. #endif
  484.        }
  485.    }
  486.             
  487.    //Jeff 20020530
  488.    if(cType!=0)  regs0->dsp24_port[1] = 0xffff;   
  489.    if (bOutVol != VolTab[cType]) 
  490.    {
  491.         regs0->dsp24_port[0] = 0x1100 | (VolTab[cType]);
  492.         bOutVol = VolTab[cType];
  493. #ifdef Ti3001_OSD_UI_1
  494.         amp_setup[ADDR_M_VOL]=audio_volume;
  495.         save_amplifier_setup(ADDR_M_VOL+ADDR_I2C_START,&audio_volume);
  496. #endif
  497. #ifdef VOLUME_RECODE
  498.        {  
  499.          int volume;      
  500. #ifdef CNTR_5SPK_VOLUME
  501.          volume=WriteToI2c(0xa0, ADDR_I2C_VOLUME, (BYTE *)&volume_5SPK[0],1);
  502. #else
  503.          volume=WriteToI2c(0xa0, ADDR_I2C_VOLUME, (BYTE *)&audio_volume, 1);
  504. #endif
  505.        }
  506. #endif
  507.    } else if (bOutVol==0) 
  508.    {
  509.      //there are two types of volume-0: one is sound-0(0x1100-0x0001), and the other one is mute(0x1100-0x0000)
  510.      //bOutVol only record 0x1100(not include 0x0001 or 0x0000), so we force to send it
  511.      regs0->dsp24_port[0] = 0x1100;
  512.    }
  513.    
  514. #ifdef DSPADUIODBG
  515.    printf("Source VOLUME,VolTab[cType]:%d cType:%d bOutVol:%d",VolTab[cType],cType,bOutVol);
  516.    printf("regs0->dsp24_port[1]=%xn", regs0->dsp24_port[1]);
  517. #endif   
  518. }
  519. /**************************************************************************
  520.  *  Function Name: AudioIOControl                         
  521.  *  Purposes:                                                             
  522.  *     Set command to DSP                          
  523.  *  Descriptions:                                                         
  524.  *     Set command to DSP through dsp24_port[0] and dsp24_port[1]
  525.  *  Arguments:                                                            
  526.  *     wCode in : Command code
  527.  *     cType in : sub-command or parameter
  528.  *     wParam in : optional parameter
  529.  *  Returns:                                                              
  530.  *     1 : success 
  531.  *     0 : fail  
  532.  *    -1 : not support
  533.  *  See also:                                                             
  534.  *    
  535.  **************************************************************************/
  536. //Do DSP Audio-IO-Control
  537. //wCode:Command code
  538. //cType:sub-command or parameter
  539. //wParam:optional parameter
  540. #ifdef SUPPORT_SOUND_EFFECT
  541. int AudioIOControl(UINT16 wCode, UINT32 cType, UINT32 wParam)
  542. #else
  543. int AudioIOControl(UINT16 wCode, BYTE cType, UINT16 wParam)
  544. #endif
  545. {
  546.     //int i;  //terry,2004/2/10 05:08PM
  547.     int iRes = 0;
  548.     //UINT32 unVol=0;
  549. #ifdef NO_AUDIO_DSP
  550.     return 1;
  551. #endif    
  552.     
  553.     //these DSP code doesn't support generic audio command
  554.     if (coding_mode_now&(AUDIF_CODING_MODE_NES) ) {
  555.         return 1;
  556.     }
  557.     #ifdef SUPPORT_MIDI_MENU_SEL // Jeff 20031104
  558.     if (coding_mode_now&AUDIF_CODING_MODE_MIDI)
  559.     {
  560.         //extern BYTE bMidiPlayerBoolean;
  561.         //if (bMidiPlayerBoolean==0) 
  562.         extern BYTE midiState;   //dtb in 20040109
  563.         if(midiState != 2) //MIDI_STATE_PAYLOAD
  564.             return 1;
  565.     }
  566.     #endif
  567.     regs0->dsp24_port[1] = wParam;
  568.     switch (wCode) {
  569. case FLOW:
  570. regs0->dsp24_port[0] = 0x0200 | cType;
  571. switch (cType) {
  572. case AUDIOPLAY:
  573.             #ifdef DSPADUIODBG
  574. printf("AUDIOPLAY ");
  575.             #endif
  576. break;
  577. case AUDIOCONTINUE:
  578.             #ifdef DSPADUIODBG
  579. printf("AUDIOCONTINUE ");
  580.             #endif
  581. break;
  582. case AUDIOSTOP:
  583.             #ifdef DSPADUIODBG
  584. printf("AUDIOSTOP ");
  585.             #endif
  586. break;
  587. case AUDIOPAUSE:
  588.             #ifdef DSPADUIODBG
  589. printf("AUDIOPAUSE ");
  590.             #endif
  591. break;
  592. case AUDIOFLUSH:
  593.             #ifdef DSPADUIODBG
  594. printf("AUDIOFLUSH ");
  595.             #endif
  596. break;
  597. case AUDIOFF2X:
  598. case AUDIOFF4X:
  599. case AUDIOFF5X: //NONO 4-2-10 22:22
  600. case AUDIOFF8X:
  601. case AUDIOFF10X: //NONO 4-2-10 22:22
  602. case AUDIOFF20X:
  603. case AUDIOFF16X: // Robert 2003/12/14
  604. case AUDIOFF30X: //NONO 4-2-10 22:22
  605. case AUDIOFF32X:
  606. case AUDIOFF60X: //NONO 4-2-10 22:22
  607.     #ifdef DSPADUIODBG
  608. printf("AUDIOFFn");
  609. #endif
  610. //to check DSP mode
  611. if (regs0->dsp24_port[5]!=0) {
  612. regs0->dsp24_port[0] = 0x0200 | cType;
  613.                 #ifdef DSPADUIODBG
  614. printf("AUDIOFF-%d x ", cType);
  615.                 #endif
  616. }
  617. break;
  618. case AUDIOFF2PLAY:
  619.             #ifdef DSPADUIODBG
  620. printf("AUDIOFF2PLAY ");
  621.             #endif
  622. break;
  623. default:
  624. iRes = -1;
  625. break;
  626. } //end of switch (cType)
  627. break;
  628.         case OUTMODE:
  629.             regs0->dsp24_port[0] = 0x0300 | cType;
  630.             #ifdef DSPADUIODBG
  631.             printf("OUTMODE:%d %x", cType, regs0->dsp24_port[1]);
  632.             #endif
  633.             break;
  634.         case VOLUME:            
  635.             dsp3_if_set_vol(cType);//terry,2004/2/11 05:40PM
  636.     break;
  637.         case KEY:
  638.             regs0->dsp24_port[0] = 0x0500 | cType;
  639.             #ifdef DSPADUIODBG
  640.             printf("KEY:%d ", cType);
  641.             #endif
  642.             break;
  643.         case ECHO:
  644.             regs0->dsp24_port[0] = 0x0600 | cType;
  645.             #ifdef DSPADUIODBG
  646.             printf("ECHO:%d ", cType);
  647.             #endif
  648.             break;
  649.         case SURROUND:
  650.             regs0->dsp24_port[0] = 0x0700 | cType;
  651.             #ifdef DSPADUIODBG
  652.             printf("SURROUND:%d ", cType);
  653.             #endif
  654.             break;
  655.         case SUBWOOF:
  656.             regs0->dsp24_port[0] = 0x0800 | cType;
  657.             #ifdef DSPADUIODBG
  658.             printf("SUBWOOF:%d ", cType);
  659.             #endif
  660.             break;
  661.         #ifdef TEST_BASS_MANAGEMENT 
  662.             #ifdef TEST_BASS_COMMAND
  663.         case BASSMANAGEMENT:        
  664.              regs0->dsp24_port[0] = 0x2000 | cType;                   
  665.                 #ifdef DSPADUIODBG
  666.                 printf("test: BASS_MANAGEMENT:%xn", wParam);
  667.                 #endif
  668.              break;   
  669.             #endif
  670.         #endif    
  671.         case SPDIF:
  672.             if (is_dts_force_spdif_bitstream() && cType==1) cType=2;
  673.             regs0->dsp24_port[0] = 0x0900 | cType;
  674.             #ifdef DSPADUIODBG
  675.             printf("SPDIF:%d ", cType);
  676.             #endif
  677.             break;
  678.         case EQ:
  679.             regs0->dsp24_port[0] = 0x0a00 | cType;
  680.             #ifdef DSPADUIODBG
  681.             printf("EQ:%d ", cType);
  682.             #endif
  683.             break;
  684.         case MIC:
  685.             regs0->dsp24_port[0] = 0x0d00 | cType;
  686.             #ifdef DSPADUIODBG
  687.             printf("MIC:%d ", cType);
  688.             #endif
  689.             break;
  690.         case AD:
  691.          dsp_AD_cmd(0x1200,cType);
  692.             break;
  693.         case AD_2:  //wangfeng 2003-09-12 17:11
  694.          dsp_AD_cmd(0x1700,cType);
  695.             break;
  696.         case SPKDELAY:
  697.             regs0->dsp24_port[0] = 0x0c00 | cType;
  698.             #ifdef DSPADUIODBG
  699.             printf("SPKDELAY(%d):%d msn", cType, wParam);
  700.             #endif
  701.             break;
  702.         case FSPKGAIN:
  703.             regs0->dsp24_port[0] = 0x1300 | (VolTab[cType*2]);//nono 2003-9-3 11:54 add"*2"
  704.             #ifdef DSPADUIODBG
  705.             printf("FSPKGAIN:%dn", cType);
  706.             #endif
  707.             break;
  708. //wanghaoying add 2003-12-12 18:03
  709. #if     !defined(CNTR_5SPK_VOLUME)
  710.         case CSPKGAIN:
  711. #ifdef YUXING_DVD
  712.             //wangap add it when CSPKGAIN is 0/1 the volumn is wrong 2003/12/23
  713.             if((cType+2)==257)
  714.             regs0->dsp24_port[0] = 0x1500 | 0x02;
  715.             else if((cType+2)==256)
  716.             regs0->dsp24_port[0] = 0x1500 | 0x00;
  717.             else
  718.             regs0->dsp24_port[0] = 0x1500 | (VolTab[(cType+2)*2]);
  719. #else
  720.             regs0->dsp24_port[0] = 0x1500 | (VolTab[cType*2]);
  721. #endif
  722.             #ifdef DSPADUIODBG
  723.             printf("CSPKGAIN:%dn", cType);
  724.             #endif
  725.             break;
  726. #endif
  727.         case SSPKGAIN:
  728.             regs0->dsp24_port[0] = 0x1400 | (VolTab[cType*2]);//nono 2003-9-3 11:54 add"*2"
  729.             #ifdef DSPADUIODBG
  730.             printf("SSPKGAIN:%dn", cType);
  731.             #endif
  732.             break;
  733. #ifdef CNTR_5SPK_VOLUME
  734.         case FLSPKGAIN:
  735.             regs0->dsp24_port[0] = 0x1A00 | (VolTab[cType]);
  736.     #ifdef VOLUME_RECODE
  737.      {  
  738.       int volume;      
  739. //printf("audio_vol=%dn",audio_volume);
  740. //if(action_click)
  741. volume=WriteToI2c(0xa0, ADDR_I2C_VOLUME+1, (BYTE *)&volume_5SPK[1], 1);
  742.      }
  743.     #endif
  744.     
  745.             #ifdef DSPADUIODBG
  746.             printf("FLSPKGAIN:%dn", cType);
  747.             #endif
  748.             break;
  749.         case FRSPKGAIN:
  750.             regs0->dsp24_port[0] = 0x1B00 | (VolTab[cType]);
  751.     #ifdef VOLUME_RECODE
  752.      {  
  753.       int volume;      
  754. printf("audio_vol=%dn",audio_volume);
  755. //if(action_click)
  756. volume=WriteToI2c(0xa0, ADDR_I2C_VOLUME+2, (BYTE *)&volume_5SPK[2], 1);
  757.      }
  758.     #endif
  759.             #ifdef DSPADUIODBG
  760.             printf("FRSPKGAIN:%dn", cType);
  761.             #endif
  762.             break;
  763.         case SLSPKGAIN:
  764.             regs0->dsp24_port[0] = 0x1C00 | (VolTab[cType]);
  765.     #ifdef VOLUME_RECODE
  766.      {  
  767.       int volume;      
  768. printf("audio_vol=%dn",audio_volume);
  769. //if(action_click)
  770. volume=WriteToI2c(0xa0, ADDR_I2C_VOLUME+3, (BYTE *)&volume_5SPK[3], 1);
  771.      }
  772.     #endif
  773.             #ifdef DSPADUIODBG
  774.             printf("SLSPKGAIN:%dn", cType);
  775.             #endif
  776.             break;
  777.         case SRSPKGAIN:
  778.             regs0->dsp24_port[0] = 0x1D00 | (VolTab[cType]);
  779.     #ifdef VOLUME_RECODE
  780.      {  
  781.       int volume;      
  782. printf("audio_vol=%dn",audio_volume);
  783. //if(action_click)
  784. volume=WriteToI2c(0xa0, ADDR_I2C_VOLUME+4, (BYTE *)&volume_5SPK[4], 1);
  785.      }
  786.     #endif
  787.             #ifdef DSPADUIODBG
  788.             printf("SRSPKGAIN:%dn", cType);
  789.             #endif
  790.             break;
  791.         case CSPKGAIN:
  792.             regs0->dsp24_port[0] = 0x1500 | (VolTab[cType]);
  793.     #ifdef VOLUME_RECODE
  794.      {  
  795.       int volume;      
  796. printf("audio_vol=%dn",audio_volume);
  797. //if(action_click)
  798. volume=WriteToI2c(0xa0, ADDR_I2C_VOLUME+5, (BYTE *)&volume_5SPK[5], 1);
  799.      }
  800.     #endif
  801.             #ifdef DSPADUIODBG
  802.             printf("CSPKGAIN:%dn", cType);
  803.             #endif
  804.             break;
  805.         case SWSPKGAIN: //Jeff 20031028
  806.             regs0->dsp24_port[0] = 0x1E00 | (VolTab[cType]);
  807.         #ifdef VOLUME_RECODE
  808.             {  
  809.                 int volume;      
  810.                 printf("audio_vol=%dn",audio_volume);
  811.                 //if(action_click)
  812.                 volume=WriteToI2c(0xa0, ADDR_I2C_VOLUME+6, (BYTE *)&volume_5SPK[6], 1);
  813.             }
  814.         #endif
  815.             #ifdef DSPADUIODBG
  816.             printf("SWSPKGAIN:%dn", cType);
  817.             #endif
  818.             break;
  819. /*        case Volume_Font_ID:
  820.          if (user_mute) 
  821.             {
  822.                 regs0->dsp24_port[1] = 0;
  823.                
  824.             }
  825.             else if( ( (audio_only==1)&&((adv_search_time<4)&&(adv_search_time>(-4))) )||(cType==0)) //nono 20020822
  826.             {//nono 2-4-30 0:35
  827.                 if (  (cd_subtype==CD_DTS) &&//20020725
  828. (adv_search_time)//>1) //|| (adv_search_time<-1) )//2-6-20 23:43
  829.                 { //Jeff 20020614
  830.                     regs0->dsp24_port[1] = 0;
  831.                 } else {
  832. #ifdef  MP3_CD_FF1_BF1_MUTE//YX822BC//nono 20020822
  833. //mix YUXING822BC when forward||backwardX2,pressing SELECT,demute will be run.
  834. if(adv_search_time)
  835. regs0->dsp24_port[1] = 0;
  836. else
  837. #endif
  838. regs0->dsp24_port[1] = 1;
  839.                 }
  840.             }
  841.             
  842.             //Jeff 20020530
  843.             if(cType!=0)//2002-5-29 for fuss mic
  844. regs0->dsp24_port[1] = 0xffff;
  845.             //To reduce redundant volume setting, Jeff 20020702
  846.             //regs0->dsp24_port[0] = 0x1100 | (VolTab[cType]);
  847.             if (bOutVol != VolTab[cType]) {
  848. regs0->dsp24_port[0] = 0x1100 | (VolTab[cType]);
  849. bOutVol = VolTab[cType];
  850. #ifdef VOLUME_RECODE
  851.      {  
  852.       int volume;      
  853. printf("audio_vol=%dn",audio_volume);
  854. if(action_click)
  855. volume=WriteToI2c(0xa0, ADDR_I2C_VOLUME, (BYTE *)&audio_volume, 1);
  856.      }
  857. #endif
  858.             } else //Jeff 20020726
  859. if (bOutVol==0) {
  860.                     //there are two types of volume-0: one is sound-0(0x1100-0x0001), and the other one is mute(0x1100-0x0000)
  861.                     //bOutVol only record 0x1100(not include 0x0001 or 0x0000), so we force to send it
  862.                     regs0->dsp24_port[0] = 0x1100;
  863.                    
  864. }
  865.          break;
  866. */        
  867. #endif //#ifdef CNTR_5SPK_VOLUME
  868. #ifdef SUPPORT_PROLOGIC_II // alan, 2003/7/11 03:28