X-Git-Url: https://git.ti.com/gitweb?p=keystone-rtos%2Ftcp3d-lld.git;a=blobdiff_plain;f=example%2Fsrc%2Ftcp3d_example_main.c;h=d0ca8979f7e5744846ee7ca9543ae60d551c8bc5;hp=34716606cc5171559a57557e7e174b7e4d3112f8;hb=6dbf7010d5edc6386e99284b1a45e0e574e7479f;hpb=b818373df7129ea894e2f044d15f2c53b0e020ea diff --git a/example/src/tcp3d_example_main.c b/example/src/tcp3d_example_main.c index 3471660..d0ca897 100644 --- a/example/src/tcp3d_example_main.c +++ b/example/src/tcp3d_example_main.c @@ -126,7 +126,7 @@ cbTestDesc codeBlockSet; Char *strMode[4] = {"3GPP(0)","LTE(1)","WIMAX(2)","WCDMA Split(3)"}; Char *strDBuf[2] = {"Disable(0)","Enable(1)"}; -Char *strInst[2] = {"TCP3D_A(0)","TCP3D_B(1)"}; +Char *strInst[2] = {"TCP3D_0(0)","TCP3D_1(1)"}; UInt32 keepTestVectMem = 0; UInt32 firstTime = 1; @@ -230,6 +230,9 @@ Void revt1ChCallback(Void); /** * Cache and other IP functions */ +#ifndef SIMULATOR_SUPPORT +static Int32 enable_ip_instance (UInt32 pwrDmnNum, UInt32 moduleNum); +#endif static Int32 enable_tcp3d (void); void tcp3dBeginMemAccess (void *ptr, uint32_t size); void tcp3dEndMemAccess (void *ptr, uint32_t size); @@ -360,14 +363,7 @@ Void testerTaskFunc(Void) dspCoreID = CSL_chipReadDNUM(); /******** Select the TCP3D Instance Number **********/ -#if 0 - if ( dspCoreID == 0 ) // Core 0 - instNum = CSL_TCP3D_A; - else - instNum = CSL_TCP3D_B; -#else instNum = getTcp3dInstNum(dspCoreID); -#endif /* Initialize the default Task parameters */ Task_Params_init(&taskParams); @@ -1233,45 +1229,87 @@ Void allDeInit(Void) } } +#ifndef SIMULATOR_SUPPORT /** * @b Description * @n - * This function enables the power/clock domains for TCP3D. + * This function enables the power/clock domains for the + * specified power domain and module. * * @retval - * Not Applicable. + * 0 for enabling power domain, -1 for failure */ -static Int32 enable_tcp3d (void) +static Int32 enable_ip_instance (UInt32 pwrDmnNum, UInt32 moduleNum) { -#ifndef SIMULATOR_SUPPORT - /* TCP3D power domain is turned OFF by default. - * It needs to be turned on before doing any TCP3D device register access. - * This is not required for the simulator. */ - - /* Set TCP3D Power domain to ON */ - CSL_PSC_enablePowerDomain (TEST_CSL_PSC_PD_TCP3D); + /* Power domains are turned OFF by default for many IP blocks. It + * needs to be turned on before doing any device + * register access. + */ + /* Set IP block Power domain to ON */ + CSL_PSC_enablePowerDomain (pwrDmnNum); - /* Enable the clocks too for TCP3D */ - CSL_PSC_setModuleNextState (TEST_CSL_PSC_LPSC_TCP3D, PSC_MODSTATE_ENABLE); + /* Enable the clocks too for the IP block */ + CSL_PSC_setModuleNextState (moduleNum, PSC_MODSTATE_ENABLE); /* Start the state transition */ - CSL_PSC_startStateTransition (TEST_CSL_PSC_PD_TCP3D); + CSL_PSC_startStateTransition (pwrDmnNum); /* Wait until the state transition process is completed. */ - while (!CSL_PSC_isStateTransitionDone (TEST_CSL_PSC_PD_TCP3D)); + while (!CSL_PSC_isStateTransitionDone (pwrDmnNum)); - /* Return TCP3D PSC status */ - if ((CSL_PSC_getPowerDomainState(TEST_CSL_PSC_PD_TCP3D) == PSC_PDSTATE_ON) && - (CSL_PSC_getModuleState (TEST_CSL_PSC_LPSC_TCP3D) == PSC_MODSTATE_ENABLE)) + /* Return IP block PSC status */ + if ((CSL_PSC_getPowerDomainState(pwrDmnNum) == PSC_PDSTATE_ON) && + (CSL_PSC_getModuleState (moduleNum) == PSC_MODSTATE_ENABLE)) { - /* TCP3D ON. Ready for use */ + /* IP block ON. Ready for use */ return 0; } else { - /* TCP3D Power on failed. Return error */ + /* IP block power on failed. Return error */ return -1; } +} +#endif + +/** + * @b Description + * @n + * This function enables the power/clock domains for TCP3D. + * + * @retval + * Not Applicable. + */ +static Int32 enable_tcp3d (void) +{ +#ifndef SIMULATOR_SUPPORT + Int32 result; + UInt32 coreID = CSL_chipReadDNUM(); + + /* TCP3D power domain is turned OFF by default. + * It needs to be turned on before doing any TCP3D device register access. + * This is not required for the simulator. + */ +#if (CSL_TCP3D_PER_CNT > 1) + + if (coreID == 0) + { + result = enable_ip_instance (TEST_CSL_PSC_PD_TCP3D_0, + TEST_CSL_PSC_LPSC_TCP3D_0); + } + else + { + result = enable_ip_instance (TEST_CSL_PSC_PD_TCP3D_1, + TEST_CSL_PSC_LPSC_TCP3D_1); + } +#else + + result = enable_ip_instance (TEST_CSL_PSC_PD_TCP3D_0, + TEST_CSL_PSC_LPSC_TCP3D_0); + +#endif /* CSL_TCP3D_PER_CNT > 1 */ + + return (result); #else /* PSC is not supported on simulator. Return success always */ return 0;