os/kernelhwsrv/kerneltest/f32test/ext/t_testext.h
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
sl@0
     1
// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of the License "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
// f32test\ext\t_testext.h
sl@0
    15
// 
sl@0
    16
//
sl@0
    17
sl@0
    18
#ifndef __TEST_EXT_H__
sl@0
    19
#define __TEST_EXT_H__
sl@0
    20
sl@0
    21
#include <f32fsys.h>
sl@0
    22
sl@0
    23
//#define TESTEXT_DEBUG
sl@0
    24
sl@0
    25
#if (defined(_DEBUG) || defined(_DEBUG_RELEASE)) && defined(TESTEXT_DEBUG)
sl@0
    26
#define __PRINT(t) {RDebug::Print(t);}
sl@0
    27
#define __PRINT1(t,a) {RDebug::Print(t,a);}
sl@0
    28
#define __PRINT2(t,a,b) {RDebug::Print(t,a,b);}
sl@0
    29
#else
sl@0
    30
#define __PRINT(t)
sl@0
    31
#define __PRINT1(t,a)
sl@0
    32
#define __PRINT2(t,a,b)
sl@0
    33
#endif
sl@0
    34
sl@0
    35
#define EExtCustom (KMaxTInt/2)
sl@0
    36
sl@0
    37
sl@0
    38
/**
sl@0
    39
This is the test proxy drive extension base class.
sl@0
    40
Test proxy drives of specific file system should derive from this base class.
sl@0
    41
@internalTechnology
sl@0
    42
*/
sl@0
    43
class CTestProxyDrive : public CBaseExtProxyDrive
sl@0
    44
	{
sl@0
    45
public:
sl@0
    46
    enum TTestCmd 
sl@0
    47
        {
sl@0
    48
        ESetEvent  = EExtCustom,
sl@0
    49
        EMark,
sl@0
    50
        EUnmark,
sl@0
    51
        EUnmarkAll,
sl@0
    52
        EIsMarked,
sl@0
    53
        EDiskSize,
sl@0
    54
        ETestCmdEnd = EExtCustom + 100
sl@0
    55
        };
sl@0
    56
    enum TBadSectorEvent
sl@0
    57
        {
sl@0
    58
        ENone, ENext, EDeterministic, ERandom
sl@0
    59
        };
sl@0
    60
sl@0
    61
protected:
sl@0
    62
	CTestProxyDrive(CProxyDrive* aProxyDrive, CMountCB* aMount);
sl@0
    63
    virtual ~CTestProxyDrive();
sl@0
    64
sl@0
    65
public:
sl@0
    66
    // Derived functions from CBaseExtProxyDrive
sl@0
    67
    // Commented out because they are not changed. Sub-classes reimplement them
sl@0
    68
    //  if interested.
sl@0
    69
//	virtual TInt Initialise();
sl@0
    70
//	virtual TInt Dismounted();
sl@0
    71
//	virtual TInt Enlarge(TInt aLength);
sl@0
    72
//	virtual TInt ReduceSize(TInt aPos, TInt aLength);
sl@0
    73
//	virtual TInt Read(TInt64 aPos,TInt aLength,const TAny* aTrg,TInt aThreadHandle,TInt aOffset,TInt aFlags);
sl@0
    74
//	virtual TInt Read(TInt64 aPos,TInt aLength,const TAny* aTrg,TInt aThreadHandle,TInt anOffset);
sl@0
    75
//	virtual TInt Read(TInt64 aPos,TInt aLength,TDes8& aTrg);
sl@0
    76
//	virtual TInt Write(TInt64 aPos,TInt aLength,const TAny* aSrc,TInt aThreadHandle,TInt aOffset,TInt aFlags);
sl@0
    77
//	virtual TInt Write(TInt64 aPos,TInt aLength,const TAny* aSrc,TInt aThreadHandle,TInt anOffset);
sl@0
    78
//	virtual TInt Write(TInt64 aPos,const TDesC8& aSrc);
sl@0
    79
//	virtual TInt Caps(TDes8& anInfo);
sl@0
    80
//	virtual TInt Format(TFormatInfo& anInfo);
sl@0
    81
//	virtual TInt Format(TInt64 aPos,TInt aLength);
sl@0
    82
//	virtual TInt SetMountInfo(const TDesC8* aMountInfo,TInt aMountInfoThreadHandle=KCurrentThreadHandle);
sl@0
    83
//	virtual TInt ForceRemount(TUint aFlags=0);
sl@0
    84
//	virtual TInt Unlock(TMediaPassword &aPassword, TBool aStorePassword);
sl@0
    85
//	virtual TInt Lock(TMediaPassword &aOldPassword, TMediaPassword &aNewPassword, TBool aStorePassword);
sl@0
    86
//	virtual TInt Clear(TMediaPassword &aPassword);
sl@0
    87
//	virtual TInt ErasePassword();
sl@0
    88
	virtual TInt ControlIO(const RMessagePtr2& aMessage,TInt aCommand,TAny* aParam1,TAny* aParam2);
sl@0
    89
	virtual TInt GetLastErrorInfo(TDes8& aErrorInfo);
sl@0
    90
sl@0
    91
protected:
sl@0
    92
	/**
sl@0
    93
	Return a pointer to a specified interface extension - to allow future extension of this class without breaking
sl@0
    94
	binary compatibility.
sl@0
    95
	@param aInterfaceId Interface identifier of the interface to be retrieved.
sl@0
    96
	@param aInterface A reference to a pointer that retrieves the specified interface.
sl@0
    97
	@param aInput An arbitrary input argument.
sl@0
    98
	@return KErrNone If the interface is supported, KErrNotSupported otherwise.
sl@0
    99
	*/	
sl@0
   100
//	virtual TInt GetInterface(TInt aInterfaceId,TAny*& aInterface,TAny* aInput);
sl@0
   101
sl@0
   102
protected:
sl@0
   103
    void InitL();
sl@0
   104
	TInt SetEvent(TInt aType, TInt aValue);
sl@0
   105
	TInt Mark(TInt aSector);
sl@0
   106
	TInt Unmark(TInt aSector);
sl@0
   107
	TInt UnmarkAll();
sl@0
   108
    TBool IsMarked(TInt aSector) const;
sl@0
   109
    TBool CheckEvent(TInt64 aPos, TInt aLength);
sl@0
   110
    virtual void DoInitL() = 0;
sl@0
   111
    virtual TBool DoCheckEvent(TInt64 aPos, TInt aLength) = 0;
sl@0
   112
    virtual TInt DoControlIO(const RMessagePtr2& aMessage,TInt aCommand,TAny* aParam1,TAny* aParam2) = 0;
sl@0
   113
sl@0
   114
protected:
sl@0
   115
    CMountCB* iMount;  // in CProxyDrive
sl@0
   116
    TUint8* iMap;
sl@0
   117
    TInt iTotalSectors;
sl@0
   118
    TBool iMountInitialised;
sl@0
   119
    TInt iEventType;
sl@0
   120
    TInt iCount;
sl@0
   121
    TInt iSuccessBytes;
sl@0
   122
    TErrorInfo::TReasonCode iLastErrorReason;
sl@0
   123
	};
sl@0
   124
sl@0
   125
#endif