kerneltest/e32test/dma/d_dma.cpp
branchRCL_3
changeset 44 3e88ff8f41d5
parent 43 c1f20ce4abcf
equal deleted inserted replaced
43:c1f20ce4abcf 44:3e88ff8f41d5
   157 	}
   157 	}
   158 
   158 
   159 #endif
   159 #endif
   160 
   160 
   161 
   161 
   162 #ifndef DMA_APIV2
       
   163 static TInt FragmentCount(DDmaRequest* aRequest)
   162 static TInt FragmentCount(DDmaRequest* aRequest)
   164 	{
   163 	{
   165 	TInt count = 0;
   164 	TInt count = 0;
   166 	for (SDmaDesHdr* pH = aRequest->iFirstHdr; pH != NULL; pH = pH->iNext)
   165 	for (SDmaDesHdr* pH = aRequest->iFirstHdr; pH != NULL; pH = pH->iNext)
   167 		count++;
   166 		count++;
   168 	return count;
   167 	return count;
   169 	}
   168 	}
   170 #endif
       
   171 
   169 
   172 
   170 
   173 //////////////////////////////////////////////////////////////////////////////
   171 //////////////////////////////////////////////////////////////////////////////
   174 
   172 
   175 class DDmaTestChannel : public DLogicalChannelBase
   173 class DDmaTestChannel : public DLogicalChannelBase
   258 		info.iDfcPriority = 3;
   256 		info.iDfcPriority = 3;
   259 		info.iDesCount = infoBuf().U.iOpen.iDesCount;
   257 		info.iDesCount = infoBuf().U.iOpen.iDesCount;
   260 		r = TDmaChannel::Open(info, iChannel);
   258 		r = TDmaChannel::Open(info, iChannel);
   261 		if (r!= KErrNone)
   259 		if (r!= KErrNone)
   262 			return r;
   260 			return r;
   263 
       
   264 		// ---> Code coverage of rarely called functions
       
   265 		const TDmac* const c = iChannel->Controller();
       
   266 		if (!c)
       
   267 			return KErrGeneral;
       
   268 		const TInt mts = iChannel->MaxTransferSize(0, iCookie);
       
   269 		if (mts == 0)
       
   270 			return KErrGeneral;
       
   271 		const TUint mam = iChannel->MemAlignMask(0, iCookie);
       
   272 		if (~mam == 0)
       
   273 			return KErrGeneral;
       
   274 		// <--- Code coverage of rarely called functions
       
   275 
       
   276 		iClient = &Kern::CurrentThread();
   261 		iClient = &Kern::CurrentThread();
   277 		for (TInt i=0; i<KMaxRequests; ++i)
   262 		for (TInt i=0; i<KMaxRequests; ++i)
   278 			{
   263 			{
   279 			r = Kern::CreateClientRequest(iClientRequests[i]);
   264 			r = Kern::CreateClientRequest(iClientRequests[i]);
   280 			if (r!=KErrNone)
   265 			if (r!=KErrNone)
   401 		return iChannel->FailNext((TInt)a1);
   386 		return iChannel->FailNext((TInt)a1);
   402 	case RTestDma::EFragmentCount:
   387 	case RTestDma::EFragmentCount:
   403 		{
   388 		{
   404 		TInt reqIdx = (TInt)a1;
   389 		TInt reqIdx = (TInt)a1;
   405 		__ASSERT_DEBUG(0 <= reqIdx && reqIdx < KMaxRequests, Kern::PanicCurrentThread(KClientPanicCat, __LINE__));
   390 		__ASSERT_DEBUG(0 <= reqIdx && reqIdx < KMaxRequests, Kern::PanicCurrentThread(KClientPanicCat, __LINE__));
   406 #ifdef DMA_APIV2
       
   407 		return iRequests[reqIdx]->FragmentCount();
       
   408 #else
       
   409 		return FragmentCount(iRequests[reqIdx]);
   391 		return FragmentCount(iRequests[reqIdx]);
   410 #endif
       
   411 		}
   392 		}
   412 	case RTestDma::EMissInterrupts:
   393 	case RTestDma::EMissInterrupts:
   413 		return iChannel->MissNextInterrupts((TInt)a1);
   394 		return iChannel->MissNextInterrupts((TInt)a1);
   414 	default:
   395 	default:
   415 		Kern::PanicCurrentThread(KClientPanicCat, __LINE__);
   396 		Kern::PanicCurrentThread(KClientPanicCat, __LINE__);