index 54704b9d02cd73e1842e3ee1daee0d459dedee40..01a35510dca9d63974f9ac7b7b90d8e94d53e377 100644 (file)
/*
-Copyright (c) 2016, Texas Instruments Incorporated - http://www.ti.com/
+Copyright (c) 2017, Texas Instruments Incorporated - http://www.ti.com/
All rights reserved.
* Redistribution and use in source and binary forms, with or without
#include <ti/sysbios/BIOS.h>
#include <ti/ipc/Ipc.h>
#include <ti/sysbios/hal/Cache.h>
+#include <ti/xdais/xdas.h>
-#include "fwkSim.h"
-
-#ifndef SIMULATE_SIO
-#include <platform.h>
-#include <platform_audio.h>
+#include <board.h>
+#include "evmc66x_i2c.h"
+#include <aud.h>
+#include <aud_audio.h>
#include "audio_dc_cfg.h"
#include "edma_cfg.h"
-#endif // SIMULATE_SIO
+#include <soc/mcasp_soc.h>
+
+#include "components/clk.h" /* PFP testing */
+#include "pfp/pfp.h"
+#include "pfp_app.h" /* contains all PFP ID's */
-#ifndef SIMULATE_SIO
+#include "ioConfig.h" //TODO: remove this header
extern Void initDev2(Void);
-#endif // SIMULATE_SIO
+extern void evmI2CInit(uint8_t i2cportnumber); // missing in evmc66x_i2c.h
+
+#ifdef IO_LOOPBACK_TEST
+extern void McaspDevice_init();
+extern void D10_init();
+extern Aud_STATUS mcaspAudioConfig();
+extern void audioIoCreate(void);
+extern void ioSemaphoreCreate(void);
+#endif
+// avoid including sap_d10.h, which would cause symbol redefinition
+// warning (MCASP_PFUNC_XXX)
+extern XDAS_Int32 D10_init(void);
/*
* ======== main ========
Int main()
{
Int status;
-#ifndef SIMULATE_SIO
- Platform_STATUS pfStatus;
-#endif // SIMULATE_SIO
+ Aud_STATUS AudStatus;
+ Int k;
+ Board_initCfg cfg;
- //System_printf("Enter main()\n");
Log_info0("Enter main()");
-#ifdef SIMULATE_SIO
- // Stop simulation
- simStop();
-#endif // SIMULATE_SIO
-
- //Platform setup!!!
-#ifndef SIMULATE_SIO
- /*
- * 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)
+ /* Setup Profile Points (PFP) */
+ Log_info0("enter PFP Setup");
+ pfpCreate();
+ pfpCalibrate(1000, 1);
+#if 0 // enabled in System Stream
+ for (k = 0; k <= PFP_ID_LAST; k++)
+ {
+ pfpEnable(k); /* Enable profile point #k */
+ }
+#endif
+ for (k = 1; k <= PFP_ID_LAST; k++)
{
- //System_printf("Error in Platform Initialization\n");
- Log_info0("Error in Platform Initialization");
+ pfpSetAlpha(k, PFP_DEF_ALPHA); /* Set default exp. avg. time const. */
}
- platform_delay(10000);
- //System_printf("\n****************************************************\n");
- //System_printf( " Audio DC Digital to Analog Loopback Test \n");
- //System_printf( "****************************************************\n");
-
- Log_info0("exit Platform Setup");
-#else // SIMULATE_SIO
- /* Initialize simulation */
- simInit();
-#endif // SIMULATE_SIO
-
-#ifndef SIMULATE_SIO
+#if 0 // debug: dummy load
+ pfpEnable(0); /* Enable profile point #0 */
+ for (k = 0; k < 1000; k++)
+ {
+ pfpBegin(PFP_ID_MAIN,0);
+ clkWorkDelay(CLK_WORKCNT_PER_MS); /* This should take about 750,000 cycles to execute, or 750e3/600e6=1.25 msec. */
+ pfpEnd(PFP_ID_MAIN,0);
+ }
+ pfpDisable(0); /* Disable profile point #0 */
+#endif
+
+ /* 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 Board init");
+
Log_info0("Configure EDMA");
/* Configure eDMA module */
- pfStatus = eDmaConfig();
- if(pfStatus != Platform_EOK)
+ AudStatus = eDmaConfig();
+ if(AudStatus != Aud_EOK)
{
//System_printf("eDMA Configuration Failed!\n");
Log_info0("eDMA Configuration Failed!");
//testRet(1);
}
+#ifdef PASDK_SIO_DEV
Log_info0("initDev2");
initDev2();
-#endif // SIMULATE_SIO
+#endif
+
+#ifdef IO_LOOPBACK_TEST
+ /* Initialize McASP HW details */
+ McaspDevice_init();
+
+ D10_init();
+
+#ifdef INPUT_SPDIF
+ // Input is DIR
+ AudStatus = aud_AudioSelectClkSrc(AUD_AUDIO_CLK_SRC_DIR);
+#else
+ // Input is HDMI
+ AudStatus = aud_AudioSelectClkSrc(AUD_AUDIO_CLK_SRC_I2S);
+#endif
+ if(AudStatus != Aud_EOK)
+ {
+ Log_info0("aud_AudioSelectClkSrc Failed!\n");
+ }
+ aud_delay(50000); // Without delay between these 2 calls system aborts.
+
+ /* Initialize McASP module */
+ status = mcaspAudioConfig();
+ if(status != Aud_EOK)
+ {
+ Log_info0("McASP Configuration Failed!\n");
+ }
+
+ ioSemaphoreCreate();
+
+ audioIoCreate();
+
+ Task_setPri(TaskAfp, -1);
+ Task_setPri(TaskAip, -1);
+ Task_setPri(TaskSysInit, -1);
+ Task_setPri(TaskAsip, 5);
+ Task_setPri(TaskAsop, 5);
+#endif
+
+ Log_info0("McASP device init");
+ /* Initialize McASP SOC level configuration */
+ McaspDevice_init();
+
+ Log_info0("D10 init");
+ /* Initialize audio hardware */
+ D10_init();
Log_info0("IPC start");
- // Initialize IPC
+ /* Initialize IPC */
status = Ipc_start();
if (status < 0)
{