Replaced platform APIs from pdk 1.0.1.2.eng with Board and Addon APIs
authorJianzhong Xu <a0869574@ti.com>
Thu, 17 Aug 2017 14:59:42 +0000 (10:59 -0400)
committerJianzhong Xu <a0869574@ti.com>
Thu, 17 Aug 2017 14:59:42 +0000 (10:59 -0400)
from pdk 1.0.6 (PRSDK 4.0).

pasdk/test_dsp/.cproject
pasdk/test_dsp/application/main.c
pasdk/test_dsp/framework/systemInit.c
pasdk/test_dsp/sap/audio_dc_cfg.c
pasdk/test_dsp/sap/audio_dc_cfg.h
pasdk/test_dsp/sap/edma_cfg.c
pasdk/test_dsp/sap/edma_cfg.h
pasdk/test_dsp/sap/platform_osal.c
pasdk/test_dsp/sap/sap_d10.c
pasdk/test_dsp/sap/sap_d10.h

index 4f691ecd946ee11f161db7a43bf1a0cdf14b43b7..2ffb90b8aadb7a645dcf6b42fe80c291a2598fed 100644 (file)
@@ -11,8 +11,8 @@
                                        <stringMacro name="AIF2_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="CSL_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="MMCSD_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
-                                       <stringMacro name="PDK_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti/processor_audio_sdk_1_00_00_03/psdk_cust/pdk_k2g_1_0_1_2_eng/packages"/>
                                        <stringMacro name="ICSS_EMAC_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+                                       <stringMacro name="PDK_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti/pdk_k2g_1_0_6_eng/packages"/>
                                        <stringMacro name="USB_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="I2C_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="CPPI_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="IQN_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="PKTLIB_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="SRIO_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
-                                       <stringMacro name="PRUSS_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="DFE_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
-                                       <stringMacro name="UART_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
-                                       <stringMacro name="SBL_BOOT_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+                                       <stringMacro name="PRUSS_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="FATFS_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
-                                       <stringMacro name="BOARD_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+                                       <stringMacro name="SBL_BOOT_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+                                       <stringMacro name="UART_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="NWAL_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+                                       <stringMacro name="BOARD_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="SPI_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                </macros>
                                <externalSettings/>
@@ -59,7 +59,7 @@
                                                                <listOptionValue builtIn="false" value="RUNTIME_SUPPORT_LIBRARY=libc.a"/>
                                                                <listOptionValue builtIn="false" value="RTSC_MBS_VERSION=2.2.0"/>
                                                                <listOptionValue builtIn="false" value="XDC_VERSION=3.32.0.06_core"/>
-                                                               <listOptionValue builtIn="false" value="RTSC_PRODUCTS=ti.mas.dsplib.c66x:3.4.0.0;com.ti.sdo.edma3:2.12.1;com.ti.rtsc.IPC:3.43.0.00_eng;com.ti.rtsc.SYSBIOS:6.45.1.29;com.ti.uia:2.0.3.43;com.ti.rtsc.XDAIS:7.24.0.04;com.ti.pdk.k2g:1.0.1.2_eng;"/>
+                                                               <listOptionValue builtIn="false" value="RTSC_PRODUCTS=ti.mas.dsplib.c66x:3.4.0.0;com.ti.sdo.edma3:2.12.4;com.ti.rtsc.IPC:3.43.0.00_eng;com.ti.rtsc.SYSBIOS:6.45.1.29;com.ti.uia:2.0.3.43;com.ti.rtsc.XDAIS:7.24.0.04;com.ti.pdk.k2g:1.0.6;"/>
                                                                <listOptionValue builtIn="false" value="EXPANDED_REPOS="/>
                                                                <listOptionValue builtIn="false" value="OUTPUT_TYPE=rtscApplication:executable"/>
                                                        </option>
                                                                <option id="com.ti.ccstudio.buildDefinitions.C6000_8.1.compilerID.DIAG_WRAP.844860326" name="Wrap diagnostic messages (--diag_wrap)" superClass="com.ti.ccstudio.buildDefinitions.C6000_8.1.compilerID.DIAG_WRAP" value="com.ti.ccstudio.buildDefinitions.C6000_8.1.compilerID.DIAG_WRAP.off" valueType="enumerated"/>
                                                                <option id="com.ti.ccstudio.buildDefinitions.C6000_8.1.compilerID.INCLUDE_PATH.1905793105" name="Add dir to #include search path (--include_path, -I)" superClass="com.ti.ccstudio.buildDefinitions.C6000_8.1.compilerID.INCLUDE_PATH" valueType="includePath">
                                                                        <listOptionValue builtIn="false" value="&quot;${CG_TOOL_ROOT}/include&quot;"/>
-                                                                       <listOptionValue builtIn="false" value="&quot;${PDK_INSTALL_PATH}/ti/drv/mcasp&quot;"/>
-                                                                       <listOptionValue builtIn="false" value="&quot;${PDK_INSTALL_PATH}/ti/platform&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${PDK_INSTALL_PATH}/ti/csl&quot;"/>
-                                                                       <listOptionValue builtIn="false" value="&quot;${PDK_INSTALL_PATH}/ti/platform/evmk2g/platform_lib/include&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${PDK_INSTALL_PATH}/ti/addon/audk2g/include&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${PDK_INSTALL_PATH}/ti/board&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${PDK_INSTALL_PATH}&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${PROC_AUDIO_SDK_ROOT}/pasdk/test_dsp/sap&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${PROC_AUDIO_SDK_ROOT}/pasdk/test_dsp/mib&quot;"/>
                                                                <option id="com.ti.ccstudio.buildDefinitions.C6000_8.1.linkerID.SEARCH_PATH.1348341304" name="Add &lt;dir&gt; to library search path (--search_path, -i)" superClass="com.ti.ccstudio.buildDefinitions.C6000_8.1.linkerID.SEARCH_PATH" valueType="libPaths">
                                                                        <listOptionValue builtIn="false" value="&quot;${CG_TOOL_ROOT}/lib&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;${CG_TOOL_ROOT}/include&quot;"/>
-                                                                       <listOptionValue builtIn="false" value="&quot;${PDK_INSTALL_PATH}/ti/platform/evmk2g/platform_lib/lib/debug&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${PDK_INSTALL_PATH}/ti//addon/audk2g/lib/k2g/c66/release&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${PDK_INSTALL_PATH}/ti/board/lib/evmK2G/c66/release&quot;"/>
                                                                </option>
                                                                <option id="com.ti.ccstudio.buildDefinitions.C6000_8.1.linkerID.LIBRARY.1649450405" name="Include library file or command file as input (--library, -l)" superClass="com.ti.ccstudio.buildDefinitions.C6000_8.1.linkerID.LIBRARY" valueType="libs">
                                                                        <listOptionValue builtIn="false" value="&quot;libc.a&quot;"/>
-                                                                       <listOptionValue builtIn="false" value="ti.platform.evmk2g.ae66"/>
+                                                                       <listOptionValue builtIn="false" value="ti.addon.audk2g.ae66"/>
+                                                                       <listOptionValue builtIn="false" value="ti.board.ae66"/>
                                                                </option>
                                                                <inputType id="com.ti.ccstudio.buildDefinitions.C6000_8.1.exeLinker.inputType__CMD_SRCS.406788628" name="Linker Command Files" superClass="com.ti.ccstudio.buildDefinitions.C6000_8.1.exeLinker.inputType__CMD_SRCS"/>
                                                                <inputType id="com.ti.ccstudio.buildDefinitions.C6000_8.1.exeLinker.inputType__CMD2_SRCS.1238226142" name="Linker Command Files" superClass="com.ti.ccstudio.buildDefinitions.C6000_8.1.exeLinker.inputType__CMD2_SRCS"/>
                                        <stringMacro name="AIF2_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="CSL_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="MMCSD_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
