kernel/eka/include/drivers/dmadefs.h
changeset 36 538db54a451d
child 130 c30940f6d922
equal deleted inserted replaced
34:f497542af8e4 36:538db54a451d
       
     1 // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // include/drivers/dmadefs.h
       
    15 // DMA Framework - General class, enum, constant and type definitions.
       
    16 //
       
    17 //
       
    18 
       
    19 #ifndef __DMADEFS_H__
       
    20 #define __DMADEFS_H__
       
    21 
       
    22 
       
    23 #include <e32def.h>
       
    24 
       
    25 
       
    26 /** The client request callback type */
       
    27 enum TDmaCallbackType
       
    28 	{
       
    29 	/** Transfer request completion callback */
       
    30 	EDmaCallbackRequestCompletion        = 0x01,
       
    31 	/** Transfer request completion callback - source side */
       
    32 	EDmaCallbackRequestCompletion_Src    = 0x02,
       
    33 	/** Transfer request completion callback - destination side */
       
    34 	EDmaCallbackRequestCompletion_Dst    = 0x04,
       
    35 
       
    36 	/** Descriptor completion callback */
       
    37 	EDmaCallbackDescriptorCompletion     = 0x08,
       
    38 	/** Descriptor completion callback - source side */
       
    39 	EDmaCallbackDescriptorCompletion_Src = 0x10,
       
    40 	/** Descriptor completion callback - destination side */
       
    41 	EDmaCallbackDescriptorCompletion_Dst = 0x20,
       
    42 
       
    43 	/** Frame completion callback */
       
    44 	EDmaCallbackFrameCompletion          = 0x40,
       
    45 	/** Frame completion callback - source side */
       
    46 	EDmaCallbackFrameCompletion_Src      = 0x80,
       
    47 	/** Frame completion callback - destination side */
       
    48 	EDmaCallbackFrameCompletion_Dst      = 0x100,
       
    49 
       
    50 	/** H/W descriptor pause event callback */
       
    51 	EDmaCallbackLinkedListPaused        = 0x200,
       
    52 	/** H/W descriptor pause event callback - source side */
       
    53 	EDmaCallbackLinkedListPaused_Src    = 0x400,
       
    54 	/** H/W descriptor pause event callback - destination side */
       
    55 	EDmaCallbackLinkedListPaused_Dst    = 0x800
       
    56 	};
       
    57 
       
    58 
       
    59 /** The outcome of the transfer request */
       
    60 enum TDmaResult
       
    61 	{
       
    62 	/** Completed without error */
       
    63 	EDmaResultOK = 0,
       
    64 	/** There was an error */
       
    65 	EDmaResultError
       
    66 	};
       
    67 
       
    68 
       
    69 
       
    70 /** To be used with address mode field of the DMA transfer config struct.
       
    71 
       
    72 	@see TDmaTransferConfig::iAddrMode
       
    73 */
       
    74 enum TDmaAddrMode
       
    75 	{
       
    76 	/** Constant addressing. The address remains the same for consecutive
       
    77 		accesses.
       
    78 	*/
       
    79 	KDmaAddrModeConstant,
       
    80 	/** Post-increment addressing. The address increases by the element size
       
    81 		after each access.
       
    82 	*/
       
    83 	KDmaAddrModePostIncrement,
       
    84 	/** Post-decrement addressing. The address decreases by the element size
       
    85 		after each access.
       
    86 	*/
       
    87 	KDmaAddrModePostDecrement,
       
    88 	/** 1D-index addressing. The address always increases by the element size
       
    89 		plus the element skip value after each access.
       
    90 	*/
       
    91 	KDmaAddrMode1DIndex,
       
    92 	/** 2D-index addressing. The address increases by the element size plus the
       
    93 		element skip value - but only within a frame. Once a full frame has been
       
    94 		transferred, the address increases by the element size plus the element
       
    95 		skip value plus the frame skip value.
       
    96 	*/
       
    97 	KDmaAddrMode2DIndex
       
    98 	};
       
    99 
       
   100 
       
   101 /** To be used with the burst size field of the DMA transfer config struct.
       
   102 
       
   103 	@see SDmacCaps::iBurstTransactions
       
   104 	@see TDmaTransferConfig::iBurstSize
       
   105 */
       
   106 enum TDmaBurstSize
       
   107 	{
       
   108 	/** Don't use burst transactions */
       
   109 	KDmaNoBursts     = -1,
       
   110 	/** Don't care (the default) */
       
   111 	KDmaBurstSizeAny = 0x00,
       
   112 	/** 4 bytes */
       
   113 	KDmaBurstSize4   = 0x04,
       
   114 	/** 8 bytes */
       
   115 	KDmaBurstSize8   = 0x08,
       
   116 	/** 16 bytes */
       
   117 	KDmaBurstSize16  = 0x10,
       
   118 	/** 32 bytes */
       
   119 	KDmaBurstSize32  = 0x20,
       
   120 	/** 64 bytes */
       
   121 	KDmaBurstSize64  = 0x40,
       
   122 	/** 128 bytes */
       
   123 	KDmaBurstSize128 = 0x80
       
   124 	};
       
   125 
       
   126 
       
   127 /** To be used with the flags field of the DMA transfer config struct.
       
   128 
       
   129 	@see TDmaTransferConfig::iFlags
       
   130 */
       
   131 enum TDmaTransferFlags
       
   132 	{
       
   133 	/** Location is address of a memory buffer (as opposed to a peripheral or a
       
   134 		register).
       
   135 	*/
       
   136 	KDmaMemAddr                      = 0x01,
       
   137 	/** Address is a physical address (as opposed to a linear one).
       
   138 		If it is a memory address then KDmaMemIsContiguous will need to be set
       
   139 		as well.
       
   140 	 */
       
   141 	KDmaPhysAddr                     = 0x02,
       
   142 	/** Target memory is known to be physically contiguous, hence there is
       
   143 		no need for the framework to check for memory fragmentation.
       
   144 	*/
       
   145 	KDmaMemIsContiguous              = 0x04,
       
   146 	/** Don't use packed access (if possible) */
       
   147 	KDmaDontUsePacked                = 0x08,
       
   148 	/** Location is big endian (little endian if not set).
       
   149 
       
   150 		To have any effect, this flag requires the DMAC to support endianness
       
   151 		conversion.
       
   152 
       
   153 		@see SDmacCaps::iEndiannessConversion
       
   154 	*/
       
   155 	KDmaBigEndian                    = 0x10,
       
   156 	/** Don't do endianness conversion even if applicable.
       
   157 
       
   158 		To have any effect, this flag requires the DMAC to support endianness
       
   159 		conversion.
       
   160 
       
   161 		@see SDmacCaps::iEndiannessConversion
       
   162 	*/
       
   163 	KDmaLockEndian                   = 0x20,
       
   164 	/** Execute client request callback after each subtransfer (streaming /
       
   165 		loop case).
       
   166 
       
   167 		This option is only taken into account if the respective
       
   168 		TDmaTransferConfig::iRepeatCount is non-zero.
       
   169 
       
   170 		The callback will complete with a TDmaCallbackType of
       
   171 		EDmaCallbackRequestCompletion (even if the repeat counts for source and
       
   172 		destination are different), unless the flag
       
   173 		TDmaPILFlags::KDmaAsymCompletionCallback is set too, in which case what
       
   174 		is described there applies.
       
   175 	*/
       
   176 	KDmaCallbackAfterEveryTransfer   = 0x40,
       
   177 	/** Execute client request callback after each completed hardware
       
   178 		descriptor.
       
   179 
       
   180 		Requires the DMAC to support this feature. Unless the DMAC supports
       
   181 		asymmetric descriptor interrupts as well, this flag should not be set
       
   182 		on only one (source or destination) side.
       
   183 
       
   184 		@see SDmacCaps::iDescriptorInterrupt
       
   185 		@see SDmacCaps::iAsymDescriptorInterrupt
       
   186 	*/
       
   187 	KDmaCallbackAfterEveryDescriptor = 0x80,
       
   188 	/** Execute client request callback after each completed frame.
       
   189 
       
   190 		Requires the DMAC to support this feature. Unless the DMAC supports
       
   191 		asymmetric frame interrupts as well, this flag should not be set on
       
   192 		only one (source or destination) side.
       
   193 
       
   194 		@see SDmacCaps::iFrameInterrupt
       
   195 		@see SDmacCaps::iAsymFrameInterrupt
       
   196 	*/
       
   197 	KDmaCallbackAfterEveryFrame      = 0x100
       
   198 	};
       
   199 
       
   200 
       
   201 /** To be used with the synchronization flags field of a DMA transfer
       
   202 	config struct.
       
   203 
       
   204 	@see SDmacCaps::iSynchronizationTypes
       
   205 	@see TDmaTransferConfig::iSyncFlags
       
   206 */
       
   207 enum TDmaTransferSyncFlags
       
   208 	{
       
   209 	/** Leave the decision on whether the transfer is hardware synchronized at
       
   210 		this end (either source or destination) to the Framework. This is the
       
   211 		default.
       
   212 	*/
       
   213 	KDmaSyncAuto        = 0x00,
       
   214 	/** Transfer is not hardware synchronized at this end (either source or
       
   215 		destination).
       
   216 	*/
       
   217 	KDmaSyncNone        = 0x01,
       
   218 	/** Transfer is hardware synchronized at this end (either source or
       
   219 		destination). This option can also be used on its own, without any
       
   220 		of the following sync sizes.
       
   221 	*/
       
   222 	KDmaSyncHere        = 0x02,
       
   223 	/** H/W synchronized at this end: transfer one ELEMENT (a number of
       
   224 		bytes, depending on the configured element size) per sync event.
       
   225 	*/
       
   226 	KDmaSyncSizeElement = 0x04,
       
   227 	/** H/W synchronized at this end: transfer one FRAME (a number of
       
   228 		elements, depending on the configured frame size) per sync event.
       
   229 	*/
       
   230 	KDmaSyncSizeFrame   = 0x08,
       
   231 	/** H/W synchronized at this end: transfer one BLOCK (a number of
       
   232 		frames, depending on the configured transfer size) per sync
       
   233 		event. This is the most common use case.
       
   234 	*/
       
   235 	KDmaSyncSizeBlock   = 0x10,
       
   236 	/** H/W synchronized at this end: transfer one PACKET (a number of
       
   237 		elements, depending on the configured packet size) per sync event.
       
   238 		In cases where the transfer block size is not a multiple of the
       
   239 		packet size the last packet will consist of the remaining elements.
       
   240 	*/
       
   241 	KDmaSyncSizePacket  = 0x20
       
   242 	};
       
   243 
       
   244 
       
   245 /** To be used with the Graphics operation field of a DMA transfer request.
       
   246 
       
   247 	@see TDmaTransferArgs::iGraphicsOps
       
   248 */
       
   249 enum TDmaGraphicsOps
       
   250 	{
       
   251 	/** Don't use any graphics acceleration feature (the default) */
       
   252 	KDmaGraphicsOpNone            = 0x00,
       
   253 	/** Enable graphics acceleration feature 'Constant Fill' */
       
   254 	KDmaGraphicsOpConstantFill    = 0x01,
       
   255 	/** Enable graphics acceleration feature 'TransparentCopy' */
       
   256 	KDmaGraphicsOpTransparentCopy = 0x02
       
   257 	};
       
   258 
       
   259 
       
   260 /** To be used with the PIL flags field of a DMA transfer request.
       
   261 
       
   262 	@see TDmaTransferArgs::iFlags
       
   263 */
       
   264 enum TDmaPILFlags
       
   265 	{
       
   266 	/** Request a different max transfer size (for instance for test
       
   267 		purposes).
       
   268 	*/
       
   269 	KDmaAltTransferLength         = 0x01,
       
   270 	/** Execute client request callback in ISR context instead of from a
       
   271 		DFC.
       
   272 	*/
       
   273 	KDmaRequestCallbackFromIsr    = 0x02,
       
   274 	/** Execute descriptor completion callback in ISR context instead of
       
   275 		from a DFC. This option is to be used in conjunction with the
       
   276 		TDmaTransferFlags::KDmaCallbackAfterEveryDescriptor flag.
       
   277 	*/
       
   278 	KDmaDescriptorCallbackFromIsr = 0x04,
       
   279 	/** Execute frame completion callback in ISR context instead of
       
   280 		from a DFC. This option is to be used in conjunction with the
       
   281 		TDmaTransferFlags::KDmaCallbackAfterEveryFrame flag.
       
   282 	*/
       
   283 	KDmaFrameCallbackFromIsr      = 0x08,
       
   284 	/** Execute the client request callback separately for source and
       
   285 		destination subtransfers.
       
   286 
       
   287 		This flag also determines the TDmaCallbackType value returned. If set,
       
   288 		the callback will complete with EDmaCallbackRequestCompletion_Src or
       
   289 		EDmaCallbackRequestCompletion_Dst, respectively, instead of with
       
   290 		EDmaCallbackRequestCompletion.
       
   291 
       
   292 		Requires the DMAC to support this feature.
       
   293 
       
   294 		@see SDmacCaps::iAsymCompletionInterrupt
       
   295 	*/
       
   296 	KDmaAsymCompletionCallback    = 0x10,
       
   297 	/** Execute the descriptor completion callback separately for source
       
   298 		and destination subtransfers.
       
   299 
       
   300 		This flag modifies the behaviour of the
       
   301 		TDmaTransferFlags::KDmaCallbackAfterEveryDescriptor flag and also
       
   302 		determines the TDmaCallbackType value returned. If set, the callback
       
   303 		will complete with EDmaCallbackDescriptorCompletion_Src or
       
   304 		EDmaCallbackDescriptorCompletion_Dst, respectively, instead of with
       
   305 		EDmaCallbackDescriptorCompletion.
       
   306 
       
   307 		Requires the DMAC to support this feature.
       
   308 
       
   309 		@see SDmacCaps::iAsymDescriptorInterrupt
       
   310 	*/
       
   311 	KDmaAsymDescriptorCallback    = 0x20,
       
   312 	/** Execute the frame completion callback separately for source and
       
   313 		destination subtransfers.
       
   314 
       
   315 		This flag modifies the behaviour of the
       
   316 		TDmaTransferFlags::KDmaCallbackAfterEveryFrame flag. If set, the
       
   317 		callback will complete with EDmaCallbackFrameCompletion_Src or
       
   318 		EDmaCallbackFrameCompletion_Dst, respectively, instead of with
       
   319 		EDmaCallbackFrameCompletion.
       
   320 
       
   321 		Requires the DMAC to support this feature.
       
   322 
       
   323 		@see SDmacCaps::iAsymFrameInterrupt
       
   324 	*/
       
   325 	KDmaAsymFrameCallback         = 0x40,
       
   326 	/** This transfer (only) should use the channel priority indicated by
       
   327 		TDmaTransferArgs::iChannelPriority.
       
   328 	*/
       
   329 	KDmaRequestChannelPriority    = 0x80
       
   330 	};
       
   331 
       
   332 
       
   333 /** Values which can be used with the priority field when opening a channel
       
   334 	and/or when fragmenting a transfer request.
       
   335 
       
   336 	@see TDmaChannel::SCreateInfo::iPriority
       
   337 	@see TDmaTransferArgs::iChannelPriority
       
   338 */
       
   339 enum TDmaPriority
       
   340 	{
       
   341 	/** No transfer priority preference (don't care value) */
       
   342 	KDmaPriorityNone = 0x0,
       
   343 	/** Platform-independent transfer priority 1 (lowest) */
       
   344 	KDmaPriority1 = 0x80000001,
       
   345 	/** Platform-independent transfer priority 2 */
       
   346 	KDmaPriority2 = 0x80000002,
       
   347 	/** Platform-independent transfer priority 3 */
       
   348 	KDmaPriority3 = 0x80000003,
       
   349 	/** Platform-independent transfer priority 4 */
       
   350 	KDmaPriority4 = 0x80000004,
       
   351 	/** Platform-independent transfer priority 5 */
       
   352 	KDmaPriority5 = 0x80000005,
       
   353 	/** Platform-independent transfer priority 6 */
       
   354 	KDmaPriority6 = 0x80000006,
       
   355 	/** Platform-independent transfer priority 7 */
       
   356 	KDmaPriority7 = 0x80000007,
       
   357 	/** Platform-independent transfer priority 8 (highest) */
       
   358 	KDmaPriority8 = 0x80000008
       
   359 	};
       
   360 
       
   361 
       
   362 /** Contains the configuration values for either the source or the
       
   363 	destination side of a DMA transfer.
       
   364 
       
   365 	Note that some fields (notably iElementSize, iElementsPerFrame and
       
   366 	iFramesPerTransfer) may only differ between source and destination if
       
   367 	the underlying DMAC supports this.
       
   368 
       
   369 	@see SDmacCaps::iSrcDstAsymmetry
       
   370 	@see TDmaTransferArgs::iSrcConfig
       
   371 	@see TDmaTransferArgs::iDstConfig
       
   372 */
       
   373 struct TDmaTransferConfig
       
   374 	{
       
   375 friend struct TDmaTransferArgs;
       
   376 
       
   377 	/** Default constructor. Initializes all fields with meaningful default
       
   378 		values.
       
   379 	*/
       
   380 #ifdef DMA_APIV2
       
   381 	KIMPORT_C
       
   382 #endif
       
   383 	TDmaTransferConfig();
       
   384 
       
   385 	/**	Intended for general use ie. not 2D or 1D transfers
       
   386 	 */
       
   387 #ifdef DMA_APIV2
       
   388 	KIMPORT_C
       
   389 #endif
       
   390 	TDmaTransferConfig (
       
   391 		TUint32 aAddr,
       
   392 		TUint aTransferFlags,
       
   393 		TDmaAddrMode aAddrMode = KDmaAddrModePostIncrement,
       
   394 		TUint aSyncFlags = KDmaSyncAuto,
       
   395 		TDmaBurstSize aBurstSize = KDmaBurstSizeAny,
       
   396 		TUint aElementSize = 0,
       
   397 		TUint aElementsPerPacket = 0,
       
   398 		TUint aPslTargetInfo = 0,
       
   399 		TInt aRepeatCount = 0
       
   400 		);
       
   401 
       
   402 	/**	Intended for 1D and 2D transfers
       
   403 	 */
       
   404 #ifdef DMA_APIV2
       
   405 	KIMPORT_C
       
   406 #endif
       
   407 	TDmaTransferConfig (
       
   408 		TUint32 aAddr,
       
   409 		TUint aElementSize,
       
   410 		TUint aElementsPerFrame,
       
   411 		TUint aFramesPerTransfer,
       
   412 		TInt aElementSkip,
       
   413 		TInt aFrameSkip,
       
   414 		TUint aTransferFlags,
       
   415 		TUint aSyncFlags = KDmaSyncAuto,
       
   416 		TDmaBurstSize aBurstSize = KDmaBurstSizeAny,
       
   417 		TUint aElementsPerPacket = 0,
       
   418 		TUint aPslTargetInfo = 0,
       
   419 		TInt aRepeatCount = 0
       
   420 		);
       
   421 
       
   422 	/** Transfer start address */
       
   423 	TUint32 iAddr;
       
   424 	/** Address mode */
       
   425 	TDmaAddrMode iAddrMode;
       
   426 	/** Element size in bytes (1/2/4/8) */
       
   427 	TUint iElementSize;
       
   428 	/** Number of elements per frame */
       
   429 	TUint iElementsPerFrame;
       
   430 	/** Number of elements per packet */
       
   431 	TUint iElementsPerPacket;
       
   432 	/** Number of frames to transfer (result is the transfer block) */
       
   433 	TUint iFramesPerTransfer;
       
   434 	/** Element skip in bytes (for addr modes E1DIndex or E2DIndex) */
       
   435 	TInt iElementSkip;
       
   436 	/** Frame skip in bytes (for addr mode E2DIndex) */
       
   437 	TInt iFrameSkip;
       
   438 	/** Use burst transactions of the specified size (in bytes)
       
   439 		@see TDmaBurstSize
       
   440 	*/
       
   441 	TInt iBurstSize;
       
   442 	/** PIL src/dst config flags.
       
   443 		@see TDmaTransferFlags
       
   444 	 */
       
   445 	TUint32 iFlags;
       
   446 	/** Transfer synchronization flags.
       
   447 		@see TDmaTransferSyncFlags
       
   448 	*/
       
   449 	TUint32 iSyncFlags;
       
   450 	/** Information passed to the PSL */
       
   451 	TUint iPslTargetInfo;
       
   452 	/** How often to repeat this (sub-)transfer:
       
   453 		0     no repeat (the default)
       
   454 		1..n  once / n times
       
   455 		-1     endlessly.
       
   456 	*/
       
   457 	TInt iRepeatCount;
       
   458 	/** Structure contents delta vector (usage tbd) */
       
   459 	TUint32 iDelta;
       
   460 	/** Reserved for future use */
       
   461 	TUint32 iReserved;
       
   462 
       
   463 private:
       
   464 	/** Private constructor. Initializes fields with the values passed in by
       
   465 		the legacy version of the DDmaRequest::Fragment() call.
       
   466 	*/
       
   467 	TDmaTransferConfig(TUint32 aAddr, TUint aFlags, TBool aAddrInc);
       
   468 	};
       
   469 
       
   470 
       
   471 /** To be used by the client to pass DMA transfer request details to the
       
   472 	framework.
       
   473 
       
   474 	Also used internally by the framework as a pseudo descriptor if the
       
   475 	controller doesn't support hardware descriptors (scatter/gather LLI).
       
   476 
       
   477 	@see DDmaRequest::Fragment
       
   478 */
       
   479 struct TDmaTransferArgs
       
   480 	{
       
   481 	friend class DDmaRequest;
       
   482 	friend class TDmaChannel;
       
   483 	friend class TDmac;
       
   484 	friend class DmaChannelMgr;
       
   485 
       
   486 	/** Default constructor. Initializes all fields with meaningful default
       
   487 		values.
       
   488 	*/
       
   489 #ifdef DMA_APIV2
       
   490 	KIMPORT_C
       
   491 #endif
       
   492 	TDmaTransferArgs();
       
   493 
       
   494 	/**	For transfers where src and dst TDmaTransferConfig structs share some
       
   495 		of the same options ie. iDmaTransferFlags, iAddrMode, iSyncFlags,
       
   496 		iBurstSize, and iElementSize.
       
   497 
       
   498 		@param aSrcAddr
       
   499 		@param aDstAddr
       
   500 		@param aCount Number of bytes to transfer
       
   501 		@param aDmaTransferFlags Bitmask of TDmaTransferFlags for src and dst
       
   502 		@param aDmaSyncFlags Bitmask of TDmaTransferSyncFlags for src and dst
       
   503 		@param aMode Address mode for src and dst
       
   504 		@param aDmaPILFlags Bitmask of TDmaPILFlags
       
   505 		@param aElementSize In bytes (1/2/4/8) for src and dst
       
   506 		@param aChannelPriority
       
   507 		@param aBurstSize for src and dst
       
   508 		@param aPslRequestInfo Info word passed to the PSL
       
   509 		@param aGraphicOp Graphics operation to be executed
       
   510 		@param aColour Colour value for graphics operation
       
   511 	*/
       
   512 #ifdef DMA_APIV2
       
   513 	KIMPORT_C
       
   514 #endif
       
   515 	TDmaTransferArgs (
       
   516 		TUint aSrcAddr, TUint aDstAddr, TUint aCount,
       
   517 		TUint aDmaTransferFlags, TUint aDmaSyncFlags = KDmaSyncAuto,
       
   518 		TUint aDmaPILFlags = 0,
       
   519 		TDmaAddrMode aMode = KDmaAddrModePostIncrement, TUint aElementSize = 0,
       
   520 		TUint aChannelPriority = KDmaPriorityNone,
       
   521 		TDmaBurstSize aBurstSize = KDmaBurstSizeAny, TUint aPslRequestInfo = 0,
       
   522 		TDmaGraphicsOps aGraphicOp = KDmaGraphicsOpNone, TUint32 aColour = 0
       
   523 		);
       
   524 
       
   525 	/** For transfers needing specific options for source and destination
       
   526 		TDmaTransferConfig structs.
       
   527 
       
   528 		@param aSrc Configuration values for the source
       
   529 		@param aDst Configuration values for the destination
       
   530 		@param aFlags @see TDmaPILFlags
       
   531 		@param aChannelPriority Use for this request (only) the indicated
       
   532 		channel priority. Requires KDmaRequestChannelPriority to be set in
       
   533 		iFlags as well. @see TDmaPriority
       
   534 
       
   535 		@param aPslRequestInfo Info word passed to the PSL
       
   536 		@param aGraphicOp Graphics operation to be executed
       
   537 		@param aColour Colour value for graphics operation
       
   538 	*/
       
   539 #ifdef DMA_APIV2
       
   540 	KIMPORT_C
       
   541 #endif
       
   542 	TDmaTransferArgs (
       
   543 		const TDmaTransferConfig& aSrc,
       
   544 		const TDmaTransferConfig& aDst,
       
   545 		TUint32 aFlags = 0,
       
   546 		TUint aChannelPriority = KDmaPriorityNone,
       
   547 		TUint aPslRequestInfo = 0,
       
   548 		TDmaGraphicsOps aGraphicOp = KDmaGraphicsOpNone, TUint32 aColour = 0
       
   549 		);
       
   550 
       
   551 	/** Configuration values for the source */
       
   552 	TDmaTransferConfig iSrcConfig;
       
   553 	/** Configuration values for the destination */
       
   554 	TDmaTransferConfig iDstConfig;
       
   555 
       
   556 	/** Number of bytes to transfer (optional).
       
   557 
       
   558 		A non-zero value here must be consistent with iElementSize,
       
   559 		iElementsPerFrame and iFramesPerTransfer in iSrcConfig and iDstConfig
       
   560 		if the latter are specified as well (or instead, they may be left at
       
   561 		their default values of zero).
       
   562 
       
   563 		If zero, the PIL will fill in a value calculated from multiplying
       
   564 		iElementSize, iElementsPerFrame and iFramesPerTransfer in iSrcConfig,
       
   565 		so that the PSL can rely on it being always non-zero and valid.
       
   566 	 */
       
   567 	TUint iTransferCount;
       
   568 	/** Graphics operation to be executed */
       
   569 	TDmaGraphicsOps iGraphicsOps;
       
   570 	/** Colour value for graphics operations */
       
   571 	TUint32 iColour;
       
   572 	/** PIL common flags
       
   573 		@see TDmaPILFlags
       
   574 	*/
       
   575 	TUint32 iFlags;
       
   576 	/** Use for this request (only) the indicated channel priority.
       
   577 		Requires KDmaRequestChannelPriority to be set in iFlags as well.
       
   578 		@see TDmaPriority
       
   579 	*/
       
   580 	TUint iChannelPriority;
       
   581 	/** Info word passed to the PSL */
       
   582 	TUint iPslRequestInfo;
       
   583 
       
   584 	/** Structure contents delta vector (usage tbd) */
       
   585 	TUint32 iDelta;
       
   586 	/** Reserved for future use */
       
   587 	TUint32 iReserved1;
       
   588 
       
   589 private:
       
   590 	/** Private constructor. Initializes fields with the values passed in by
       
   591 		the legacy version of the DDmaRequest::Fragment() call.
       
   592 	*/
       
   593 	TDmaTransferArgs(TUint32 aSrcAddr, TUint32 aDstAddr, TInt aCount,
       
   594 					 TUint aFlags, TUint32 aPslInfo);
       
   595 	/** Stores the PSL cookie returned by TDmaChannel::PslId() at request
       
   596 		fragmentation time.
       
   597 		The value PslId() is often (but not necessarily) identical with the
       
   598 		client's TDmaChannel::SCreateInfo::iCookie, which gets passed by the
       
   599 		PIL into DmaChannelMgr::Open() as 'aOpenId'.
       
   600 	*/
       
   601 	TUint32 iChannelCookie;
       
   602 	/** Reserved for future use */
       
   603 	TUint32 iReserved2;
       
   604 	};
       
   605 
       
   606 
       
   607 /** DMAC capabilities info structure.
       
   608 
       
   609 	Instances are to be filled in by the PSL and then linked to via TDmaChannel
       
   610 	objects after they have been opened.
       
   611 
       
   612 	The contents may vary even between channels on the same DMAC (but will
       
   613 	remain constant for a given channel for the duration that it is open),
       
   614 	depending on static or dynamic factors which only the PSL knows about.
       
   615 
       
   616 	@see TDmaChannel::Open
       
   617 	@see TDmaChannel::DmacCaps
       
   618 */
       
   619 struct SDmacCaps
       
   620 	{
       
   621 	/** DMAC supports n + 1 different channel priorities. */
       
   622 	TUint iChannelPriorities;
       
   623 	/** DMAC supports the pausing and resuming of channels. */
       
   624 	TBool iChannelPauseAndResume;
       
   625 	/** DMA addresses must be aligned on an element size boundary. */
       
   626 	TBool iAddrAlignedToElementSize;
       
   627 	/** DMAC supports 1D (element) index addressing in hardware. */
       
   628 	TBool i1DIndexAddressing;
       
   629 	/** DMAC supports 2D (frame) index addressing in hardware. */
       
   630 	TBool i2DIndexAddressing;
       
   631 	/** DMAC supports these transfer synchronization types (bitmap of values).
       
   632 
       
   633 		@see TDmaTransferSyncFlags
       
   634 	*/
       
   635 	TUint iSynchronizationTypes;
       
   636 	/** DMAC supports burst transactions with these sizes (bitmap of values).
       
   637 
       
   638 		@see TDmaBurstSize
       
   639 	*/
       
   640 	TUint iBurstTransactions;
       
   641 	/** DMAC supports a 'h/w descriptor complete' interrupt. */
       
   642 	TBool iDescriptorInterrupt;
       
   643 	/** DMAC supports a 'frame transfer complete' interrupt. */
       
   644 	TBool iFrameInterrupt;
       
   645 	/** DMAC supports a 'linked-list pause event' interrupt. */
       
   646 	TBool iLinkedListPausedInterrupt;
       
   647 	/** DMAC supports endianness conversion. */
       
   648 	TBool iEndiannessConversion;
       
   649 	/** DMAC supports these graphics operations (bitmap of values).
       
   650 
       
   651 		@see TDmaGraphicsOps
       
   652 	*/
       
   653 	TUint iGraphicsOps;
       
   654 	/** DMAC supports repeated transfers (loops). */
       
   655 	TBool iRepeatingTransfers;
       
   656 	/** DMAC supports logical channel linking (chaining). */
       
   657 	TBool iChannelLinking;
       
   658 	/** DMAC supports scatter/gather mode (linked list items). */
       
   659 	TBool iHwDescriptors;
       
   660 	/** DMAC supports asymmetric source and destination transfer
       
   661 		parameters (such as element size).
       
   662 	*/
       
   663 	TBool iSrcDstAsymmetry;
       
   664 	/** DMAC supports asymmetric h/w descriptor lists.
       
   665 
       
   666 		ETrue here requires ETrue for iHwDescriptors and iSrcDstAsymmetry as
       
   667 		well.
       
   668 	*/
       
   669 	TBool iAsymHwDescriptors;
       
   670 	/** DMAC with asymmetric descriptor support has the limitation that the
       
   671 		number of bytes transferred in source and destination must be equal in
       
   672 		every link segment (i.e. in each src/dst descriptor pair).
       
   673 
       
   674 		ETrue here requires ETrue for iAsymHwDescriptors as well.
       
   675 	*/
       
   676 	TBool iBalancedAsymSegments;
       
   677 	/** DMAC supports separate transfer completion notifications for source and
       
   678 		destination side subtransfers.
       
   679 
       
   680 		This capability is required for the asymmetric transfer completion
       
   681 		callback API feature.
       
   682 
       
   683 		@see TDmaPILFlags::KDmaAsymCompletionCallback
       
   684 	*/
       
   685 	TBool iAsymCompletionInterrupt;
       
   686 	/** DMAC supports separate descriptor completion notifications for source and
       
   687 		destination side.
       
   688 
       
   689 		This capability is required for the asymmetric descriptor completion
       
   690 		callback API feature.
       
   691 
       
   692 		ETrue here requires ETrue for both iDescriptorInterrupt and
       
   693 		iAsymHwDescriptors as well.
       
   694 
       
   695 		@see TDmaPILFlags::KDmaAsymDescriptorCallback
       
   696 	*/
       
   697 	TBool iAsymDescriptorInterrupt;
       
   698 	/** DMAC supports separate frame completion notifications for source and
       
   699 		destination side.
       
   700 
       
   701 		This capability is required for the asymmetric frame completion
       
   702 		callback API feature.
       
   703 
       
   704 		ETrue here requires ETrue for iFrameInterrupt as well.
       
   705 
       
   706 		@see TDmaPILFlags::KDmaAsymFrameCallback
       
   707 	*/
       
   708 	TBool iAsymFrameInterrupt;
       
   709 
       
   710 	/** Reserved for future use */
       
   711 	TUint32 iReserved[5];
       
   712 	};
       
   713 
       
   714 
       
   715 struct TDmaV2TestInfo
       
   716 	{
       
   717 	enum {KMaxChannels=32};
       
   718 	/** Maximum transfer size in bytes for all channels (ie. the minimum of all channels' maximum size)*/
       
   719 	TUint iMaxTransferSize;
       
   720 	/** 3->Memory buffers must be 4-byte aligned, 7->8-byte aligned, ... */
       
   721 	TUint iMemAlignMask;
       
   722 	/** Cookie to pass to DDmaRequest::Fragment for memory-memory transfer */
       
   723 	TUint32 iMemMemPslInfo;
       
   724 	/** Number of test single-buffer channels */
       
   725 	TInt iMaxSbChannels;
       
   726 	/** Pointer to array containing single-buffer test channel ids */
       
   727 	TUint32 iSbChannels[KMaxChannels];
       
   728 	/** Number of test double-buffer channels */
       
   729 	TInt iMaxDbChannels;
       
   730 	/** Pointer to array containing double-buffer test channel ids */
       
   731 	TUint32 iDbChannels[KMaxChannels];
       
   732 	/** Number of test scatter-gather channels */
       
   733 	TInt iMaxSgChannels;
       
   734 	/** Pointer to array containing scatter-gather test channel ids */
       
   735 	TUint32 iSgChannels[KMaxChannels];
       
   736 	};
       
   737 
       
   738 
       
   739 #endif	// #ifndef __DMADEFS_H__