kerneltest/e32test/dmav2/cap_reqs.h
changeset 11 329ab0095843
equal deleted inserted replaced
10:36bfc973b146 11:329ab0095843
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: Contains TDmaCapability and associated definitions.
       
    15 * These are used by the DMA tests in test_cases.cpp to express dependancies
       
    16 * on various DMA controller/channel capabilities
       
    17 *
       
    18 */
       
    19 #ifndef __CAP_REQS_H__
       
    20 #define __CAP_REQS_H__
       
    21 
       
    22 #include <e32std.h>
       
    23 
       
    24 /**
       
    25 The various types of requirement on a
       
    26 value that can be specified by a TDmaCapability
       
    27 */
       
    28 enum TCapsReqType
       
    29 		{
       
    30 		EEqual, EGTE /* >= */, ELTE /* <= */, EBitsSet, EBitsClear
       
    31 		};
       
    32 
       
    33 /**
       
    34 Enumerates all the various DMA channel capabilities
       
    35 */
       
    36 enum TCapsReq
       
    37 		{
       
    38 		ENone,
       
    39 		EChannelPriorities,
       
    40 		EChannelPauseAndResume,
       
    41 		EAddrAlignedToElementSize,
       
    42 		E1DAddressing,
       
    43 		E2DAddressing,
       
    44 		ESynchronizationTypes,
       
    45 		EBurstTransactions,
       
    46 		EDescriptorInterrupt,
       
    47 		EFrameInterrupt,
       
    48 		ELinkedListPausedInterrupt,
       
    49 		EEndiannessConversion,
       
    50 		EGraphicsOps,
       
    51 		ERepeatingTransfers,
       
    52 		EChannelLinking,
       
    53 		EHwDescriptors,
       
    54 		ESrcDstAsymmetry,
       
    55 		EAsymHwDescriptors,
       
    56 		EBalancedAsymSegments,
       
    57 		EAsymCompletionInterrupt,
       
    58 		EAsymDescriptorInterrupt,
       
    59 		EAsymFrameInterrupt,
       
    60 		EPilVersion,
       
    61 		};
       
    62 
       
    63 enum TResult {ERun=0, ESkip=1, EFail=2}; //The ordering of these should not be changed
       
    64 
       
    65 struct SDmacCaps;
       
    66 struct TDmacTestCaps;
       
    67 
       
    68 /**
       
    69 Represents a requirement for some DMA capability
       
    70 to be either present or not present, less than, equal to, or
       
    71 greater than some value, or to have certain bits in a mask
       
    72 set or unset.
       
    73 */
       
    74 struct TDmaCapability
       
    75 	{
       
    76 	TDmaCapability()
       
    77 		:iCapsReq(ENone), iCapsReqType(EEqual), iValue(ETrue), iFail(EFalse)
       
    78 		{}
       
    79 
       
    80 	TDmaCapability(TCapsReq aReq, TCapsReqType aReqType, TUint aValue, TBool aFail)
       
    81 		:iCapsReq(aReq), iCapsReqType(aReqType), iValue(aValue), iFail(aFail)
       
    82 		{}
       
    83 
       
    84 	static void SelfTest();
       
    85 
       
    86 	/**
       
    87 	Compares the requirements held in the struct
       
    88 	against those described in aChannelCaps and makes a decision
       
    89 	as to whether this test case should be run, skipped, or failed.
       
    90 	*/
       
    91 	TResult CompareToDmaCaps(const SDmacCaps& aChannelCaps) const;
       
    92 	TResult CompareToDmaCaps(const TDmacTestCaps& aChannelCaps) const;
       
    93 
       
    94 private:
       
    95 	TBool RequirementSatisfied(const SDmacCaps& aChannelCaps) const;
       
    96 	TBool RequirementSatisfied(const TDmacTestCaps& aChannelCaps) const;
       
    97 
       
    98 	TBool TestValue(TUint aValue) const;
       
    99 
       
   100 public:
       
   101 	TCapsReq		iCapsReq;
       
   102 	TCapsReqType	iCapsReqType;
       
   103 	TUint			iValue;
       
   104 	// if HW capability is not available:-
       
   105 	// 	ETrue - Fail the test
       
   106 	//	EFalse - Skip the test
       
   107 	TBool			iFail;
       
   108 	};
       
   109 
       
   110 //A set of DMA capability requirements
       
   111 const TDmaCapability none(ENone, EEqual, 0, ETrue);
       
   112 
       
   113 const TDmaCapability pauseRequired(EChannelPauseAndResume, EEqual, ETrue, ETrue);
       
   114 const TDmaCapability pauseRequired_skip(EChannelPauseAndResume, EEqual, ETrue, EFalse);
       
   115 const TDmaCapability pauseNotWanted(EChannelPauseAndResume, EEqual, EFalse, ETrue);
       
   116 
       
   117 const TDmaCapability hwDesNotWanted(EHwDescriptors, EEqual, EFalse, ETrue);
       
   118 const TDmaCapability hwDesNotWanted_skip(EHwDescriptors, EEqual, EFalse, EFalse);
       
   119 const TDmaCapability hwDesWanted(EHwDescriptors, EEqual, ETrue, ETrue);
       
   120 const TDmaCapability hwDesWanted_skip(EHwDescriptors, EEqual, ETrue, EFalse);
       
   121 
       
   122 const TDmaCapability cap_2DRequired(E2DAddressing, EEqual, ETrue, EFalse);
       
   123 
       
   124 const TDmaCapability capEqualV1(EPilVersion, EEqual, 1, EFalse);
       
   125 const TDmaCapability capEqualV2(EPilVersion, EEqual, 2, EFalse);
       
   126 const TDmaCapability capEqualV2Fatal(EPilVersion, EEqual, 2, ETrue);
       
   127 
       
   128 const TDmaCapability capAboveV1(EPilVersion, EGTE, 2, EFalse);
       
   129 const TDmaCapability capBelowV2(EPilVersion, ELTE, 1, EFalse);
       
   130 #endif // #ifdef __CAP_REQS_H__