-                                       <stringMacro name="ICSS_EMAC_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="PDK_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti/processor_audio_sdk_1_00_00_03/psdk_cust/pdk_k2g_1_0_1_2_eng/packages"/>
+                                       <stringMacro name="ICSS_EMAC_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="USB_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="I2C_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="IQN2_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="IQN_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="PKTLIB_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="SRIO_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
-                                       <stringMacro name="DFE_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="PRUSS_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
-                                       <stringMacro name="FATFS_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
-                                       <stringMacro name="SBL_BOOT_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+                                       <stringMacro name="DFE_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="UART_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
-                                       <stringMacro name="NWAL_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+                                       <stringMacro name="SBL_BOOT_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+                                       <stringMacro name="FATFS_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="BOARD_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+                                       <stringMacro name="NWAL_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="SPI_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                </macros>
                                <externalSettings/>
                                        <stringMacro name="AIF2_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="CSL_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="MMCSD_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
-                                       <stringMacro name="ICSS_EMAC_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="PDK_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti/processor_audio_sdk_1_00_00_03/psdk_cust/pdk_k2g_1_0_1_2_eng/packages"/>
+                                       <stringMacro name="ICSS_EMAC_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="USB_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="I2C_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="IQN2_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="IQN_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="PKTLIB_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="SRIO_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
-                                       <stringMacro name="DFE_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="PRUSS_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
-                                       <stringMacro name="FATFS_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
-                                       <stringMacro name="SBL_BOOT_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+                                       <stringMacro name="DFE_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="UART_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
-                                       <stringMacro name="NWAL_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+                                       <stringMacro name="SBL_BOOT_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+                                       <stringMacro name="FATFS_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="BOARD_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+                                       <stringMacro name="NWAL_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="SPI_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                </macros>
                                <externalSettings/>
                                        <stringMacro name="AIF2_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="CSL_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="MMCSD_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
-                                       <stringMacro name="ICSS_EMAC_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="PDK_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti/processor_audio_sdk_1_00_00_03/psdk_cust/pdk_k2g_1_0_1_2_eng/packages"/>
+                                       <stringMacro name="ICSS_EMAC_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="USB_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="I2C_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="IQN2_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="IQN_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="PKTLIB_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="SRIO_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
-                                       <stringMacro name="DFE_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="PRUSS_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
-                                       <stringMacro name="FATFS_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
-                                       <stringMacro name="SBL_BOOT_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+                                       <stringMacro name="DFE_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="UART_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
-                                       <stringMacro name="NWAL_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+                                       <stringMacro name="SBL_BOOT_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+                                       <stringMacro name="FATFS_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="BOARD_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+                                       <stringMacro name="NWAL_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                        <stringMacro name="SPI_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
                                </macros>
                                <externalSettings/>
index ccf98aae2dbdd08d3b45709d846f6f02aea888ae..41e959c7cb2e5132f5d1a10d21696b01c1bc3232 100644 (file)
@@ -45,8 +45,10 @@ All rights reserved.
 #include <ti/ipc/Ipc.h>
 #include <ti/sysbios/hal/Cache.h>
 
-#include <platform.h>
-#include <platform_audio.h>
+#include <board.h>
+#include "evmc66x_i2c.h"
+#include <audk2g.h>
+#include <audk2g_audio.h>
 #include "audio_dc_cfg.h"
 #include "edma_cfg.h"
 
@@ -55,7 +57,7 @@ All rights reserved.
 #include "pfp_app.h"        /* contains all PFP ID's */
 
 extern Void initDev2(Void);
-
+extern void evmI2CInit(uint8_t i2cportnumber); // missing in evmc66x_i2c.h
 
 /*
  *  ======== main ========
@@ -63,8 +65,9 @@ extern Void initDev2(Void);
 Int main()
 {
     Int status;
-    Platform_STATUS pfStatus;
+    Audk2g_STATUS AudStatus;
     Int k;
+    Board_initCfg cfg;
 
     Log_info0("Enter main()");
     
@@ -93,46 +96,19 @@ Int main()
     pfpDisable(0);   /* Disable profile point #0 */
 #endif    
 
-    //Platform setup!!!
-    /*
-     * use ROV->SysMin to view the characters in the circular buffer
-     */
-    //System_printf("enter Platform Setup\n");
-    Log_info0("enter Platform Setup");
-
-    platform_init_flags  init_flags;
-    platform_init_config init_config;
-
-    /* Set request to configure PLL, DDR and Time Stamp Counter */
-    init_flags.pll  = 0; //1; // FL: turn this off for now since handled by gel file
-    init_flags.ddr  = 0;
-    init_flags.tcsl = 1; // FL: not used by platform_init()
-    init_flags.phy  = 0;
-    init_flags.ecc  = 0;
-
-    /* PLL configuration shall be done based on default values */
-    init_config.pllm       = 0;
-    init_config.plld       = 0;
-    init_config.postdiv    = 0;
-    init_config.mastercore = 1; // FL: not used by platform_init()
-
-    pfStatus = platform_init(&init_flags, &init_config);
-    if (pfStatus != Platform_EOK)
-    {
-        //System_printf("Error in Platform Initialization\n");
-        Log_info0("Error in Platform Initialization");
-    }
-    platform_delay(10000);
-    //System_printf("\n****************************************************\n");
-    //System_printf(  "      Audio DC Digital to Analog Loopback Test      \n");
-    //System_printf(  "****************************************************\n");
+    /* initialize board */
+    cfg = BOARD_INIT_PINMUX_CONFIG | BOARD_INIT_MODULE_CLOCK;
+    Board_init(cfg);
+       evmI2CInit(I2C_PORT_0);
+       evmI2CInit(I2C_PORT_1);
+       evmI2CInit(I2C_PORT_2);
 
     Log_info0("exit Platform Setup");
 
     Log_info0("Configure EDMA");
     /* Configure eDMA module */
