Revision: 201033 RCL_3
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Thu, 19 Aug 2010 10:59:57 +0300
branchRCL_3
changeset 13 cb9d56c0e2af
parent 11 7fcac431985a
child 14 2b9ddd958b2b
Revision: 201033 Kit: 201033
emulator/emulatorbsp/inc/variantmediadef.h
emulator/emulatorbsp/specific/mmc.cpp
emulator/emulatorbsp/specific/mmci.h
emulator/emulatorbsp/specific/property.cpp
emulator/emulatorbsp/test/bld.inf
emulator/emulatorbsp/test/mediaext/d_nfe.mmp
--- a/emulator/emulatorbsp/inc/variantmediadef.h	Mon Jun 21 16:55:23 2010 +0300
+++ b/emulator/emulatorbsp/inc/variantmediadef.h	Thu Aug 19 10:59:57 2010 +0300
@@ -57,4 +57,17 @@
 #define NAND_NUMMEDIA 1
 #define NAND_DRIVENAME "Nand"
 
+// Variant parameters for test NFE media extension driver 
+#define NFE_DRIVECOUNT 2
+#define NFE_DRIVELIST 1,5
+#define NFE_DRIVELETTERLIST 23,20			// EDRive? IDs of the each instance. (EDriveX,EDriveU from estart.txt)
+
+#define NFE_INSTANCE_COUNT 2				// the number of NFE media driver instances
+#define NFE_INSTANCE_DRIVE_COUNTS 1,1		// the number of drives in NFE_DRIVELIST for each instance of the driver
+
+// Variant parameters for production NFE media extension driver (same as NFE_DRIVELETTERLIST)
+#define NFE_INSTANCE_UI_DRIVE_ID 23,20			// EDRive? IDs of the each instance. (EDriveX,EDriveU from estart.txt)
+
+
+
 #endif
--- a/emulator/emulatorbsp/specific/mmc.cpp	Mon Jun 21 16:55:23 2010 +0300
+++ b/emulator/emulatorbsp/specific/mmc.cpp	Thu Aug 19 10:59:57 2010 +0300
@@ -307,11 +307,27 @@
 		FILE_FLAG_RANDOM_ACCESS,					// DWORD dwFlagsAndAttributes
 			NULL);									// HANDLE hTemplateFile
 	
-	TInt fileSize=GetFileSize(*aHandle,NULL);
-	if (fileSize>TotalMDiskSize)
+	TInt fileSize = 0;
+	if (*aHandle!=INVALID_HANDLE_VALUE)
+	    {
+        fileSize = GetFileSize(*aHandle,NULL);
+        // Check whether MMC card force mount property is set.
+        // Force mount MMC card image regardless of whether the size of the image file is
+        // as specified in the epoc.ini.
+        // Specify "MMCCardForceMount 1" in the epoc.ini to enable force mount.
+        TBool forceMount = Property::GetBool("MMCCardForceMount");
+        if (forceMount && fileSize != INVALID_FILE_SIZE)
+            {
+            TInt sizeInKB = fileSize >> 10;
+            SetupDiskParms(sizeInKB);
+            TotalMDiskSize = fileSize;
+            }
+	    }
+
+	if (fileSize!=TotalMDiskSize)
 		//
 		// The Drive file already exists and size of emulated drive as configured in 
-		// epoc.ini has been reduced. Musn't corrupt the emulated drive so delete the 
+		// epoc.ini has been changed. Musn't corrupt the emulated drive so delete the 
 		// drive file and start from scratch. The emulated drive contents will be 
 		// erased.
 		//
@@ -379,6 +395,21 @@
 		delete cip;
 		return(err);
 		}
+	
+	TBool forceMount = Property::GetBool("MMCCardForceMount");
+	if (forceMount)
+	    {
+        // if Force Mount as image file size, CSIZE and CSIZE_MULT will be set 
+        // again inside the CreateBinFileForCard() call above.
+        cip->iForceMount = ETrue;
+        cip->iForceMountCSIZE = CSIZE;
+        cip->iForceMountCSIZE_MULT = CSIZE_MULT;
+	    }
+	else
+	    {
+        cip->iForceMountCSIZE = EFalse;
+	    }
+	
 	cip->iWinHandle=h;
 	iCardPool[aCardNum]=cip;
 	return(KErrNone);
