baseintegtests/baseintegrationtest/testsuites/sd/inc/sdbase.h
author Slion
Tue, 08 Dec 2009 08:11:42 +0100
branchanywhere
changeset 19 f6d3d9676ee4
parent 0 a41df078684a
permissions -rw-r--r--
Trying to figure out how to implement my WINC like compatibility layer. Going the emulation way is probably not so smart. We should not use the kernel but rather hook native functions in the Exec calls.

// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
// All rights reserved.
// This component and the accompanying materials are made available
// under the terms of the License "Eclipse Public License v1.0"
// which accompanies this distribution, and is available
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
//
// Initial Contributors:
// Nokia Corporation - initial contribution.
//
// Contributors:
//
// Description:
//

#ifndef SDBASE_H
#define SDBASE_H

#include <testexecuteserverbase.h>
#include <testexecutestepbase.h>
#include "d_mmcif.h"

#define SYMBIAN_TEST_LE2(a,b) (((b) << 8) + (a))
#define SYMBIAN_TEST_LE4(a,b,c,d) (((d) << 24) + ((c) << 16) + ((b) << 8) + (a))
#define SYMBIAN_TEST_CEIL(a,b) ((a) % (b) ? 1 + ((a) - (a) % (b)) / (b)  : (a) / (b))
#define SYMBIAN_TEST_IP(a,b) ((a) % (b) ? 1 + ((a) - (a) % (b)) / (b)  : (a) / (b))

/*
Base class for all test steps
*/
class CBaseTestSDBase : public CTestStep
	{
public:
	virtual TVerdict doTestStepPreambleL() = 0;
	virtual TVerdict doTestStepPostambleL();

protected:
// The following four functions can be called in the test preamble.
	TBool InitDriveLetter();	// Initialise attribute iDrive
	TBool InitDeviceDriver();   // Load D_MMCIF device driver for direct disk access
	TBool InitFileServer();     // Initialise attribute iFs
	TBool InitFileMan();        // Initialise attribute iFileMan

	// Direct disk access. InitDeviceDriver() must be called first
	TInt ReadSector(TInt aSector, TDes8& aSectorBuffer);
	TInt WriteSector(TInt aSector, const TDesC8& aSectorBuffer);

	TMmcCardInfo iCardInfo;
	TInt iCardSizeInSectors;
	
	// Call InitFileServer() before using iFs
	RFs iFs;
	
	// Call InitFileMan() before using iFileMan
	CFileMan *iFileMan;

	// The drive number assigned to the SD card. Call InitDriveLetter() first
	TInt iDrive;

private:
	RMmcCntrlIf iDriver;
	};

#endif // SDBASE_H