-    pfStatus = eDmaConfig();
-    if(pfStatus != Platform_EOK)
+    AudStatus = eDmaConfig();
+    if(AudStatus != Audk2g_EOK)
     {
         //System_printf("eDMA Configuration Failed!\n");
         Log_info0("eDMA Configuration Failed!");
index e00de484dcb02d3322527726975f59432abde545..bc1c4a9f34d9133eaadc5209597ecbca724250a5 100644 (file)
@@ -117,11 +117,11 @@ Void taskSysInitFxn(Void)
     // Create Shared DDR region as non-Cacheable, Before IPC attach
     // TODO: remove hardcoded address and get correct values from .bld
     {   // base: 0x81000000, len: 0x01000000,
-        UInt Common2_DDR3_MAR_base = 0x01848204;
+        //UInt Common2_DDR3_MAR_base = 0x01848204;
         UInt Common2_DDR3_base = 0x81000000;
         UInt Common2_DDR3_len = 0x01000000;
         // disable cache for common2 DDR3
-        Cache_setMar(Common2_DDR3_base, Common2_DDR3_len, Cache_Mar_DISABLE);
+        Cache_setMar((xdc_Ptr)Common2_DDR3_base, Common2_DDR3_len, Cache_Mar_DISABLE);
     }
 
     //taskPriAfp = Task_setPri(TaskAfp, -1);
@@ -214,15 +214,15 @@ Void taskSysInitFxn(Void)
 
     // FL: debug
     // Any of these can be used on ARM, but DSP must configure the GPIO since pinMuxSetMode() is only available on DSP
-    pinMuxSetMode(101,PADCONFIG_MUX_MODE_QUATERNARY); // PAD101 to QUATERNARY, GPIO (B5 on AudioDaughterCard J12)
+    audk2g_pinMuxSetMode(101,AUDK2G_PADCONFIG_MUX_MODE_QUATERNARY); // PAD101 to QUATERNARY, GPIO (B5 on AudioDaughterCard J12)
     GPIOSetDirection(GPIO_PORT_0, GPIO_PIN_99, GPIO_OUT); // GPIO0,pin99 output
     GPIOSetOutput(GPIO_PORT_0, GPIO_PIN_99);
     GPIOClearOutput(GPIO_PORT_0, GPIO_PIN_99);
-    pinMuxSetMode(117,PADCONFIG_MUX_MODE_QUATERNARY); // PAD117 to QUATERNARY, GPIO (B8 on AudioDaughterCard J12)
+    audk2g_pinMuxSetMode(117,AUDK2G_PADCONFIG_MUX_MODE_QUATERNARY); // PAD117 to QUATERNARY, GPIO (B8 on AudioDaughterCard J12)
     GPIOSetDirection(GPIO_PORT_0, GPIO_PIN_106, GPIO_OUT); // GPIO0,pin106 output
     GPIOSetOutput(GPIO_PORT_0, GPIO_PIN_106);
     GPIOClearOutput(GPIO_PORT_0, GPIO_PIN_106);
-    pinMuxSetMode(118,PADCONFIG_MUX_MODE_QUATERNARY); // PAD118 to QUATERNARY, GPIO (B9 on AudioDaughterCard J12)
+    audk2g_pinMuxSetMode(118,AUDK2G_PADCONFIG_MUX_MODE_QUATERNARY); // PAD118 to QUATERNARY, GPIO (B9 on AudioDaughterCard J12)
     GPIOSetDirection(GPIO_PORT_0, GPIO_PIN_107, GPIO_OUT); // GPIO0,pin107 output
     GPIOSetOutput(GPIO_PORT_0, GPIO_PIN_107);
     GPIOClearOutput(GPIO_PORT_0, GPIO_PIN_107);
index 98f10e866b6bc39f3933d3072d9d7e9e852e54c4..a45dcbbe3b5b3d11d14140dcf6fb7d3475777604 100644 (file)
@@ -45,9 +45,10 @@ All rights reserved.
 #include <stdarg.h>
 #include "string.h"
 #include <xdc/runtime/Log.h>
+#include "audk2g_audio.h"
 
 
-Platform_STATUS audioHDMIConfig(void);
+Audk2g_STATUS audioHDMIConfig(void);
 
 #define HSR4_I2C_ADDR 0x5D
 #define        HSR4_I2C_PORT_NUM I2C_PORT_1
@@ -73,82 +74,82 @@ Int16 DA10x_I2C_read( Uint16, Uint8*, Uint16);
  *
  *  \return    Platform_EOK on Success or error code
  */
-Platform_STATUS audioAdcConfig(AdcDevId  devId, AdcConfig *config)
+Audk2g_STATUS audioAdcConfig(Audk2gAdcDevId  devId, AdcConfig *config)
 {
-       Platform_STATUS status;
+       Audk2g_STATUS status;
 
        if(config == NULL)
        {
-               IFPRINT(platform_write("Invalid Inputs\n"));
-               return (Platform_EINVALID);
+               IFPRINT(audk2g_write("Invalid Inputs\n"));
+               return (Audk2g_EINVALID);
        }
 
        /* Initialize all the HW instances of ADC */
-       status = platformAudioAdcInit(devId);
-       if(status != Platform_EOK)
+       status = audk2g_AudioAdcInit(devId);
+       if(status != Audk2g_EOK)
        {
-               IFPRINT(platform_write("audioAdcConfig : platformaudioAdcConfig Failed\n"));
+               IFPRINT(audk2g_write("audioAdcConfig : platformaudioAdcConfig Failed\n"));
                return (status);
        }
 
        /* Set ADC channel gain */
-       status = platformAudioAdcSetGain(devId, ADC_CH_ALL, config->gain);
-       if(status != Platform_EOK)
+       status = audk2g_AudioAdcSetGain(devId, AUDK2G_ADC_CH_ALL, config->gain);
+       if(status != Audk2g_EOK)
        {
-               IFPRINT(platform_write("audioAdcConfig : platformAudioAdcSetGain Failed\n"));
+               IFPRINT(audk2g_write("audioAdcConfig : audk2g_AudioAdcSetGain Failed\n"));
                return (status);
        }
 
        /* Configure Left input mux for ADC1L */
-       status = platformAudioAdcSetLeftInputMux(devId, ADC_CH1_LEFT,
+       status = audk2g_AudioAdcSetLeftInputMux(devId, AUDK2G_ADC_CH1_LEFT,
                                                 config->adc1LMux);
-       if(status != Platform_EOK)
+       if(status != Audk2g_EOK)
        {
-               IFPRINT(platform_write("audioAdcConfig : platformAudioAdcSetLeftInputMux Failed\n"));
+               IFPRINT(audk2g_write("audioAdcConfig : audk2g_AudioAdcSetLeftInputMux Failed\n"));
                return (status);
        }
 
        /* Configure Left input mux for ADC2L*/
-       status = platformAudioAdcSetLeftInputMux(devId, ADC_CH2_LEFT,
+       status = audk2g_AudioAdcSetLeftInputMux(devId, AUDK2G_ADC_CH2_LEFT,
                                                 config->adc2LMux);
-       if(status != Platform_EOK)
+       if(status != Audk2g_EOK)
        {
-               IFPRINT(platform_write("audioAdcConfig : platformAudioAdcSetLeftInputMux Failed\n"));
+               IFPRINT(audk2g_write("audioAdcConfig : audk2g_AudioAdcSetLeftInputMux Failed\n"));
                return (status);
        }
 
        /* Configure Right input mux for ADC1R */
-       status = platformAudioAdcSetRightInputMux(devId, ADC_CH1_RIGHT,
+       status = audk2g_AudioAdcSetRightInputMux(devId, AUDK2G_ADC_CH1_RIGHT,
                                                  config->adc1RMux);
-       if(status != Platform_EOK)
+       if(status != Audk2g_EOK)
        {
-               IFPRINT(platform_write("audioAdcConfig : platformAudioAdcSetRightInputMux Failed\n"));
+               IFPRINT(audk2g_write("audioAdcConfig : audk2g_AudioAdcSetRightInputMux Failed\n"));
                return (status);
        }
 
        /* Configure Right input mux for ADC2R */
-       status = platformAudioAdcSetRightInputMux(devId, ADC_CH2_RIGHT,
+       status = audk2g_AudioAdcSetRightInputMux(devId, AUDK2G_ADC_CH2_RIGHT,
                                                  config->adc2RMux);
-       if(status != Platform_EOK)
+       if(status != Audk2g_EOK)
        {
-               IFPRINT(platform_write("audioAdcConfig : platformAudioAdcSetRightInputMux Failed\n"));
+               IFPRINT(audk2g_write("audioAdcConfig : audk2g_AudioAdcSetRightInputMux Failed\n"));
                return (status);
        }
 
        /* Configure audio data format */
-       status = platformAudioAdcDataConfig(devId, config->wlen, config->format);
-       if(status != Platform_EOK)
+       status = audk2g_AudioAdcDataConfig(devId, config->wlen, config->format);
+       if(status != Audk2g_EOK)
        {
-               IFPRINT(platform_write("audioAdcConfig : platformAudioAdcDataConfig Failed\n"));
+               IFPRINT(audk2g_write("audioAdcConfig : audk2g_AudioAdcDataConfig Failed\n"));
                return (status);
        }
 
        /* Configure all the interrupts */
-       status = platformAudioAdcConfigIntr(devId, ADC_INTR_ALL,
+       status = audk2g_AudioAdcConfigIntr(devId, AUDK2G_ADC_INTR_ALL,
                                            config->intEnable);
-       if(status != Platform_EOK)
+       if(status != Audk2g_EOK)
        {
-               IFPRINT(platform_write("audioAdcConfig : platformAudioAdcConfigIntr Failed\n"));
+               IFPRINT(audk2g_write("audioAdcConfig : audk2g_AudioAdcConfigIntr Failed\n"));
                return (status);
        }
 
@@ -166,79 +167,79 @@ Platform_STATUS audioAdcConfig(AdcDevId  devId, AdcConfig *config)
  *
  *  \return    Platform_EOK on Success or error code
  */
-Platform_STATUS audioDacConfig(DacDevId devId, DacConfig *config)
+Audk2g_STATUS audioDacConfig(Audk2gDacDevId devId, DacConfig *config)
 {
-       Platform_STATUS status;
+       Audk2g_STATUS status;
 
        if(config == NULL)
        {
-               IFPRINT(platform_write("Invalid Inputs\n"));
-               return (Platform_EINVALID);
+               IFPRINT(audk2g_write("Invalid Inputs\n"));
+               return (Audk2g_EINVALID);
        }
 
        /* Initialize Audio DAC */
-       status = platformAudioDacInit(devId);
-       if(status != Platform_EOK)
+       status = audk2g_AudioDacInit(devId);
+       if(status != Audk2g_EOK)
        {
-               IFPRINT(platform_write("audioDacConfig : platformaudioDacConfig Failed\n"));
+               IFPRINT(audk2g_write("audioDacConfig : platformaudioDacConfig Failed\n"));
                return (status);
        }
 
        /* Configure AMUTE control event */
-       status = platformAudioDacAmuteCtrl(devId, config->amuteCtrl,
+       status = audk2g_AudioDacAmuteCtrl(devId, config->amuteCtrl,
                                           config->amuteEnable);
-       if(status != Platform_EOK)
+       if(status != Audk2g_EOK)
        {
-               IFPRINT(platform_write("audioDacConfig : platformAudioDacAmuteCtrl Failed\n"));
+               IFPRINT(audk2g_write("audioDacConfig : audk2g_AudioDacAmuteCtrl Failed\n"));
                return (status);
        }
 
        /* Set sampling mode */
-       status = platformAudioDacSetSamplingMode(devId, config->samplingMode);
-       if(status != Platform_EOK)
+       status = audk2g_AudioDacSetSamplingMode(devId, config->samplingMode);
+       if(status != Audk2g_EOK)
        {
-               IFPRINT(platform_write("audioDacConfig : platformAudioDacSetSamplingMode Failed\n"));
+               IFPRINT(audk2g_write("audioDacConfig : audk2g_AudioDacSetSamplingMode Failed\n"));
                return (status);
        }
 
        /* Set data format */
-       status = platformAudioDacSetDataFormat(devId, config->dataFormat);
-       if(status != Platform_EOK)
+       status = audk2g_AudioDacSetDataFormat(devId, config->dataFormat);
+       if(status != Audk2g_EOK)
        {
-               IFPRINT(platform_write("audioDacConfig : platformAudioDacSetDataFormat Failed\n"));
+               IFPRINT(audk2g_write("audioDacConfig : audk2g_AudioDacSetDataFormat Failed\n"));
                return (status);
        }
 
        /* Enable soft mute control */
-       status = platformAudioDacSoftMuteCtrl(devId, DAC_CHAN_ALL,
+       status = audk2g_AudioDacSoftMuteCtrl(devId, AUDK2G_DAC_CHAN_ALL,
                                              config->softMuteEnable);
-       if(status != Platform_EOK)
+       if(status != Audk2g_EOK)
        {
-               IFPRINT(platform_write("audioDacConfig : platformAudioDacSoftMuteCtrl Failed\n"));
+               IFPRINT(audk2g_write("audioDacConfig : audk2g_AudioDacSoftMuteCtrl Failed\n"));
                return (status);
        }
 
        /* Set attenuation mode */
-       status = platformAudioDacSetAttnMode(devId, config->attnMode);
-       if(status != Platform_EOK)
+       status = audk2g_AudioDacSetAttnMode(devId, config->attnMode);
+       if(status != Audk2g_EOK)
        {
-               IFPRINT(platform_write("audioDacConfig : platformAudioDacSetAttnMode Failed\n"));
+               IFPRINT(audk2g_write("audioDacConfig : audk2g_AudioDacSetAttnMode Failed\n"));
                return (status);
        }
 
        /* Set De-emphasis control */
-       status = platformAudioDacDeempCtrl(devId, config->deempCtrl);
-       if(status != Platform_EOK)
+       status = audk2g_AudioDacDeempCtrl(devId, config->deempCtrl);
+       if(status != Audk2g_EOK)
        {
-               IFPRINT(platform_write("audioDacConfig : platformAudioDacDeempCtrl Failed\n"));
+               IFPRINT(audk2g_write("audioDacConfig : audk2g_AudioDacDeempCtrl Failed\n"));
                return (status);
        }
 
        /* Set DAC volume */
-       status = platformAudioDacSetVolume(devId, DAC_CHAN_ALL, config->volume);
-       if(status != Platform_EOK)
+       status = audk2g_AudioDacSetVolume(devId, AUDK2G_DAC_CHAN_ALL, config->volume);
+       if(status != Audk2g_EOK)
        {
-               IFPRINT(platform_write("audioDacConfig : platformAudioDacSetVolume Failed\n"));
+               IFPRINT(audk2g_write("audioDacConfig : audk2g_AudioDacSetVolume Failed\n"));
                return (status);
        }
 
@@ -253,18 +254,18 @@ Platform_STATUS audioDacConfig(DacDevId devId, DacConfig *config)
  *
  *  \return    Platform_EOK on Success or error code
  */
-Platform_STATUS audioDirConfig(void)
+Audk2g_STATUS audioDirConfig(void)
 {
-       Platform_STATUS status;
+       Audk2g_STATUS status;
        int8_t          fsout;
 #ifdef CHECK_ERROR_STATUS
        uint32_t        timeout;
 #endif
 
-       status = platformAudioDirInit();
-       if(status != Platform_EOK)
+       status = audk2g_AudioDirInit();
+       if(status != Audk2g_EOK)
        {
-               IFPRINT(platform_write("audioDirConfig : Audio DIR Configuration Failed!\n"));
+               IFPRINT(audk2g_write("audioDirConfig : Audio DIR Configuration Failed!\n"));
                return (status);
        }
 
@@ -275,45 +276,45 @@ Platform_STATUS audioDirConfig(void)
        timeout = ERROR_STATUS_WAIT_TIMEOUT;
        while (timeout)
        {
-               if(!platformAudioDirGetErrStatus())
+               if(!audk2g_AudioDirGetErrStatus())
                {
-                       IFPRINT(platform_write("audioDirConfig : DIR in PLL Mode\n"));
+                       IFPRINT(audk2g_write("audioDirConfig : DIR in PLL Mode\n"));
                        break;
                }
 
-               IFPRINT(platform_write("audioDirConfig : Waiting for DIR to Enter PLL Mode...\n"));
-               platform_delay(10);
+               IFPRINT(audk2g_write("audioDirConfig : Waiting for DIR to Enter PLL Mode...\n"));
+               audk2g_delay(10);
                timeout--;
        }
 
        if(!timeout)
        {
-               IFPRINT(platform_write("audioDirConfig : DIR is not in PLL Mode!!\n"));
+               IFPRINT(audk2g_write("audioDirConfig : DIR is not in PLL Mode!!\n"));
                return (Platform_EFAIL);
        }
 #endif
 
-       fsout = platformAudioDirGetFsOut();
+       fsout = audk2g_AudioDirGetFsOut();
        if(fsout == 2)
        {
-               IFPRINT(platform_write("audioDirConfig : Out of Range Sampling Frequency\n"));
+               IFPRINT(audk2g_write("audioDirConfig : Out of Range Sampling Frequency\n"));
        }
        else if(fsout == 0)
        {
-               IFPRINT(platform_write("audioDirConfig : Calculated Sampling Frequency Output is 43 kHz\9645.2 kHz\n"));
+               IFPRINT(audk2g_write("audioDirConfig : Calculated Sampling Frequency Output is 43 kHz\9645.2 kHz\n"));
        }
        else if(fsout == 1)
        {
-               IFPRINT(platform_write("audioDirConfig : Calculated Sampling Frequency Output is 46.8 kHz\9649.2 kHz\n"));
+               IFPRINT(audk2g_write("audioDirConfig : Calculated Sampling Frequency Output is 46.8 kHz\9649.2 kHz\n"));
        }
        else if(fsout == 3)
        {
-               IFPRINT(platform_write("audioDirConfig : Calculated Sampling Frequency Output is 31.2 kHz\9632.8 kHz\n"));
+               IFPRINT(audk2g_write("audioDirConfig : Calculated Sampling Frequency Output is 31.2 kHz\9632.8 kHz\n"));
        }
        else
        {
-               IFPRINT(platform_write("audioDirConfig : Error in Reading FSOUT status \n"));
-               status = Platform_EFAIL;
+               IFPRINT(audk2g_write("audioDirConfig : Error in Reading FSOUT status \n"));
+               status = Audk2g_EFAIL;
        }
 
        return (status);
@@ -418,10 +419,10 @@ void set_audio_desc(unsigned char var1,unsigned char var2,unsigned char var3,uns
 {
        int ret_val=I2C_RET_OK;
 
-       platform_delay(10);do{ret_val=alpha_i2c_write(HSDIO_EDID_AUDIO_DESC_FORMAT(var1, var2));}while (ret_val !=I2C_RET_OK);
-       platform_delay(10);do{ret_val=alpha_i2c_write(HSDIO_EDID_AUDIO_DESC_NUM_CHANNELS(var1, var3));}while (ret_val !=I2C_RET_OK);
-       platform_delay(10);do{ret_val=alpha_i2c_write(HSDIO_EDID_AUDIO_DESC_SAMPLE_RATES(var1, var4));}while (ret_val !=I2C_RET_OK);
-       platform_delay(10);do{ret_val=alpha_i2c_write(HSDIO_EDID_AUDIO_DESC_MISC(var1, var5));}while (ret_val !=I2C_RET_OK);
+       audk2g_delay(10);do{ret_val=alpha_i2c_write(HSDIO_EDID_AUDIO_DESC_FORMAT(var1, var2));}while (ret_val !=I2C_RET_OK);
+       audk2g_delay(10);do{ret_val=alpha_i2c_write(HSDIO_EDID_AUDIO_DESC_NUM_CHANNELS(var1, var3));}while (ret_val !=I2C_RET_OK);
+       audk2g_delay(10);do{ret_val=alpha_i2c_write(HSDIO_EDID_AUDIO_DESC_SAMPLE_RATES(var1, var4));}while (ret_val !=I2C_RET_OK);
+       audk2g_delay(10);do{ret_val=alpha_i2c_write(HSDIO_EDID_AUDIO_DESC_MISC(var1, var5));}while (ret_val !=I2C_RET_OK);
 }
 
 int gI2Ccnt=0;
@@ -446,7 +447,7 @@ void hrptredid()
             
        }while (ret_val !=I2C_RET_OK); */
        do{ret_val=alpha_i2c_write(HSDIO_EDID_SPEAKER_ALLOCATION_BLOCK(0xFF));}while (ret_val !=I2C_RET_OK);
-       platform_delay(10);
+       audk2g_delay(10);
        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);   // PCM 2 channel, 32kHz, 44.1kHz, 48kHz, 88.2kHz, 96kHz, 176.4 KHz, 192 KHz, 16bit, 20bit, 24bit
@@ -471,7 +472,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(10);
+       audk2g_delay(10);
        do{ret_val=alpha_i2c_write(HSDIO_EDID_GO);}while (ret_val !=I2C_RET_OK);
 }
 
@@ -481,14 +482,14 @@ void  hdmi128()
 {
        int ret_val=I2C_RET_OK;
 
-       platform_delay(10);do{ret_val=alpha_i2c_write(HSDIO_ALERT(HSDIO_ALERT_INPUT_AUDIO_CHANGE_msk));}while (ret_val !=I2C_RET_OK);
-       //platform_delay(10);do{ret_val=alpha_i2c_write(HSDIO_ALERT(HSDIO_ALERT_INPUT_AUDIO_MUTE_msk));}while (ret_val !=I2C_RET_OK);
-       platform_delay(10);do{ret_val=alpha_i2c_write(HSDIO_AUDIO_MCLK_TO_HOST(HSDIO_AudioMClk_128X));}while (ret_val !=I2C_RET_OK);
-       platform_delay(10);do{ret_val=alpha_i2c_write(HSDIO_AUDIO_UNMUTE_DELAY_TO_HOST(HSDIO_AudioUnMuteDelay_NO_DELAY));}while (ret_val !=I2C_RET_OK);
-       platform_delay(10);do{ret_val=alpha_i2c_write(HSDIO_AUDIO_FORMAT_TO_HOST(HSDIO_AudioFmt_I2S));}while (ret_val !=I2C_RET_OK);
-       platform_delay(10);do{ret_val=alpha_i2c_write(HSDIO_IMPLEMENT_AUDIO_TO_HOST_CMDS);}while (ret_val !=I2C_RET_OK);
-       platform_delay(10);do{ret_val=alpha_i2c_write(HSDIO_AUDIO_ROUTING(HSDIO_AudioRouting_HSDIOIN_NOOUT));}while (ret_val !=I2C_RET_OK);
-       platform_delay(10);do{ret_val=alpha_i2c_write(HSDIO_SYS_CFG_GO);}while (ret_val !=I2C_RET_OK);
+       audk2g_delay(10);do{ret_val=alpha_i2c_write(HSDIO_ALERT(HSDIO_ALERT_INPUT_AUDIO_CHANGE_msk));}while (ret_val !=I2C_RET_OK);
+       //audk2g_delay(10);do{ret_val=alpha_i2c_write(HSDIO_ALERT(HSDIO_ALERT_INPUT_AUDIO_MUTE_msk));}while (ret_val !=I2C_RET_OK);
+       audk2g_delay(10);do{ret_val=alpha_i2c_write(HSDIO_AUDIO_MCLK_TO_HOST(HSDIO_AudioMClk_128X));}while (ret_val !=I2C_RET_OK);
+       audk2g_delay(10);do{ret_val=alpha_i2c_write(HSDIO_AUDIO_UNMUTE_DELAY_TO_HOST(HSDIO_AudioUnMuteDelay_NO_DELAY));}while (ret_val !=I2C_RET_OK);
+       audk2g_delay(10);do{ret_val=alpha_i2c_write(HSDIO_AUDIO_FORMAT_TO_HOST(HSDIO_AudioFmt_I2S));}while (ret_val !=I2C_RET_OK);
+       audk2g_delay(10);do{ret_val=alpha_i2c_write(HSDIO_IMPLEMENT_AUDIO_TO_HOST_CMDS);}while (ret_val !=I2C_RET_OK);
+       audk2g_delay(10);do{ret_val=alpha_i2c_write(HSDIO_AUDIO_ROUTING(HSDIO_AudioRouting_HSDIOIN_NOOUT));}while (ret_val !=I2C_RET_OK);
+       audk2g_delay(10);do{ret_val=alpha_i2c_write(HSDIO_SYS_CFG_GO);}while (ret_val !=I2C_RET_OK);
 }
 
 //
@@ -612,9 +613,9 @@ unsigned int read_hdmi_samprate()
 }
 
 
-Platform_STATUS audioHDMIConfig(void)
+Audk2g_STATUS audioHDMIConfig(void)
 {
-       Platform_STATUS status = Platform_EOK;
+       Audk2g_STATUS status = Audk2g_EOK;
 
        DA10x_I2C_init();
        hrptredid();
@@ -709,8 +710,6 @@ Int16 DA10x_I2C_reset( )
 Int16 DA10x_I2C_write( Uint16 i2c_addr, Uint8* data, Uint16 len )
 {
     Int32 timeout, i;
-    Int32   oldMask;
-
 
         I2C_ICCNT = len;                    // Set length
         I2C_ICSAR = i2c_addr;               // Set I2C slave address
index d920083f61a46825c9ce1226ed35a45c766a0c7a..c2fbb8cc3f38f920102263469d7f6c94306563a4 100644 (file)
@@ -43,8 +43,8 @@ All rights reserved.
 #ifndef _AUDIO_DC_CFG_H_
 #define _AUDIO_DC_CFG_H_
 
-#include "platform_internal.h"
-#include "platform.h"
+#include "audk2g.h"
+#include "audk2g_audio.h"
 /**
  *  \brief    ADC configuration parameter structure
  *
@@ -52,12 +52,12 @@ All rights reserved.
 typedef struct _AdcConfig
 {
        uint8_t          gain;
-       AdcLeftInputMux  adc1LMux;
-       AdcLeftInputMux  adc2LMux;
-       AdcRightInputMux adc1RMux;
-       AdcRightInputMux adc2RMux;
-       AdcRxWordLen     wlen;
-       AdcDataFormat    format;
+       Audk2gAdcLeftInputMux  adc1LMux;
+       Audk2gAdcLeftInputMux  adc2LMux;
+       Audk2gAdcRightInputMux adc1RMux;
+       Audk2gAdcRightInputMux adc2RMux;
+       Audk2gAdcRxWordLen     wlen;
+       Audk2gAdcDataFormat    format;
        uint8_t          intEnable;
 } AdcConfig;
 
@@ -67,13 +67,13 @@ typedef struct _AdcConfig
  */
 typedef struct _DacConfig
 {
-       DacAmuteCtrl    amuteCtrl;
+       Audk2gDacAmuteCtrl    amuteCtrl;
        uint8_t         amuteEnable;
-       DacSamplingMode samplingMode;
-       DacDataFormat   dataFormat;
+       Audk2gDacSamplingMode samplingMode;
+       Audk2gDacDataFormat   dataFormat;
        uint8_t         softMuteEnable;
-       DacAttnMode     attnMode;
-       DacDeempCtrl    deempCtrl;
+       Audk2gDacAttnMode     attnMode;
+       Audk2gDacDeempCtrl    deempCtrl;
        uint8_t         volume;
 } DacConfig;
 
@@ -88,7 +88,7 @@ typedef struct _DacConfig
  *
  *  \return    Platform_EOK on Success or error code
  */
-Platform_STATUS audioAdcConfig(AdcDevId  devId, AdcConfig *config);
+Audk2g_STATUS audioAdcConfig(Audk2gAdcDevId  devId, AdcConfig *config);
 
 /**
  *  \brief    Initializes DAC module
@@ -101,7 +101,7 @@ Platform_STATUS audioAdcConfig(AdcDevId  devId, AdcConfig *config);
  *
  *  \return    Platform_EOK on Success or error code
  */
-Platform_STATUS audioDacConfig(DacDevId devId, DacConfig *config);
+Audk2g_STATUS audioDacConfig(Audk2gDacDevId devId, DacConfig *config);
 
 /**
  *  \brief    Initializes DIR module
@@ -111,7 +111,7 @@ Platform_STATUS audioDacConfig(DacDevId devId, DacConfig *config);
  *
  *  \return    Platform_EOK on Success or error code
  */
-Platform_STATUS audioDirConfig(void);
+Audk2g_STATUS audioDirConfig(void);
 
 /**
  *  \brief    Initializes HSR41 module
@@ -121,8 +121,20 @@ Platform_STATUS audioDirConfig(void);
  *
  *  \return    Platform_EOK on Success or error code
  */
+Audk2g_STATUS audioHDMIConfig(void);
+
+/**
+ *  \brief    Read HDMI sampling rate
+ *
+ */
+unsigned int read_hdmi_samprate();
+
+/**
+ *  \brief    Clear HDMI interrupt on ~HMINT
+ *
+ */
+void clear_hdmi_hmint();
 
-Platform_STATUS audioHDMIConfig(void);
 /* ------------------------------------------------------------------------ *
  *                                                                          *
  *  Variable types                                                          *
index 6ae1244f7b4d7fc8481820f63d3ec75c118c1637..4f48551f42cb77966e4307a2dac96eb0a2c11ba3 100644 (file)
@@ -100,7 +100,7 @@ extern UARTDMA_HwAttrs uartInitCfg[];
  *
  *  \return    Platform_EOK on Success or error code
  */
-Platform_STATUS eDmaConfig(void)
+Audk2g_STATUS eDmaConfig(void)
 {
     EDMA3_DRV_Result edmaResult = 0;
 
@@ -108,8 +108,8 @@ Platform_STATUS eDmaConfig(void)
     hEdma0 = edma3init(CSL_EDMACC_0, &edmaResult);
     if((hEdma0 == NULL) || (edmaResult != 0))
     {
-               IFPRINT(platform_write("eDMA instance 0 Initialization Failed\n"));
-               return (Platform_EFAIL);
+               IFPRINT(audk2g_write("eDMA instance 0 Initialization Failed\n"));
+               return (Audk2g_EFAIL);
        }
 #ifdef DCS7_UART_EDMA_ENABLE
     uartInitCfg[0].edmaHandle = hEdma0;
@@ -118,11 +118,11 @@ Platform_STATUS eDmaConfig(void)
     hEdma1 = edma3init(CSL_EDMACC_1, &edmaResult);
     if((hEdma1 == NULL) || (edmaResult != 0))
     {
-               IFPRINT(platform_write("eDMA instance 1 Initialization Failed\n"));
-               return (Platform_EFAIL);
+               IFPRINT(audk2g_write("eDMA instance 1 Initialization Failed\n"));
+               return (Audk2g_EFAIL);
        }
 
-       return (Platform_EOK);
+       return (Audk2g_EOK);
 }
 
 /**
index 3941823fd551cbdb9a40468051a30128d3b9ade0..14d1d44ae1ec3b854d7b7d585ecba38c749a1b39 100644 (file)
@@ -55,7 +55,7 @@ All rights reserved.
  *
  *  \return    Platform_EOK on Success or error code
  */
-Platform_STATUS eDmaConfig(void);
+Audk2g_STATUS eDmaConfig(void);
 
 #endif /* _EDMA_CFG_H_ */
 
index 0cd2ab067cc09f4340561b19d3313ed4d80ef6c9..d22d42878eb5010f8823793cf95e17c4f609ab17 100644 (file)
@@ -43,6 +43,7 @@ All rights reserved.
 * project
 *
 ******************************************************************************/
+#if 0 // Functions defined below are not used in PASDK
 
 #include <cerrno>
 #include <stdio.h>
@@ -88,3 +89,4 @@ void Osal_platformSpiCsExit (void)
     return;
 }
 
+#endif
index 2c6a72f050ba1b3c92eb9df63471e9245e7f2872..66cb7cc82035b3d673cd2791c6df70a877b58049 100644 (file)
@@ -68,6 +68,7 @@ All rights reserved.
 #include <sap_d10.h>
 #include <audio_dc_cfg.h>
 #include "vproccmds_a.h"
+#include "evmc66x_gpio.h"  // in "${PDK_INSTALL_PATH}/ti/addon/audk2g/include"
 
 #include "dbgBenchmark.h" // PCM high-sampling rate + SRC + CAR benchmarking
 
@@ -83,6 +84,13 @@ static int manageOutput (DEV2_Handle device, const SAP_D10_Tx_Params *pParams, f
 
 void HSR4_readStatus (PAF_SIO_InputStatus *pStatus);
 unsigned int HDMIGpioGetState (void);
+
+/** GPIO number for I2S Header HSR4's ~HMINT pin - GPIO port 0 */
+#define AUDK2G_AUDIO_HSR_HMINTz_GPIO      (105)   // missing from audio addon
+
+/** GPIO number for I2S Header HSR4's ~RESET pin - GPIO port 0 */
+#define AUDK2G_AUDIO_HSR_RESETz_GPIO      (104)   // missing from audio addon
+
 // -----------------------------------------------------------------------------
 // State machine variables and defines
 
@@ -673,55 +681,77 @@ const SAP_D10_Tx_Params SAP_D10_TX_DAC_16CH =
 /* DAC default configuration parameters */
 DacConfig  dacCfg =
 {
-       DAC_AMUTE_CTRL_SCKI_LOST,   /* Amute event */
+       AUDK2G_DAC_AMUTE_CTRL_SCKI_LOST,   /* Amute event */
        0,                          /* Amute control */
-       DAC_SAMPLING_MODE_SINGLE_RATE,     /* Sampling mode */
-       DAC_DATA_FORMAT_I2S,        /* Data format */
+       AUDK2G_DAC_SAMPLING_MODE_SINGLE_RATE,     /* Sampling mode */
+       AUDK2G_DAC_DATA_FORMAT_I2S,        /* Data format */
        0,                          /* Soft mute control */
-       DAC_ATTENUATION_WIDE_RANGE, /* Attenuation mode */
-       DAC_DEEMP_44KHZ,            /* De-emph control */
+       AUDK2G_DAC_ATTENUATION_WIDE_RANGE, /* Attenuation mode */
+       AUDK2G_DAC_DEEMP_44KHZ,            /* De-emph control */
        100                         /* Volume */
 };
 /* ADC default configuration parameters */
 AdcConfig adcCfg =
 {
        90,                  /* ADC gain */
-       ADC_INL_SE_VINL1,    /* Left input mux for ADC1L */
-       ADC_INL_SE_VINL2,    /* Left input mux for ADC2L */
-       ADC_INR_SE_VINR1,    /* Right input mux for ADC1R */
-       ADC_INR_SE_VINR2,    /* Right input mux for ADC2R */
-       ADC_RX_WLEN_24BIT,   /* ADC word length */
-       ADC_DATA_FORMAT_I2S, /* ADC data format */
+       AUDK2G_ADC_INL_SE_VINL1,    /* Left input mux for ADC1L */
+       AUDK2G_ADC_INL_SE_VINL2,    /* Left input mux for ADC2L */
+       AUDK2G_ADC_INR_SE_VINR1,    /* Right input mux for ADC1R */
+       AUDK2G_ADC_INR_SE_VINR2,    /* Right input mux for ADC2R */
+       AUDK2G_ADC_RX_WLEN_24BIT,   /* ADC word length */
+       AUDK2G_ADC_DATA_FORMAT_I2S, /* ADC data format */
        0
 };
 
-Platform_STATUS setAudioDacConfig(void)
+Audk2g_STATUS setAudioDacConfig(void)
 {
-       Platform_STATUS status;
+       Audk2g_STATUS status;
 
        /* Initialize Audio DAC module */
-       status = audioDacConfig(DAC_DEVICE_ALL, &dacCfg);
+       status = audioDacConfig(AUDK2G_DAC_DEVICE_ALL, &dacCfg); // defined in sap\audio_dc_cfg.c
        if (status)
                Log_info0("SAP_D10: Audio DAC Configuration Failed!!!\n");
        return status;
 
 }
 
+// Configure GPIO for HSR HDMI signaling. This needs to be added to audk2g_AudioInit()
+// in ti\addon\audk2g\src\audk2g.c.
+Audk2g_STATUS audk2g_AudioInit_Extra()
+{
+       /* Configure GPIO for HSR HDMI Signaling - GPIO0 104 (~RESET) & 105 (~HMINT) */
+       audk2g_pinMuxSetMode(114, AUDK2G_PADCONFIG_MUX_MODE_QUATERNARY);
+       audk2g_gpioSetDirection(AUDK2G_GPIO_PORT_0, AUDK2G_AUDIO_HSR_HMINTz_GPIO, AUDK2G_GPIO_IN);
+
+       audk2g_pinMuxSetMode(113, AUDK2G_PADCONFIG_MUX_MODE_QUATERNARY);
+       audk2g_gpioSetDirection(AUDK2G_GPIO_PORT_0, AUDK2G_AUDIO_HSR_RESETz_GPIO, AUDK2G_GPIO_OUT);
+       audk2g_gpioSetOutput(AUDK2G_GPIO_PORT_0, AUDK2G_AUDIO_HSR_RESETz_GPIO);
+
+       return Audk2g_EOK;
+}
+
 static inline XDAS_Int32 initD10 (DEV2_Handle device)
 {
-       Platform_STATUS status = Platform_EOK;
+       Audk2g_STATUS status = Audk2g_EOK;
 
        /* Initialize common audio configurations */
-       status = platformAudioInit();
-       if(status != Platform_EOK)
+       status = audk2g_AudioInit(); // defined in in ti\addon\audk2g\src\audk2g.c
+       if(status != Audk2g_EOK)
        {
                Log_info0("Audio Init Failed!\n");
                return status;
        }
 
+       status = (Audk2g_STATUS)audk2g_AudioInit_Extra();
+       if(status != Audk2g_EOK)
+       {
+               Log_info0("Audio Init Failed!\n");
+               return status;
+       }
+    
        /* Initialize Audio ADC module */
-       status = audioAdcConfig(ADC_DEVICE_ALL, &adcCfg);
-       if(status != Platform_EOK)
+       status = audioAdcConfig(AUDK2G_ADC_DEVICE_ALL, &adcCfg);
+       if(status != Audk2g_EOK)
        {
                Log_info0("Audio ADC Configuration Failed!\n");
                return status;
@@ -730,13 +760,13 @@ static inline XDAS_Int32 initD10 (DEV2_Handle device)
        /* Setup DIR 9001 for SPDIF input operation */
        //status = platformAudioSelectClkSrc(AUDIO_CLK_SRC_DIR);
        status = audioDirConfig();
-       if(status != Platform_EOK)
+       if(status != Audk2g_EOK)
        {
                Log_info0("Audio DIR Init Failed!\n");
                return status;
        }
-       status = platformAudioSelectClkSrc(AUDIO_CLK_SRC_DIR);
-       platform_delay(5000); // Without delay between these 2 calls system aborts.
+       status = audk2g_AudioSelectClkSrc(AUDK2G_AUDIO_CLK_SRC_I2S);
+       audk2g_delay(5000); // Without delay between these 2 calls system aborts.
        status = setAudioDacConfig();
 
 #if 1
@@ -745,7 +775,7 @@ static inline XDAS_Int32 initD10 (DEV2_Handle device)
        /* Initialize the HDMI Card      */
     while(HDMIGpioGetState());
        status = audioHDMIConfig();
-       if(status != Platform_EOK)
+       if(status != Audk2g_EOK)
        {
                Log_info0("Audio HDMI Init Failed!\n");
                return status;
@@ -764,29 +794,30 @@ static inline XDAS_Int32 initD10 (DEV2_Handle device)
 // speed clocks (DIR/HDMI) or the internal AUXCLK (Audio_OSC). This is divided down
 // output via ACLKX0 which is connected to the high speed input
 // of TX0 (DAC) and TX2 (DIT).
+#define AUDK2G_AUDIO_CLK_SRC_OSC (AUDK2G_AUDIO_CLK_SRC_I2S+1)  //temporary, to add AUDK2G_AUDIO_CLK_SRC_OSC to audk2g_audio.h
 
 static XDAS_Int32 clockMuxTx (int sel, int force)
 {
-       Platform_STATUS status = 0;
+       Audk2g_STATUS status = 0;
     // select clkxDiv table
     if (sel == D10_MCLK_DIR)
     {
-       status = platformAudioSelectClkSrc(AUDIO_CLK_SRC_DIR);
+       status = audk2g_AudioSelectClkSrc(AUDK2G_AUDIO_CLK_SRC_DIR);
        pClkxDiv = (unsigned char *) clkxDivDIR;
     }
     else if (sel == D10_MCLK_HDMI)
     {
-       status = platformAudioSelectClkSrc(AUDIO_CLK_SRC_I2S);
+       status = audk2g_AudioSelectClkSrc(AUDK2G_AUDIO_CLK_SRC_I2S);
        pClkxDiv = (unsigned char *) clkxDivHDMI;
     }
     else if (sel == D10_MCLK_OSC)
     {
-       status = platformAudioSelectClkSrc(AUDIO_CLK_SRC_OSC);
+       status = audk2g_AudioSelectClkSrc((Audk2gAudioClkSrc)AUDK2G_AUDIO_CLK_SRC_OSC);
        pClkxDiv = (unsigned char *) clkxDivADC;
        }
     Log_info1("SAP_D10: Inside clockMuxTx with sel = %d", sel);
 
-    platform_delay(20000);
+    audk2g_delay(20000);
 
     return status;
 } //clockMuxTx
@@ -816,10 +847,10 @@ static int manageInput (DEV2_Handle device, const SAP_D10_Rx_Params *pParams, PA
     if ((((pParams->d10rx.mode & D10_MCLK_MASK) >> D10_MCLK_SHIFT) == D10_MCLK_DIR) &
         (((pParams->d10rx.mode & D10_MODE_MASK) >> D10_MODE_SHIFT) == D10_MODE_STD))
     {
-        pStatusIn->lock = !(platformAudioDirGetClkStatus());
-        pStatusIn->nonaudio = !(platformAudioDirGetAudioStatus());
-        pStatusIn->emphasis = platformAudioDirGetEmphStatus();
-        pStatusIn->sampleRateMeasured = RateTable_spdif[platformAudioDirGetFsOut()];
+        pStatusIn->lock = !(audk2g_AudioDirGetClkStatus());
+        pStatusIn->nonaudio = !(audk2g_AudioDirGetAudioStatus());
+        pStatusIn->emphasis = audk2g_AudioDirGetEmphStatus();
+        pStatusIn->sampleRateMeasured = RateTable_spdif[audk2g_AudioDirGetFsOut()];
                pStatusIn->sampleRateData = pStatusIn->sampleRateMeasured;
                PrevSampRate = pStatusIn->sampleRateMeasured;
 
@@ -1074,7 +1105,7 @@ XDAS_Int32 D10_sapControl (DEV2_Handle device, const PAF_SIO_Params *pParams, XD
                     // the periodic manage_output calls.
                     int sel = (pDapD10TxParams->d10tx.mode & D10_MCLK_MASK) >> D10_MCLK_SHIFT;
                     clockMuxTx (sel, -1);
-                    platform_delay(50000); // GJ REVISIT: Without delay between Tx McASP & DAC configs, system aborts.
+                    audk2g_delay(50000); // GJ REVISIT: Without delay between Tx McASP & DAC configs, system aborts.
                     setAudioDacConfig();
                                        dacHardUnMute ();
 
@@ -1172,7 +1203,7 @@ XDAS_Int32 D10_sapControl (DEV2_Handle device, const PAF_SIO_Params *pParams, XD
 
 
 unsigned int HDMIGpioGetState (void) {
-       return(gpioReadInput(GPIO_PORT_0, PLATFORM_AUDIO_HSR_HMINTz_GPIO));
+       return(audk2g_gpioReadInput(AUDK2G_GPIO_PORT_0, AUDK2G_AUDIO_HSR_HMINTz_GPIO));
 }
 
 // EOF
index c31e78dbdf832d7284d1c186021694d2213e17c2..355e987d43c597b181e3eae600b6d9ba08f5bae2 100644 (file)
@@ -47,9 +47,6 @@ All rights reserved.
 #include <sap.h>
 #include <pafsio.h>
 
-#include "platform_internal.h"
-#include "platform.h"
-
 // mode is a bitfield
 //      bit 0:  SYNC 0 = synchronous, 1 = asynchronous (Tx)
 //      bit 1:  Reserved