@@ -1314,6 +1345,20 @@
 
 void TWinsCardInfo::GetCSD(TUint8* aResp) const
 	{
+	TUint size;
+    TUint sizeMult;
+    
+    if (iForceMount)
+        {
+        size = iForceMountCSIZE;
+        sizeMult = iForceMountCSIZE_MULT;
+        }
+    else
+        {
+        size = DWinsMMCStack::CSIZE;
+        sizeMult = DWinsMMCStack::CSIZE_MULT;
+        }
+		
 	// Bits 127-96
 	TUint32 csd=(KCsdStructure<<30); 	/* CSD_STRUCTURE */
 	csd|=		(KCsdSpecVers<<26); 	/* SPEC_VERS */
@@ -1341,16 +1386,16 @@
 	csd|=		(0x0<<14);	/* WRITE_BLK_MISALIGN: No */  
 	csd|=		(0x0<<13);	/* READ_BLK_MISALIGN: No */  
 	csd|=		(0x0<<12);	/* DSR_IMP: No DSR */ 
-	csd|=		((DWinsMMCStack::CSIZE>>10&3)<<8);			/* C_SIZE: MMCSz Kb */
-	csd|=		((DWinsMMCStack::CSIZE>>2) & 0xFF);			/* C_SIZE: MMCSz Kb */
+	csd|=		((size>>10&3)<<8);			/* C_SIZE: MMCSz Kb */
+	csd|=		((size>>2) & 0xFF);			/* C_SIZE: MMCSz Kb */
 	TMMC::BigEndian4Bytes(&aResp[4],csd); 
 	// Bits 63-32
-	csd=		((DWinsMMCStack::CSIZE&3)<<30); 			/* C_SIZE: MMCSz Kb */
+	csd=		((size&3)<<30); 			/* C_SIZE: MMCSz Kb */
 	csd|=		(0x1<<27); 	/* VDD_R_CURR_MIN: 1mA */
 	csd|=		(0x1<<24);	/* VDD_R_CURR_MAX: 5mA */  
 	csd|=		(0x2<<21); 	/* VDD_W_CURR_MIN: 5mA */
 	csd|=		(0x3<<18);	/* VDD_W_CURR_MAX: 25mA */  
-	csd|=		((DWinsMMCStack::CSIZE_MULT&0x07)<<15);		/* C_SIZE_MULT: 0 */  
+	csd|=		((sizeMult&0x07)<<15);		/* C_SIZE_MULT: 0 */  
 	csd|=		(0x0<<10);	/* SECTOR_SIZE: 1 write block */  
 	csd|=		(0x0<<5);	/* ERASE_GRP_SIZE: 1 secotr */  
 	csd|=		(0x0);		/* WP_GRP_SIZE: 1 erase group */  
--- a/emulator/emulatorbsp/specific/mmci.h	Mon Jun 21 16:55:23 2010 +0300
+++ b/emulator/emulatorbsp/specific/mmci.h	Thu Aug 19 10:59:57 2010 +0300
@@ -52,6 +52,10 @@
 	TMMCardStateEnum iState;			// Simulation of card's current state
 	HANDLE iWinHandle;
 	TRCA iRCA;
+	
+	TBool iForceMount;
+	TUint iForceMountCSIZE;             // mmc card size field
+	TUint iForceMountCSIZE_MULT;        // mmc card size field
 	};
 
 class DWinsMMCStack : public DMMCStack
--- a/emulator/emulatorbsp/specific/property.cpp	Mon Jun 21 16:55:23 2010 +0300
+++ b/emulator/emulatorbsp/specific/property.cpp	Thu Aug 19 10:59:57 2010 +0300
@@ -435,6 +435,16 @@
 		}
 	
 
+	// Get the name of the extension media drivers from epoc.ini (optional)
+	value = NULL;
+	iProperties.GetString("MediaExtensionDriver", value);
+	if (value)
+		{
+		if (iProperties.Append("Extension", value) == NULL)
+			return KErrNoMemory;		
+		}
+
+
 //	load additional configuration specific properties
 
 //	get the multi property "configuration"
--- a/emulator/emulatorbsp/test/bld.inf	Mon Jun 21 16:55:23 2010 +0300
+++ b/emulator/emulatorbsp/test/bld.inf	Thu Aug 19 10:59:57 2010 +0300
@@ -20,6 +20,7 @@
 PRJ_EXPORTS
 
 PRJ_MMPFILES
+mediaext/d_nfe.mmp
 
 PRJ_TESTMMPFILES
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/emulator/emulatorbsp/test/mediaext/d_nfe.mmp	Thu Aug 19 10:59:57 2010 +0300
@@ -0,0 +1,56 @@
+// Copyright (c) 1995-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:
+// e32test\group\d_nfe.mmp
+// 
+//
+
+/**
+@file
+
+@SYMPurpose medtestnfe.pdd NFE test Media Driver
+*/
+
+#include "../variant.mmh"
+
+target		VariantTarget(medtestnfe,pdd)
+
+targettype	pdd
+
+#include "kernel/kern_ext.mmh"
+#include "drivers/elocd.mmh"
+
+//macro COMPOSITE_DRIVES
+
+OS_LAYER_SYSTEMINCLUDE_SYMBIAN
+
+// point to variantmediadef.h
+SYMBIAN_BASE_SYSTEMINCLUDE(wins)
+
+sourcepath		../../../../../kernelhwsrv/kerneltest/e32test/mediaext
+source			d_nfe.cpp
+library			elocd.lib
+
+start wins
+win32_headers
+end
+
+epocallowdlldata
+
+uid				0x100039d0 0xA000E7C5
+VENDORID		0x70000001
+capability		all
+
+
+
+SMPSAFE