测试notify前想先测试2个核的semaphore传递信号,程序很简单: 在.cfg里加入semaphore,并设为0: Program.global.semHandle = Semaphore.create(0); 在.c文件的任务里加入如下语句:0核打印,打印完释放semHandle ,1核等semHandle ,semHandle 来了 再打印: coreId = CSL_chipReadReg (CSL_CHIP_DNUM); switch(coreId)
{
case 0:
platform_write("Core %d is working! \n",coreId);
for(i=0;i<3;i++)
{
platform_write("Core %d is working on count %d! \n",coreId,i);
}
Semaphore_post(semHandle);
platform_write("Core %d Mission Complete,and Semaphore is %d \n",coreId,Semaphore_getCount(semHandle));
break;
case 1:
Semaphore_pend(semHandle,BIOS_WAIT_FOREVER);
platform_write("Core 1 is working! \n");
for(i=0;i<Led_Light_Cnt;i++)
{
platform_write("Core 1 is working on count %d! \n",i);
} break; default:
break;
}
可是运行结果总是0核打印正常,Semaphore_post 之后 Semaphore 也为1了,可是1核就是不打印啊,核1在Semaphore_pend(semHandle,BIOS_WAIT_FOREVER)之前的语句都正常执行,之后语句就不行了,传递不过来?!为啥?
|