kerneltest/e32test/nkernsa/testdfc.cpp
changeset 90 947f0dc9f7a8
parent 0 a41df078684a
child 257 3e88ff8f41d5
equal deleted inserted replaced
52:2d65c2f76d7b 90:947f0dc9f7a8
  1197 void TDfcX::ThreadActivity()
  1197 void TDfcX::ThreadActivity()
  1198 	{
  1198 	{
  1199 	TInt ncpus = NKern::NumberOfCpus();
  1199 	TInt ncpus = NKern::NumberOfCpus();
  1200 	TInt ocpu = NKern::CurrentCpu();
  1200 	TInt ocpu = NKern::CurrentCpu();
  1201 	NThread* pC = NKern::CurrentThread();
  1201 	NThread* pC = NKern::CurrentThread();
  1202 	volatile TUint32* pX = (volatile TUint32*)&pC->iRunCount32[1];	// HACK!
  1202 	volatile TUint32* pX = (volatile TUint32*)&pC->iRunCount.i32[1];	// HACK!
  1203 	TInt cpu = ocpu;
  1203 	TInt cpu = ocpu;
  1204 	TInt i;
  1204 	TInt i;
  1205 	if ((iS->iMode & TDfcStress::EMode_SelfMigrate) && !pC->iEvents.IsEmpty())
  1205 	if ((iS->iMode & TDfcStress::EMode_SelfMigrate) && !pC->iEvents.IsEmpty())
  1206 		{
  1206 		{
  1207 		for (i=0; i<ncpus; ++i)
  1207 		for (i=0; i<ncpus; ++i)
  1427 
  1427 
  1428 void TDfcX::CreateDfcOrTimer()
  1428 void TDfcX::CreateDfcOrTimer()
  1429 	{
  1429 	{
  1430 //	volatile TUint32* xc = 0;
  1430 //	volatile TUint32* xc = 0;
  1431 	NThreadBase* t = iS->iDfcQ[0]->iThread;
  1431 	NThreadBase* t = iS->iDfcQ[0]->iThread;
  1432 	volatile TUint32* xc = &t->iRunCount32[1];	// HACK!
  1432 	volatile TUint32* xc = &t->iRunCount.i32[1];	// HACK!
  1433 	if (!(iFlags & EFlag_Timer))
  1433 	if (!(iFlags & EFlag_Timer))
  1434 		{
  1434 		{
  1435 		TDfc* d = 0;
  1435 		TDfc* d = 0;
  1436 		if (!(iFlags & EFlag_IDFC))
  1436 		if (!(iFlags & EFlag_IDFC))
  1437 			{
  1437 			{
  1438 			d = new TDfc(&TDfcX::DfcFn, this, iDfcQ, 1);
  1438 			d = new TDfc(&TDfcX::DfcFn, this, iDfcQ, 1);
  1439 			xc = (volatile TUint32*)&iDfcQ->iThread->iRunCount32[1];
  1439 			xc = (volatile TUint32*)&iDfcQ->iThread->iRunCount.i32[1];
  1440 			}
  1440 			}
  1441 		else if (iFlags & EFlag_Tied)
  1441 		else if (iFlags & EFlag_Tied)
  1442 			{
  1442 			{
  1443 			d = new TDfc(iXTied, &TDfcX::IDfcFn, this);
  1443 			d = new TDfc(iXTied, &TDfcX::IDfcFn, this);
  1444 			xc = (volatile TUint32*)&iXTied->iRunCount32[1];
  1444 			xc = (volatile TUint32*)&iXTied->iRunCount.i32[1];
  1445 			}
  1445 			}
  1446 		else
  1446 		else
  1447 			d = new TDfc(&TDfcX::IDfcFn, this);
  1447 			d = new TDfc(&TDfcX::IDfcFn, this);
  1448 		__NK_ASSERT_ALWAYS(d!=0);
  1448 		__NK_ASSERT_ALWAYS(d!=0);
  1449 		__e32_atomic_store_rel_ptr(&iDfc, d);
  1449 		__e32_atomic_store_rel_ptr(&iDfc, d);
  1452 		{
  1452 		{
  1453 		NTimer* tmr = 0;
  1453 		NTimer* tmr = 0;
  1454 		if (iFlags & EFlag_DFC)
  1454 		if (iFlags & EFlag_DFC)
  1455 			{
  1455 			{
  1456 			tmr = new NTimer(&TDfcX::TimerDfcFn, this, iDfcQ, 1);
  1456 			tmr = new NTimer(&TDfcX::TimerDfcFn, this, iDfcQ, 1);
  1457 			xc = (volatile TUint32*)&iDfcQ->iThread->iRunCount32[1];
  1457 			xc = (volatile TUint32*)&iDfcQ->iThread->iRunCount.i32[1];
  1458 			}
  1458 			}
  1459 		else if (iFlags & EFlag_Tied)
  1459 		else if (iFlags & EFlag_Tied)
  1460 			{
  1460 			{
  1461 			tmr = new NTimer(iXTied, &TDfcX::TimerIsrFn, this);
  1461 			tmr = new NTimer(iXTied, &TDfcX::TimerIsrFn, this);
  1462 			xc = (volatile TUint32*)&iXTied->iRunCount32[1];
  1462 			xc = (volatile TUint32*)&iXTied->iRunCount.i32[1];
  1463 			}
  1463 			}
  1464 		else
  1464 		else
  1465 			tmr = new NTimer(&TDfcX::TimerIsrFn, this);
  1465 			tmr = new NTimer(&TDfcX::TimerIsrFn, this);
  1466 		__NK_ASSERT_ALWAYS(tmr!=0);
  1466 		__NK_ASSERT_ALWAYS(tmr!=0);
  1467 		__e32_atomic_store_rel_ptr(&iTimer, tmr);
  1467 		__e32_atomic_store_rel_ptr(&iTimer, tmr);