本帖最后由 一只耳朵怪 于 2018-6-19 10:45 编辑
我用的硬件是TMDSEVM6678LE评估版,CCS5.2,pdk_C6678_1_1_2_5。我想将测试SRIO内环的工程(路径C:
tipdk_C6678_1_1_2_5packagestidrvsrioexampleSRIOLoopbackDioIsr)和测试网络的工程(路径C:tipdk_C6678_1_1_2_5packagestidrvpaexampleemacExample)合并成一个工程。我的整个工程如附件所示(编译时要将附件中SRIO_LoopbackDioIsrexampleproject文件夹内的emac包含进去)。我的做法是:将emacExample中的C代码加入SRIOLoopbackDioIsr工程中,cfg文件用loopbackDioIsr.cfg。下边是main函数:
Void main(Void)
[
Task_Params cpswTaskParams;
/* Get the core number. */
coreNum = CSL_chipReadReg (CSL_CHIP_DNUM);
#if 0 //SRIO测试函数
Task_Params taskParams;
#ifdef SIMULATOR_SUPPORT
#warn SRIO DIO LSU ISR example is not supported on SIMULATOR !!!
System_printf ("SRIO DIO LSU ISR example is not supported on SIMULATOR. Exiting!n");
return;
#else
System_printf ("Executing the SRIO DIO example on the DEVICEn");
#endif
/* Initialize the system only if the core was configured to do so. */
if (coreNum == 0)
[
System_printf ("Debug(Core %d): System Initialization for CPPI & QMSSn", coreNum);
/* System Initialization */
if (system_init() < 0)
return;
//Cpsw_SingleCoreApp();
/* Power on SRIO peripheral before using it */
if (enable_srio () < 0)
[
System_printf ("Error: SRIO PSC Initialization Failedn");
return;
]
/* Device Specific SRIO Initializations: This should always be called before
* initializing the SRIO Driver. */
if (SrioDevice_init() < 0)
return;
/* Initialize the SRIO Driver */
if (Srio_init () < 0)
[
System_printf ("Error: SRIO Driver Initialization Failedn");
return;
]
/* SRIO Driver is operational at this time. */
System_printf ("Debug(Core %d): SRIO Driver has been initializedn", coreNum);
/* Write to the SHARED memory location at this point in time. The other cores cannot execute
* till the SRIO Driver is up and running. */
isSRIOInitialized[0] = 1;
/* The SRIO IP block has been initialized. We need to writeback the cache here because it will
* ensure that the rest of the cores which are waiting for SRIO to be initialized would now be
* woken up. */
CACHE_wbL1d ((void *) &isSRIOInitialized[0], 128, CACHE_WAIT);
]
else
[
/* All other cores need to wait for the SRIO to be initialized before they proceed. */
System_printf ("Debug(Core %d): Waiting for SRIO to be initialized.n", coreNum);
/* All other cores loop around forever till the SRIO is up and running.
* We need to invalidate the cache so that we always read this from the memory. */
while (isSRIOInitialized[0] == 0)
CACHE_invL1d ((void *) &isSRIOInitialized[0], 128, CACHE_WAIT);
/* Start the QMSS. */
if (Qmss_start() != QMSS_SOK)
[
System_printf ("Error: Unable to start the QMSSn");
return;
]
//Cpsw_SingleCoreApp();
System_printf ("Debug(Core %d): SRIO can now be used.n", coreNum);
]
if (coreNum == 0)
[
/* Create the DIO Example Task.*/
Task_Params_init(&taskParams);
taskParams.priority = 1;
Task_create(dioExampleTask, &taskParams, NULL);
]
#endif
#if 1 //emac测试函数
if (!cpswSimTest)
[
passPowerUp();
]
/* Initialize the task params */
Task_Params_init(&cpswTaskParams);
//cpswTaskParams.priority = 2;
/* Create the CPSW single core example task */
Task_create((Task_FuncPtr)&Cpsw_SingleCoreApp, &cpswTaskParams, NULL);
#endif
/* Start the BIOS */
BIOS_start();
]
main 函数中有两个测试函数,一个是网络测试函数,一个是SRIO测试函数,每个函数单独测试,运行正常。现在我想将两者一起用,即在一个核中既运行网络测试函数,又可以运行SRIO函数。我的做法参考了
http://e2e.ti.com/support/dsp/c6000_multi-core_dsps/f/639/t/198711.aspx,改法如下:
1.对Cpsw_SingleCoreApp任务的Init_Qmss函数中的
qmssInitConfig.maxDescNum = NUM_HOST_DESC;修改成qmssInitConfig.maxDescNum = NUM_HOST_DESC+128;
memset (gHostDesc, 0, SIZE_HOST_DESC * (NUM_HOST_DESC));修改成memset (gHostDesc, 0, SIZE_HOST_DESC * (NUM_HOST_DESC+128));
memCfg.descNum = NUM_HOST_DESC;修改成memCfg.descNum = NUM_HOST_DESC+128;
cppiDescCfg.descNum = NUM_HOST_DESC修改成cppiDescCfg.descNum = NUM_HOST_DESC+128;
2.由于SRIO和emac都初始化了QMSS,将SRIO的QMSS初始化加到Cpsw_SingleCoreApp函数中;
.SRIO的QMSS初始化函数如下:
void mysrioqmssinit() [
Int32 result; Qmss_MemRegInfo memRegInfo;
/* Memory Region 1Configuration */
memRegInfo.descBase = (UInt32 *)Convert_CoreLocal2GlobalAddr((UInt32)gHostDesc);
memRegInfo.descSize = SIZE_HOST_DESC;
memRegInfo.descNum = NUM_HOST_DESC;
memRegInfo.manageDescFlag = Qmss_ManageDesc_MANAGE_DESCRIPTOR;
memRegInfo.memRegion = Qmss_MemRegion_MEMORY_REGION1;//Qmss_MemRegion_MEMORY_REGION_NOT_SPECIFIED;
memRegInfo.startIndex = 128;
/* Initialize and inset the memory region. */
//Success - Inserted Memory region index. Range is 0 to 19.
//Failure - QMSS_INVALID_PARAM
// Failure - QMSS_NOT_INITIALIZED
// Failure - QMSS_MEMREGION_ALREADY_INITIALIZED
//Failure - QMSS_MEMREGION_INVALID_PARAM
//Failure - QMSS_MAX_DESCRIPTORS_CONFIGURED
//Failure - QMSS_MEMREGION_INVALID_INDEX
//Failure - QMSS_MEMREGION_OVERLAP
//Failure - QMSS_QUEUE_OPEN_ERROR
//Failure - QMSS_RESOURCE_MEMORY_REGION_INIT_DENIED
//Failure - QMSS_RESOURCE_LINKING_RAM_INIT_DENIED
result = Qmss_insertMemoryRegion (&memRegInfo);
if (result < QMSS_SOK)
[
System_printf ("Error inserting memory region: %dn", result);
return;
]
]
3.在Cpsw_SingleCoreApp中初始化顺序如下:
Init_Qmss();
mysrioqmssinit();
Init_Cppi ();
Init_PASS ();
Init_Cpsw ();
Setup_Tx ();
Setup_Rx ();
Setup_PASS ();
4.运行结果:在函数mysrioqmssinit()中 result = Qmss_insertMemoryRegion (&memRegInfo)的返回值为-135,但是emac函数运行正常;
现在我的问题是:
1.我这样初始化正确与否?哪里出了毛病?
2.将srio和emac合并,还需要做什么修改?
0