1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/kernelhwsrv/kerneltest/e32test/dmav2/cap_reqs.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,130 @@
1.4 +/*
1.5 +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
1.6 +* All rights reserved.
1.7 +* This component and the accompanying materials are made available
1.8 +* under the terms of "Eclipse Public License v1.0"
1.9 +* which accompanies this distribution, and is available
1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.11 +*
1.12 +* Initial Contributors:
1.13 +* Nokia Corporation - initial contribution.
1.14 +*
1.15 +* Contributors:
1.16 +*
1.17 +* Description: Contains TDmaCapability and associated definitions.
1.18 +* These are used by the DMA tests in test_cases.cpp to express dependancies
1.19 +* on various DMA controller/channel capabilities
1.20 +*
1.21 +*/
1.22 +#ifndef __CAP_REQS_H__
1.23 +#define __CAP_REQS_H__
1.24 +
1.25 +#include <e32std.h>
1.26 +
1.27 +/**
1.28 +The various types of requirement on a
1.29 +value that can be specified by a TDmaCapability
1.30 +*/
1.31 +enum TCapsReqType
1.32 + {
1.33 + EEqual, EGTE /* >= */, ELTE /* <= */, EBitsSet, EBitsClear
1.34 + };
1.35 +
1.36 +/**
1.37 +Enumerates all the various DMA channel capabilities
1.38 +*/
1.39 +enum TCapsReq
1.40 + {
1.41 + ENone,
1.42 + EChannelPriorities,
1.43 + EChannelPauseAndResume,
1.44 + EAddrAlignedToElementSize,
1.45 + E1DAddressing,
1.46 + E2DAddressing,
1.47 + ESynchronizationTypes,
1.48 + EBurstTransactions,
1.49 + EDescriptorInterrupt,
1.50 + EFrameInterrupt,
1.51 + ELinkedListPausedInterrupt,
1.52 + EEndiannessConversion,
1.53 + EGraphicsOps,
1.54 + ERepeatingTransfers,
1.55 + EChannelLinking,
1.56 + EHwDescriptors,
1.57 + ESrcDstAsymmetry,
1.58 + EAsymHwDescriptors,
1.59 + EBalancedAsymSegments,
1.60 + EAsymCompletionInterrupt,
1.61 + EAsymDescriptorInterrupt,
1.62 + EAsymFrameInterrupt,
1.63 + EPilVersion,
1.64 + };
1.65 +
1.66 +enum TResult {ERun=0, ESkip=1, EFail=2}; //The ordering of these should not be changed
1.67 +
1.68 +struct SDmacCaps;
1.69 +struct TDmacTestCaps;
1.70 +
1.71 +/**
1.72 +Represents a requirement for some DMA capability
1.73 +to be either present or not present, less than, equal to, or
1.74 +greater than some value, or to have certain bits in a mask
1.75 +set or unset.
1.76 +*/
1.77 +struct TDmaCapability
1.78 + {
1.79 + TDmaCapability()
1.80 + :iCapsReq(ENone), iCapsReqType(EEqual), iValue(ETrue), iFail(EFalse)
1.81 + {}
1.82 +
1.83 + TDmaCapability(TCapsReq aReq, TCapsReqType aReqType, TUint aValue, TBool aFail)
1.84 + :iCapsReq(aReq), iCapsReqType(aReqType), iValue(aValue), iFail(aFail)
1.85 + {}
1.86 +
1.87 + static void SelfTest();
1.88 +
1.89 + /**
1.90 + Compares the requirements held in the struct
1.91 + against those described in aChannelCaps and makes a decision
1.92 + as to whether this test case should be run, skipped, or failed.
1.93 + */
1.94 + TResult CompareToDmaCaps(const SDmacCaps& aChannelCaps) const;
1.95 + TResult CompareToDmaCaps(const TDmacTestCaps& aChannelCaps) const;
1.96 +
1.97 +private:
1.98 + TBool RequirementSatisfied(const SDmacCaps& aChannelCaps) const;
1.99 + TBool RequirementSatisfied(const TDmacTestCaps& aChannelCaps) const;
1.100 +
1.101 + TBool TestValue(TUint aValue) const;
1.102 +
1.103 +public:
1.104 + TCapsReq iCapsReq;
1.105 + TCapsReqType iCapsReqType;
1.106 + TUint iValue;
1.107 + // if HW capability is not available:-
1.108 + // ETrue - Fail the test
1.109 + // EFalse - Skip the test
1.110 + TBool iFail;
1.111 + };
1.112 +
1.113 +//A set of DMA capability requirements
1.114 +const TDmaCapability none(ENone, EEqual, 0, ETrue);
1.115 +
1.116 +const TDmaCapability pauseRequired(EChannelPauseAndResume, EEqual, ETrue, ETrue);
1.117 +const TDmaCapability pauseRequired_skip(EChannelPauseAndResume, EEqual, ETrue, EFalse);
1.118 +const TDmaCapability pauseNotWanted(EChannelPauseAndResume, EEqual, EFalse, ETrue);
1.119 +
1.120 +const TDmaCapability hwDesNotWanted(EHwDescriptors, EEqual, EFalse, ETrue);
1.121 +const TDmaCapability hwDesNotWanted_skip(EHwDescriptors, EEqual, EFalse, EFalse);
1.122 +const TDmaCapability hwDesWanted(EHwDescriptors, EEqual, ETrue, ETrue);
1.123 +const TDmaCapability hwDesWanted_skip(EHwDescriptors, EEqual, ETrue, EFalse);
1.124 +
1.125 +const TDmaCapability cap_2DRequired(E2DAddressing, EEqual, ETrue, EFalse);
1.126 +
1.127 +const TDmaCapability capEqualV1(EPilVersion, EEqual, 1, EFalse);
1.128 +const TDmaCapability capEqualV2(EPilVersion, EEqual, 2, EFalse);
1.129 +const TDmaCapability capEqualV2Fatal(EPilVersion, EEqual, 2, ETrue);
1.130 +
1.131 +const TDmaCapability capAboveV1(EPilVersion, EGTE, 2, EFalse);
1.132 +const TDmaCapability capBelowV2(EPilVersion, ELTE, 1, EFalse);
1.133 +#endif // #ifdef __CAP_REQS_H__