Revision: 201018
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Mon, 03 May 2010 13:33:44 +0300
changeset 12 a80bfc23ff0e
parent 11 95831389e787
child 14 cf4c5641c6dd
Revision: 201018 Kit: 201018
emulator/emulatorbsp/documentation/wins_ether_drv_howto.txt
naviengine/navienginebsp/ne1_tb/test/timestamp/d_timestamp.cpp
stvariants/montblanc/src/soc/core/genepi/test/t_genepi_st_08/src/t_genepi_st_08.cpp
stvariants/montblanc/src/soc/core/genepi/test/t_genepi_st_08/src/t_genepi_st_08blocks.cpp
stvariants/montblanc/src/soc/peripheral/mmc/8500ed/mmc/emmcptn.cpp
stvariants/montblanc/src/soc/peripheral/mmc/8500ed/mmc/emmcptn.mmp
stvariants/montblanc/src/soc/peripheral/mmc/8500ed/mmc/epbusm.mmh
stvariants/montblanc/src/soc/peripheral/mmc/8500ed/mmc/epbusmmc.mmp
stvariants/montblanc/test/symbian/e32/timestamp/d_timestamp.cpp
--- a/emulator/emulatorbsp/documentation/wins_ether_drv_howto.txt	Fri Apr 16 16:08:15 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,193 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "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:
-*
-*/
-HOWTO for Wins Ethernet Driver
-
-0. Pre-requisities
-The implementation of Wins Ethernet driver makes use of packet capturing library: 
-WinPcap, Release 2.2. This software sets the network card of the PC, on which Epoc 
-Emulator is working, into so called promiscuous mode. The user must be confident that 
-the environment she/he works in doesn’t forbid such settings. The quickest way 
-to ensure about it is to contact network administrator.
-
-
-1. Trouble Shooting
-The following problems may occur when attempting to use WINS version of Ethernet driver:
-* Network application doesn’t send nor receive any packets: two potential reasons:
-  - bad settings in CommDB - refer to point 4
-  - Wpcap not installed - refer to point 2
-
-* A panic is raised of category: 'D32ETHER' with one of the following reasons:
-   1	meaning: bad MAC address in ini file or entry for it missing or ini file missing
-   2	meaning: entry for network interface name missing in ini file or ini file missing
-   3	meaning: Wpcap couldn't be initialised - potentially not installed or name 
-	of network interface in .ini file wrong
-Panics occur if system is not configured properly, remedy can be found in notes below.
-
-* Wpcap error may occur - refer to http://winpcap.polito.it/misc/changelog.htm 
-  for advice how to fix the problem (this will require usually upgrading WinPcap 
-  package on user'’ machine).
-
-
-2. Wpcap
-Wpcap must be installed on a machine that wishes to use driver. Installation is simple: 
-WinPcap.exe (located in: \epoc32\tools)
-should be run and then instructions should be followed. 
-If user has already Wpcap installed on his workstation then should try to use 
-Ethernet driver with this version. In case when it fails he must uninstall existing 
-Wpcap and install the one from Epoc directory mentioned above.
-
-
-3. Netcards
-When Wpcap is already installed, a program called Netcards.exe should be run. 
-It can be found in \epoc32\tools. 
-(Note: Netcards uses Wpcap so the latter must be installed first). 
-It will request user to select network card. Netcards writes a few entries 
-into \epoc32\data\ethernet.ini file which are read by Epoc Emulator at startup 
-(ensure that \epoc32\data directory exists). In particular MAC address value for use 
-by Emulator is determined by the entry named 'ETHER_MAC' (it is recommended that 
-network administrator was aware of the value of MAC address written there and authorise 
-it if necessary; according to local conditions any other value preferred 
-by administrator can be written manually instead of the value written by Netcards). 
-Ethernet driver for WINS was originally 
-designed for use in Techview environment which uses ethernet.ini file. Other environments 
-(like Quartz) may use different .ini file (e.g. \epoc32\data\quartz.ini). A user can 
-still run Ethernet module in these environments provided that .ini files appropriate 
-for these environments contain entries written by netcards.exe to ethernet.ini - user can 
-simply copy them - they are easy to recognise as they begin with ‘ETHER_‘ prefix .
-
-
-4. CommDB
-CommDB settings should indicate use of the NIF: ethint.nif and the agent: nullagt.agt. 
-In current release of Epoc Networking software, data in the database are written by program 
-called ced.exe, which takes wanted settings from text file: ced.cfg.
-Example settings to be put in this file are shown below. In the example it is assumed 
-that IP address and network mask will be acquired by DHCP protocol:
-
-############################################################
-## LANBearer
-## 
-[LANBearer]
-ADD_SECTION
-# COMMDB_ID = 1
-	Name=Wins Ethernet
-	Agent=nullagt.agt
-	IfName=ethint
-	LDDFilename=enet
-	LDDName=Ethernet
-	PDDFilename=ethernet
-	PDDName=Ethernet.Wins
-	PacketDriverName=EtherPkt.drv
-	LastSocketActivityTimeout=-1
-	LastSessionClosedTimeout=-1
-	LastSocketClosedTimeout=-1
-	FIELD_COUNT=8
-END_ADD
-
-ADD_SECTION
-# COMMDB_ID = 2
-	Name=Assabet on-board Ethernet
-	Agent=nullagt.agt
-	IfName=ethint
-	LDDFilename=enet
-	LDDName=Ethernet
-	PDDFilename=ethernet
-	PDDName=Ethernet.Assabet
-	PacketDriverName=EtherPkt.drv
-	LastSocketActivityTimeout=-1
-	LastSessionClosedTimeout=-1
-	LastSocketClosedTimeout=-1
-	FIELD_COUNT=8
-END_ADD
-
-############################################################
-## LANService
-## 
-[LANService]
-
-ADD_SECTION
-# COMMDB_ID = 1
-	Name=Ethernet
-	#IfNetworks=ip,ip6
-	IfNetworks=ip
-	IpNetMask=0.0.0.0
-	IpGateway=0.0.0.0
-	IpAddrFromServer=TRUE
-	IpAddr=0.0.0.0
-	IpDNSAddrFromServer=TRUE
-	IpNameServer1=0.0.0.0
-	IpNameServer2=0.0.0.0
-	FIELD_COUNT=9
-END_ADD
-
-
-############################################################
-## IAP
-## 
-[IAP]
-ADD_SECTION
-# COMMDB_ID = 1
-	Name=Ethernet IAP
-	IAPService=1
-	IAPServiceType=LANService
-	IAPBearer=1
-	IAPBearerType=LANBearer
-	IAPNetwork=1
-	IAPNetworkWeighting=0
-	Location=2
-	FIELD_COUNT=8
-END_ADD
-
-ADD_SECTION
-# COMMDB_ID = 2
-	Name=NT RAS with Null Modem
-	IAPService=2
-	IAPServiceType=DialOutISP
-	IAPBearer=2
-	IAPBearerType=ModemBearer
-	IAPNetwork=1
-	IAPNetworkWeighting=0
-	Location=2
-	FIELD_COUNT=8
-END_ADD
-
-############################################################
-## ConnectionPreferences
-## 
-[ConnectionPreferences]
-
-
-ADD_SECTION
-	Ranking=0
-	Direction=OUTGOING
-	DialogPref=PROMPT
-	BearerSet=LAN
-	#IAP=Ethernet IAP
-	IAP=1
-	FIELD_COUNT=5
-END_ADD
-
-ADD_SECTION
-	Ranking=1
-	Direction=OUTGOING
-	DialogPref=DONOTPROMPT
-	BearerSet=LAN
-#IAP=Ethernet IAP
-	IAP=1
-	FIELD_COUNT=5
-END_ADD
-
- 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/naviengine/navienginebsp/ne1_tb/test/timestamp/d_timestamp.cpp	Mon May 03 13:33:44 2010 +0300
@@ -0,0 +1,182 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "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: 
+*
+*/
+
+
+#include <kern_priv.h>
+#include <kernel.h>
+#include "d_timestamp.h"
+#include "d_timestamp_dev.h"
+#include "ne1_tb_power.h"
+
+// Name for PDD, will be LDD name and this suffix
+_LIT(KTimestampPddSuffix,".NE1_TB");
+
+
+class DNE1_TimestampTestPddChannel : public DTimestampTestPddChannel
+	{
+public:
+	// Inherited from DTimestampTestPddChanel. These called by the LDD.
+	virtual void StartLPMEntryCheck();
+    virtual TBool EndLPMEntryCheck();
+    virtual void TestConfig(STimestampTestConfig& aInfo);
+private:
+	TUint iInitialIdleCount;
+	};
+
+/**
+  Logical Device (factory class) for DNE1_TimestampTestPddChannel
+*/
+class DNE1_TimestampTestPddFactory : public DPhysicalDevice
+	{
+public:
+	DNE1_TimestampTestPddFactory();
+	//	Inherited from DLogicalDevice
+	virtual TInt Install();
+	virtual void GetCaps(TDes8& aDes) const;
+    virtual TInt Create(DBase*& aChannel, TInt aUnit, const TDesC8* aInfo, const TVersion& aVer);
+	virtual TInt Validate(TInt aUnit, const TDesC8* aInfo, const TVersion& aVer);
+private:
+    TVersion iVersion;
+	};
+
+//
+// DNE1_TimestampTestPddFactory
+//
+
+/**
+  Standard export function for PDDs. This creates a DPhysicalDevice derived object,
+  in this case, our DNE1_TimestampTestPddFactory
+*/
+DECLARE_STANDARD_PDD()
+	{
+	return new DNE1_TimestampTestPddFactory();
+	}
+
+/**
+ * constructor
+ */
+DNE1_TimestampTestPddFactory::DNE1_TimestampTestPddFactory()
+	{
+	// Set version number for this device
+	iVersion=RTimestampTest::VersionRequired();
+	}
+
+/**
+  Second stage constructor for DPhysicalDevice derived objects.
+  This must at least set a name for the driver object.
+
+  @return KErrNone or standard error code.
+*/
+TInt DNE1_TimestampTestPddFactory::Install()
+    {
+    TName name(RTimestampTest::Name());
+    name.Append(KTimestampPddSuffix);
+    return SetName(&name);
+	}
+
+/**
+  Returns the drivers capabilities. This is not used by the Symbian OS device driver framework
+  but may be useful for the LDD to use.
+
+  @param aDes Descriptor to write capabilities information into
+*/
+void DNE1_TimestampTestPddFactory::GetCaps(TDes8& aDes) const
+	{
+	// Create a capabilities object
+	RTimestampTest::TCaps caps;
+	caps.iVersion = iVersion;
+    // Write it back to user memory
+	Kern::InfoCopy(aDes,(TUint8*)&caps,sizeof(caps));
+	}
+
+/**
+  Called by the kernel's device driver framework to create a Physical Channel.
+  This is called in the context of the user thread (client) which requested the creation of a Logical Channel
+  (E.g. through a call to RBusLogicalChannel::DoCreate)
+  The thread is in a critical section.
+
+  @param aChannel Set to point to the created Physical Channel
+  @param aUnit The unit argument supplied by the client to RBusLogicalChannel::DoCreate
+  @param aInfo The info argument supplied by the client to RBusLogicalChannel::DoCreate
+  @param aVer The version number of the Logical Channel which will use this Physical Channel 
+
+  @return KErrNone or standard error code.
+*/
+TInt DNE1_TimestampTestPddFactory::Create(DBase*& aChannel, TInt aUnit, const TDesC8* aInfo, const TVersion& aVer)
+	{
+	// Ignore the parameters we aren't interested in...
+	(void)aUnit;
+	(void)aInfo;
+	(void)aVer;
+
+	// Create a new physical channel
+	DNE1_TimestampTestPddChannel* channel=new DNE1_TimestampTestPddChannel;
+    aChannel = channel;
+    return (channel) ? KErrNone : KErrNoMemory;
+	}
+
+/**
+  Called by the kernel's device driver framework to check if this PDD is suitable for use with a Logical Channel.
+  This is called in the context of the user thread (client) which requested the creation of a Logical Channel
+  (E.g. through a call to RBusLogicalChannel::DoCreate)
+  The thread is in a critical section.
+
+  @param aUnit The unit argument supplied by the client to RBusLogicalChannel::DoCreate
+  @param aInfo The info argument supplied by the client to RBusLogicalChannel::DoCreate
+  @param aVer The version number of the Logical Channel which will use this Physical Channel 
+
+  @return KErrNone or standard error code.
+*/
+TInt DNE1_TimestampTestPddFactory::Validate(TInt aUnit, const TDesC8* aInfo, const TVersion& aVer)
+	{
+	// Check version numbers
+	if (!Kern::QueryVersionSupported(iVersion,aVer))
+		return KErrNotSupported;
+        
+    (void)aInfo;
+    (void) aUnit;    
+    return KErrNone;
+    }
+
+////
+// Channel implementation
+
+
+/**
+   Called before each cycle in the test. Takes a copy of current idle count in power controller
+*/
+void  DNE1_TimestampTestPddChannel::StartLPMEntryCheck()
+    {
+    iInitialIdleCount = TNE1_TBPowerController::IdleCount();
+    }
+
+/**
+   Called at the end of each cycle. Should return true if we have entered idle since call to
+   StartLPMEntryCheck. This will be the case if the idle count has changed
+*/
+TBool  DNE1_TimestampTestPddChannel::EndLPMEntryCheck()
+    {
+    return (iInitialIdleCount!=TNE1_TBPowerController::IdleCount());
+    }
+
+
+/**
+   Called to allow baseport to override test parameters. For Navi defaults are fine
+*/
+void DNE1_TimestampTestPddChannel::TestConfig(STimestampTestConfig& aInfo) 
+    {
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stvariants/montblanc/src/soc/core/genepi/test/t_genepi_st_08/src/t_genepi_st_08.cpp	Mon May 03 13:33:44 2010 +0300
@@ -0,0 +1,64 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "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: 
+*
+*/
+/*****************************************************************************/
+/**
+*  © ST-Ericsson, 2009 - All rights reserved
+*  Reproduction and Communication of this document is strictly prohibited
+*  unless specifically authorized in writing by ST-Ericsson
+*
+*  File Name:t_genepi_st_08.cpp Test application file
+* author  ST-Ericsson
+*/
+/*****************************************************************************/ 
+
+/****************************************************************************
+ * Includes
+ ****************************************************************************/
+#include "t_genepi_st_08blocks.h"
+
+/****************************************************************************
+FUNCTION : MainL
+PURPOSE  : Genepi driver tests
+ *****************************************************************************/
+LOCAL_C void MainL()
+{
+	Ct_genepi_st_08blocks* gTest = Ct_genepi_st_08blocks::NewL( );
+	CleanupStack::PushL( gTest );
+	gTest->RunAllTest05();
+	CleanupStack::Pop();
+}
+
+/****************************************************************************
+FUNCTION : E32Main
+PURPOSE  : Entry routine for the Test program
+ *****************************************************************************/
+
+GLDEF_C TInt E32Main()
+	/**
+	 * @return - Standard Epoc error code on exit
+	 */
+{
+	CTrapCleanup* cleanup = CTrapCleanup::New();
+	if(cleanup == NULL)
+	{
+		return KErrNoMemory;
+	}
+	TRAP_IGNORE(MainL());
+	delete cleanup;
+	return KErrNone;
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stvariants/montblanc/src/soc/core/genepi/test/t_genepi_st_08/src/t_genepi_st_08blocks.cpp	Mon May 03 13:33:44 2010 +0300
@@ -0,0 +1,101 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "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: 
+*
+*/
+/*****************************************************************************/
+/**
+*  © ST-Ericsson, 2009 - All rights reserved
+*  Reproduction and Communication of this document is strictly prohibited
+*  unless specifically authorized in writing by ST-Ericsson
+*
+*  File Name:t_genepi_st_08blocks.cpp Test application file
+* author  ST-Ericsson
+*/
+/*****************************************************************************/ 
+
+/****************************************************************************
+ * Includes
+ ****************************************************************************/
+#include "t_genepi_st_08blocks.h"
+#include <e32test.h>
+
+// -----------------------------------------------------------------------------
+// Ct_genepi_st_08blocks::Ct_genepi_st_08blocks
+// C++ default constructor
+// -----------------------------------------------------------------------------
+//
+Ct_genepi_st_08blocks::Ct_genepi_st_08blocks( ) : iRTestgenepi(_L("t_genepi_st_08"))
+{
+}
+
+// -----------------------------------------------------------------------------
+// Ct_genepi_st_08blocks::~Ct_genepi_st_08blocks
+// C++ default destructor
+// -----------------------------------------------------------------------------
+//
+Ct_genepi_st_08blocks::~Ct_genepi_st_08blocks( )
+{
+}
+
+// -----------------------------------------------------------------------------
+// Ct_genepi_st_08blocks::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+Ct_genepi_st_08blocks* Ct_genepi_st_08blocks::NewL()
+{
+	Ct_genepi_st_08blocks* self = new (ELeave) Ct_genepi_st_08blocks( );
+	return self;
+}	
+
+// -----------------------------------------------------------------------------
+// Ct_genepi_st_08blocks::RunAllTest05
+// Run all tests in sequence
+// -----------------------------------------------------------------------------
+//
+void Ct_genepi_st_08blocks::RunAllTest05()
+{
+	TInt ret = KErrNone;
+
+	iRTestgenepi.Start(_L("Testing Genepi  Driver"));
+	Printf(0, _L("t_genepi_st_08"), _L("Executing Test Class ID: t_genepi_st_08.\n"));
+
+	iRTestgenepi.Next(_L("Test Case no. t_genepi_st_08_01 Started"));
+	ret = t_genepi_core_08_01();
+	iRTestgenepi(ret == KErrNone);
+	Printf(0, _L("t_genepi_st_08"), _L("Test Case no. t_genepi_st_08_01 Completed\n"));
+
+
+	Printf(0, _L("t_genepi_st_08"), _L("Ending test.\n"));
+	iRTestgenepi.End();
+	iRTestgenepi.Close();
+}	
+
+
+void Ct_genepi_st_08blocks::Printf( const TInt aPriority, 
+		const TDesC& aDefinition, 
+		TRefByValue<const TDesC> aFmt,... )
+{
+	VA_LIST list;
+	VA_START(list,aFmt);
+	TName aBuf;
+
+	// Parse parameters
+	aBuf.AppendFormatList(aFmt,list);        
+
+	iRTestgenepi.Printf(aBuf); 
+}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stvariants/montblanc/src/soc/peripheral/mmc/8500ed/mmc/emmcptn.cpp	Mon May 03 13:33:44 2010 +0300
@@ -0,0 +1,748 @@
+// Copyright (c) 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:
+// Partition Management for Embedded MMC devices
+// 
+//
+
+#include "emmcptn.h"
+
+#define ST_FLASHER
+#define BGAHSMMC_PI_STR_SIZE sizeof( BGAHSMMC_PI_STR )
+
+//- Constants ---------------------------------------------------------------
+
+const TUint8  KMaxNbrOfTocItems     = 16; //condition false in decode partition info function 32; //should be 16 (32*16=512)
+const TUint8  KXMaxNbrOfTocItems    = 16;
+const TUint32 KEndOfToc             = 0xFFFFFFFFUL;
+const TInt  KMaxItemNameLen   		= 12;
+
+const TUint32 KMegaByte 			= 1024 * 1024;
+const TUint32 KEraseStepSize 		= 4 * KMegaByte;
+
+// for Emmc(S) min erase is 256KB for Emmc(T) min erase is 512KB
+const TUint32 KEraseMinSize			= 512 * 1024;
+const TInt KDiskSectorSize			=512;
+const TInt KDiskSectorShift			=9;
+
+// UnistoreII definitions
+#define VOLNUM							0			
+#define SECTOR_SIZE						512
+#define TWO_SECTOR_SIZE					1024
+
+struct STocItem
+	{
+	TUint32 iByteStartAddress;
+	TUint32 iByteSize;
+	TUint32 iFlags;
+	TUint32 iAlign;
+	TUint32 iLoadAddress;
+	TText8  iFileName[KMaxItemNameLen];
+	};
+
+
+class Toc
+    {
+    public:
+        TInt Init();
+        TInt GetItem(const TText8* aItemName, STocItem& aItem);
+        TInt GetItemEx(const TText8* aName, STocItem& aItem);
+	public:
+		STocItem iTOC[KMaxNbrOfTocItems];
+		STocItem iEmmcPartitionTable[4];		
+		TUint32  iTocStartSector;
+		TUint64  iUserAreaInBytes;
+		TInt 	 iPartitionCount;
+		TBool    iEMMCPtnUpdate;
+		
+#if defined(_VERSION_INFO)
+		TUint32 iVersionInfoItems;
+		TVersionInfoItem iVersionInfo[KMaxSectionItems];
+#endif
+
+	private:
+        TInt GetItemX(const TText8* aItemName, STocItem& aItem);
+
+    };
+
+
+class DLegacyEMMCPartitionInfo : public DEMMCPartitionInfo
+	{
+public:
+	 DLegacyEMMCPartitionInfo();
+	~DLegacyEMMCPartitionInfo();
+	Toc *iTocPtr;
+
+
+public:
+	virtual TInt Initialise(DMediaDriver* aDriver);
+	virtual TInt PartitionInfo(TPartitionInfo& anInfo, const TMMCCallBack& aCallBack);
+	virtual TInt PartitionCaps(TLocDrv& aDrive, TDes8& aInfo);
+	
+protected:
+	void SetPartitionEntry(TPartitionEntry* aEntry, TUint aFirstSector, TUint aNumSectors);
+	
+private:
+	static void SessionEndCallBack(TAny* aSelf);
+		   void DoSessionEndCallBack();
+	virtual TInt DecodePartitionInfo();
+	
+protected:
+	DMediaDriver*   iDriver;
+	TPartitionInfo* iPartitionInfo;
+	TMMCCallBack	iSessionEndCallBack;
+	TMMCCallBack 	iCallBack;         // Where to report the PartitionInfo completion
+	DMMCSession*	iSession;
+	TMMCard*		iCard;
+	TUint8*			iIntBuf;
+	};
+
+DLegacyEMMCPartitionInfo::DLegacyEMMCPartitionInfo()
+  : iSessionEndCallBack(DLegacyEMMCPartitionInfo::SessionEndCallBack, this)
+	{
+	}
+
+DLegacyEMMCPartitionInfo::~DLegacyEMMCPartitionInfo()
+	{
+	delete iSession;
+	}
+
+TInt DLegacyEMMCPartitionInfo::Initialise(DMediaDriver* aDriver)
+	{
+	iDriver = aDriver;
+
+	DMMCSocket* socket = ((DMMCSocket*)((DPBusPrimaryMedia*)(iDriver->iPrimaryMedia))->iSocket);
+	if(socket == NULL)
+		return(KErrNoMemory);
+
+	DMMCStack* stack = socket->Stack(0);
+	iCard = stack->CardP(((DPBusPrimaryMedia*)(iDriver->iPrimaryMedia))->iSlotNumber);
+	
+	iSession = stack->AllocSession(iSessionEndCallBack);
+	if (iSession == NULL)
+		return(KErrNoMemory);
+
+	iSession->SetStack(stack);
+	iSession->SetCard(iCard);
+
+	// this gets used before any access
+	TInt bufLen, minorBufLen;
+	stack->BufferInfo(iIntBuf, bufLen, minorBufLen);
+
+	return(KErrNone);
+	}
+
+TInt DLegacyEMMCPartitionInfo::PartitionInfo(TPartitionInfo& anInfo, const TMMCCallBack& aCallBack)
+	{
+	iPartitionInfo = &anInfo;
+	iCallBack = aCallBack;
+	// If media driver is persistent (see EMediaDriverPersistent), 
+	// the card may have changed since last power down, so reset CID
+	iSession->SetCard(iCard);
+	
+	TUint32 TocOffset =0; //TOC is on first Block
+
+#ifndef ST_FLASHER
+	TocOffset = 1280; //TOC mapped 0x000A0000 bytes offset i.e. 1280 blocks
+#endif //!ST_FLASHER
+
+	iSession->SetupCIMReadBlock(TocOffset, iIntBuf);	// aBlocks = 1
+
+	TInt r = iDriver->InCritical();
+	if (r == KErrNone)
+		r = iSession->Engage();
+
+	if(r != KErrNone)
+		iDriver->EndInCritical();
+	
+	return(r);
+	}
+
+TInt DLegacyEMMCPartitionInfo::PartitionCaps(TLocDrv& aDrive, TDes8& aInfo)
+	{
+	 TLocalDriveCapsV6Buf& Info = static_cast< TLocalDriveCapsV6Buf&> (aInfo);
+	__KTRACE_OPT(KPBUSDRV,Kern::Printf(">>iPartitionType=%d",aDrive.iPartitionType));	
+	
+
+	if (aDrive.iPartitionType == KPartitionTypeRofs)
+		{
+		__KTRACE_OPT(KPBUSDRV,Kern::Printf("eMMC proto: Caps for ROFS,drive NO =%d",aDrive.iDriveNumber));
+
+		Info().iType 			= EMediaHardDisk;		
+		Info().iDriveAtt 		= KDriveAttLocal | KDriveAttInternal;
+		Info().iFileSystemId  	= KDriveFileSysROFS;
+		Info().iPartitionType 	= KPartitionTypeRofs;
+		Info().iMediaAtt      	|= KMediaAttWriteProtected;
+		Info().iSize 		 	= TUint32(iTocPtr->iEmmcPartitionTable[1].iByteSize);
+
+		}
+	else if	(aDrive.iPartitionType == KPartitionTypeEmpty) //for CoreOS
+		{
+
+		__KTRACE_OPT(KPBUSDRV,Kern::Printf("eMMC proto: Caps for EmptyP,drive NO =%d",aDrive.iDriveNumber));
+		
+		Info().iType 			= EMediaHardDisk;
+		Info().iDriveAtt 		= KDriveAttLocal | KDriveAttInternal;	
+		Info().iFileSystemId  	= KDriveFileNone;
+		Info().iPartitionType 	= KPartitionTypeEmpty;
+		Info().iMediaAtt      	|= KMediaAttWriteProtected;
+		Info().iSize 		    = iTocPtr->iEmmcPartitionTable[0].iByteSize;
+		
+		}
+		
+	else if((aDrive.iDriveNumber == 2) && (!iTocPtr->iEMMCPtnUpdate))
+		{
+		__KTRACE_OPT(KPBUSDRV,Kern::Printf("eMMC proto: Caps iDriveNumber =%d",aDrive.iDriveNumber));
+		
+
+		Info().iType 			= EMediaHardDisk;
+		Info().iDriveAtt 		|= KDriveAttLocal | KDriveAttInternal ;
+
+		Info().iFileSystemId 	= KDriveFileSysFAT;
+		Info().iPartitionType 	= KPartitionTypeWin95FAT32;
+		Info().iMediaAtt      	|= KMediaAttFormattable;
+		Info().iSize 		 	= TUint64(iTocPtr->iUserAreaInBytes);
+		}
+		
+	// is this query for the swap partition ?
+	if (aDrive.iPartitionType == KPartitionTypePagedData)
+		{
+		Info().iFileSystemId = KDriveFileNone;
+		Info().iDriveAtt|= KDriveAttHidden;
+		}
+
+	// is this query for the ROFS partition ?
+	if (aDrive.iPartitionType == KPartitionTypeRofs)
+		{
+		Info().iFileSystemId = KDriveFileSysROFS;
+		Info().iMediaAtt&= ~KMediaAttFormattable;
+		Info().iMediaAtt|= KMediaAttWriteProtected;
+		}
+	
+	// is this query for the ROM partition ?
+	if (aDrive.iPartitionType == KPartitionTypeROM)
+		{
+		Info().iFileSystemId = KDriveFileNone;
+		Info().iMediaAtt&= ~KMediaAttFormattable;
+		Info().iMediaAtt|= KMediaAttWriteProtected;
+		}
+	
+	return KErrNone;
+	}
+
+void DLegacyEMMCPartitionInfo::SessionEndCallBack(TAny* aSelf)
+	{
+	DLegacyEMMCPartitionInfo& self = *static_cast<DLegacyEMMCPartitionInfo*>(aSelf);
+	self.DoSessionEndCallBack();
+	}
+
+void DLegacyEMMCPartitionInfo::DoSessionEndCallBack()
+	{
+	iDriver->EndInCritical();
+
+	TInt r = iSession->EpocErrorCode();
+
+	if (r == KErrNone)
+		r = DecodePartitionInfo();
+
+	iDriver->PartitionInfoComplete(r == KErrNone ? r : KErrNotReady);
+	}
+
+TInt DLegacyEMMCPartitionInfo::DecodePartitionInfo()
+//
+// decode partition info that was read into internal buffer 
+//
+	{
+	__KTRACE_OPT(KPBUSDRV,Kern::Printf(">>emcptn:DecodePartitionInfo"));
+
+	TUint partitionCount=iPartitionInfo->iPartitionCount=0;
+	TInt defaultPartitionNumber=-1;
+	TMBRPartitionEntry* pe;
+	const TUint KMBRFirstPartitionOffsetAligned = KMBRFirstPartitionOffset & ~3;
+	TInt i;
+	iTocPtr = reinterpret_cast<Toc*>(iIntBuf);
+	iTocPtr->iEMMCPtnUpdate = EFalse;
+	iTocPtr->iPartitionCount = 0;
+
+	STocItem item; 
+		
+#ifdef ST_FLASHER
+	for (TUint8 nCnt = 0; nCnt < 5; nCnt++) 
+#else
+	for (TUint8 nCnt = 0; nCnt < KMaxNbrOfTocItems; nCnt++) 
+#endif //ST_FLASHER	
+		{ 
+
+#ifdef ST_FLASHER
+		if((iTocPtr->GetItemEx((TText8*)"NORMAL", item) == KErrNone) ||(iTocPtr->GetItemEx((TText8*)"X-LOADER", item)== KErrNone))
+#else
+		if(iTocPtr->GetItemEx("SOS+CORE", item)== KErrNone) 
+#endif //ST_FLASHER
+			{
+			__KTRACE_OPT(KPBUSDRV,Kern::Printf(">>Valid TOC/PIB found"));
+			}
+		else 
+			{
+			__KTRACE_OPT(KPBUSDRV,Kern::Printf("ERROR eMMC proto: No Valid TOC/PIB structure !"));
+			iTocPtr->iEMMCPtnUpdate = ETrue; 
+			}
+		}
+
+	if(iTocPtr)
+	{
+	if(!iTocPtr->iEMMCPtnUpdate)
+		{
+
+		TInt ret = KErrNone;
+
+		//SOS+CORE/NORMAL=0,SOS+ROFS1=1,SOS+ROFS2=2,SOS-USER/PRODUCTION=3
+
+#ifdef ST_FLASHER
+
+
+
+		ret = iTocPtr->GetItemEx((TText8*)"NORMAL", item);
+#else
+		ret = iTocPtr->GetItemEx("SOS+CORE", item); 
+#endif //ST_FLASHER
+					
+		if(ret == KErrNone)	
+			{
+			__KTRACE_OPT(KPBUSDRV,Kern::Printf(">>SOS+CORE/NORMAL partition found"));
+			//SOS+CORE Partition
+			iTocPtr->iEmmcPartitionTable[0] = item;	
+			}
+		else 
+			{
+			__KTRACE_OPT(KPBUSDRV,Kern::Printf(">>ERROR SOS+CORE/NORMAL partition NOT found"));
+			}
+
+		//In ST flasher ROFS partitions are not define
+#ifndef ST_FLASHER
+		ret = iTocPtr->GetItemEx("SOS+ROFS1", item); 
+		if(ret == KErrNone)	
+			{
+			__KTRACE_OPT(KPBUSDRV,Kern::Printf(">>SOS+ROFS1 partition found"));
+			//Rofs Partition
+			iTocPtr->iEmmcPartitionTable[1] = item;	
+			}
+		else 
+			{
+			__KTRACE_OPT(KPBUSDRV,Kern::Printf(">>ERROR SOS+ROFS1 partition NOT found"));
+			}
+
+		// In ST flasher consider : Normal -> coreos, ADL -> Rofs, No Rofs_Ext,Production -> User
+
+		ret = iTocPtr->GetItemEx("SOS+ROFS2", item); 
+		if(ret == KErrNone)	
+			{
+			__KTRACE_OPT(KPBUSDRV,Kern::Printf(">>SOS+ROFS2 partition found"));
+			//ROFX Partition
+			iTocPtr->iEmmcPartitionTable[2] = item;	
+			}
+		else 
+			{
+			__KTRACE_OPT(KPBUSDRV,Kern::Printf(">>ERROR SOS+ROFS2 partition NOT found"));
+			}
+#endif //ST_FLASHER
+
+#ifdef ST_FLASHER
+		//USER partition is => Start address of PRODUCTION + Size of PRODUCTION
+		ret = iTocPtr->GetItemEx((TText8*)"PRODUCTION", item);
+#else
+		ret = iTocPtr->GetItemEx("SOS-USER", item); 
+#endif //ST_FLASHER		
+		if(ret == KErrNone)	
+			{
+			__KTRACE_OPT(KPBUSDRV,Kern::Printf(">>SOS-USER partition found"));
+			//SOS-USER Partition
+			iTocPtr->iEmmcPartitionTable[3] = item;	
+#ifdef ST_FLASHER			
+			TUint64 NoOfBlock512KAlign 							= (iTocPtr->iEmmcPartitionTable[3].iByteStartAddress + iTocPtr->iEmmcPartitionTable[3].iByteSize)/(KEraseMinSize);	
+			iTocPtr->iEmmcPartitionTable[3].iByteStartAddress	= (NoOfBlock512KAlign * KEraseMinSize) + KEraseStepSize;//align with 512KB + extra 4MB
+			iTocPtr->iUserAreaInBytes 							= (iCard->DeviceSize64()  - ((TUint64)(iTocPtr->iEmmcPartitionTable[3].iByteStartAddress)));		
+#else //ST_FLASHER
+			iTocPtr->iEmmcPartitionTable[3].iByteStartAddress 	= iTocPtr->iEmmcPartitionTable[3].iByteStartAddress;
+			iTocPtr->iUserAreaInBytes 							= iTocPtr->iEmmcPartitionTable[3].iByteSize;
+#endif //ST_FLASHER			
+			}
+		else //search MEM_INIT partition
+			{
+			__KTRACE_OPT(KPBUSDRV,Kern::Printf(">>ERROR SOS-USER partition NOT found search for MEM_INIT"));
+			//USER partition is => Start address of MEM_INIT + Size of MEM_INIT
+			ret = iTocPtr->GetItemEx((TText8*)"MEM_INIT", item); 
+			if(ret == KErrNone)	
+				{
+				__KTRACE_OPT(KPBUSDRV,Kern::Printf(">>MEM_INIT partition found"));
+				//SOS-USER Partition
+				iTocPtr->iEmmcPartitionTable[3] 					= item;	
+				TUint64 NoOfBlock512KAlign 							= (iTocPtr->iEmmcPartitionTable[3].iByteStartAddress + iTocPtr->iEmmcPartitionTable[3].iByteSize)/(KEraseMinSize);	
+				iTocPtr->iEmmcPartitionTable[3].iByteStartAddress	= (NoOfBlock512KAlign * KEraseMinSize) + KEraseStepSize;//align with 512KB + extra 4MB
+				iTocPtr->iUserAreaInBytes 							= (iCard->DeviceSize64()  - ((TUint64)(iTocPtr->iEmmcPartitionTable[3].iByteStartAddress)));		
+				}
+			else 
+				{
+				__KTRACE_OPT(KPBUSDRV,Kern::Printf(">>ERROR MEM_INIT partition NOT found"));
+				}
+			}
+			
+
+		//	User Partition : iPartitionCount =0
+		iPartitionInfo->iEntry[iTocPtr->iPartitionCount].iPartitionBaseAddr 	= iTocPtr->iEmmcPartitionTable[3].iByteStartAddress;
+		//iTocPtr->iUserAreaInBytes 											= iTocPtr->iUserAreaInBytes - (TUint64)(KEraseStepSize - KDiskSectorSize);// (0x3ffe00)		
+		iPartitionInfo->iEntry[iTocPtr->iPartitionCount].iPartitionLen 			= iTocPtr->iUserAreaInBytes;		
+
+		__KTRACE_OPT(KPBUSDRV,Kern::Printf(">>iTocPtr->iEmmcPartitionTable[3].iByteSize=0x%x",iTocPtr->iUserAreaInBytes));		
+
+		SetPartitionEntry( &iPartitionInfo->iEntry[iTocPtr->iPartitionCount], iTocPtr->iEmmcPartitionTable[3].iByteStartAddress/KDiskSectorSize, iTocPtr->iUserAreaInBytes/(TUint64)(KDiskSectorSize ));		
+		iPartitionInfo->iEntry[iTocPtr->iPartitionCount].iPartitionType 		= KPartitionTypeFAT16;
+		iTocPtr->iPartitionCount++;
+
+		//	CoreOs Partition : iPartitionCount =1
+		iPartitionInfo->iEntry[iTocPtr->iPartitionCount].iPartitionBaseAddr 	= iTocPtr->iEmmcPartitionTable[0].iByteStartAddress;
+		iPartitionInfo->iEntry[iTocPtr->iPartitionCount].iPartitionLen 			= iTocPtr->iEmmcPartitionTable[0].iByteSize;
+
+		SetPartitionEntry( &iPartitionInfo->iEntry[iTocPtr->iPartitionCount], iTocPtr->iEmmcPartitionTable[0].iByteStartAddress/KDiskSectorSize, iTocPtr->iEmmcPartitionTable[0].iByteSize/KDiskSectorSize );		
+		iPartitionInfo->iEntry[iTocPtr->iPartitionCount].iPartitionType 		=  KPartitionTypeROM;//KPartitionTypeEmpty indar
+		iTocPtr->iPartitionCount ++;				
+		}
+
+	}
+
+	__KTRACE_OPT(KPBUSDRV,Kern::Printf(">>partitionCount=%d",iTocPtr->iPartitionCount));
+
+	partitionCount=iTocPtr->iPartitionCount;
+
+	// Read of the first sector successful so check for a Master Boot Record
+	if (*(TUint16*)(&iIntBuf[KMBRSignatureOffset])!=0xAA55)
+	// If no valid signature give up now, No way to re-format an internal drive correctly
+			{
+			__KTRACE_OPT(KPBUSDRV, Kern::Printf("mmc:No MBR Found"));
+			// return KErrCorrupt;
+			}
+				
+
+	__ASSERT_COMPILE(KMBRFirstPartitionOffsetAligned + KMBRMaxPrimaryPartitions * sizeof(TMBRPartitionEntry) <= KMBRSignatureOffset);
+
+	memmove(&iIntBuf[0], &iIntBuf[2],
+		KMBRFirstPartitionOffsetAligned + KMBRMaxPrimaryPartitions * sizeof(TMBRPartitionEntry)); 
+
+
+	for (i=0, pe = (TMBRPartitionEntry*)(&iIntBuf[KMBRFirstPartitionOffsetAligned]);
+		pe->iPartitionType != 0 && i < KMaxPartitionEntries; i++,pe--)
+		{
+		if (pe->IsDefaultBootPartition())
+			{
+			SetPartitionEntry(&iPartitionInfo->iEntry[0],pe->iFirstSector,pe->iNumSectors);
+			defaultPartitionNumber=i;
+			partitionCount++;
+			break;
+			}
+		}
+
+	// Now add any other partitions
+	for (i=0, pe = (TMBRPartitionEntry*)(&iIntBuf[KMBRFirstPartitionOffsetAligned]);
+		pe->iPartitionType != 0 && i < KMaxPartitionEntries; i++,pe--)
+		{
+		if (defaultPartitionNumber==i)
+			{
+			// Already sorted
+			}
+
+		// FAT partition ?
+		else if (pe->IsValidDosPartition() || pe->IsValidFAT32Partition())
+			{
+			SetPartitionEntry(&iPartitionInfo->iEntry[partitionCount],pe->iFirstSector,pe->iNumSectors);
+			__KTRACE_OPT(KLOCDPAGING, Kern::Printf("Mmc: FAT partition found at sector #%u", pe->iFirstSector));
+			partitionCount++;
+			}
+
+		else if (pe->iPartitionType == KPartitionTypeROM)
+			{
+			TPartitionEntry& partitionEntry = iPartitionInfo->iEntry[partitionCount];
+			SetPartitionEntry(&iPartitionInfo->iEntry[partitionCount],pe->iFirstSector,pe->iNumSectors);
+			partitionEntry.iPartitionType = pe->iPartitionType;
+			partitionCount++;				 
+
+			__KTRACE_OPT(KLOCDPAGING, Kern::Printf("Mmc: KPartitionTypeROM found at sector #%u", pe->iFirstSector));
+			}
+
+		// ROFS partition ?
+		else if (pe->iPartitionType == KPartitionTypeRofs)
+			{
+			
+// Don't expose this for normal operation only boot?			
+			TPartitionEntry& partitionEntry = iPartitionInfo->iEntry[partitionCount];
+			SetPartitionEntry(&iPartitionInfo->iEntry[partitionCount],pe->iFirstSector,pe->iNumSectors);
+			partitionEntry.iPartitionType = pe->iPartitionType;
+			__KTRACE_OPT(KLOCDPAGING, Kern::Printf("Mmc: KPartitionTypeRofs found at sector #%u", pe->iFirstSector));
+			partitionCount++;
+			}
+ 
+		// Swap partition ?
+		else if (pe->iPartitionType == KPartitionTypePagedData)
+			{
+			__KTRACE_OPT(KLOCDPAGING, Kern::Printf("Mmc: KPartitionTypePagedData found at sector #%u", pe->iFirstSector));
+
+			TPartitionEntry& partitionEntry = iPartitionInfo->iEntry[partitionCount];
+			SetPartitionEntry(&iPartitionInfo->iEntry[partitionCount],pe->iFirstSector,pe->iNumSectors);
+			partitionEntry.iPartitionType = pe->iPartitionType;
+			partitionCount++;
+			}
+		}
+
+	// Check the validity of the partition address boundaries
+	// If there is any MBR errors
+	if(partitionCount > 0)
+		{
+		const TInt64 deviceSize = iCard->DeviceSize64();
+		TPartitionEntry& part = iPartitionInfo->iEntry[partitionCount - 1];
+		// Check that the card address space boundary is not exceeded by the last partition
+		if(part.iPartitionBaseAddr + part.iPartitionLen > deviceSize)
+			{
+			__KTRACE_OPT(KPBUSDRV, Kern::Printf("Mmc: MBR partition exceeds card memory space"));
+			return KErrCorrupt;
+			}
+		
+		// More than one partition. Go through all of them
+		if (partitionCount > 0)
+			{
+			for(i=partitionCount-1; i>0; i--)
+				{
+				const TPartitionEntry& curr = iPartitionInfo->iEntry[i];
+				TPartitionEntry& prev = iPartitionInfo->iEntry[i-1];
+				// Check if partitions overlap
+				if(curr.iPartitionBaseAddr < (prev.iPartitionBaseAddr + prev.iPartitionLen))
+					{
+					__KTRACE_OPT(KPBUSDRV, Kern::Printf("Mmc: Overlapping partitions"));
+						//return KErrCorrupt;
+					}
+				}
+			}
+		}
+
+	if (defaultPartitionNumber==(-1) && partitionCount==0)
+		{
+		__KTRACE_OPT(KPBUSDRV, Kern::Printf("No Valid Partitions Found!"));
+		return KErrCorrupt;
+		}
+
+	
+	iPartitionInfo->iPartitionCount=partitionCount;
+	iPartitionInfo->iMediaSizeInBytes=iCard->DeviceSize64();
+
+#ifdef _DEBUG
+	__KTRACE_OPT(KPBUSDRV, Kern::Printf("<Mmc:PartitionInfo (C:%d)",partitionCount));
+	for (TUint x=0; x<partitionCount; x++)
+		__KTRACE_OPT(KPBUSDRV, Kern::Printf("     Partition%d (B:%xH L:%xH)",x,I64LOW(iPartitionInfo->iEntry[x].iPartitionBaseAddr),I64LOW(iPartitionInfo->iEntry[x].iPartitionLen)));
+#endif
+
+
+	//Notify medmmc that partitioninfo is complete.
+	iCallBack.CallBack();
+	
+	return(KErrNone);
+	}
+
+
+void DLegacyEMMCPartitionInfo::SetPartitionEntry(TPartitionEntry* aEntry, TUint aFirstSector, TUint aNumSectors)
+//
+// auxiliary static function to record partition information in TPartitionEntry object
+//
+	{
+	aEntry->iPartitionBaseAddr=aFirstSector;
+	aEntry->iPartitionBaseAddr<<=KDiskSectorShift;
+	aEntry->iPartitionLen=aNumSectors;
+	aEntry->iPartitionLen<<=KDiskSectorShift;
+	aEntry->iPartitionType=KPartitionTypeFAT12;
+	}
+
+// End - DLegacyEMMCPartitionInfo
+
+
+EXPORT_C DEMMCPartitionInfo* CreateEmmcPartitionInfo()
+	{
+	return new DLegacyEMMCPartitionInfo;
+	}
+
+DECLARE_STANDARD_EXTENSION()
+	{
+	return KErrNone;
+	}
+
+
+
+
+/**************************************************************************
+* TInt Toc::GetItemX(const TText8* aItemName, STocItem& aItem)
+*-----------------------------------------------------------------------
+* Search entry in XLOADER TOC with ItemName.
+* End of TOC limited by amount of entries only
+*-----------------------------------------------------------------------
+* Parameters:
+* TText8		: Item Name
+* STocItem		: Reference of Item
+*-----------------------------------------------------------------------
+* Return Value
+* KErrNone		: If Item Found other wise return KErrNotFound
+*************************************************************************/
+
+TInt Toc::GetItemX(const TText8* aItemName, STocItem& aItem)
+    {
+	TUint8 i = 0;
+
+    if ( aItemName == NULL )
+        {
+        return KErrNotFound;
+        }
+
+    // check all items
+	while ( i < KXMaxNbrOfTocItems )
+		{
+		TUint8 j;	
+		for ( j = 0; j < KMaxItemNameLen; j++ )				
+			{
+				if ( aItemName[j] == iTOC[i].iFileName[j] )
+					{
+					if ( aItemName[j] == 0 )
+						{
+						// item found
+						aItem = iTOC[i];
+						return KErrNone;
+						}
+					}
+				else
+					{
+					break;
+					}
+			}
+
+		i++;
+		}
+	
+	return KErrNotFound;
+    }
+
+
+/**************************************************************************
+* TInt Toc::GetItem(const TText8* aItemName, STocItem& aItem)
+*-----------------------------------------------------------------------
+* Search entry in TOC with ItemName.
+*-----------------------------------------------------------------------
+* Parameters:
+* TText8		: Item Name
+* STocItem		: Reference of Item
+*-----------------------------------------------------------------------
+* Return Value
+* KErrNone		: If Item Found other wise return KErrNotFound
+*************************************************************************/
+
+TInt Toc::GetItem(const TText8* aItemName, STocItem& aItem)
+    {
+	TUint8 i = 0;
+
+    if ( aItemName == NULL )
+        {
+        return KErrNotFound;
+        }
+
+	// check all items
+	while ( i < KMaxNbrOfTocItems && iTOC[i].iByteStartAddress != KEndOfToc )
+		{
+		TUint8 j;	
+		for ( j = 0; j < KMaxItemNameLen; j++ )				
+			{
+				if ( aItemName[j] == iTOC[i].iFileName[j] )
+					{
+					if ( aItemName[j] == 0 )
+						{
+						// item found
+						aItem = iTOC[i];
+						aItem.iByteStartAddress += ((TUint32)SECTOR_SIZE) * iTocStartSector;
+						return KErrNone;
+						}
+					}
+				else
+					{
+					break;
+					}
+			}
+
+		i++;
+		}
+	
+	return KErrNotFound;
+    }
+
+/**************************************************************************
+* TInt Toc::GetItem(const TText8* aItemName, STocItem& aItem)
+*-----------------------------------------------------------------------
+* Search entry in TOC with aName as part of ItemName.
+*-----------------------------------------------------------------------
+* Parameters:
+* TText8		: Item Name
+* STocItem		: Reference of Item
+*-----------------------------------------------------------------------
+* Return Value
+* KErrNone		: If Item Found other wise return KErrNotFound
+*************************************************************************/
+
+TInt Toc::GetItemEx(const TText8* aName, STocItem& aItem)
+    {
+	TInt i = 0;
+	TInt l1 =0;
+	TInt j , k,l2;
+
+    if ( aName == NULL )
+        {
+        return KErrNotFound;
+        }
+        
+	// calculate length for name to be searched
+	while ( i < KMaxItemNameLen && aName[i] != 0 ) { i++; l1++; }	
+	if ( !l1 ) return KErrGeneral; // zero length
+
+	// check all items
+	i = 0;
+	while ( i < KMaxNbrOfTocItems && iTOC[i].iByteStartAddress != KEndOfToc )
+		{	
+		// calculate length of current item
+		j = 0; l2 = 0;
+		while ( j < KMaxItemNameLen && iTOC[i].iFileName[j] != 0 ) { j++; l2++; }
+		if ( l2 < l1 ) { i++; continue; } // too short name, skip it
+	
+
+		// compare Item with aName
+		for ( j = 0; j <= (l2 - l1); j++ )				
+			{
+				for ( k = 0; k < l1; k++ )
+					{
+						if ( aName[k] != iTOC[i].iFileName[j+k] ) break;
+					}
+
+				if ( k == l1 )
+					{
+					// item found
+					aItem = iTOC[i];
+			//		aItem.iByteStartAddress += ((TUint32)SECTOR_SIZE) * iTocStartSector; //indar check*
+					return KErrNone;
+					}
+			}		
+
+		i++;
+		}
+	
+	return KErrNotFound;
+    }
+//  End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stvariants/montblanc/src/soc/peripheral/mmc/8500ed/mmc/emmcptn.mmp	Mon May 03 13:33:44 2010 +0300
@@ -0,0 +1,47 @@
+// Copyright (c) 1998-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:
+// eka/drivers/medmmc/emmcptn.mmp
+// 
+//
+#include        <8500/variant.mmh>
+target			VariantTarget(emmcptn,dll)
+targettype		kext
+
+#include			"kernel/kern_ext.mmh"
+USERINCLUDE	../../../../../../../../../kernelhwsrv/kernel/eka/include/drivers
+SYMBIAN_BASE_SYSTEMINCLUDE(drivers)
+
+source			emmcptn.cpp
+
+library			epbusmmc.lib
+
+
+
+library			elocd.lib
+deffile 			../../../../../../../../../kernelhwsrv/kernel/eka/eabi/emmcptn.def
+
+nostrictdef
+noexportlibrary
+
+uid				0x1000008d 0x20026BFD
+VENDORID 0x70000001
+
+SMPSAFE
+
+start wins
+win32_headers
+end
+
+capability		all
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stvariants/montblanc/src/soc/peripheral/mmc/8500ed/mmc/epbusm.mmh	Mon May 03 13:33:44 2010 +0300
@@ -0,0 +1,57 @@
+// Copyright (c) 1998-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:
+// e32\drivers\pbus\mmc\epbusm.mmh
+// Common files for all MMC/SD/CPRM builds
+// 
+//
+
+#include			"kernel/kern_ext.mmh"
+
+//linkas				epbusm.dll
+
+USERINCLUDE	../../../../../../../../../kernelhwsrv/kernel/eka/include
+USERINCLUDE	../../../../../../../../../kernelhwsrv/kernel/eka/drivers/pbus/mmc
+USERINCLUDE	../../../../../../../../../kernelhwsrv/kernel/eka/drivers/pbus/mmc/traces
+SYMBIAN_BASE_SYSTEMINCLUDE(drivers)
+OS_LAYER_SYSTEMINCLUDE_SYMBIAN
+SYMBIAN_BASE_SYSTEMINCLUDE(8500)
+SYMBIAN_BASE_SYSTEMINCLUDE(kernel)
+SYMBIAN_BASE_SYSTEMINCLUDE(internal)
+SYMBIAN_ASSP_SYSTEMINCLUDE(nomadik_8500)
+
+
+sourcepath			..
+source				spbus.cpp
+
+sourcepath			../../../../../../../../../kernelhwsrv/kernel/eka/drivers/pbus
+source				pbusmedia.cpp
+
+sourcepath			../../../../../../../../../kernelhwsrv/kernel/eka/drivers/pbus/mmc
+source				stack.cpp
+source				stackbody.cpp
+source				session.cpp
+source				mmccd_init.cpp
+
+library				elocd.lib
+
+start wins
+win32_library		kernel32.lib
+end
+
+epocallowdlldata
+
+uid 				0x1000008d  0x2002E964
+
+capability			all
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stvariants/montblanc/src/soc/peripheral/mmc/8500ed/mmc/epbusmmc.mmp	Mon May 03 13:33:44 2010 +0300
@@ -0,0 +1,32 @@
+// Copyright (c) 1998-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:
+// e32/drivers/pbus/mmc/epbusmmc.mmp
+// 
+//
+
+#include        <8500/variant.mmh>
+#include			"epbusm.mmh"
+
+target			VariantTarget(epbusmmc,dll)
+targettype			kext
+linkas				epbusmmc.lib
+
+//deffile 			../../../~/epbusm.def
+
+deffile 			../../../../../../../../../kernelhwsrv/kernel/eka/eabi/epbusm.def
+
+library     VariantTarget(mmcpwrmgr,lib)
+VENDORID 0x70000001
+
+SMPSAFE
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stvariants/montblanc/test/symbian/e32/timestamp/d_timestamp.cpp	Mon May 03 13:33:44 2010 +0300
@@ -0,0 +1,198 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "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: 
+*
+*/
+
+
+#include <kern_priv.h>
+#include <kernel.h>
+#include "d_timestamp.h"
+#include "d_timestamp_dev.h"
+#include "power_info.h"
+#include "power_config.h"
+
+// Name for PDD, will be LDD name and this suffix
+_LIT(KTimestampPddSuffix,".8500");
+
+
+class D8500_TimestampTestPddChannel : public DTimestampTestPddChannel
+	{
+public:
+	// Inherited from DTimestampTestPddChanel. These called by the LDD.
+	virtual void StartLPMEntryCheck();
+    virtual TBool EndLPMEntryCheck();
+    virtual void TestConfig(STimestampTestConfig& aInfo);
+private:
+	TUint iInitialIdleCount;
+	};
+
+/**
+  Logical Device (factory class) for D8500_TimestampTestPddChannel
+*/
+class D8500_TimestampTestPddFactory : public DPhysicalDevice
+	{
+public:
+	D8500_TimestampTestPddFactory();
+	//	Inherited from DLogicalDevice
+	virtual TInt Install();
+	virtual void GetCaps(TDes8& aDes) const;
+    virtual TInt Create(DBase*& aChannel, TInt aUnit, const TDesC8* aInfo, const TVersion& aVer);
+	virtual TInt Validate(TInt aUnit, const TDesC8* aInfo, const TVersion& aVer);
+private:
+    TVersion iVersion;
+	};
+
+//
+// D8500_TimestampTestPddFactory
+//
+
+/**
+  Standard export function for PDDs. This creates a DPhysicalDevice derived object,
+  in this case, our D8500_TimestampTestPddFactory
+*/
+DECLARE_STANDARD_PDD()
+	{
+	return new D8500_TimestampTestPddFactory();
+	}
+
+/**
+ * constructor
+ */
+D8500_TimestampTestPddFactory::D8500_TimestampTestPddFactory()
+	{
+	// Set version number for this device
+	iVersion=RTimestampTest::VersionRequired();
+	}
+
+/**
+  Second stage constructor for DPhysicalDevice derived objects.
+  This must at least set a name for the driver object.
+
+  @return KErrNone or standard error code.
+*/
+TInt D8500_TimestampTestPddFactory::Install()
+    {
+    TName name(RTimestampTest::Name());
+    name.Append(KTimestampPddSuffix);
+    return SetName(&name);
+	}
+
+/**
+  Returns the drivers capabilities. This is not used by the Symbian OS device driver framework
+  but may be useful for the LDD to use.
+
+  @param aDes Descriptor to write capabilities information into
+*/
+void D8500_TimestampTestPddFactory::GetCaps(TDes8& aDes) const
+	{
+	// Create a capabilities object
+	RTimestampTest::TCaps caps;
+	caps.iVersion = iVersion;
+    // Write it back to user memory
+	Kern::InfoCopy(aDes,(TUint8*)&caps,sizeof(caps));
+	}
+
+/**
+  Called by the kernel's device driver framework to create a Physical Channel.
+  This is called in the context of the user thread (client) which requested the creation of a Logical Channel
+  (E.g. through a call to RBusLogicalChannel::DoCreate)
+  The thread is in a critical section.
+
+  @param aChannel Set to point to the created Physical Channel
+  @param aUnit The unit argument supplied by the client to RBusLogicalChannel::DoCreate
+  @param aInfo The info argument supplied by the client to RBusLogicalChannel::DoCreate
+  @param aVer The version number of the Logical Channel which will use this Physical Channel 
+
+  @return KErrNone or standard error code.
+*/
+TInt D8500_TimestampTestPddFactory::Create(DBase*& aChannel, TInt aUnit, const TDesC8* aInfo, const TVersion& aVer)
+	{
+	// Ignore the parameters we aren't interested in...
+	(void)aUnit;
+	(void)aInfo;
+	(void)aVer;
+
+	// Create a new physical channel
+	D8500_TimestampTestPddChannel* channel=new D8500_TimestampTestPddChannel;
+    aChannel = channel;
+    return (channel) ? KErrNone : KErrNoMemory;
+	}
+
+/**
+  Called by the kernel's device driver framework to check if this PDD is suitable for use with a Logical Channel.
+  This is called in the context of the user thread (client) which requested the creation of a Logical Channel
+  (E.g. through a call to RBusLogicalChannel::DoCreate)
+  The thread is in a critical section.
+
+  @param aUnit The unit argument supplied by the client to RBusLogicalChannel::DoCreate
+  @param aInfo The info argument supplied by the client to RBusLogicalChannel::DoCreate
+  @param aVer The version number of the Logical Channel which will use this Physical Channel 
+
+  @return KErrNone or standard error code.
+*/
+TInt D8500_TimestampTestPddFactory::Validate(TInt aUnit, const TDesC8* aInfo, const TVersion& aVer)
+	{
+	// Check version numbers
+	if (!Kern::QueryVersionSupported(iVersion,aVer))
+		return KErrNotSupported;
+        
+        // Ignore extra info, (this could be used for validation purposes) and unit
+    (void)aInfo;
+    (void) aUnit;    
+    return KErrNone;
+    }
+
+////
+// Channel implementation
+
+
+/**
+   Called before each cycle in the test. Takes a copy of current idle count in power controller
+*/
+void  D8500_TimestampTestPddChannel::StartLPMEntryCheck()
+    {
+#ifdef __SMP__    
+    iInitialIdleCount = IdleRestoreCount();
+#endif
+    }
+
+/**
+   Called at the end of each cycle. Should return true if we have entered idle since call to
+   StartLPMEntryCheck. This will be the case if the idle count has changed
+*/
+TBool  D8500_TimestampTestPddChannel::EndLPMEntryCheck()
+    {
+    // should only really return true if a low power mode >= WFIITS has been entered. 
+#ifdef __SMP__     // we don't care about single core build in this test
+    if (DEFAULT_STATE_WFIITS_ENABLE || DEFAULT_STATE_IDLE_ENABLE || 
+        DEFAULT_STATE_SLEEP_ENABLE || DEFAULT_STATE_DEEPSLEEP_ENABLE)
+        return (iInitialIdleCount!=IdleRestoreCount());
+    else
+        return ETrue;
+#else
+    return ETrue;
+#endif
+    }
+
+
+/**
+   Called to allow baseport to override test parameters. For Navi defaults are fine
+*/
+void D8500_TimestampTestPddChannel::TestConfig(STimestampTestConfig& aInfo) 
+    {
+    // default test config is fine for HREF
+    // accebtable error up to 2%
+    aInfo.iErrorPercent = 2;
+    }