kernel/eka/include/drivers/dma_v2.h
changeset 152 657f875b013e
parent 139 95f71bcdcdb7
child 232 9143fc12f708
child 247 d8d70de2bd36
equal deleted inserted replaced
139:95f71bcdcdb7 152:657f875b013e
    68 
    68 
    69 	The EKA1 "Fill Mode" can be implemented by omitting KDmaIncSrc.
    69 	The EKA1 "Fill Mode" can be implemented by omitting KDmaIncSrc.
    70 
    70 
    71 	Some peripherals may require a post-increment address mode.
    71 	Some peripherals may require a post-increment address mode.
    72 
    72 
    73 	@see DDmaRequest::Fragment
    73 	@see DDmaRequest::Fragment()
    74 
    74 
    75 	Note: This enum is only required for backwards compatibility with the old
    75 	Note: This enum is only required for backwards compatibility with the old
    76 	DMA framework, it can be removed once this is no longer needed.
    76 	DMA framework, it can be removed once this is no longer needed.
    77 
    77 
    78 	@deprecated
    78 	@deprecated
   335 		operates on the source port descriptor chain.
   335 		operates on the source port descriptor chain.
   336 
   336 
   337 		Works like ExpandDesList except that it uses the iSrcFirstHdr and
   337 		Works like ExpandDesList except that it uses the iSrcFirstHdr and
   338 		iSrcLastHdr fields.
   338 		iSrcLastHdr fields.
   339 
   339 
   340 		@see ExpandDesList
   340 		@see ExpandDesList()
   341 
   341 
   342 		This function can only be used if SDmacCaps::iAsymHwDescriptors is
   342 		This function should only be used if SDmacCaps::iAsymHwDescriptors is
   343 		true, otherwise it will just return KErrGeneral.
   343 		reported as true, as only then the framework will actually use the
       
   344 		allocated descriptors.
   344 
   345 
   345 		@param aCount Number of descriptors to append.
   346 		@param aCount Number of descriptors to append.
   346 
   347 
   347 		@return KErrNone or standard error code.
   348 		@return KErrNone or standard error code.
   348 
   349 
   355 		operates on the destination port descriptor chain.
   356 		operates on the destination port descriptor chain.
   356 
   357 
   357 		Works like ExpandDesList except that it uses the iDstFirstHdr and
   358 		Works like ExpandDesList except that it uses the iDstFirstHdr and
   358 		iDstLastHdr fields.
   359 		iDstLastHdr fields.
   359 
   360 
   360 		@see ExpandDesList
   361 		@see ExpandDesList()
   361 
   362 
   362 		This function can only be used if SDmacCaps::iAsymHwDescriptors is
   363 		This function should only be used if SDmacCaps::iAsymHwDescriptors is
   363 		true, otherwise it will just return KErrGeneral.
   364 		reported as true, as only then the framework will actually use the
       
   365 		allocated descriptors.
   364 
   366 
   365 		@param aCount Number of descriptors to append.
   367 		@param aCount Number of descriptors to append.
   366 
   368 
   367 		@return KErrNone or standard error code.
   369 		@return KErrNone or standard error code.
   368 
   370 
   371 	IMPORT_C TInt ExpandDstDesList(TInt aCount=1);
   373 	IMPORT_C TInt ExpandDstDesList(TInt aCount=1);
   372 
   374 
   373 
   375 
   374 	/** Free resources associated with this request.
   376 	/** Free resources associated with this request.
   375 
   377 
   376 		Assume the request is not being transferred or pending.
   378 		Assumes the request is not being transferred or pending.
       
   379 
       
   380 		@see ExpandDesList()
   377 
   381 
   378 		@released
   382 		@released
   379 	*/
   383 	*/
   380 	IMPORT_C void FreeDesList();
   384 	IMPORT_C void FreeDesList();
   381 
   385 
   382 
   386 
   383 	/** Free resources associated with this request. This function variant
   387 	/** Free resources associated with this request. This function variant
   384 		operates on the source port descriptor chain.
   388 		operates on the source port descriptor chain.
   385 
   389 
   386 		@see FreeDesList
   390 		Assumes the request is not being transferred or pending.
   387 
   391 
   388 		This function can only be used if SDmacCaps::iAsymHwDescriptors is
   392 		@see ExpandSrcDesList()
   389 		true, otherwise it will do nothing.
       
   390 
   393 
   391 		@prototype
   394 		@prototype
   392 	*/
   395 	*/
   393 	IMPORT_C void FreeSrcDesList();
   396 	IMPORT_C void FreeSrcDesList();
   394 
   397 
   395 
   398 
   396 	/** Free resources associated with this request. This function variant
   399 	/** Free resources associated with this request. This function variant
   397 		operates on the destination port descriptor chain.
   400 		operates on the destination port descriptor chain.
   398 
   401 
   399 		@see FreeDesList
   402 		Assumes the request is not being transferred or pending.
   400 
   403 
   401 		This function can only be used if SDmacCaps::iAsymHwDescriptors is
   404 		@see ExpandDstDesList()
   402 		true, otherwise it will do nothing.
       
   403 
   405 
   404 		@prototype
   406 		@prototype
   405 	*/
   407 	*/
   406 	IMPORT_C void FreeDstDesList();
   408 	IMPORT_C void FreeDstDesList();
   407 
   409 
  1195 		requests count has changed in a significant way, either before the
  1197 		requests count has changed in a significant way, either before the
  1196 		channel's Transfer() method is invoked for a request on a previously
  1198 		channel's Transfer() method is invoked for a request on a previously
  1197 		empty request queue, or immediately after the request count has become
  1199 		empty request queue, or immediately after the request count has become
  1198 		zero because of request cancellation or completion.
  1200 		zero because of request cancellation or completion.
  1199 
  1201 
  1200 		Depending on the current value of iQueuedRequests, the PSL may power
  1202 		Depending on the current and previous observed values of
  1201 		down or power up the channel. Note that iQueuedRequests gets accessed
  1203 		iQueuedRequests, the PSL may power down or power up the channel.
  1202 		and changed by different threads, so the PSL needs to take the usual
  1204 
  1203 		precautions when evaluating the variable's value.
  1205 		Note that iQueuedRequests gets accessed and changed by different
       
  1206 		threads, so the PSL needs to take the usual precautions when evaluating
       
  1207 		the variable's value. Also, due to the multithreaded framework
       
  1208 		architecture, there is no guarantee that the function calls always
       
  1209 		arrive at the PSL level in the strict chronological order of
       
  1210 		iQueuedRequests being incremented/decremented in the PIL, i.e. it might
       
  1211 		happen that the PSL finds iQueuedRequests to have the same value in two
       
  1212 		or more consecutive calls (that's why the previous observed value needs
       
  1213 		to be locally available and taken into account). It is however promised
       
  1214 		that before any actual transfer commences the PSL will find the request
       
  1215 		count to be greater than zero and that after the last request has
       
  1216 		finished it will be found to be zero.
  1204 
  1217 
  1205 		None of the internal DMA framework mutexes is being held by the PIL
  1218 		None of the internal DMA framework mutexes is being held by the PIL
  1206 		when calling this function.
  1219 		when calling this function.
       
  1220 
       
  1221 		Here is an example implementation for a derived channel class:
       
  1222 
       
  1223 		@code
       
  1224 
       
  1225 		class TFooDmaChannel : public TDmaSgChannel
       
  1226 			{
       
  1227 			DMutex* iDmaMutex;
       
  1228 			TInt iPrevQueuedRequests;
       
  1229 			virtual void QueuedRequestCountChanged();
       
  1230 			};
       
  1231 
       
  1232 		void TFooDmaChannel::QueuedRequestCountChanged()
       
  1233 			{
       
  1234 			Kern::MutexWait(*iDmaMutex);
       
  1235 			if ((iQueuedRequests > 0) && (iPrevQueuedRequests == 0))
       
  1236 				{
       
  1237 				IncreasePowerCount(); // Base port specific
       
  1238 				}
       
  1239 			else if ((iQueuedRequests == 0) && (iPrevQueuedRequests > 0))
       
  1240 				{
       
  1241 				DecreasePowerCount(); // Base port specific
       
  1242 				}
       
  1243 			iPrevQueuedRequests = iQueuedRequests;
       
  1244 			Kern::MutexSignal(*iDmaMutex);
       
  1245 			}
       
  1246 
       
  1247 		@endcode
  1207 
  1248 
  1208 		@see iQueuedRequests
  1249 		@see iQueuedRequests
  1209 	*/
  1250 	*/
  1210 	virtual void QueuedRequestCountChanged();
  1251 	virtual void QueuedRequestCountChanged();
  1211 
  1252