Add Govind's changes for new HSR4/interconnect boards
[processor-sdk/performance-audio-sr.git] / processor_audio_sdk_1_00_00_00 / pasdk / test_dsp / sap / audio_dc_cfg.c
index b00318e16033a4a04e65de4fd3eaa690ea5d25e3..d77c99cc7886b4da9fa85bdad307160c50ce2f2d 100644 (file)
@@ -1,35 +1,37 @@
+
 /*
- * Copyright (c) 2015, Texas Instruments Incorporated
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * *  Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *
- * *  Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * *  Neither the name of Texas Instruments Incorporated nor the names of
- *    its contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
+Copyright (c) 2016, Texas Instruments Incorporated - http://www.ti.com/
+All rights reserved.
+
+* Redistribution and use in source and binary forms, with or without 
+* modification, are permitted provided that the following conditions
+* are met:
+*
+* Redistributions of source code must retain the above copyright
+* notice, this list of conditions and the following disclaimer.
+*
+* Redistributions in binary form must reproduce the above copyright
+* notice, this list of conditions and the following disclaimer in the
+* documentation and/or other materials provided with the
+* distribution.
+*
+* Neither the name of Texas Instruments Incorporated nor the names of
+* its contributors may be used to endorse or promote products derived
+* from this software without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*
+*/
 
 /**
  * \file      audio_dc_config.c
@@ -382,11 +384,11 @@ void set_audio_desc(unsigned char var1,unsigned char var2,unsigned char var3,uns
 {
        int ret_val=I2C_RET_OK;
        do{ret_val=alpha_i2c_write(HSDIO_EDID_AUDIO_DESC_FORMAT(var1, var2));}while (ret_val !=I2C_RET_OK);
-       platform_delay(10000);
+       platform_delay(1000);
        do{ret_val=alpha_i2c_write(HSDIO_EDID_AUDIO_DESC_NUM_CHANNELS(var1, var3));}while (ret_val !=I2C_RET_OK);
-       platform_delay(10000);
+       platform_delay(1000);
        do{ret_val=alpha_i2c_write(HSDIO_EDID_AUDIO_DESC_SAMPLE_RATES(var1, var4));}while (ret_val !=I2C_RET_OK);
-       platform_delay(10000);
+       platform_delay(1000);
        do{ret_val=alpha_i2c_write(HSDIO_EDID_AUDIO_DESC_MISC(var1, var5));}while (ret_val !=I2C_RET_OK);
        platform_delay(1000);
        do{ret_val=alpha_i2c_write(HSDIO_ALERT(HSDIO_ALERT_INPUT_AUDIO_CHANGE_msk));}while (ret_val !=I2C_RET_OK);
@@ -400,11 +402,14 @@ void hrptredid()
        int ret_val=I2C_RET_OK;
 
        do{
-               platform_delay(10000);
+               platform_delay(1000);
                ret_val=alpha_i2c_write(HSDIO_EDID_SPEAKER_ALLOCATION_BLOCK(0xFF));
+        if (ret_val !=I2C_RET_OK)
+            i2cConfig(HSR4_I2C_PORT_NUM);        
+            
        }while (ret_val !=I2C_RET_OK);
 
-       platform_delay(10000);
+       platform_delay(1000);
        do{ret_val=alpha_i2c_write(HSDIO_EDID_SPEAKER_ALLOCATION_BLOCK_2(0x7));}while (ret_val !=I2C_RET_OK);
 
        set_audio_desc(0,1,2,0x7f,7);   // Stero PCM
@@ -428,7 +433,7 @@ void hrptredid()
        set_audio_desc(17,0,0,0,0);
        set_audio_desc(18,0,0,0,0);
        set_audio_desc(19,0,0,0,0);
-       platform_delay(10000);
+       platform_delay(1000);
        do{ret_val=alpha_i2c_write(HSDIO_EDID_GO);}while (ret_val !=0);
        //fclose(fp1);
 }
@@ -436,39 +441,39 @@ void hrptredid()
 void  hdmi128()
 {
                int ret_val=0;
-       platform_delay(10000);
+       platform_delay(1000);
        do{ret_val=alpha_i2c_write(HSDIO_AUDIO_MCLK_TO_HOST(HSDIO_AudioMClk_128X));}while (ret_val !=0);
-       platform_delay(10000);
+       platform_delay(1000);
        do{ret_val=alpha_i2c_write(HSDIO_AUDIO_FORMAT_TO_HOST(HSDIO_AudioFmt_I2S));}while (ret_val !=0);
-       platform_delay(10000);
+       platform_delay(1000);
        do{ret_val=alpha_i2c_write(HSDIO_IMPLEMENT_AUDIO_TO_HOST_CMDS);}while (ret_val !=0);
-       platform_delay(10000);
+       platform_delay(1000);
        do{ret_val=alpha_i2c_write(HSDIO_AUDIO_OUTPUT_PRESENT(HSDIO_AudioPresent_HAS_NO_AUDIO));}while (ret_val !=0);
-       platform_delay(10000);
+       platform_delay(1000);
        do{ret_val=alpha_i2c_write(HSDIO_AUDIO_OUTPUT_FORMAT(HSDIO_AudioFmt_I2S));}while (ret_val !=0);
-       platform_delay(10000);
+       platform_delay(1000);
        do{ret_val=alpha_i2c_write(HSDIO_AUDIO_OUTPUT_SAMPLE_SIZE(HSDIO_AudioSampleSize_32));}while (ret_val !=0);
-       platform_delay(10000);
+       platform_delay(1000);
        do{ret_val=alpha_i2c_write(HSDIO_AUDIO_OUTPUT_FREQ(HSDIO_AudioFreq_48K));}while (ret_val !=0);
-       platform_delay(10000);
+       platform_delay(1000);
        do{ret_val=alpha_i2c_write(HSDIO_AUDIO_OUTPUT_LAYOUT(HSDIO_AudioLayout_2));}while (ret_val !=0);
-       platform_delay(10000);
+       platform_delay(1000);
        do{ret_val=alpha_i2c_write(HSDIO_AUDIO_OUTPUT_MCLK(HSDIO_AudioMClk_AUTO));}while (ret_val !=0);
-       platform_delay(10000);
+       platform_delay(1000);
        do{ret_val=alpha_i2c_write(HSDIO_AUDIO_OUTPUT_AUX_CHANNEL_CNT(1));}while (ret_val !=0);
-       platform_delay(10000);
+       platform_delay(1000);
        do{ret_val=alpha_i2c_write(HSDIO_AUDIO_OUTPUT_AUX_SPEAKER_MAPPING(0));}while (ret_val !=0);
-       platform_delay(10000);
+       platform_delay(1000);
        do{ret_val=alpha_i2c_write(HSDIO_AUDIO_OUTPUT_CHSTS_PCM_PREEMPHASIS(HSDIO_CSFormatInfo_PCM_NO_PRE));}while (ret_val !=0);
-       platform_delay(10000);
+       platform_delay(1000);
        do{ret_val=alpha_i2c_write(HSDIO_AUDIO_OUTPUT_CHSTS_COPYRIGHT(HSDIO_CSCopyright_PROTECTED));}while (ret_val !=0);
-       platform_delay(10000);
+       platform_delay(1000);
        do{ret_val=alpha_i2c_write(HSDIO_AUDIO_OUTPUT_CHSTS_WORD_LENGTH(HSDIO_CSWordLength_24));}while (ret_val !=0);
-       platform_delay(10000);
+       platform_delay(1000);
        do{ret_val=alpha_i2c_write(HSDIO_AUDIO_OUTPUT_GO);}while (ret_val !=0);
-       platform_delay(10000);
+       platform_delay(1000);
        do{ret_val=alpha_i2c_write(HSDIO_AUDIO_ROUTING(HSDIO_AudioRouting_HSDIOIN_HOSTOUT));}while (ret_val !=0);
-       platform_delay(10000);
+       platform_delay(1000);
        do{ret_val=alpha_i2c_write(HSDIO_SYS_CFG_GO);}while (ret_val !=0);
 }