kerneltest/e32test/dma/t_dma.cpp
changeset 109 b3a1d9898418
parent 102 ef2a444a7410
equal deleted inserted replaced
102:ef2a444a7410 109:b3a1d9898418
   464 	TInt fragSize = initialFragmentSize;
   464 	TInt fragSize = initialFragmentSize;
   465 	TInt step = 0;
   465 	TInt step = 0;
   466 	do
   466 	do
   467 		{
   467 		{
   468 		fragSize -= step;
   468 		fragSize -= step;
   469 		// make sure size is aligned
   469 
       
   470 		// Make sure size is aligned
   470 		fragSize = fragSize & ~Info.iMemAlignMask;
   471 		fragSize = fragSize & ~Info.iMemAlignMask;
       
   472 		if(fragSize == 0)
       
   473 			break;
   471 
   474 
   472 		r = OpenChannel(iMaxFragCount, fragSize);
   475 		r = OpenChannel(iMaxFragCount, fragSize);
   473 		test_KErrNone(r);
   476 		test_KErrNone(r);
   474 
   477 
   475 		for(iFragCount=1; iFragCount <= iMaxFragCount; iFragCount++)
   478 		for(iFragCount=1; iFragCount <= iMaxFragCount; iFragCount++)
   476 			{
   479 			{
   477 			test.Printf(_L("Fragment size %d bytes, %d fragments\nIter: "), fragSize, iFragCount);
   480 			test.Printf(_L("Chan %d Fragment size %d bytes, %d fragments, %d iters\n"), iChannelId, fragSize, iFragCount, iInnerIterations);
   478 			for(TInt i=0; i<iInnerIterations; i++)
   481 			for(TInt i=0; i<iInnerIterations; i++)
   479 				{
   482 				{
   480 
       
   481 				test.Printf(_L("%d "), i);
       
   482 				r = Transfer(fragSize);
   483 				r = Transfer(fragSize);
   483 				test_KErrNone(r);
   484 				test_KErrNone(r);
   484 
       
   485 				}
   485 				}
   486 			test.Printf(_L("\n"));
       
   487 			}
   486 			}
   488 		iChannel.Close();
   487 		iChannel.Close();
   489 		// Reduce frag size by an eigth each iteration
   488 		// Reduce frag size by a quarter each iteration
   490 		step = (fragSize/8);
   489 		step = (fragSize/4);
   491 		} while (step > 0);
   490 		} while (step > 0);
   492 
   491 
   493 	iTimer.Close();
   492 	iTimer.Close();
   494 
   493 
   495 	test.Close();
   494 	test.Close();
   525 	iTimer.After(timerStatus, microSecTimeout);
   524 	iTimer.After(timerStatus, microSecTimeout);
   526 
   525 
   527 	User::WaitForRequest(rs, timerStatus);
   526 	User::WaitForRequest(rs, timerStatus);
   528 	if(rs.Int() == KRequestPending)
   527 	if(rs.Int() == KRequestPending)
   529 		{
   528 		{
   530 		RDebug::Print(_L("Transfer timed out!"));
   529 		RDebug::Printf("Chan %d: Transfer timed out!", iChannelId);
   531 		// timed out
   530 		// timed out
   532 		test(EFalse);
   531 		test(EFalse);
   533 		}
   532 		}
   534 	iTimer.Cancel();
   533 	iTimer.Cancel();
   535 	test_KErrNone(rs.Int());
   534 	test_KErrNone(rs.Int());
  1186 	// Use fewer iterations on the emulator
  1185 	// Use fewer iterations on the emulator
  1187 	// since it is slower. Also this test is really
  1186 	// since it is slower. Also this test is really
  1188 	// intended to find errors in PSL implmentations
  1187 	// intended to find errors in PSL implmentations
  1189 	const TInt iterPerFragSize = 1;
  1188 	const TInt iterPerFragSize = 1;
  1190 #else
  1189 #else
  1191 	const TInt iterPerFragSize = 30;
  1190 	const TInt iterPerFragSize = 10;
  1192 #endif
  1191 #endif
  1193 	const TInt rangeMaxFragCount = 8;
  1192 	const TInt rangeMaxFragCount = 5;
  1194 
  1193 
  1195 	test.Next(_L("sb"));
  1194 	test.Next(_L("sb"));
  1196 	RunSbTest(maxchannel, new CFragSizeRange(1, rangeMaxFragCount, rangeFragSize, iterPerFragSize));
  1195 	RunSbTest(maxchannel, new CFragSizeRange(1, rangeMaxFragCount, rangeFragSize, iterPerFragSize));
  1197 	test.Next(_L("db"));
  1196 	test.Next(_L("db"));
  1198 	RunDbTest(maxchannel, new CFragSizeRange(1, rangeMaxFragCount, rangeFragSize, iterPerFragSize));
  1197 	RunDbTest(maxchannel, new CFragSizeRange(1, rangeMaxFragCount, rangeFragSize, iterPerFragSize));