kerneltest/e32test/dmav2/d_dma2.cpp
changeset 243 c7a0ce20c48c
parent 199 189ece41fa29
child 293 0659d0e1a03c
equal deleted inserted replaced
231:75252ea6123b 243:c7a0ce20c48c
   109 	TInt GetChannelCapsByCookie(TUint aDriverCookie, SDmacCaps& aChannelCaps);
   109 	TInt GetChannelCapsByCookie(TUint aDriverCookie, SDmacCaps& aChannelCaps);
   110 	TInt GetChannelCapsByCookie(TUint aDriverCookie, TDmacTestCaps& aChannelCaps);
   110 	TInt GetChannelCapsByCookie(TUint aDriverCookie, TDmacTestCaps& aChannelCaps);
   111 	TInt CancelAllByCookie(TUint aDriverCookie);
   111 	TInt CancelAllByCookie(TUint aDriverCookie);
   112 	TInt IsrRedoRequestByCookie(TUint aDriverCookie,TUint32 aSrcAddr,TUint32 aDstAddr,TInt aTransferCount,TUint32 aPslRequestInfo,TBool aIsrCb);
   112 	TInt IsrRedoRequestByCookie(TUint aDriverCookie,TUint32 aSrcAddr,TUint32 aDstAddr,TInt aTransferCount,TUint32 aPslRequestInfo,TBool aIsrCb);
   113 	TInt IsQueueEmptyByCookie(TUint aDriverCookie, TBool& aQueueEmpty);		
   113 	TInt IsQueueEmptyByCookie(TUint aDriverCookie, TBool& aQueueEmpty);		
   114 	TInt ChannelIsOpenedByCookie(TUint aDriverCookie, TBool& aChannelOpen);		
   114 	TInt ChannelIsOpenedByCookie(TUint aDriverCookie, TBool& aChannelOpen);	
       
   115 	TInt EnableDstElementCountingByCookie(TUint aDriverCookie);
       
   116 	TInt EnableSrcElementCountingByCookie(TUint aDriverCookie);
       
   117 	TInt DisableDstElementCountingByCookie(TUint aDriverCookie);
       
   118 	TInt DisableSrcElementCountingByCookie(TUint aDriverCookie);
       
   119 	TInt TotalNumDstElementsTransferredByCookie(TUint aDriverCookie);
       
   120 	TInt TotalNumSrcElementsTransferredByCookie(TUint aDriverCookie);
   115 	void CloseDmaChannelByIndex(TInt aIndex);
   121 	void CloseDmaChannelByIndex(TInt aIndex);
   116 	void CancelAllByIndex(TInt aIndex);
   122 	void CancelAllByIndex(TInt aIndex);
   117 	TInt LinkDmaChannelByIndex(TInt aIndex);
   123 	TInt LinkDmaChannelByIndex(TInt aIndex);
   118 	TInt UnlinkDmaChannelByIndex(TInt aIndex);
   124 	TInt UnlinkDmaChannelByIndex(TInt aIndex);
   119 	TInt PauseDmaChannelByIndex(TInt aIndex);
   125 	TInt PauseDmaChannelByIndex(TInt aIndex);
   120 	TInt ResumeDmaChannelByIndex(TInt aIndex);		
   126 	TInt ResumeDmaChannelByIndex(TInt aIndex);		
   121 	TInt IsrRedoRequestByIndex(TInt aIndex,TUint32 aSrcAddr,TUint32 aDstAddr,TInt aTransferCount,TUint32 aPslRequestInfo,TBool aIsrCb);
   127 	TInt IsrRedoRequestByIndex(TInt aIndex,TUint32 aSrcAddr,TUint32 aDstAddr,TInt aTransferCount,TUint32 aPslRequestInfo,TBool aIsrCb);
       
   128 	void EnableDstElementCountingByIndex(TInt aIndex);
       
   129 	void EnableSrcElementCountingByIndex(TInt aIndex);
       
   130 	void DisableDstElementCountingByIndex(TInt aIndex);
       
   131 	void DisableSrcElementCountingByIndex(TInt aIndex);
       
   132 	TInt TotalNumDstElementsTransferredByIndex(TInt aIndex);
       
   133 	TInt TotalNumSrcElementsTransferredByIndex(TInt aIndex);
   122 	TInt CreateSharedChunk();
   134 	TInt CreateSharedChunk();
   123 	TUint OpenSharedChunkHandle();
   135 	TUint OpenSharedChunkHandle();
   124 
   136 
   125 	/**
   137 	/**
   126 	Creates a new kernel-side DMA request object, associated with a previously
   138 	Creates a new kernel-side DMA request object, associated with a previously
   147 	TInt FragmentRequest(TUint aRequestCookie, const TDmaTransferArgs& aTransferArgs, TBool aLegacy=ETrue);
   159 	TInt FragmentRequest(TUint aRequestCookie, const TDmaTransferArgs& aTransferArgs, TBool aLegacy=ETrue);
   148 
   160 
   149 	TInt QueueRequest(TUint aRequestCookie, TRequestStatus* aStatus, TCallbackRecord* aRecord, TUint64* aDurationMicroSecs);
   161 	TInt QueueRequest(TUint aRequestCookie, TRequestStatus* aStatus, TCallbackRecord* aRecord, TUint64* aDurationMicroSecs);
   150 	DClientDmaRequest* RequestFromCookie(TUint aRequestCookie) const;
   162 	DClientDmaRequest* RequestFromCookie(TUint aRequestCookie) const;
   151 	TInt RequestFragmentCount(TUint aRequestCookie);
   163 	TInt RequestFragmentCount(TUint aRequestCookie);
   152 
       
   153 	TDmaV2TestInfo ConvertTestInfo(const TDmaTestInfo& aOldInfo) const;
   164 	TDmaV2TestInfo ConvertTestInfo(const TDmaTestInfo& aOldInfo) const;
   154 private:
   165 private:
   155 	DThread* iClient;
   166 	DThread* iClient;
   156 	TDynamicDfcQue* iDfcQ;
   167 	TDynamicDfcQue* iDfcQ;
   157 	TDynamicDfcQue* iIsrCallbackDfcQ; // Will be used by requests which complete with an ISR callback
   168 	TDynamicDfcQue* iIsrCallbackDfcQ; // Will be used by requests which complete with an ISR callback
   663 			{
   674 			{
   664 			TUint requestCookie = reinterpret_cast<TUint>(a1);
   675 			TUint requestCookie = reinterpret_cast<TUint>(a1);
   665 			TInt r = RequestFragmentCount(requestCookie);
   676 			TInt r = RequestFragmentCount(requestCookie);
   666 			return r;
   677 			return r;
   667 			}
   678 			}
       
   679 	case RDmaSession::EEnableDstElementCounting:
       
   680 			{		
       
   681 			TUint requestCookie = reinterpret_cast<TUint>(a1);
       
   682 			TInt r = EnableDstElementCountingByCookie(requestCookie);
       
   683 			return r;
       
   684 			}
       
   685 	case RDmaSession::EEnableSrcElementCounting:
       
   686 			{
       
   687 			TUint requestCookie = reinterpret_cast<TUint>(a1);		
       
   688 			TInt r = EnableSrcElementCountingByCookie(requestCookie);
       
   689 			return r;
       
   690 			}
       
   691 	case RDmaSession::EDisableDstElementCounting:
       
   692 			{
       
   693 			TUint requestCookie = reinterpret_cast<TUint>(a1);
       
   694 			TInt r = DisableDstElementCountingByCookie(requestCookie);
       
   695 			return r;
       
   696 			}
       
   697 	case RDmaSession::EDisableSrcElementCounting:
       
   698 			{
       
   699 			TUint requestCookie = reinterpret_cast<TUint>(a1);
       
   700 			TInt r = DisableSrcElementCountingByCookie(requestCookie);
       
   701 			return r;
       
   702 			}
       
   703 	case RDmaSession::ETotalNumDstElementsTransferred:
       
   704 			{
       
   705 			TUint requestCookie = reinterpret_cast<TUint>(a1);
       
   706 			TInt r = TotalNumDstElementsTransferredByCookie(requestCookie);
       
   707 			return r;
       
   708 			}
       
   709 	case RDmaSession::ETotalNumSrcElementsTransferred:
       
   710 			{
       
   711 			TUint requestCookie = reinterpret_cast<TUint>(a1);
       
   712 			TInt r = TotalNumSrcElementsTransferredByCookie(requestCookie);
       
   713 			return r;
       
   714 			}
   668 	case RDmaSession::ERequestOpen:
   715 	case RDmaSession::ERequestOpen:
   669 			{
   716 			{
   670 			RDmaSession::TRequestCreateArgs createArgs(0, EFalse, 0);
   717 			RDmaSession::TRequestCreateArgs createArgs(0, EFalse, 0);
   671 			TPckg<RDmaSession::TRequestCreateArgs> package(createArgs);
   718 			TPckg<RDmaSession::TRequestCreateArgs> package(createArgs);
   672 			Kern::KUDesGet(package, *reinterpret_cast<TDes8*>(a1));
   719 			Kern::KUDesGet(package, *reinterpret_cast<TDes8*>(a1));
  1052 		{
  1099 		{
  1053 		return KErrNotFound;
  1100 		return KErrNotFound;
  1054 		}
  1101 		}
  1055 	}
  1102 	}
  1056 
  1103 
       
  1104 TInt DDmaTestSession::EnableDstElementCountingByCookie(TUint aDriverCookie)
       
  1105 	{
       
  1106 	__KTRACE_OPT(KDMA, Kern::Printf("EnableDstElementCountingByCookie: 0x%08x", aDriverCookie)); 
       
  1107 	const TInt index = CookieToRequestIndex(aDriverCookie);
       
  1108 	
       
  1109 	if(index >= 0)
       
  1110 		{
       
  1111 		EnableDstElementCountingByIndex(index);
       
  1112 		return KErrNone;
       
  1113 		}
       
  1114 	else
       
  1115 		{
       
  1116 		return KErrNotFound;
       
  1117 		}
       
  1118 	}
       
  1119 
       
  1120 void DDmaTestSession::EnableDstElementCountingByIndex(TInt aIndex)
       
  1121 	{
       
  1122 	__KTRACE_OPT(KDMA, Kern::Printf("EnableDstElementCountingByIndex: %d", aIndex)); 		
       
  1123 	__NK_ASSERT_DEBUG(aIndex < iClientDmaReqs.Count()); 
       
  1124 #ifdef DMA_APIV2	
       
  1125 	iClientDmaReqs[aIndex]->EnableDstElementCounting();
       
  1126 #endif
       
  1127 	}
       
  1128 
       
  1129 TInt DDmaTestSession::EnableSrcElementCountingByCookie(TUint aDriverCookie)
       
  1130 	{
       
  1131 	__KTRACE_OPT(KDMA, Kern::Printf("EnableSrcElementCountingByCookie: 0x%08x", aDriverCookie)); 
       
  1132 	const TInt index = CookieToRequestIndex(aDriverCookie);
       
  1133 	
       
  1134 	if(index >= 0)
       
  1135 		{
       
  1136 		EnableSrcElementCountingByIndex(index);
       
  1137 		return KErrNone;
       
  1138 		}
       
  1139 	else
       
  1140 		{
       
  1141 		return KErrNotFound;
       
  1142 		}
       
  1143 	}
       
  1144 
       
  1145 void DDmaTestSession::EnableSrcElementCountingByIndex(TInt aIndex)
       
  1146 	{
       
  1147 	__KTRACE_OPT(KDMA, Kern::Printf("EnableSrcElementCountingByIndex: %d", aIndex)); 		
       
  1148 	__NK_ASSERT_DEBUG(aIndex < iClientDmaReqs.Count()); 
       
  1149 	
       
  1150 #ifdef DMA_APIV2
       
  1151 	iClientDmaReqs[aIndex]->EnableSrcElementCounting();
       
  1152 #endif
       
  1153 	}
       
  1154 
       
  1155 TInt DDmaTestSession::DisableDstElementCountingByCookie(TUint aDriverCookie)
       
  1156 	{
       
  1157 	__KTRACE_OPT(KDMA, Kern::Printf("DisableDstElementCountingByCookie: 0x%08x", aDriverCookie)); 
       
  1158 	const TInt index = CookieToRequestIndex(aDriverCookie);
       
  1159 	
       
  1160 	if(index >= 0)
       
  1161 		{
       
  1162 		DisableDstElementCountingByIndex(index);
       
  1163 		return KErrNone;
       
  1164 		}
       
  1165 	else
       
  1166 		{
       
  1167 		return KErrNotFound;
       
  1168 		}
       
  1169 	}
       
  1170 
       
  1171 void DDmaTestSession::DisableDstElementCountingByIndex(TInt aIndex)
       
  1172 	{
       
  1173 	__KTRACE_OPT(KDMA, Kern::Printf("DisableDstElementCountingByIndex: %d", aIndex)); 		
       
  1174 	__NK_ASSERT_DEBUG(aIndex < iClientDmaReqs.Count()); 
       
  1175 #ifdef DMA_APIV2
       
  1176 	iClientDmaReqs[aIndex]->DisableDstElementCounting();
       
  1177 #endif
       
  1178 	}
       
  1179 
       
  1180 TInt DDmaTestSession::DisableSrcElementCountingByCookie(TUint aDriverCookie)
       
  1181 	{
       
  1182 	__KTRACE_OPT(KDMA, Kern::Printf("DisableSrcElementCountingByCookie: 0x%08x", aDriverCookie)); 
       
  1183 	const TInt index = CookieToRequestIndex(aDriverCookie);
       
  1184 	
       
  1185 	if(index >= 0)
       
  1186 		{
       
  1187 		DisableSrcElementCountingByIndex(index);
       
  1188 		return KErrNone;
       
  1189 		}
       
  1190 	else
       
  1191 		{
       
  1192 		return KErrNotFound;
       
  1193 		}
       
  1194 	}
       
  1195 
       
  1196 void DDmaTestSession::DisableSrcElementCountingByIndex(TInt aIndex)
       
  1197 	{
       
  1198 	__KTRACE_OPT(KDMA, Kern::Printf("DisableSrcElementCountingByIndex: %d", aIndex)); 		
       
  1199 	__NK_ASSERT_DEBUG(aIndex < iClientDmaReqs.Count()); 
       
  1200 #ifdef DMA_APIV2
       
  1201 	iClientDmaReqs[aIndex]->DisableSrcElementCounting();
       
  1202 #endif
       
  1203 	}
       
  1204 
       
  1205 TInt DDmaTestSession::TotalNumDstElementsTransferredByCookie(TUint aDriverCookie)
       
  1206 	{
       
  1207 	__KTRACE_OPT(KDMA, Kern::Printf("TotalNumDstElementsTransferredByCookie: 0x%08x", aDriverCookie)); 
       
  1208 	const TInt index = CookieToRequestIndex(aDriverCookie);
       
  1209 	
       
  1210 	if(index >= 0)
       
  1211 		{
       
  1212 		TInt r = TotalNumDstElementsTransferredByIndex(index);
       
  1213 		return r;
       
  1214 		}
       
  1215 	else
       
  1216 		{
       
  1217 		return KErrNotFound;
       
  1218 		}
       
  1219 	}
       
  1220 
       
  1221 TInt DDmaTestSession::TotalNumDstElementsTransferredByIndex(TInt aIndex)
       
  1222 	{
       
  1223 	__KTRACE_OPT(KDMA, Kern::Printf("TotalNumDstElementsTransferredByIndex: %d", aIndex)); 		
       
  1224 	__NK_ASSERT_DEBUG(aIndex < iClientDmaReqs.Count()); 
       
  1225 	
       
  1226 #ifdef DMA_APIV2
       
  1227 	TInt r = iClientDmaReqs[aIndex]->TotalNumDstElementsTransferred();
       
  1228 	return r;
       
  1229 #else
       
  1230 	return KErrNotSupported;
       
  1231 #endif
       
  1232 	}
       
  1233 
       
  1234 TInt DDmaTestSession::TotalNumSrcElementsTransferredByCookie(TUint aDriverCookie)
       
  1235 	{
       
  1236 	__KTRACE_OPT(KDMA, Kern::Printf("TotalNumSrcElementsTransferredByCookie: 0x%08x", aDriverCookie)); 
       
  1237 	const TInt index = CookieToRequestIndex(aDriverCookie);
       
  1238 	
       
  1239 	if(index >= 0)
       
  1240 		{
       
  1241 		TInt r = TotalNumSrcElementsTransferredByIndex(index);
       
  1242 		return r;
       
  1243 		}
       
  1244 	else
       
  1245 		{
       
  1246 		return KErrNotFound;
       
  1247 		}
       
  1248 	}
       
  1249 
       
  1250 TInt DDmaTestSession::TotalNumSrcElementsTransferredByIndex(TInt aIndex)
       
  1251 	{
       
  1252 	__KTRACE_OPT(KDMA, Kern::Printf("TotalNumSrcElementsTransferredByIndex: %d", aIndex)); 		
       
  1253 	__NK_ASSERT_DEBUG(aIndex < iClientDmaReqs.Count()); 
       
  1254 	
       
  1255 #ifdef DMA_APIV2
       
  1256 	TInt r = iClientDmaReqs[aIndex]->TotalNumSrcElementsTransferred();
       
  1257 	return r;
       
  1258 #else
       
  1259 	return KErrNotSupported;
       
  1260 #endif
       
  1261 	}
  1057 TInt DDmaTestSession::IsrRedoRequestByCookie(TUint aDriverCookie,TUint32 aSrcAddr,TUint32 aDstAddr,TInt aTransferCount,TUint32 aPslRequestInfo,TBool aIsrCb)
  1262 TInt DDmaTestSession::IsrRedoRequestByCookie(TUint aDriverCookie,TUint32 aSrcAddr,TUint32 aDstAddr,TInt aTransferCount,TUint32 aPslRequestInfo,TBool aIsrCb)
  1058 {
  1263 {
  1059 	__KTRACE_OPT(KDMA, Kern::Printf("IsrRedoRequestByCookie: 0x%08x", aDriverCookie)); 
  1264 	__KTRACE_OPT(KDMA, Kern::Printf("IsrRedoRequestByCookie: 0x%08x", aDriverCookie)); 
  1060 	const TInt index = CookieToChannelIndex(aDriverCookie);
  1265 	const TInt index = CookieToChannelIndex(aDriverCookie);
  1061 	
  1266