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