Merge Revision 201023 into RCL_3 trunk RCL_3
authorJohn Imhofe
Tue, 06 Jul 2010 11:40:58 +0100
branchRCL_3
changeset 38 83c58605f049
parent 31 cc88aabd867b (current diff)
parent 36 bbf8bed59bcb (diff)
Merge Revision 201023 into RCL_3 trunk
kerneltest/e32test/digitiser/t_traweventdigitiser.cpp
kerneltest/e32test/group/t_traweventdigitiser.mmp
--- a/bsptemplate/asspandvariant/template_variant/hal/config.hcf	Wed Jun 09 10:31:37 2010 +0100
+++ b/bsptemplate/asspandvariant/template_variant/hal/config.hcf	Tue Jul 06 11:40:58 2010 +0100
@@ -99,3 +99,4 @@
 ECustomResourceDrive : set = 0
 EDisplayNumberOfScreens=0
 ENumCpus=GetNumCpus
+EDigitiserOrientation : set = DigitiserOrientation
--- a/halservices/hal/inc/hal_data.h	Wed Jun 09 10:31:37 2010 +0100
+++ b/halservices/hal/inc/hal_data.h	Tue Jul 06 11:40:58 2010 +0100
@@ -114,7 +114,7 @@
 		@see HALData::TCPU
 		*/
 		ECPU,
-		
+		  
 		
 		/**
 		A revision number for the CPU architecture.
@@ -1097,19 +1097,24 @@
 		Serial number of this board
 		*/
 		ESerialNumber,
-		
-		
+				
 		/**
 		Interrupt used by sampling profiler - applicable for SMP only. Each CPU_i is interrupted by interrupt number ECpuProfilingInterrupt + i
 		*/
 		ECpuProfilingDefaultInterruptBase,
 
-
 		/**
 		Number of processors present on the device. Returns 1 on unicore. This number is constant and does not take account of power management
 		*/
 		ENumCpus,
 
+		/**
+		The orientation of the Digitiser. Usually mirrors device orientation.
+		
+		@see TDigitiserOrientation for allowed values
+		@capability WriteDeviceData needed to Set this attribute
+		*/
+		EDigitiserOrientation,
 
 		/*
 		 * NOTE:
@@ -1328,6 +1333,29 @@
 		EPowerBackupStatus_Good,
 		};
 	
+	
+    /**
+    Describes the orientation of the screen digitiser, usually mirrors the
+    device orientation not necessarily the display rotation as this might be
+	limited to upright and left 90 only. The values in degrees measures 
+	the anti-clockwise angle from the left edge of the digitiser from the 
+	normal default position of the device. 
+	
+	User-side clients can use attribute to inform the digitiser driver of the
+	digitiser orientation. The driver may then use this information to adjust 
+	X.Y sampling depending on input pointer type.
+	
+    @see HALData::TAttribute
+    */
+	enum TDigitiserOrientation
+		{
+		EDigitiserOrientation_default,	///< Driver using build-in default
+		EDigitiserOrientation_000,		///< Device normal 'make-call' position
+		EDigitiserOrientation_090,		///< Device rotated left 90 degrees
+		EDigitiserOrientation_180,		///< Device rotated 180 degrees
+		EDigitiserOrientation_270		///< Device rotated right 90 degrees
+		};
+	
 	};
 
 #endif
--- a/halservices/hal/rom/hal.hby	Wed Jun 09 10:31:37 2010 +0100
+++ b/halservices/hal/rom/hal.hby	Tue Jul 06 11:40:58 2010 +0100
@@ -1,4 +1,4 @@
-// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2007-2010 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"
@@ -139,3 +139,5 @@
 #define ESerialNumber					117
 #define ECpuProfilingDefaultInterruptBase		118
 #define ENumCpus						119
+#define EDigitiserOrientation			120
+
--- a/halservices/hal/src/userhal.cpp	Wed Jun 09 10:31:37 2010 +0100
+++ b/halservices/hal/src/userhal.cpp	Tue Jul 06 11:40:58 2010 +0100
@@ -1,4 +1,4 @@
-// Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 1999-2010 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"
@@ -41,7 +41,8 @@
 	EInvalidAttribKeybd=13,
 	EInvalidAttribPen=14,
 	EInvalidAttribMouse=15,
-	EInvalidAttrib3DPointer=16
+	EInvalidAttrib3DPointer=16,
+	EInvalidAttribDigitiserOrientation=17
 	};
 
 void Panic(THalUserHalPanic aPanic)
@@ -929,3 +930,27 @@
 	return KErrNone;
 	}
 
+// EDigitiserOrientation
+#if defined(_DEBUG)
+TInt DigitiserOrientation(TInt aDeviceNumber, TInt aAttrib, TBool aSet, TAny* aInOut)
+#else
+TInt DigitiserOrientation(TInt aDeviceNumber, TInt /*aAttrib*/, TBool aSet, TAny* aInOut)
+#endif
+	{
+	__ASSERT_DEBUG(aAttrib == HALData::EDigitiserOrientation, Panic(EInvalidAttribDigitiserOrientation));
+	__ASSERT_DEBUG(aDeviceNumber >= 0, Panic(EInvalidAttribDigitiserOrientation));	
+	
+	if (aSet)
+		{
+		//Set
+		if ( ((TInt)aInOut) < 0 || ((TInt)aInOut) > HALData::EDigitiserOrientation_270) 
+			return KErrArgument;
+		return UserSvr::HalFunction(EHalGroupDigitiser, EDigitiserOrientation, aInOut, (TAny*)ETrue, aDeviceNumber);
+		}
+		
+	//Get
+	__ASSERT_DEBUG(aInOut != 0, Panic(EInvalidAttribDigitiserOrientation));
+	return UserSvr::HalFunction(EHalGroupDigitiser, EDigitiserOrientation, aInOut, (TAny*)EFalse, aDeviceNumber);
+	}
+
+
--- a/halservices/hal/tsrc/t_newhal.cpp	Wed Jun 09 10:31:37 2010 +0100
+++ b/halservices/hal/tsrc/t_newhal.cpp	Tue Jul 06 11:40:58 2010 +0100
@@ -144,7 +144,7 @@
 	_S("ESerialNumber"),
 	_S("ECpuProfilingDefaultInterruptBase"),
 	_S("ENumCpus"),
-
+	_S("EDigitiserOrientation")
 	};
 
 TInt MatchAbbrev(const TDesC& anInput, const TText** aList, TInt aListLen)
@@ -159,7 +159,7 @@
 		if (r>=0)
 			{
 			// substring matches
-			if (r==0 && list_entry.Length()==anInput.Length())
+			if (r==0 && list_entry.Length()==anInput.Length()) 
 				{
 				// exact match
 				return i;
--- a/kernel/eka/drivers/locmedia/locmedia.cpp	Wed Jun 09 10:31:37 2010 +0100
+++ b/kernel/eka/drivers/locmedia/locmedia.cpp	Tue Jul 06 11:40:58 2010 +0100
@@ -458,10 +458,12 @@
 			if (r==KErrNone)
 				{
 				__TRACE_TIMING(2);
-				OstTraceDefExt4( OST_TRACE_CATEGORY_RND, TRACE_REQUEST, DLOCALDRIVE_REQUEST_READ, "ERead iDriveNumber=%d; length=0x%x; position=0x%x; TLocDrvRequest Object=0x%x", (TInt) iDrive->iDriveNumber, (TUint) m.Length(), (TUint) m.Pos(), (TUint) &m);
+				OstTraceDefExt2( OST_TRACE_CATEGORY_RND, TRACE_REQUEST, DLOCALDRIVE_REQUEST_READ, "ERead iDriveNumber=%d; TLocDrvRequest Object=0x%x", (TInt) iDrive->iDriveNumber, (TUint) &m);
+				OstTraceDefExt4( OST_TRACE_CATEGORY_RND, TRACE_REQUEST, DLOCALDRIVE_REQUEST_READ2, "ERead length=%x:%x, pos=%x:%x", (TUint) I64HIGH(m.Length()), (TUint) I64LOW(m.Length()), (TUint) I64HIGH(m.Pos()), (TUint) I64LOW(m.Pos()));
 				r=iDrive->Request(m);
 				__TRACE_TIMING(3);
-				OstTraceDefExt4( OST_TRACE_CATEGORY_RND, TRACE_REQUEST, DLOCALDRIVE_REQUEST_READ_RETURN, "ERead Return iDriveNumber=%d; length=0x%x; position=0x%x; TLocDrvRequest Object=0x%x", (TInt) iDrive->iDriveNumber, (TUint) m.Length(), (TUint) m.Pos(), (TUint) &m );
+				OstTraceDefExt2( OST_TRACE_CATEGORY_RND, TRACE_REQUEST, DLOCALDRIVE_REQUEST_READ_RETURN, "ERead Return iDriveNumber=%d; TLocDrvRequest Object=0x%x", (TInt) iDrive->iDriveNumber, (TUint) &m );
+				OstTraceDefExt4( OST_TRACE_CATEGORY_RND, TRACE_REQUEST, DLOCALDRIVE_REQUEST_READ_RETURN2, "ERead Return length=%x:%x, pos=%x:%x", (TUint) I64HIGH(m.Length()), (TUint) I64LOW(m.Length()), (TUint) I64HIGH(m.Pos()), (TUint) I64LOW(m.Pos()));
 				}
 			m.CloseRemoteThread();
 			break;
@@ -472,9 +474,11 @@
 			r=m.ProcessMessageData(a1);
 			if (r==KErrNone)
 				{
-				OstTraceDefExt4( OST_TRACE_CATEGORY_RND, TRACE_REQUEST, DLOCALDRIVE_REQUEST_WRITE, "EWrite iDriveNumber=%d; length=0x%x; position=0x%x; TLocDrvRequest Object=0x%x", (TInt) iDrive->iDriveNumber, (TUint) m.Length(), (TUint) m.Pos(), (TUint) &m );
+				OstTraceDefExt2( OST_TRACE_CATEGORY_RND, TRACE_REQUEST, DLOCALDRIVE_REQUEST_WRITE, "EWrite iDriveNumber=%d; TLocDrvRequest Object=0x%x", (TInt) iDrive->iDriveNumber, (TUint) &m );
+				OstTraceDefExt4( OST_TRACE_CATEGORY_RND, TRACE_REQUEST, DLOCALDRIVE_REQUEST_WRITE2, "EWrite length=%x:%x, pos=%x:%x", (TUint) I64HIGH(m.Length()), (TUint) I64LOW(m.Length()), (TUint) I64HIGH(m.Pos()), (TUint) I64LOW(m.Pos()));
 				r=iDrive->Request(m);
-				OstTraceDefExt4( OST_TRACE_CATEGORY_RND, TRACE_REQUEST, DLOCALDRIVE_REQUEST_WRITE_RETURN, "EWrite Return iDriveNumber=%d; length=0x%x; position=0x%x; TLocDrvRequest Object=0x%x", (TInt) iDrive->iDriveNumber, (TUint) m.Length(), (TUint) m.Pos(), (TUint) &m );
+				OstTraceDefExt2( OST_TRACE_CATEGORY_RND, TRACE_REQUEST, DLOCALDRIVE_REQUEST_WRITE_RETURN, "EWrite Return iDriveNumber=%d; TLocDrvRequest Object=0x%x", (TInt) iDrive->iDriveNumber, (TUint) &m );
+				OstTraceDefExt4( OST_TRACE_CATEGORY_RND, TRACE_REQUEST, DLOCALDRIVE_REQUEST_WRITE_RETURN2, "EWrite Return length=%x:%x, pos=%x:%x", (TUint) I64HIGH(m.Length()), (TUint) I64LOW(m.Length()), (TUint) I64HIGH(m.Pos()), (TUint) I64LOW(m.Pos()));
 				}
 			m.CloseRemoteThread();
 			break;
@@ -1412,7 +1416,7 @@
 	OstTraceFunctionEntry1( TLOCDRVREQUEST_CHECKANDADJUSTFORPARTITION_ENTRY, this );
 	TLocDrv& d=*Drive();
 	__KTRACE_OPT(KLOCDRV,Kern::Printf("CheckAndAdjustForPartition drive %d partition len %lx",d.iDriveNumber,d.iPartitionLen));
-	OstTraceExt2( TRACE_INTERNALS, TLOCDRVREQUEST_CHECKANDADJUSTFORPARTITION1, "iDriveNumber=%d; partition length=0x%lx", d.iDriveNumber, (TInt) d.iPartitionLen );
+	OstTraceExt3( TRACE_INTERNALS, TLOCDRVREQUEST_CHECKANDADJUSTFORPARTITION1, "iDriveNumber=%d; partition length=%x:%x", d.iDriveNumber, (TInt) I64HIGH (d.iPartitionLen), (TInt) I64LOW (d.iPartitionLen));
 	Flags() |= EAdjusted;
 	TInt r;
 	switch (Id())
@@ -1433,7 +1437,7 @@
 		    }
 		case DLocalDrive::EEnlarge:
 			__KTRACE_OPT(KLOCDRV,Kern::Printf("Enlarge request %lx",Length()));
-			OstTrace1( TRACE_INTERNALS, TLOCDRVREQUEST_CHECKANDADJUSTFORPARTITION2, "Enlarge request=0x%lx", Length() );
+			OstTraceExt2( TRACE_INTERNALS, TLOCDRVREQUEST_CHECKANDADJUSTFORPARTITION2, "Enlarge request=%x:%x", (TInt) I64HIGH(Length()), (TInt) I64LOW(Length()) );
 			if (Length()>KMaxTInt)
 				r = KErrArgument;
 			else
@@ -1441,7 +1445,7 @@
 			break;
 		case DLocalDrive::EReduce:
 			__KTRACE_OPT(KLOCDRV,Kern::Printf("Reduce request %lx@%lx",Length(),Pos()));
-			OstTraceExt2( TRACE_INTERNALS, TLOCDRVREQUEST_CHECKANDADJUSTFORPARTITION3, "Reduce request length=0x%lx; position=0x%lx", (TUint) Length(), (TUint) Pos() );
+			OstTraceExt4( TRACE_INTERNALS, TLOCDRVREQUEST_CHECKANDADJUSTFORPARTITION3, "Reduce request length=%x:%x; position=%x:%x", (TUint) I64HIGH(Length()), (TUint) I64LOW(Length()), (TUint) I64HIGH(Pos()), (TUint) I64LOW(Pos()) );
 			if (Pos()+Length()>d.iPartitionLen)
 				r = KErrArgument;
 			else
@@ -1449,7 +1453,7 @@
 			break;
 		case DLocalDrive::EFormat:
 			__KTRACE_OPT(KLOCDRV,Kern::Printf("Format request %lx@%lx",Length(),Pos()));
-			OstTraceExt2( TRACE_INTERNALS, TLOCDRVREQUEST_CHECKANDADJUSTFORPARTITION4, "Format request length=0x%lx; position=0x%lx", (TUint) Length(), (TUint) Pos() );
+			OstTraceExt4( TRACE_INTERNALS, TLOCDRVREQUEST_CHECKANDADJUSTFORPARTITION4, "Format request length=%x:%x; position=%x:%x", (TUint) I64HIGH(Length()),(TUint) I64LOW(Length()), (TUint) I64HIGH(Pos()), (TUint) I64LOW(Pos()) );
 			if (!(DriverFlags() & RLocalDrive::ELocDrvWholeMedia))
 				{
 				if (Pos()>d.iPartitionLen)
@@ -1477,7 +1481,7 @@
 //		    Otherwise the media driver adjust it internally
 		case DMediaPagingDevice::ECodePageInRequest:
 			__KTRACE_OPT(KLOCDPAGING,Kern::Printf("Adjusted Paging read request %lx@%lx",Length(),Pos()));
-			OstTraceDefExt2(OST_TRACE_CATEGORY_RND, TRACE_DEMANDPAGING, TLOCDRVREQUESTCHECKANDADJUSTFORPARTITION5, "Adjusted Paging read request length=0x%lx; position=0x%lx", (TUint) Length(),  (TUint) Pos());
+			OstTraceDefExt4(OST_TRACE_CATEGORY_RND, TRACE_DEMANDPAGING, TLOCDRVREQUESTCHECKANDADJUSTFORPARTITION5, "Adjusted Paging read request length=%x:%x; position=%x%:%x", (TUint) I64HIGH(Length()), (TUint) I64LOW(Length()),  (TUint) I64HIGH(Pos()), (TUint) I64LOW(Pos()));
 			if (Pos()+Length()>d.iPartitionLen)
 			    {
 				r = KErrArgument;
@@ -1490,7 +1494,7 @@
 		
 		default:	// read or write or fragment
 			__KTRACE_OPT(KLOCDRV,Kern::Printf("R/W request %lx@%lx",Length(),Pos()));
-			OstTraceExt2( TRACE_INTERNALS, TLOCDRVREQUEST_CHECKANDADJUSTFORPARTITION6, "Read/Write request length=0x%x; position=0x%x", (TUint) Length(), (TUint) Pos() );
+			OstTraceExt4( TRACE_INTERNALS, TLOCDRVREQUEST_CHECKANDADJUSTFORPARTITION6, "Read/Write request length=%x:%x; position=%x:%x", (TUint) I64HIGH(Length()), (TUint) I64LOW(Length()), (TUint) I64HIGH(Pos()), (TUint) I64LOW(Pos()));
 			if (DriverFlags() & RLocalDrive::ELocDrvWholeMedia)
 				{
 				if (d.iMedia && d.iMedia->iDriver && Pos()+Length() > d.iMedia->iDriver->iTotalSizeInBytes)
@@ -1795,7 +1799,8 @@
 	__KTRACE_OPT(KLOCDRV,Kern::Printf("DPrimaryMediaBase(%d)::Request(%08x)",iMediaId,&aReq));
 	__KTRACE_OPT(KLOCDRV,Kern::Printf("this=%x, ReqId=%d, Pos=%lx, Len=%lx, remote thread %O",this,aReq.Id(),aReq.Pos(),aReq.Length(),aReq.RemoteThread()));
 
-	OstTraceDefExt4(OST_TRACE_CATEGORY_RND, TRACE_REQUEST, DPRIMARYMEDIABASE_REQUEST, "reqId=%d; length=0x%lx; position=0x%lx; remote thread=0x%x", (TInt) aReq.Id(), (TUint) aReq.Length(),  (TUint) aReq.Pos(), (TUint) aReq.RemoteThread());
+	OstTraceDefExt2(OST_TRACE_CATEGORY_RND, TRACE_REQUEST, DPRIMARYMEDIABASE_REQUEST, "reqId=%d; remote thread=0x%x", (TInt) aReq.Id(), (TUint) aReq.RemoteThread());
+	OstTraceDefExt4(OST_TRACE_CATEGORY_RND, TRACE_REQUEST, DPRIMARYMEDIABASE_REQUEST2, "length=%x:%x; position=%x:%x", (TUint) I64HIGH(aReq.Length()), (TUint) I64LOW(aReq.Length()), (TUint) I64HIGH(aReq.Pos()), (TUint) I64LOW(aReq.Pos()));
 	
 	TInt reqId = aReq.Id();
 
@@ -2088,7 +2093,8 @@
 		fragment.Flags() = aReq.Flags();
 
 		__KTRACE_OPT2(KLOCDPAGING,KLOCDRV,Kern::Printf("Send fragment (0x%08x) type(%d), length(0x%x), offset within original req(0x%x), pos in media(0x%lx)",&fragment,fragment.Id(), pinnedLen, pos, fragment.Pos()));
-		OstTraceDefExt5(OST_TRACE_CATEGORY_RND, TRACE_DEMANDPAGING, DPRIMARYMEDIABASE_PINFRAGMENTSENDRECEIVE3, "Send fragment 0x%08x; type=%d; length=0x%x; offset within original req=0x%x; position in media=0x%lx", (TUint) &fragment, (TInt) fragment.Id(), (TUint) pinnedLen, (TUint) pos, (TUint) fragment.Pos());
+		OstTraceDefExt4(OST_TRACE_CATEGORY_RND, TRACE_DEMANDPAGING, DPRIMARYMEDIABASE_PINFRAGMENTSENDRECEIVE3, "Send fragment 0x%08x; type=%d; length=0x%x; offset within original req=0x%x", (TUint) &fragment, (TInt) fragment.Id(), (TUint) pinnedLen, (TUint) pos);
+		OstTraceDefExt3(OST_TRACE_CATEGORY_RND, TRACE_DEMANDPAGING, DPRIMARYMEDIABASE_PINFRAGMENTSENDRECEIVE4, "Send fragment 0x%08x; position in media=%x:%x",(TUint) &fragment, (TUint) I64HIGH(fragment.Pos()), (TUint) I64LOW(fragment.Pos()));
 		
 #ifdef BTRACE_PAGING_MEDIA
 		TInt buf[4];
@@ -2503,7 +2509,7 @@
 	DMedia* media=pL->iMedia;
 	TInt r=KErrNone;
 	
-	OstTraceDefExt3( OST_TRACE_CATEGORY_RND, TRACE_REQUEST, DPRIMARYMEDIABASE_DOREQUEST, "req Id=%d; length=0x%x; position=0x%x", (TInt) m.Id(), (TInt) m.Length(), (TInt) m.Pos());
+	OstTraceDefExt5( OST_TRACE_CATEGORY_RND, TRACE_REQUEST, DPRIMARYMEDIABASE_DOREQUEST, "req Id=%d; length=%x:%x; position=%x:%x", (TInt) m.Id(), (TUint) I64HIGH(m.Length()), (TUint) I64LOW(m.Length()), (TUint) I64HIGH(m.Pos()), (TUint) I64LOW(m.Pos()) );
 	
 	// re-open this drive's media driver ?
 	if (m.iValue == DLocalDrive::EForceMediaChange)
@@ -4010,7 +4016,8 @@
 		    m.Flags() |= TLocDrvRequest::EPhysAddrOnly;
 
 		__KTRACE_OPT2(KLOCDRV,KLOCDPAGING,Kern::Printf("ReqId=%d, Pos=0x%lx, Len=0x%lx, remote Des 0x%x",m.Id(),m.Pos(),m.Length(),m.RemoteDes()));
-		OstTraceDefExt4(OST_TRACE_CATEGORY_RND, TRACE_DEMANDPAGING, DMEDIAPAGINGDEVICE_READ2, "reqId=%d; position=0x%lx; length=0x%x; remote Des=0x%x", (TInt) m.Id(), (TUint) m.Pos(), (TUint) m.Length(), (TUint) m.RemoteDes());
+		OstTraceDefExt2(OST_TRACE_CATEGORY_RND, TRACE_DEMANDPAGING, DMEDIAPAGINGDEVICE_READ2, "reqId=%d; remote Des=0x%x", (TInt) m.Id(), (TUint) m.RemoteDes());
+		OstTraceDefExt4(OST_TRACE_CATEGORY_RND, TRACE_DEMANDPAGING, DMEDIAPAGINGDEVICE_READ3, "length=%x:%x, pos=%x:%x", (TUint) I64HIGH(m.Length()), (TUint) I64LOW(m.Length()), (TUint) I64HIGH(m.Pos()), (TUint) I64LOW(m.Pos()));
 		
 		__ASSERT_DEBUG(iPrimaryMedia->iBody, LOCM_FAULT());
 		TInt mediaChanges = iPrimaryMedia->iBody->iMediaChanges;
@@ -4143,7 +4150,8 @@
 		m.DriverFlags() = 0;        
 
 		__KTRACE_OPT2(KLOCDRV,KLOCDPAGING,Kern::Printf("ReqId=%d, Pos=0x%lx, Len=0x%lx, remote Des 0x%x",m.Id(),m.Pos(),m.Length(),m.RemoteDes()));
-		OstTraceDefExt4(OST_TRACE_CATEGORY_RND, TRACE_DEMANDPAGING, DMEDIAPAGINGDEVICE_WRITE2, "reqId=%d; position=0x%lx; length=0x%lx; remote Des=0x%x", (TInt) m.Id(), (TUint) m.Pos(), (TUint) m.Length(), (TUint) m.RemoteDes());
+		OstTraceDefExt2(OST_TRACE_CATEGORY_RND, TRACE_DEMANDPAGING, DMEDIAPAGINGDEVICE_WRITE2, "reqId=%d; remote Des=0x%x", (TInt) m.Id(), (TUint) m.RemoteDes());
+		OstTraceDefExt4(OST_TRACE_CATEGORY_RND, TRACE_DEMANDPAGING, DMEDIAPAGINGDEVICE_WRITE3, "length=%x:%x, pos=%x:%x", (TUint) I64HIGH(m.Length()), (TUint) I64LOW(m.Length()),  (TUint) I64HIGH(m.Pos()), (TUint) I64LOW(m.Pos()));
 		
 		__ASSERT_DEBUG(iPrimaryMedia->iBody, LOCM_FAULT());
 		TInt mediaChanges = iPrimaryMedia->iBody->iMediaChanges;
@@ -4238,8 +4246,8 @@
 	m.RemoteDesOffset() = 0;		// pre-aligned
 	m.DriverFlags()=0;
 	__KTRACE_OPT2(KLOCDRV,KLOCDPAGING,Kern::Printf("ReqId=%d, Pos=0x%lx, Len=0x%lx, remote Des 0x%x",m.Id(),m.Pos(),m.Length(),m.RemoteDes()));
-	OstTraceDefExt4(OST_TRACE_CATEGORY_RND, TRACE_DEMANDPAGING, DMEDIAPAGINGDEVICE_DELETENOTIFY2 , "reqId=%d; position=0x%lx; length=0x%lx; remote Des=0x%x", m.Id(), m.Pos(), m.Length(), (TUint) m.RemoteDes());
-
+	OstTraceDefExt2(OST_TRACE_CATEGORY_RND, TRACE_DEMANDPAGING, DMEDIAPAGINGDEVICE_DELETENOTIFY2 , "reqId=%d; remote Des=0x%x", m.Id(),(TUint) m.RemoteDes());
+	OstTraceDefExt4(OST_TRACE_CATEGORY_RND, TRACE_DEMANDPAGING, DMEDIAPAGINGDEVICE_DELETENOTIFY3 , "length=%x:%x, pos=%x:%x", (TUint) I64HIGH(m.Length()), (TUint) I64LOW(m.Length()), (TUint) I64HIGH(m.Pos()), (TUint) I64LOW(m.Pos()));
 	// send request aynchronously as we don't particularly care about the result 
 	// and waiting would slow down the thread taking the page fault
 	iPrimaryMedia->RequestCountInc();
--- a/kernel/eka/drivers/medmmc/medmmc.cpp	Wed Jun 09 10:31:37 2010 +0100
+++ b/kernel/eka/drivers/medmmc/medmmc.cpp	Tue Jul 06 11:40:58 2010 +0100
@@ -759,7 +759,7 @@
 	TUint32 length(I64LOW(iCurrentReq->Length()));
 
 	__KTRACE_OPT(KPBUSDRV, Kern::Printf(">mmd:dr:0x%lx,0x%x", pos, length));
-	OstTraceExt2( TRACE_INTERNALS, DMMCMEDIADRIVERFLASH_DO_READ, "Position=0x%lx; Length=0x%x", (TUint) pos, (TUint) length);
+	OstTraceExt3( TRACE_INTERNALS, DMMCMEDIADRIVERFLASH_DO_READ, "Position=%x:%x; Length=0x%x", (TUint) I64HIGH(pos), (TUint) I64LOW(pos), (TUint) length);
 	__ASSERT_DEBUG(CurrentRequest() == EMReqIdle, Panic(EDRInUse));
 	__ASSERT_DEBUG(pos < TotalSizeInBytes(), Panic(EDRStart));
 	__ASSERT_DEBUG(iCurrentReq->Length() >= 0, Panic(EDRNotPositive));
@@ -830,7 +830,7 @@
 //
 	{
 	OstTraceFunctionEntryExt( DMMCMEDIADRIVERFLASH_LAUNCHREAD_ENTRY, this );
-	OstTraceExt2( TRACE_INTERNALS, DMMCMEDIADRIVERFLASH_LAUNCHREAD, "position=0x%lx; length=0x%x", (TUint) iCurrentReq->Pos(), (TUint) I64LOW(iCurrentReq->Length()));
+	OstTraceExt3( TRACE_INTERNALS, DMMCMEDIADRIVERFLASH_LAUNCHREAD, "position=%x:%x; length=0x%x", (TUint) I64HIGH(iCurrentReq->Pos()), (TUint) I64LOW(iCurrentReq->Pos()) ,(TUint) I64LOW(iCurrentReq->Length()));
 	__KTRACE_OPT(KPBUSDRV, Kern::Printf(">mmd:lr:0x%lx,0x%x", aStart, aLength));
 	__ASSERT_DEBUG(TotalSizeInBytes() > aStart, Panic(ELRStart));
 	__ASSERT_DEBUG(aLength > 0, Panic(ELRNotPositive));
@@ -896,7 +896,7 @@
 	{
 	OstTraceFunctionEntry1( DMMCMEDIADRIVERFLASH_LAUNCHDBREAD_ENTRY, this );
 	__KTRACE_OPT(KPBUSDRV, Kern::Printf(">mmd:ldbr:0x%lx,0x%x", iReqCur, I64LOW(iReqEnd - iReqCur)));
-	OstTraceExt2( TRACE_INTERNALS, DMMCMEDIADRIVERFLASH_LAUNCHDBREAD, "position=0x%lx; length=0x%x", (TInt) iReqCur, (TInt) I64LOW(iReqEnd - iReqCur));
+	OstTraceExt3( TRACE_INTERNALS, DMMCMEDIADRIVERFLASH_LAUNCHDBREAD, "position=%x:%x; length=0x%x", (TInt) I64HIGH(iReqCur), (TInt) I64LOW(iReqCur), (TInt) I64LOW(iReqEnd - iReqCur));
 	__ASSERT_DEBUG(TotalSizeInBytes() > iReqCur, Panic(ELRStart));
 	__ASSERT_DEBUG(I64LOW(iReqEnd - iReqCur) > 0, Panic(ELRNotPositive));
 	__ASSERT_DEBUG(TotalSizeInBytes() >= iReqEnd, Panic(ELREnd));
@@ -957,7 +957,7 @@
 //
 	{
 	OstTraceFunctionEntryExt( DMMCMEDIADRIVERFLASH_LAUNCHPHYSREAD_ENTRY, this );
-	OstTraceExt2( TRACE_INTERNALS, DMMCMEDIADRIVERFLASH_LAUNCHPHYSREAD, "position=0x%lx; length=0x%x", (TInt) iReqCur, (TInt) I64LOW(iReqEnd - iReqCur));
+	OstTraceExt3( TRACE_INTERNALS, DMMCMEDIADRIVERFLASH_LAUNCHPHYSREAD, "position=%x:%x; length=0x%x", (TInt) I64HIGH(iReqCur), (TInt) I64LOW(iReqCur), (TInt) I64LOW(iReqEnd - iReqCur));
 	__KTRACE_OPT(KPBUSDRV, Kern::Printf(">mmd:physr:0x%lx,0x%x", aStart, aLength));
 	__ASSERT_DEBUG(TotalSizeInBytes() > aStart, Panic(ELRStart));
 	__ASSERT_DEBUG(aLength > 0, Panic(ELRNotPositive));
@@ -1049,7 +1049,7 @@
 	const TUint32 length = I64LOW(iCurrentReq->Length());
 
 	__KTRACE_OPT(KPBUSDRV, Kern::Printf(">mmd:dw:0x%lx,0x%x", pos, length));
-	OstTraceExt2( TRACE_INTERNALS, DMMCMEDIADRIVERFLASH_DOWRITE, "position=0x%lx; length=0x%x", (TUint) pos, (TUint) length);
+	OstTraceExt3( TRACE_INTERNALS, DMMCMEDIADRIVERFLASH_DOWRITE, "position=%x:%x; length=0x%x", (TUint) I64HIGH(pos), (TUint) I64LOW(pos), (TUint) length);
 	__ASSERT_DEBUG(CurrentRequest() == EMReqIdle, Panic(EDWInUse));
 	__ASSERT_DEBUG(pos < TotalSizeInBytes(), Panic(EDWStart));
 	__ASSERT_DEBUG(length > 0, Panic(EDWNotPositive));
@@ -1084,7 +1084,7 @@
 	const TUint32 length = I64LOW(iCurrentReq->Length());
 
 	__KTRACE_OPT(KPBUSDRV, Kern::Printf(">mmd:df:0x%lx,0x%x", pos, length));
-	OstTraceExt2( TRACE_INTERNALS, DMMCMEDIADRIVERFLASH_DOFORMAT, "position=0x%lx; length=0x%x", (TUint) pos, (TUint) length);
+	OstTraceExt3( TRACE_INTERNALS, DMMCMEDIADRIVERFLASH_DOFORMAT, "position=%x:%x; length=0x%x", (TUint) I64HIGH(pos), (TUint) I64LOW(pos), (TUint) length);
 	__ASSERT_DEBUG(CurrentRequest() == EMReqIdle, Panic(EDFInUse));
 	__ASSERT_DEBUG(pos < TotalSizeInBytes(), Panic(EDFStart));
 	__ASSERT_DEBUG(length > 0, Panic(EDFNotPositive));
@@ -1125,7 +1125,7 @@
 //
 	{
 	OstTraceFunctionEntryExt( DMMCMEDIADRIVERFLASH_LAUNCHFORMAT_ENTRY, this );
-	OstTraceExt2( TRACE_INTERNALS, DMMCMEDIADRIVERFLASH_LAUNCHFORMAT, "position=0x%lx; length=0x%x", (TInt) iReqCur, (TInt) I64LOW(iReqEnd - iReqCur));
+	OstTraceExt3( TRACE_INTERNALS, DMMCMEDIADRIVERFLASH_LAUNCHFORMAT, "position=%x:%x; length=0x%x", (TInt) I64HIGH(iReqCur), (TInt) I64LOW(iReqCur), (TInt) I64LOW(iReqEnd - iReqCur));
 	__KTRACE_OPT(KPBUSDRV, Kern::Printf(">mmd:lf:0x%lx,0x%x", aStart, aLength));
 	__ASSERT_DEBUG(TotalSizeInBytes() > aStart, Panic(ELFStart));
 	__ASSERT_DEBUG((aStart & iBlkMsk) == 0, Panic(ELWFmtStAlign));
@@ -1224,7 +1224,7 @@
 //
 	{
 	OstTraceExt4(TRACE_FLOW, DMMCMEDIADRIVERFLASH_LAUNCHWRITE_ENTRY, "DMmcMediaDriverFlash::LaunchWrite;aStart=%Ld;aLength=%x;aMedReq=%d;this=%x", aStart, (TUint) aLength, (TInt) aMedReq, (TUint) this);
-	OstTraceExt2( TRACE_INTERNALS, DMMCMEDIADRIVERFLASH_LAUNCHWRITE, "position=0x%lx; length=0x%x", (TInt) iReqCur, (TInt) I64LOW(iReqEnd - iReqCur));
+	OstTraceExt3( TRACE_INTERNALS, DMMCMEDIADRIVERFLASH_LAUNCHWRITE, "position=%x:%x; length=0x%x", (TInt) I64HIGH(iReqCur), (TInt) I64LOW(iReqCur),(TInt) I64LOW(iReqEnd - iReqCur));
 	__KTRACE_OPT(KPBUSDRV, Kern::Printf("\n>mmd:lw:0x%lx,%d,%d", aStart, aLength, aMedReq));
 	__ASSERT_DEBUG(aMedReq == EMReqWrite || aMedReq == EMReqFormat, Panic(ELWRequest));
 	__ASSERT_DEBUG(TotalSizeInBytes() > aStart, Panic(ELWStart));
@@ -2896,7 +2896,7 @@
 	{
 	OstTraceFunctionEntryExt( DMMCMEDIADRIVERFLASH_READDATAUNTILCACHEEXHAUSTED_ENTRY, this );
 	__KTRACE_OPT(KPBUSDRV, Kern::Printf(">mmd:rdc:%x,%x", iReqCur, iReqEnd));
-	OstTraceExt2( TRACE_INTERNALS, DMMCMEDIADRIVERFLASH_READDATAUNTILCACHEEXHAUSTED, "iReqCur=0x%x; iReqEnd=0x%x", (TUint) iReqCur, (TUint) iReqEnd );
+	OstTraceExt3( TRACE_INTERNALS, DMMCMEDIADRIVERFLASH_READDATAUNTILCACHEEXHAUSTED, "iReqCur=%x:%x; iReqEnd=0x%x", (TUint) I64HIGH(iReqCur), (TUint) I64LOW(iReqCur), (TUint) iReqEnd );
 	
 	if ( iCurrentReq->IsPhysicalAddress()
 #if defined(__DEMAND_PAGING__) && !defined(__WINS__)
--- a/kernel/eka/drivers/xyin/d_xyin.cpp	Wed Jun 09 10:31:37 2010 +0100
+++ b/kernel/eka/drivers/xyin/d_xyin.cpp	Tue Jul 06 11:40:58 2010 +0100
@@ -1,4 +1,4 @@
-// Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 1998-2010 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"
@@ -19,6 +19,7 @@
 
 #include <drivers/xyin.h>
 #include <kernel/kern_priv.h>
+#include <hal_data.h>
 
 _LIT(KLitDigitiser,"Digitiser");
 
@@ -50,7 +51,8 @@
 	:	DPowerHandler(KLitDigitiser),
 		iMsgQ(rxMsg,this,NULL,1),
 		iSampleDfc(sampleDfc,this,5),
-		iPenUpDfc(penUpDfc,this,5)
+		iPenUpDfc(penUpDfc,this,5),
+		iOrientation(HALData::EDigitiserOrientation_default)
 	{
 //	iBufferIndex=0;
 //	iLastPos=TPoint(0,0);
@@ -358,6 +360,26 @@
 		case EDigitiserHalXYState:
 			kumemput32(a1, (TBool*)&iPointerOn, sizeof(TBool));
 			break;
+			
+		// a2 = TBool aSet (ETrue for setting, EFalse for retrieval) 
+		// a1 = TDigitizerOrientation (set)
+		// a1 = &TDigitizerOrientation (get)
+		case EDigitiserOrientation:	
+			if ((TBool)a2)
+				{
+				// Set the orientation attribute
+				// In case user thread, check it has WDD capability
+				if(!Kern::CurrentThreadHasCapability(ECapabilityWriteDeviceData,__PLATSEC_DIAGNOSTIC_STRING("Checked by Hal function EDigitiserOrientation")))
+					return KErrPermissionDenied;
+				iOrientation = (TInt)a1;
+				}
+			else
+				{
+				// Get the orientation attribute, safe copy it into user memory
+				kumemput32(a1, &iOrientation, sizeof(TInt));	
+				}
+			break; 
+			
 		default:
 			r=KErrNotSupported;
 			break;
--- a/kernel/eka/include/drivers/xyin.h	Wed Jun 09 10:31:37 2010 +0100
+++ b/kernel/eka/include/drivers/xyin.h	Tue Jul 06 11:40:58 2010 +0100
@@ -1,4 +1,4 @@
-// Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 1998-2010 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"
@@ -27,6 +27,7 @@
 #include <platform.h>
 #include <e32hal.h>
 
+
 #ifdef _DEBUG
 //#define __DIGITISER_DEBUG1__
 //#define __DIGITISER_DEBUG2__
@@ -180,6 +181,7 @@
 	TState iState;
 	TInt iCount;
 	TUint8 iPointerOn;
+	TInt iOrientation;	 			// HALData::TDigitizerOrientation
 	};
 
 
--- a/kernel/eka/include/e32ver.h	Wed Jun 09 10:31:37 2010 +0100
+++ b/kernel/eka/include/e32ver.h	Tue Jul 06 11:40:58 2010 +0100
@@ -28,7 +28,7 @@
 
 const TInt KE32MajorVersionNumber=2;
 const TInt KE32MinorVersionNumber=0;
-const TInt KE32BuildVersionNumber=2122;
+const TInt KE32BuildVersionNumber=2127;
 
 const TInt KMachineConfigurationMajorVersionNumber=1;
 const TInt KMachineConfigurationMinorVersionNumber=0;
--- a/kernel/eka/include/u32hal.h	Wed Jun 09 10:31:37 2010 +0100
+++ b/kernel/eka/include/u32hal.h	Tue Jul 06 11:40:58 2010 +0100
@@ -1,4 +1,4 @@
-// Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 1995-2010 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"
@@ -1989,7 +1989,23 @@
     @see TPckgBuf
     @see TDigitiserInfoV02
     */
-	EDigitiserHal3DInfo
+	EDigitiserHal3DInfo,
+
+	/**
+	Get or sets the digitiser driver's current orientation property.
+	Requirements of the HAL function handler's 2nd, 3rd and 4th parameters:
+	
+	- TInt aFunction : This enum value.
+    - TAny* a1 : if Set, a TDigitiserOrientation value the driver should now use	
+			   : If Get, a pointer to a TDigitiserOrientation. The HAL function 
+			   : needs to set its value to the current value used in the driver.	
+	- TAny* a2 : Cast to a TInt. Should be assigned the value 
+			   : EFalse - Get property; ETrue - Set property 
+	
+	@see HALData::TDigitiserOrientation
+	@capability WriteDeviceData To set the property, None to read
+	*/
+	EDigitiserOrientation
 
 	};
 
--- a/kernel/eka/memmodel/epoc/flexible/mmu/mpager.cpp	Wed Jun 09 10:31:37 2010 +0100
+++ b/kernel/eka/memmodel/epoc/flexible/mmu/mpager.cpp	Tue Jul 06 11:40:58 2010 +0100
@@ -498,56 +498,86 @@
 	}
 
 
-TInt DPager::TryStealOldestPage(SPageInfo*& aPageInfoOut)
+SPageInfo* DPager::StealOrAllocPage(TBool aAllowAlloc, Mmu::TRamAllocFlags aAllocFlags)
 	{
 	__NK_ASSERT_DEBUG(RamAllocLock::IsHeld());
 	__NK_ASSERT_DEBUG(MmuLock::IsHeld());
-	
-	// The PageCleaningLock may or may not be held.  This method will release the RamAllocLock if it
-	// has to wait for the PageCleaningLock
+
+	// The PageCleaningLock may or may not be held to start with
 	TBool pageCleaningLockAcquired = EFalse;
 
-	// find oldest page in list...
 	SDblQueLink* link;
+	SPageInfo* pageInfo ;
+	
+restart:
+
+	// if there is a free page in the live list then use that (it will be at the end)...
+	if (iOldestCleanCount)
+		{
+		__NK_ASSERT_DEBUG(!iOldestCleanList.IsEmpty());
+		link = iOldestCleanList.Last();
+		pageInfo = SPageInfo::FromLink(link);
+		if(pageInfo->Type()==SPageInfo::EUnused)
+			goto try_steal_from_page_info;
+		}
+	
+	// maybe try getting a free page from the system pool...
+	if (aAllowAlloc && !HaveMaximumPages())
+		{
+		MmuLock::Unlock();
+		pageInfo = GetPageFromSystem(aAllocFlags);
+		MmuLock::Lock();
+		if (pageInfo)
+			goto exit;
+		}
+	
+	// try stealing the oldest clean page on the  live list if there is one...
 	if (iOldestCleanCount)
 		{
 		__NK_ASSERT_DEBUG(!iOldestCleanList.IsEmpty());
 		link = iOldestCleanList.Last();
+		goto try_steal_from_link;
 		}
-	else if (iOldestDirtyCount)
+
+	// no clean oldest pages, see if we can clean multiple dirty pages in one go...
+	if (iOldestDirtyCount > 1 && iPagesToClean > 1)
 		{
 		__NK_ASSERT_DEBUG(!iOldestDirtyList.IsEmpty());
 
-		// see if we can clean multiple dirty pages in one go...
-		if (iPagesToClean > 1 && iOldestDirtyCount > 1)
+		// check if we hold page cleaning lock
+		TBool needPageCleaningLock = !PageCleaningLock::IsHeld();
+		if (needPageCleaningLock)
 			{
-			if (!PageCleaningLock::IsHeld())
-				{
-				// temporarily release ram alloc mutex and acquire page cleaning mutex
-				MmuLock::Unlock();
-				RamAllocLock::Unlock();
-				PageCleaningLock::Lock();
-				MmuLock::Lock();
-				pageCleaningLockAcquired = ETrue;
-				}
-
-			// there may be clean pages now if we've waited on the page cleaning mutex, if so don't
-			// bother cleaning but just restart
-			if (iOldestCleanCount == 0 && iOldestDirtyCount >= 1)
-				CleanSomePages(EFalse);
-
-			if (pageCleaningLockAcquired)
-				{
-				// release page cleaning mutex and re-aquire ram alloc mutex
-				MmuLock::Unlock();
-				PageCleaningLock::Unlock();			
-				RamAllocLock::Lock();
-				MmuLock::Lock();
-				}
-			
-			return 1;  // tell caller to restart their operation
+			// temporarily release ram alloc mutex and acquire page cleaning mutex
+			MmuLock::Unlock();
+			RamAllocLock::Unlock();
+			PageCleaningLock::Lock();
+			MmuLock::Lock();
 			}
-		
+
+		// there may be clean pages now if we've waited on the page cleaning mutex, if so don't
+		// bother cleaning but just restart
+		if (iOldestCleanCount == 0 && iOldestDirtyCount >= 1)
+			CleanSomePages(EFalse);
+
+		if (needPageCleaningLock)
+			{
+			// release page cleaning mutex and re-aquire ram alloc mutex
+			MmuLock::Unlock();
+			PageCleaningLock::Unlock();			
+			RamAllocLock::Lock();
+			MmuLock::Lock();
+			}
+
+		// if there are now some clean pages we restart so as to take one of them
+		if (iOldestCleanCount > 0)
+			goto restart;
+		}
+
+	// otherwise just try to steal the oldest page...
+	if (iOldestDirtyCount)
+		{
+		__NK_ASSERT_DEBUG(!iOldestDirtyList.IsEmpty());
 		link = iOldestDirtyList.Last();
 		}
 	else if (iOldCount)
@@ -561,32 +591,44 @@
 		__NK_ASSERT_ALWAYS(!iYoungList.IsEmpty());
 		link = iYoungList.Last();
 		}
-	SPageInfo* pageInfo = SPageInfo::FromLink(link);
-
-	if (pageInfo->IsDirty())
+
+try_steal_from_link:
+
+	// lookup page info
+	__NK_ASSERT_DEBUG(link);
+	pageInfo = SPageInfo::FromLink(link);
+	
+try_steal_from_page_info:
+	
+	// if the page is dirty and we don't hold the page cleaning mutex then we have to wait on it,
+	// and restart - we clean with the ram alloc mutex held in this case
+	if (pageInfo->IsDirty() && !PageCleaningLock::IsHeld())
 		{		
 		MmuLock::Unlock();
 		PageCleaningLock::Lock();
 		MmuLock::Lock();
 		pageCleaningLockAcquired = ETrue;
+		goto restart;
 		}
 	
 	// try to steal it from owning object...
-	TInt r = StealPage(pageInfo);	
-	if (r == KErrNone)
-		{
-		BalanceAges();
-		aPageInfoOut = pageInfo;
-		}
-
+	if (StealPage(pageInfo) != KErrNone)
+		goto restart;
+	
+	BalanceAges();
+	
+exit:
 	if (pageCleaningLockAcquired)
 		{		
 		MmuLock::Unlock();
 		PageCleaningLock::Unlock();
 		MmuLock::Lock();
 		}
+
+	__NK_ASSERT_DEBUG(RamAllocLock::IsHeld());
+	__NK_ASSERT_DEBUG(MmuLock::IsHeld());
 	
-	return r;
+	return pageInfo;
 	}
 
 
@@ -1050,20 +1092,20 @@
 	__NK_ASSERT_DEBUG(MmuLock::IsHeld());
 	__NK_ASSERT_DEBUG(iNumberOfFreePages>0);
 
-	SPageInfo* pageInfo = NULL;
-	if (TryStealOldestPage(pageInfo) == KErrNone)
+	SPageInfo* pageInfo = StealOrAllocPage(EFalse, (Mmu::TRamAllocFlags)0);
+	
+	// StealOrAllocPage may have released the MmuLock, so check there are still enough pages
+	// to remove one from the live list
+	if (iNumberOfFreePages>0)
 		{
-		// TryStealOldestPage may have released the MmuLock, so check there are still enough pages
-		// to remove one from the live list
-		if (iNumberOfFreePages>0)
-			{
-			ReturnPageToSystem(*pageInfo);
-			return ETrue;
-			}
-		else
-			AddAsFreePage(pageInfo);
+		ReturnPageToSystem(*pageInfo);
+		return ETrue;
 		}
-	return EFalse;
+	else
+		{
+		AddAsFreePage(pageInfo);
+		return EFalse;
+		}
 	}
 
 
@@ -1092,51 +1134,23 @@
 
 SPageInfo* DPager::PageInAllocPage(Mmu::TRamAllocFlags aAllocFlags)
 	{
-	SPageInfo* pageInfo;
-	TPhysAddr pagePhys;
-	TInt r = KErrGeneral;
+	// ram alloc mutex may or may not be held
+	__NK_ASSERT_DEBUG(!MmuLock::IsHeld());
 	
 	RamAllocLock::Lock();
-	MmuLock::Lock();
-
-find_a_page:
-	// try getting a free page from our live list...
-	if (iOldestCleanCount)
+	
+	MmuLock::Lock();	
+	SPageInfo* pageInfo = StealOrAllocPage(ETrue, aAllocFlags);
+	TBool wasAllocated = pageInfo->Type() == SPageInfo::EUnknown;
+	MmuLock::Unlock();
+
+	if (!wasAllocated)
 		{
-		pageInfo = SPageInfo::FromLink(iOldestCleanList.Last());
-		if(pageInfo->Type()==SPageInfo::EUnused)
-			goto try_steal_oldest_page;
-		}
-
-	// try getting a free page from the system pool...
-	if(!HaveMaximumPages())
-		{
-		MmuLock::Unlock();
-		pageInfo = GetPageFromSystem(aAllocFlags);
-		if(pageInfo)
-			goto done;
-		MmuLock::Lock();
+		// make page state same as a freshly allocated page...
+		TPhysAddr pagePhys = pageInfo->PhysAddr();
+		TheMmu.PagesAllocated(&pagePhys,1,aAllocFlags);
 		}
 
-	// otherwise steal a page from the live list...
-try_steal_oldest_page:
-	__NK_ASSERT_ALWAYS(iOldestCleanCount|iOldestDirtyCount|iOldCount|iYoungCount);
-	r = TryStealOldestPage(pageInfo);
-	
-	// if this fails we restart whole process.
-	// failure can be either KErrInUse if the page was used while we were stealing, or 1 to indicate
-	// that some pages were cleaned and the operation should be restarted
-	if (r != KErrNone)
-		goto find_a_page;
-
-	// otherwise we're done!
-	MmuLock::Unlock();
-
-	// make page state same as a freshly allocated page...
-	pagePhys = pageInfo->PhysAddr();
-	TheMmu.PagesAllocated(&pagePhys,1,aAllocFlags);
-
-done:
 	RamAllocLock::Unlock();
 
 	return pageInfo;
@@ -2046,9 +2060,9 @@
 	NKern::ThreadEnterCS();
 	RamAllocLock::Lock();
 
-	// We must hold this otherwise TryStealOldestPage will release the RamAllocLock while waiting
-	// for it.  Note this method is not used in producton, so it's ok to hold both locks for longer
-	// than would otherwise happen.
+	// We must hold this otherwise StealOrAllocPage will release the RamAllocLock while waiting for
+	// it.  Note this method is not used in producton, so it's ok to hold both locks for longer than
+	// would otherwise happen.
 	PageCleaningLock::Lock();  
 
 	MmuLock::Lock();
--- a/kernel/eka/memmodel/epoc/flexible/mmu/mpager.h	Wed Jun 09 10:31:37 2010 +0100
+++ b/kernel/eka/memmodel/epoc/flexible/mmu/mpager.h	Tue Jul 06 11:40:58 2010 +0100
@@ -432,19 +432,19 @@
 	void RemovePage(SPageInfo* aPageInfo);
 
 	/**
-	Attempt to steal the oldest page on the live list.
+	Get a page, either by stealing one from the live list or allocating one from the system.
 
-	If the oldest page is an oldest dirty page, this attempts to clean multiple pages by calling
-	#CleanSomePages and then returns without stealing any page.  This allows the caller to restart
-	their operation after the lengthy cleaning process, which may no longer need to call this
-	function.
+	
+	
+	If the oldest page is an oldest dirty page, this may attempt to clean multiple pages by calling
+	#CleanSomePages.
 
 	If the oldest page is on any other list (i.e. is an old or young page) this will steal it,
 	aquiring the page cleaning mutex first if it is dirty.
 
-	Called from #PageInAllocPage.
+	Called from #PageInAllocPage and #TryReturnOldestPageToSystem.
 	
-	@param aPageInfoOut Set to the SPageInfo pointer for the stolen page if any.
+	@param aAllowAlloc Indicates whether the method should try to allocate a page from the system
 	
 	@return KErrNone on success, KErrInUse if stealing failed or 1 to indicate the the oldest page
 	was dirty and the PageCleaning mutex was not held.
@@ -452,7 +452,7 @@
 	@pre MmuLock held
 	@post MmuLock left unchanged.
 	*/
-	TInt TryStealOldestPage(SPageInfo*& aPageInfoOut);
+	SPageInfo* StealOrAllocPage(TBool aAllowAlloc, Mmu::TRamAllocFlags aAllocFlags);
 
 	/**
 	Steal a page from the memory object (if any) which is using the page.
--- a/kernel/eka/release.txt	Wed Jun 09 10:31:37 2010 +0100
+++ b/kernel/eka/release.txt	Tue Jul 06 11:40:58 2010 +0100
@@ -1,3 +1,45 @@
+Version 2.00.2127
+=================
+(Made by vfebvre 24/05/2010)
+
+1.	jcoppear
+	1.	ou1cimx1#389410 ENV E32TEST T_IPCCPY hangs on H4HRP.ARMV5.UREL.FMM.ONENANDPAGE
+
+
+Version 2.00.2126
+=================
+(Made by vfebvre 20/05/2010)
+
+1.	necliffo
+	1.	ou1cimx1#389444 NAND paging are in bootloop
+
+
+Version 2.00.2125
+=================
+(Made by vfebvre 19/05/2010)
+
+1.	hengrant
+	1.	ou1cimx1#377066 Trace outputs truncated data for length and position
+
+
+Version 2.00.2124
+=================
+(Made by vfebvre 14/05/2010)
+
+1.	famustaf
+	1.	ou1cimx1#380187 Build on Linux - Incorrect slash in #include in sf_sys.cpp
+		Changed backslash to forward slash.
+
+
+Version 2.00.2123
+=================
+(Made by vfebvre 12/05/2010)
+
+1.	stmansfi
+	1.	RM 417-69728 KHS Digitiser HAL Changes 92
+		PackageReleaseID=488421
+
+
 Version 2.00.2122
 =================
 (Made by vfebvre 11/05/2010)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kerneltest/e32test/digitiser/digi.auto.bat	Tue Jul 06 11:40:58 2010 +0100
@@ -0,0 +1,19 @@
+rem
+rem Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+rem All rights reserved.
+rem This component and the accompanying materials are made available
+rem under the terms of the License "Eclipse Public License v1.0"
+rem which accompanies this distribution, and is available
+rem at the URL "http://www.eclipse.org/legal/epl-v10.html".
+rem
+rem Initial Contributors:
+rem Nokia Corporation - initial contribution.
+rem
+rem Contributors:
+rem
+rem Description:
+rem
+
+t_userdigitisertest
+t_userdigitisernocap
+t_ldddigitisertest
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kerneltest/e32test/digitiser/digitiser.inf	Tue Jul 06 11:40:58 2010 +0100
@@ -0,0 +1,44 @@
+// 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 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:
+// Digitiser Driver Tests
+// Convienence INF file to build just Digitiser tests "bldmake -f digitiser.inf bldfiles"
+// Test MMPs also part of the offical ../group/bld.inf e32test component.
+//
+
+/**
+@file
+
+@SYMPurpose Kernel and User library test code
+*/
+
+PRJ_PLATFORMS
+
+BASEDEFAULT
+
+PRJ_TESTEXPORTS
+
+digitiser_tests.iby			/epoc32/rom/include/digitiser_tests.iby
+tshell_digitisertests.oby	../../../kernel/eka/rombuild/tshell_digitisertests.oby
+
+digi.auto.bat				/epoc32/rom/include/digi.auto.bat
+
+PRJ_TESTMMPFILES
+
+..\group\d_ldddigitisertest			support
+
+#ifndef SMP
+..\group\t_userdigitisertest
+..\group\t_userdigitisernocaps
+..\group\t_ldddigitisertest
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kerneltest/e32test/digitiser/digitiser_tests.iby	Tue Jul 06 11:40:58 2010 +0100
@@ -0,0 +1,27 @@
+// 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 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:
+// Digitiser Driver Test Application
+//
+
+#ifndef __DIGITISER_TEST_IBY__
+#define __DIGITISER_TEST_IBY__
+
+device[VARID]=\Epoc32\Release\##KMAIN##\##BUILD##\d_ldddigitisertest.ldd	\sys\bin\d_ldddigitisertest.ldd
+file=\Epoc32\Release\##MAIN##\##BUILD##\t_ldddigitisertest.exe				\sys\bin\t_ldddigitisertest.exe
+file=\Epoc32\Release\##MAIN##\##BUILD##\t_userdigitisertest.exe				\sys\bin\t_userdigitisertest.exe
+file=\Epoc32\Release\##MAIN##\##BUILD##\t_userdigitisernocaps.exe			\sys\bin\t_userdigitisernocaps.exe
+
+data=\epoc32\rom\include\digi.auto.bat										\digi.auot.bat
+
+#endif // __DIGITISER_TEST_IBY__
--- a/kerneltest/e32test/digitiser/t_traweventdigitiser.cpp	Wed Jun 09 10:31:37 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,143 +0,0 @@
-// Copyright (c) 2008-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\digitiser\t_traweventdigitiser.cpp
-// Overview:
-// Test the TRawEvent APIS and events associated with the Digitiser and also verify the BTRACEs (manually)
-// API Information:
-// UserSvr
-// Details:
-// - Test the following 6  Events types 
-// 1.	EPointerMove
-// 2.	EPointer3DInRange,
-// 3.	EPointer3DOutOfRange,
-// 4.	EPointer3DTilt,
-// 5.	EPointer3DRotation,
-// 6.	EPointer3DTiltAndMove,
-// Platforms/Drives/Compatibility:
-// All.
-// Assumptions/Requirement/Pre-requisites: 
-// Failures and causes:
-// 
-//
-
-#include <e32test.h>
-#include <e32svr.h>
-#include <e32cmn.h>
-#include <e32cmn_private.h>
-
-LOCAL_D RTest test(_L("t_TRawEventDigitiser"));
-
-class TestTRawDigitiserEvent
-	{
-public:
-	TestTRawDigitiserEvent(TRawEvent::TType aType,TInt aX,TInt aY,TInt aZ,TInt aScanCode,TInt aPhi,TInt aTheta,TInt aAlpha,TUint8 aPointerNumber,TUint8 iTip);
-	void TestEvents();	
-private:	
-	TRawEvent::TType iType;
-	TInt iX;
-    TInt iY;
-	TInt iZ;
-	TInt iScanCode;
-	TInt iPhi;
-	TInt iTheta;
-	TInt iAlpha;
-	TUint8 iPointerNumber;
-	TUint8 iTip;
-	TRawEvent iDigitiser3DEvent;
-	};
-
-
-TestTRawDigitiserEvent::TestTRawDigitiserEvent(TRawEvent::TType aType,TInt aX,TInt aY,TInt aZ,TInt aScanCode,TInt aPhi,TInt aTheta,TInt aAlpha,TUint8 aPointerNumber,TUint8 aTip):iType(aType),iX(aX),iY(aY),iZ(aZ),iScanCode(aScanCode),iPhi(aPhi),iTheta(aTheta),iAlpha(aAlpha),iPointerNumber(aPointerNumber),iTip(aTip)
-	{}
-
-
-void TestTRawDigitiserEvent::TestEvents()
-	{
-	
-	test(iDigitiser3DEvent.Type()==0);
-	iDigitiser3DEvent.Set(iType);
-	test(iDigitiser3DEvent.Type()==iType);
-	iDigitiser3DEvent.SetPointerNumber(iPointerNumber);
-	test(iPointerNumber == iDigitiser3DEvent.PointerNumber());
-	iDigitiser3DEvent.Set(iType,iScanCode);
-	//Set the Type temporarily to get through the assertion 
-	iDigitiser3DEvent.Set(TRawEvent::EKeyDown);
-    test(iScanCode==iDigitiser3DEvent.ScanCode());
-	iDigitiser3DEvent.Set(iType,iX,iY);
-	//Set the Type temporarily to get through the assertion
-	iDigitiser3DEvent.Set(TRawEvent::EPointerMove);
-	test(TPoint(iX,iY)==iDigitiser3DEvent.Pos());
-	iDigitiser3DEvent.Set(iType,iX,iY,iZ);
-	//Set the Type temporarily to get through the assertion
-	iDigitiser3DEvent.Set(TRawEvent::EPointerMove);
-	test(TPoint3D(iX,iY,iZ)==iDigitiser3DEvent.Pos3D());
-	iDigitiser3DEvent.SetTip(iTip);
-	test(TBool(iTip) == iDigitiser3DEvent.IsTip());
-	iDigitiser3DEvent.SetTilt(iType,iPhi,iTheta);
-	//Set the Type temporarily to get through the assertion
-	iDigitiser3DEvent.Set(TRawEvent::EPointer3DTilt);
-	TAngle3D rawEventAnge3D=iDigitiser3DEvent.Tilt();
-	test((rawEventAnge3D.iPhi==iPhi) && (rawEventAnge3D.iTheta==iTheta)) ;
-	
-
-	iDigitiser3DEvent.SetRotation(iType,iAlpha);
-	//Set the Type temporarily to get through the assertion
-	iDigitiser3DEvent.Set(TRawEvent::EPointer3DRotation);
-	test(iAlpha == iDigitiser3DEvent.Rotation());
-	iDigitiser3DEvent.Set(iType,iX+1,iY+1,iZ+1,iPhi+1,iTheta+1,iAlpha+1);
-	//Set the Type temporarily to get through the assertion
-	iDigitiser3DEvent.Set(TRawEvent::EPointer3DTiltAndMove);
-	test(TPoint3D(iX+1,iY+1,iZ+1)==iDigitiser3DEvent.Pos3D());
-    rawEventAnge3D=iDigitiser3DEvent.Tilt();
-	test((rawEventAnge3D.iPhi==iPhi+1) &&(rawEventAnge3D.iTheta==iTheta+1));	
-	test((iAlpha+1) == iDigitiser3DEvent.Rotation());   
-	iDigitiser3DEvent.Set(iType,iX+2,iY+2,iZ+2,static_cast<TUint8>(iPointerNumber+1));
-	//Set the Type temporarily to get through the assertion
-	iDigitiser3DEvent.Set(TRawEvent::EPointer3DTiltAndMove);
-  	test(TPoint3D(iX+2,iY+2,iZ+2)==iDigitiser3DEvent.Pos3D());
-	test((iPointerNumber+1) == iDigitiser3DEvent.PointerNumber());
-
-	UserSvr::AddEvent(iDigitiser3DEvent);
-	}
-
-
-GLDEF_C TInt E32Main()
-//
-//
-    {
-
- 	test.Title();
-	test.Start(_L("Testing Digitiser Events"));
-	
-    TestTRawDigitiserEvent digitiserEvent1(TRawEvent::EPointerMove, -890,-123, -823,455,2563,156,62,3,1);
-	TestTRawDigitiserEvent digitiserEvent2(TRawEvent::EPointer3DInRange, 23,45,23,1,2,6,4,2,1);
-	TestTRawDigitiserEvent digitiserEvent3(TRawEvent::EPointer3DOutOfRange, 23,45,23,1,2,6,4,2,0);
-	TestTRawDigitiserEvent digitiserEvent4(TRawEvent::EPointer3DTilt, 23,45,23,1,2,6,4,2,1);
-	TestTRawDigitiserEvent digitiserEvent5(TRawEvent::EPointer3DRotation, 23,45,23,1,2,6,4,2,1);
-	TestTRawDigitiserEvent digitiserEvent6(TRawEvent::EPointer3DTiltAndMove, 23,45,23,1,2,6,4,2,0);
-
-    digitiserEvent1.TestEvents();
-	digitiserEvent2.TestEvents();
-	digitiserEvent3.TestEvents();
-	digitiserEvent4.TestEvents();
-	digitiserEvent5.TestEvents();
-	digitiserEvent6.TestEvents();    
-	test.Printf(_L("T_TRAWEVENTDIGITISER: TEST Successfully Completed\n"));
-	test.End();
-	test.Close();
-
-    return KErrNone;
-
-    }
-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kerneltest/e32test/digitiser/t_userdigitisertest.cpp	Tue Jul 06 11:40:58 2010 +0100
@@ -0,0 +1,267 @@
+// 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 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\digitiser\t_userdigitisertest.cpp
+// Overview:
+// Test the TRawEvent APIS and events associated with the Digitiser and also verify the BTRACEs (manually)
+// Test HAL digitiser orientation attribute
+// API Information:
+// UserSvr
+// Details:
+// - Test the following 6  Events types 
+// 1.	EPointerMove
+// 2.	EPointer3DInRange,
+// 3.	EPointer3DOutOfRange,
+// 4.	EPointer3DTilt,
+// 5.	EPointer3DRotation,
+// 6.	EPointer3DTiltAndMove,
+// Platforms/Drives/Compatibility:
+// All.
+// Assumptions/Requirement/Pre-requisites: 
+// Failures and causes:
+// 
+//
+
+#define __E32TEST_EXTENSION__
+#include <e32test.h>
+#include <e32svr.h>
+#include <e32cmn.h>
+#include <e32cmn_private.h>
+#include <hal.h>
+
+#ifndef E32TEST_NOCAPS
+LOCAL_D RTest test(_L("T_UserDigitiserTest"));
+#else
+LOCAL_D RTest test(_L("T_UserDigitiserNoCaps"));
+#endif
+
+class TestTRawDigitiserEvent
+	{
+public:
+	TestTRawDigitiserEvent(TRawEvent::TType aType,TInt aX,TInt aY,TInt aZ,TInt aScanCode,TInt aPhi,TInt aTheta,TInt aAlpha,TUint8 aPointerNumber,TUint8 iTip);
+	void TestEvents();	
+private:	
+	TRawEvent::TType iType;
+	TInt iX;
+    TInt iY;
+	TInt iZ;
+	TInt iScanCode;
+	TInt iPhi;
+	TInt iTheta;
+	TInt iAlpha;
+	TUint8 iPointerNumber;
+	TUint8 iTip;
+	TRawEvent iDigitiser3DEvent;
+	};
+
+
+TestTRawDigitiserEvent::TestTRawDigitiserEvent(TRawEvent::TType aType,TInt aX,TInt aY,TInt aZ,TInt aScanCode,TInt aPhi,TInt aTheta,TInt aAlpha,TUint8 aPointerNumber,TUint8 aTip):iType(aType),iX(aX),iY(aY),iZ(aZ),iScanCode(aScanCode),iPhi(aPhi),iTheta(aTheta),iAlpha(aAlpha),iPointerNumber(aPointerNumber),iTip(aTip)
+	{}
+
+
+void TestTRawDigitiserEvent::TestEvents()
+	{
+	static TInt count = 0;
+	count++;
+	test.Printf(_L("TestTRawDigitiserEvent test case %2d\n"), count);
+	
+	test(iDigitiser3DEvent.Type()==0);
+	iDigitiser3DEvent.Set(iType);
+	test(iDigitiser3DEvent.Type()==iType);
+	iDigitiser3DEvent.SetPointerNumber(iPointerNumber);
+	test(iPointerNumber == iDigitiser3DEvent.PointerNumber());
+	iDigitiser3DEvent.Set(iType,iScanCode);
+	//Set the Type temporarily to get through the assertion 
+	iDigitiser3DEvent.Set(TRawEvent::EKeyDown);
+    test(iScanCode==iDigitiser3DEvent.ScanCode());
+	iDigitiser3DEvent.Set(iType,iX,iY);
+	//Set the Type temporarily to get through the assertion
+	iDigitiser3DEvent.Set(TRawEvent::EPointerMove);
+	test(TPoint(iX,iY)==iDigitiser3DEvent.Pos());
+	iDigitiser3DEvent.Set(iType,iX,iY,iZ);
+	//Set the Type temporarily to get through the assertion
+	iDigitiser3DEvent.Set(TRawEvent::EPointerMove);
+	test(TPoint3D(iX,iY,iZ)==iDigitiser3DEvent.Pos3D());
+	iDigitiser3DEvent.SetTip(iTip);
+	test(TBool(iTip) == iDigitiser3DEvent.IsTip());
+	iDigitiser3DEvent.SetTilt(iType,iPhi,iTheta);
+	//Set the Type temporarily to get through the assertion
+	iDigitiser3DEvent.Set(TRawEvent::EPointer3DTilt);
+	TAngle3D rawEventAnge3D=iDigitiser3DEvent.Tilt();
+	test((rawEventAnge3D.iPhi==iPhi) && (rawEventAnge3D.iTheta==iTheta)) ;
+	
+
+	iDigitiser3DEvent.SetRotation(iType,iAlpha);
+	//Set the Type temporarily to get through the assertion
+	iDigitiser3DEvent.Set(TRawEvent::EPointer3DRotation);
+	test(iAlpha == iDigitiser3DEvent.Rotation());
+	iDigitiser3DEvent.Set(iType,iX+1,iY+1,iZ+1,iPhi+1,iTheta+1,iAlpha+1);
+	//Set the Type temporarily to get through the assertion
+	iDigitiser3DEvent.Set(TRawEvent::EPointer3DTiltAndMove);
+	test(TPoint3D(iX+1,iY+1,iZ+1)==iDigitiser3DEvent.Pos3D());
+    rawEventAnge3D=iDigitiser3DEvent.Tilt();
+	test((rawEventAnge3D.iPhi==iPhi+1) &&(rawEventAnge3D.iTheta==iTheta+1));	
+	test((iAlpha+1) == iDigitiser3DEvent.Rotation());   
+	iDigitiser3DEvent.Set(iType,iX+2,iY+2,iZ+2,static_cast<TUint8>(iPointerNumber+1));
+	//Set the Type temporarily to get through the assertion
+	iDigitiser3DEvent.Set(TRawEvent::EPointer3DTiltAndMove);
+  	test(TPoint3D(iX+2,iY+2,iZ+2)==iDigitiser3DEvent.Pos3D());
+	test((iPointerNumber+1) == iDigitiser3DEvent.PointerNumber());
+
+	UserSvr::AddEvent(iDigitiser3DEvent);
+	}
+	
+	
+struct HalAttribute_TestCase
+	{
+	HALData::TAttribute iAttr;
+	TInt				iValueIn;
+	TInt				iSetRC;		// Set to KMaxTInt to skip set test case
+	TInt				iGetRC;		// Set to KMaxTInt to skip get test case
+
+	};
+	
+static HalAttribute_TestCase gHalAttributeTests[] =
+	{
+#ifndef E32TEST_NOCAPS
+	// Normal all pass tests
+	{ HALData::EDigitiserOrientation, HALData::EDigitiserOrientation_000,		KErrNone, KErrNone},
+	{ HALData::EDigitiserOrientation, HALData::EDigitiserOrientation_090,		KErrNone, KErrNone},	
+	{ HALData::EDigitiserOrientation, HALData::EDigitiserOrientation_180,		KErrNone, KErrNone},
+	{ HALData::EDigitiserOrientation, HALData::EDigitiserOrientation_270,		KErrNone, KErrNone},
+	{ HALData::EDigitiserOrientation, HALData::EDigitiserOrientation_default,	KErrNone, KErrNone},
+				
+	// Negative tests
+	{ HALData::EDigitiserOrientation, -1,		KErrArgument, KMaxTInt},
+	{ HALData::EDigitiserOrientation, 100,		KErrArgument, KMaxTInt},
+		
+#else
+	// Platsec tests for no capabilities executable.
+	{ HALData::EDigitiserOrientation, HALData::EDigitiserOrientation_default,		KMaxTInt, KErrNone},			 // Get, No caps needed
+	{ HALData::EDigitiserOrientation, HALData::EDigitiserOrientation_default,		KErrPermissionDenied, KMaxTInt}, // Set WDD cap needed
+#endif
+	};
+	
+static TInt gNumHalAttributeTests = sizeof(gHalAttributeTests)/sizeof(HalAttribute_TestCase);
+
+void DoTestDigitiserHalAttributes()
+	{
+	__UHEAP_MARK;
+#ifndef E32TEST_NOCAPS
+	test.Start(_L("DoTestDigitiserHalAttributes tests"));
+#else
+	test.Start(_L("DoTestDigitiserHalAttributes NO CAPS tests"));
+	
+	// Skip No Caps testing for WDD caps when enforcement is not enabled on the
+	// platform i.e. when a emulator epoc.ini is missing.
+	if (!PlatSec::IsCapabilityEnforced(ECapabilityWriteDeviceData))
+		{
+		test.Printf(_L("Platform security enforcement off, skipping\n"));
+		test.End();
+		__UHEAP_MARKEND;
+		return;
+		}
+#endif
+
+	TInt i = 0;
+	TInt origValue = -1;
+	TInt r = HAL::Get(HALData::EDigitiserOrientation, origValue);
+	if (r == KErrNotSupported)
+		{
+		test.Printf(_L("Platform doesn't support EDigitiserOrientation, skipping\n"));
+		test.End();
+		__UHEAP_MARKEND;
+		return;
+		}
+	test_KErrNone(r);
+	
+	// Attribute supported on platform, proceed with test.
+	TInt value = -1;
+	for (i=0; i < gNumHalAttributeTests; i++)
+		{
+		test.Printf(_L("DoTestDigitiserHalAttributes - step/row %2d\n"), i+1);
+		
+		if (gHalAttributeTests[i].iSetRC != KMaxTInt) // Skip set test?
+			{
+			r = HAL::Set(gHalAttributeTests[i].iAttr,  gHalAttributeTests[i].iValueIn);
+			test_Equal( gHalAttributeTests[i].iSetRC, r);	
+			}
+			
+		if (gHalAttributeTests[i].iGetRC != KMaxTInt) // Skip get test?
+			{
+			r = HAL::Get(gHalAttributeTests[i].iAttr,  value);
+			test_Equal(gHalAttributeTests[i].iGetRC, r);
+			test_Equal(gHalAttributeTests[i].iValueIn, value);
+			}
+		}
+		
+#ifndef E32TEST_NOCAPS
+	// Return system state back to before the test
+	r = HAL::Set(HALData::EDigitiserOrientation, origValue);
+	test_KErrNone(r);
+#endif
+		
+	test.Printf(_L("DoTestDigitiserHalAttributes - complete\n"));
+	test.End();
+	__UHEAP_MARKEND;
+	}
+
+#ifndef E32TEST_NOCAPS
+void DoTestRawDigitiserEvent()
+	{
+	__UHEAP_MARK;
+	test.Start(_L("DoTestRawDigitiserEvent tests"));
+
+    TestTRawDigitiserEvent digitiserEvent1(TRawEvent::EPointerMove, -890,-123, -823,455,2563,156,62,3,1);
+	TestTRawDigitiserEvent digitiserEvent2(TRawEvent::EPointer3DInRange, 23,45,23,1,2,6,4,2,1);
+	TestTRawDigitiserEvent digitiserEvent3(TRawEvent::EPointer3DOutOfRange, 23,45,23,1,2,6,4,2,0);
+	TestTRawDigitiserEvent digitiserEvent4(TRawEvent::EPointer3DTilt, 23,45,23,1,2,6,4,2,1);
+	TestTRawDigitiserEvent digitiserEvent5(TRawEvent::EPointer3DRotation, 23,45,23,1,2,6,4,2,1);
+	TestTRawDigitiserEvent digitiserEvent6(TRawEvent::EPointer3DTiltAndMove, 23,45,23,1,2,6,4,2,0);
+
+    digitiserEvent1.TestEvents();
+	digitiserEvent2.TestEvents();
+	digitiserEvent3.TestEvents();
+	digitiserEvent4.TestEvents();
+	digitiserEvent5.TestEvents();
+	digitiserEvent6.TestEvents();    
+	
+	test.End();
+	__UHEAP_MARKEND;
+	}
+#endif
+
+
+GLDEF_C TInt E32Main()
+//
+//
+    {
+	__UHEAP_MARK;
+	
+ 	test.Title();
+	test.Start(_L("User-side Digitiser Testing Events/HAL"));
+	
+	DoTestDigitiserHalAttributes();
+	
+#ifndef E32TEST_NOCAPS
+	DoTestRawDigitiserEvent();
+#endif
+
+	test.Printf(_L("\n"));
+	test.End();
+	test.Close();
+
+	__UHEAP_MARKEND;
+    return KErrNone;
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kerneltest/e32test/digitiser/tshell_digitisertests.oby	Tue Jul 06 11:40:58 2010 +0100
@@ -0,0 +1,29 @@
+/*
+* 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 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:
+*
+*/
+
+#define BASE_ROM
+#include <rom\##VARIANT##\header.iby>
+
+
+files=
+
+#include <rom\##VARIANT##\kernel.iby>
+#include "user.iby"
+#include <rom\hal\hal.iby>
+#include <rom\f32\f32.iby>
+
+#include <rom\include\digitiser_tests.iby>
--- a/kerneltest/e32test/group/bld.inf	Wed Jun 09 10:31:37 2010 +0100
+++ b/kerneltest/e32test/group/bld.inf	Tue Jul 06 11:40:58 2010 +0100
@@ -383,7 +383,8 @@
 t_newldd
 t_lddpowerseqtest
 t_ldddigitisertest
-t_traweventdigitiser
+t_userdigitisertest
+t_userdigitisernocaps
 t_persistrestart	manual
 halsettings	support
 
--- a/kerneltest/e32test/group/t_traweventdigitiser.mmp	Wed Jun 09 10:31:37 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +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 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:
-*
-*/
-
-TARGET         t_traweventdigitiser.exe        
-TARGETTYPE     EXE
-SOURCEPATH	../digitiser
-SOURCE         t_traweventdigitiser.cpp
-LIBRARY        euser.lib
-OS_LAYER_SYSTEMINCLUDE_SYMBIAN
-
-
-capability		all
-
-VENDORID 0x70000001
-
-SMPSAFE
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kerneltest/e32test/group/t_userdigitisernocaps.mmp	Tue Jul 06 11:40:58 2010 +0100
@@ -0,0 +1,36 @@
+/*
+* 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 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:
+*
+*/
+
+TARGET		t_userdigitisernocaps.exe
+TARGETTYPE	EXE
+
+CAPABILITY	None
+MACRO		E32TEST_NOCAPS
+
+VENDORID	0x70000001
+SMPSAFE
+
+OS_LAYER_SYSTEMINCLUDE_SYMBIAN
+
+SOURCEPATH	../digitiser
+SOURCE		t_userdigitisertest.cpp
+
+LIBRARY		euser.lib
+LIBRARY		hal.lib
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kerneltest/e32test/group/t_userdigitisertest.mmp	Tue Jul 06 11:40:58 2010 +0100
@@ -0,0 +1,34 @@
+/*
+* Copyright (c) 2009-2010 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:
+*
+*/
+
+TARGET		t_userdigitisertest.exe
+TARGETTYPE	EXE
+
+CAPABILITY	SwEvent WriteDeviceData
+VENDORID	0x70000001
+SMPSAFE
+
+OS_LAYER_SYSTEMINCLUDE_SYMBIAN
+
+SOURCEPATH	../digitiser
+SOURCE		t_userdigitisertest.cpp
+
+LIBRARY		euser.lib
+LIBRARY		hal.lib
+
+
+
--- a/kerneltest/e32test/hcr/d_hcrut_psl.cpp	Wed Jun 09 10:31:37 2010 +0100
+++ b/kerneltest/e32test/hcr/d_hcrut_psl.cpp	Tue Jul 06 11:40:58 2010 +0100
@@ -127,7 +127,7 @@
 #if !defined(__WINS__) && !defined(__X86__)
     
     // Note to future implementor:
-	// #include <kernel\kernboot.h>
+	// #include <kernel/kernboot.h>
 	// First check to see if SMRIB was created during boot time. 
     // If SSuperPageBase::iSmrData == KSuperPageAddressFieldUndefined (i.e. -1) 
 	// it does not exist, return KErrNotSupported, SMR not support by base port
--- a/kerneltest/e32test/smr/d_smr.cpp	Wed Jun 09 10:31:37 2010 +0100
+++ b/kerneltest/e32test/smr/d_smr.cpp	Tue Jul 06 11:40:58 2010 +0100
@@ -19,7 +19,7 @@
 
 #include "d_trace.h"
 
-#include <memmodel\epoc\platform.h>
+#include <memmodel/epoc/platform.h>
 #include <bootdefs.h>
 #include <kernel/kernboot.h>
 #include <kernel/kern_priv.h>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kerneltest/f32test/ext/t_bitproxydrive.cpp	Tue Jul 06 11:40:58 2010 +0100
@@ -0,0 +1,305 @@
+// Copyright (c) 2002-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:
+// f32test\ext\bitproxydrive.cpp
+// extension to do XOR on every byte on 32 byte boundary read or written to media subsystem in same thread
+// therefore RFile::Read/Write does not have this operation carried out on it
+// 
+//
+
+#include <f32fsys.h>
+
+class CBitExtProxyDrive : public CExtProxyDrive
+	{
+public:
+	CBitExtProxyDrive(CMountCB* aMount, CExtProxyDriveFactory* aDevice);
+	~CBitExtProxyDrive();
+
+public:
+	virtual TInt Initialise();
+	virtual TInt Dismounted();
+	virtual TInt Enlarge(TInt aLength);
+	virtual TInt ReduceSize(TInt aPos, TInt aLength);
+	virtual TInt Read(TInt64 aPos, TInt aLength, const TAny* aTrg, TInt aThreadHandle, TInt aOffset, TInt aFlags);
+	virtual TInt Read(TInt64 aPos, TInt aLength, const TAny* aTrg, TInt aThreadHandle, TInt anOffset);
+	virtual TInt Read(TInt64 aPos, TInt aLength, TDes8& aTrg);
+	virtual TInt Write(TInt64 aPos, TInt aLength,const TAny* aSrc, TInt aThreadHandle, TInt aOffset, TInt aFlags);
+	virtual TInt Write(TInt64 aPos, TInt aLength, const TAny* aSrc, TInt aThreadHandle, TInt anOffset);
+	virtual TInt Write(TInt64 aPos,const TDesC8& aSrc);
+	virtual TInt Caps(TDes8& anInfo);
+	virtual TInt Format(TFormatInfo& aInfo);
+	virtual TInt Format(TInt64 aPos,TInt aLength);
+	virtual TInt SetInfo(const RMessage2 &msg, TAny* aMessageParam2, TAny* aMessageParam3);
+	virtual TInt NotifyChange(TDes8 &aChanged,TRequestStatus* aStatus);
+	virtual void NotifyChangeCancel();
+
+    TInt SetMountInfo(const TDesC8* aMountInfo,TInt aMountInfoThreadHandle=KCurrentThreadHandle);
+    TInt ForceRemount(TUint aFlags = 0);
+    TInt Unlock(TMediaPassword& aPassword, TBool aStorePassword);
+    TInt Lock(TMediaPassword& aOldPassword, TMediaPassword& aNewPassword, TBool aStorePassword);
+    TInt Clear(TMediaPassword& aPassword);
+    TInt ErasePassword();
+
+	TInt GetInterface(TInt aInterfaceId,TAny*& aInterface,TAny* aInput);
+
+private:
+
+	TBusLocalDrive iDrive;
+	TInt iLocalDriveNumber;
+	TBool iChanged;
+
+	TRequestStatus* iNotifyChangeStatus;
+	};
+
+
+
+class CBitProxyDriveFactory : public CExtProxyDriveFactory
+	{
+public:
+	CBitProxyDriveFactory();
+	~CBitProxyDriveFactory();
+	virtual TInt Install();
+	virtual TInt CreateProxyDrive(CProxyDrive*& aMountProxyDrive,CMountCB* aMount);
+	};
+
+
+
+
+CBitExtProxyDrive::CBitExtProxyDrive(CMountCB* aMount, CExtProxyDriveFactory* aDevice)
+:   CExtProxyDrive(aMount,aDevice)
+	{
+	}
+
+CBitExtProxyDrive::~CBitExtProxyDrive()
+	{
+	iDrive.Disconnect();
+	}
+
+/**
+Initialise the proxy drive.
+@return system wide error code.
+*/
+TInt CBitExtProxyDrive::Initialise()
+	{
+	TInt r = KErrNone;
+    return r;
+	}
+
+TInt CBitExtProxyDrive::SetInfo(const RMessage2 &msg, TAny* /*aMessageParam2*/, TAny* /*aMessageParam3*/)
+    {
+	TInt r = KErrNone;
+
+    TPckg<TInt> infoPckg(iLocalDriveNumber);
+	TRAP(r, msg.ReadL(2, infoPckg));
+
+	if(r != KErrNone)
+		{
+		RDebug::Print(_L("CBitExtProxyDrive::SetInfo(): cant read from the RMessage %d"), r);
+		return r;
+		}
+
+	r = iDrive.Connect(iLocalDriveNumber, iChanged);
+
+	if(r != KErrNone)
+		{
+		RDebug::Print(_L("CBitExtProxyDrive::SetInfo(): failed to connect to drive %d, r %d"), iDriveNumber, r);
+		return r;
+		}
+
+    return r;
+    }
+
+TInt CBitExtProxyDrive::Dismounted()
+	{
+	TInt r = KErrNone;
+    return r;
+	}
+
+TInt CBitExtProxyDrive::Enlarge(TInt /*aLength*/)
+	{
+	return KErrNotSupported;
+	}
+
+
+TInt CBitExtProxyDrive::ReduceSize(TInt /*aPos*/, TInt /*aLength*/)
+	{
+	return KErrNotSupported;
+	}
+
+
+TInt CBitExtProxyDrive::Read(TInt64 aPos, TInt aLength, const TAny* aTrg, TInt aThreadHandle, TInt aOffset)
+	{
+	TInt r = iDrive.Read(aPos, aLength, aTrg, aThreadHandle, aOffset);
+    return r;
+	}
+
+
+TInt CBitExtProxyDrive::Read(TInt64 aPos, TInt aLength, const TAny* aTrg, TInt aThreadHandle, TInt aOffset, TInt aFlags)
+	{
+	TInt r = iDrive.Read(aPos, aLength, aTrg, aThreadHandle, aOffset, aFlags);
+    return r;
+	}
+
+TInt CBitExtProxyDrive::Read(TInt64 aPos, TInt aLength, TDes8& aTrg)
+	{
+	TInt r = iDrive.Read(aPos, aLength, aTrg);
+    return r;
+	}
+
+TInt CBitExtProxyDrive::Write(TInt64 aPos, TInt aLength, const TAny* aSrc, TInt aThreadHandle, TInt aOffset)
+	{
+	TInt r = iDrive.Write(aPos, aLength, aSrc, aThreadHandle, aOffset);
+    return r;
+	}
+
+
+TInt CBitExtProxyDrive::Write(TInt64 aPos, TInt aLength, const TAny* aSrc, TInt aThreadHandle, TInt aOffset, TInt aFlags)
+	{
+	TInt r = iDrive.Write(aPos, aLength, aSrc, aThreadHandle, aOffset, aFlags);
+    return r;
+	}
+
+TInt CBitExtProxyDrive::Write(TInt64 aPos,const TDesC8& aSrc)
+	{
+	TInt r = iDrive.Write(aPos, aSrc);
+    return r;
+	}
+
+
+TInt CBitExtProxyDrive::Caps(TDes8& anInfo)
+	{
+	TLocalDriveCapsV6Buf caps;
+    caps.FillZ();
+
+//    TLocalDriveCapsV6& c = caps();
+
+	TInt r = iDrive.Caps(caps);
+	caps.SetLength( Min(caps.Length(), anInfo.MaxLength()) );
+
+	anInfo.Copy(caps);
+    
+	return r;
+	}
+
+
+
+TInt CBitExtProxyDrive::Format(TInt64 aPos, TInt aLength)
+	{
+	TInt r = iDrive.Format(aPos, aLength);
+    return r;
+	}
+
+
+TInt CBitExtProxyDrive::Format(TFormatInfo& aInfo)
+	{
+	TInt r = iDrive.Format(aInfo);
+    return r;
+    }
+
+
+TInt CBitExtProxyDrive::NotifyChange(TDes8& /*aChanged*/, TRequestStatus* aStatus)
+	{
+//	iDrive.NotifyChange(aStatus);
+	iNotifyChangeStatus = aStatus;
+	return KErrNone;
+	}
+
+void CBitExtProxyDrive::NotifyChangeCancel()
+	{
+//	iDrive.NotifyChangeCancel();
+	if (iNotifyChangeStatus)
+		User::RequestComplete(iNotifyChangeStatus, KErrCancel);
+	}
+
+TInt CBitExtProxyDrive::SetMountInfo(const TDesC8* aMountInfo,TInt aMountInfoThreadHandle)
+    {
+	TInt r = iDrive.SetMountInfo(aMountInfo, aMountInfoThreadHandle);
+    return r;
+    }
+
+TInt CBitExtProxyDrive::ForceRemount(TUint aFlags)
+    {
+	TInt r = iDrive.ForceRemount(aFlags);
+    return r;
+    }
+
+TInt CBitExtProxyDrive::Unlock(TMediaPassword& aPassword, TBool aStorePassword)
+    {
+	TInt r = iDrive.Unlock(aPassword, aStorePassword);
+    return r;
+    }
+
+TInt CBitExtProxyDrive::Lock(TMediaPassword& aOldPassword, TMediaPassword& aNewPassword, TBool aStorePassword)
+    {
+	TInt r = iDrive.SetPassword(aOldPassword, aNewPassword, aStorePassword);
+    return r;
+    }
+
+TInt CBitExtProxyDrive::Clear(TMediaPassword& aPassword)
+    {
+	TInt r = iDrive.Clear(aPassword);
+    return r;
+    }
+
+TInt CBitExtProxyDrive::ErasePassword()
+    {
+	TInt r = iDrive.ErasePassword();
+    return r;
+    }
+
+TInt CBitExtProxyDrive::GetInterface(TInt aInterfaceId, TAny*& /*aInterface*/, TAny* /*aInput*/)
+	{
+	switch(aInterfaceId)
+		{
+		case ELocalBufferSupport:
+			return KErrNone;
+		default:
+			return KErrNotSupported;
+		}
+	}
+
+
+
+CBitProxyDriveFactory::CBitProxyDriveFactory()
+	{
+	}
+
+CBitProxyDriveFactory::~CBitProxyDriveFactory()
+	{
+	}
+
+TInt CBitProxyDriveFactory::Install()
+	{
+	_LIT(KProxyName,"bitproxydrive");
+	return SetName(&KProxyName);
+	}
+
+TInt CBitProxyDriveFactory::CreateProxyDrive(CProxyDrive*& aMountProxyDrive,CMountCB* aMount)
+	{
+    aMountProxyDrive = new CBitExtProxyDrive(aMount,this);
+    return (aMountProxyDrive==NULL) ? KErrNoMemory : KErrNone;
+	}
+
+
+extern "C" {
+
+
+/* 
+Create the proxy drive factory object for the usbhost mass storage proxy
+*/
+EXPORT_C CExtProxyDriveFactory* CreateFileSystem()
+	{
+	return new CBitProxyDriveFactory();
+	}
+}
+
--- a/kerneltest/f32test/group/bld.inf	Wed Jun 09 10:31:37 2010 +0100
+++ b/kerneltest/f32test/group/bld.inf	Tue Jul 06 11:40:58 2010 +0100
@@ -273,3 +273,5 @@
 t_cp932dll      support
 t_cp_plugin
 
+t_bitproxydrive    support
+t_proxydrive1
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kerneltest/f32test/group/t_bitproxydrive.mmp	Tue Jul 06 11:40:58 2010 +0100
@@ -0,0 +1,33 @@
+// Copyright (c) 2002-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:
+// f32test/group/t_bitext.mmp
+// 
+//
+
+TARGET			t_bitproxydrive.pxy
+TARGETTYPE		fsy
+
+SOURCEPATH		../ext
+SOURCE			t_bitproxydrive.cpp
+
+OS_LAYER_SYSTEMINCLUDE_SYMBIAN
+
+LIBRARY			euser.lib efile.lib
+
+UID		0x100039df 0x10000CEE
+VENDORID 0x70000001
+
+#include "../../../userlibandfileserver/fileserver/group/f32caps.mmh"  // Capabilities of File Server process
+
+SMPSAFE
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kerneltest/f32test/group/t_proxydrive1.mmp	Tue Jul 06 11:40:58 2010 +0100
@@ -0,0 +1,35 @@
+// Copyright (c) 2002-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:
+// f32test/group/t_proxydrive1.mmp
+// 
+//
+
+TARGET         t_proxydrive1.exe        
+TARGETTYPE     EXE
+SOURCEPATH	../server
+SOURCE         t_proxydrive1.cpp
+SOURCE         t_main.cpp
+SOURCEPATH     ../fileutils/src
+SOURCE         t_chlffs.cpp f32_test_utils.cpp
+
+
+LIBRARY        euser.lib efsrv.lib hal.lib
+OS_LAYER_SYSTEMINCLUDE_SYMBIAN
+USERINCLUDE    ../server
+USERINCLUDE    ../fileutils/inc
+
+CAPABILITY		TCB DISKADMIN ALLFILES
+VENDORID 0x70000001
+
+SMPSAFE
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kerneltest/f32test/server/t_proxydrive1.cpp	Tue Jul 06 11:40:58 2010 +0100
@@ -0,0 +1,166 @@
+// Copyright (c) 2002-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:
+// f32test\ext\t_ext1.cpp
+// 
+//
+
+#include <f32file.h>
+#include <e32test.h>
+#include <e32svr.h>
+#include "t_server.h"
+#include "f32_test_utils.h"
+
+using namespace F32_Test_Utils;
+
+
+GLDEF_D RTest test(_L("T_PROXYDRIVE1"));
+
+
+TInt GetRemovableDrive(TInt aDriveNumber)
+	{
+	RLocalDrive d;
+	TBool flag=EFalse;
+
+	//Find the local drive number corresponding to aDriveNumber
+	TMediaSerialNumber serialNum;
+	TInt r = TheFs.GetMediaSerialNumber(serialNum, aDriveNumber);
+	if(r!= KErrNone)
+		return r;
+
+	TInt len = serialNum.Length();
+	test.Printf(_L("Serial number (len %d) :\n"), len);
+
+	for (TInt n=0; n<KMaxLocalDrives; n++)
+		{
+		r = d.Connect(n, flag);
+		if(r != KErrNone)
+			{
+			test.Printf(_L("drive %d: TBusLocalDrive::Connect() failed %d\n"), n, r);
+			continue;
+			}
+
+	    TLocalDriveCapsV5Buf capsBuf;
+	    TLocalDriveCapsV5& caps = capsBuf();
+		r = d.Caps(capsBuf);
+		if(r != KErrNone)
+			{
+			test.Printf(_L("drive %d: TBusLocalDrive::Caps() failed %d\n"), n, r);
+			continue;
+			}
+
+		if ((caps.iDriveAtt & KDriveAttRemovable) == 0)
+			{
+			continue;
+			}
+
+		TPtrC8 localSerialNum(caps.iSerialNum, caps.iSerialNumLength);
+		if (serialNum.Compare(localSerialNum) == 0)
+			{
+			d.Close();
+			test.Printf(_L("found removable drive: local drive number %d\n"), n);
+			return n;
+			}
+
+		d.Close();
+		}
+
+	return KErrNotFound;
+	}
+
+
+
+
+GLDEF_C void CallTestsL()
+	{
+    TInt drive;
+	TInt err=RFs::CharToDrive(gDriveToTest,drive);
+	test.Start(_L("Starting Test - T_PROXYDRIVE1"));
+	test(err==KErrNone);
+
+    PrintDrvInfo(TheFs, drive);
+
+
+	_LIT(KBitProxyDriveName, "t_bitproxydrive.pxy");
+	_LIT(KBitProxyDrive, "bitproxydrive");
+
+	TInt r;
+
+	TInt localDriveNumber = GetRemovableDrive(drive);
+	if (localDriveNumber < 0)
+		{
+		test.Printf(_L("Not a removable drive, skipping test\n"));
+		return;
+		}
+
+
+	test.Next(_L("Adding and then removing a proxy drive with an open subsession"));
+	r = TheFs.AddProxyDrive(KBitProxyDriveName);
+	test.Printf(_L("AddProxyDrive(%S) r %d\n"), &KBitProxyDriveName, r);
+	test(r == KErrNone || r == KErrAlreadyExists);
+
+	TPckgBuf<TInt> p1; p1() = localDriveNumber;
+	TBuf<1> p2;
+	TInt driveNumber = EDriveM;
+
+	r = TheFs.MountProxyDrive(driveNumber, KBitProxyDrive, &p1, &p2);
+	test.Printf(_L("MountProxyDrive(%d, %S) r %d\n"), driveNumber, &KBitProxyDrive, r);
+	test (r >= 0);
+
+	_LIT(KFileSystem, "FAT");
+	r = TheFs.MountFileSystem(KFileSystem, driveNumber);
+	test.Printf(_L("MountFileSystem(%S) r %d\n"), &KFileSystem, r);
+	test(r == KErrNone);
+
+
+	RFs fs;
+	r = fs.Connect();
+	test(r == KErrNone);
+
+
+	TPath dirPath = _L("?:\\*");
+	dirPath[0] = (TUint8) ('A' + driveNumber);
+	RDir dir;
+	r = dir.Open(fs, dirPath, KEntryAttNormal);
+	test.Printf(_L("RDir::Open(%S) r %d\n"), &dirPath, r);
+
+
+	r = TheFs.DismountFileSystem(KFileSystem, driveNumber);
+	test.Printf(_L("DismountFileSystem(%S) r %d\n"), &KFileSystem, r);
+	test (r == KErrInUse);
+
+	// dismount failed - attempt a forced dismount
+	TRequestStatus stat;
+	TheFs.NotifyDismount(driveNumber, stat, EFsDismountForceDismount);
+	User::WaitForRequest(stat);
+	r = stat.Int();
+	test.Printf(_L("DismountFileSystem(%S, EFsDismountForceDismount) r %d\n"), &KFileSystem, r);
+	test (r == KErrNone);
+
+	r = TheFs.DismountProxyDrive(driveNumber);
+	test.Printf(_L("DismountProxyDrive(%d) r %d\n"), driveNumber, r);
+	test (r == KErrNone);
+	
+
+	test.Printf(_L("closing dir (%S)....\n"), &dirPath, r);
+	dir.Close();
+
+	test.Printf(_L("closing file session()....\n"));
+	fs.Close();
+
+	r = TheFs.RemoveProxyDrive(KBitProxyDrive);
+	test (r == KErrNone);
+
+	test.End();
+	test.Close();
+	}
--- a/userlibandfileserver/fileserver/group/release.txt	Wed Jun 09 10:31:37 2010 +0100
+++ b/userlibandfileserver/fileserver/group/release.txt	Tue Jul 06 11:40:58 2010 +0100
@@ -1,3 +1,31 @@
+Version 2.00.2060
+=================
+(Made by vfebvre 25/05/2010)
+
+1.	migubarr
+	1.	ou1cimx1#393012 Crash when usb memory is dismounted during copy
+
+2.	michcox
+	1.	ou1cimx1#378895 TB92 Symbian.org Bug 2544 -  Possible deadlocks on f32 plugin chains
+
+
+Version 2.00.2059
+=================
+(Made by vfebvre 21/05/2010)
+
+1.	niccox
+	1.	ou1cimx1#391109 Incorrect update of progress bar with format of Usb Mass Storage
+
+
+Version 2.00.2058
+=================
+(Made by vfebvre 14/05/2010)
+
+1.	famustaf
+	1.	ou1cimx1#380187 Build on Linux - Incorrect slash in #include in sf_sys.cpp
+		Changed backslash to forward slash.
+
+
 Version 2.00.2057
 =================
 (Made by vfebvre 07/05/2010)
--- a/userlibandfileserver/fileserver/inc/f32ver.h	Wed Jun 09 10:31:37 2010 +0100
+++ b/userlibandfileserver/fileserver/inc/f32ver.h	Tue Jul 06 11:40:58 2010 +0100
@@ -58,6 +58,6 @@
 
 @see TVersion
 */
-const TInt KF32BuildVersionNumber=2057;
+const TInt KF32BuildVersionNumber=2060;
 //
 #endif
--- a/userlibandfileserver/fileserver/sfat32/sl_drv.cpp	Wed Jun 09 10:31:37 2010 +0100
+++ b/userlibandfileserver/fileserver/sfat32/sl_drv.cpp	Tue Jul 06 11:40:58 2010 +0100
@@ -49,6 +49,7 @@
 {
 	 if((iMount != NULL) && (iMount->LocalDrive() != NULL))
 		{
+		ASSERT(iMount->LocalDrive()->Mount() == NULL || iMount->LocalDrive()->Mount() == iMount);
 		iMount->LocalDrive()->SetMount(NULL);
         }
 
--- a/userlibandfileserver/fileserver/sfile/sf_ext.cpp	Wed Jun 09 10:31:37 2010 +0100
+++ b/userlibandfileserver/fileserver/sfile/sf_ext.cpp	Tue Jul 06 11:40:58 2010 +0100
@@ -188,7 +188,7 @@
 EXPORT_C CLocDrvMountCB::~CLocDrvMountCB()
 	{
 	__PRINT1(_L("CLocDrvMountCB::~CLocDrvMountCB() 0x%x"),this);
-	if(iProxyDrive && !LocalDrives::IsProxyDrive(Drive().DriveNumber()) && LocalDrives::IsValidDriveMapping(Drive().DriveNumber()))
+	if(iProxyDrive && !LocalDrives::IsProxyDrive(Drive().DriveNumber()))
 		delete(iProxyDrive);
 	}
 
@@ -281,7 +281,6 @@
 	{
 	__ASSERT_ALWAYS(iProxyDrive!=NULL,Fault(ELocDrvDismountedLocalDrive));
 	iProxyDrive->Dismounted();
-	iProxyDrive->SetMount(NULL);
 	}
 
 
--- a/userlibandfileserver/fileserver/sfile/sf_local.cpp	Wed Jun 09 10:31:37 2010 +0100
+++ b/userlibandfileserver/fileserver/sfile/sf_local.cpp	Tue Jul 06 11:40:58 2010 +0100
@@ -386,7 +386,8 @@
 	__ASSERT_ALWAYS(aDrive>=0 && aDrive<KMaxDrives,Fault(EClearProxyDriveMapping1));
 	__ASSERT_DEBUG(iMapping[aDrive]>= KMaxLocalDrives && iProxyDriveMapping[iMapping[aDrive]-KMaxLocalDrives],Fault(EClearProxyDriveMapping2));
 	TInt idx = iMapping[aDrive]-KMaxLocalDrives;
-	delete iProxyDriveMapping[idx];
+	if (iProxyDriveMapping[idx]->Mount() == NULL)	// don't delete if it's still owned by its mount
+		delete iProxyDriveMapping[idx];
 	iProxyDriveMapping[idx] = NULL;
 	iMapping[aDrive] = KDriveInvalid;
 	}
--- a/userlibandfileserver/fileserver/sfile/sf_plugin_man.cpp	Wed Jun 09 10:31:37 2010 +0100
+++ b/userlibandfileserver/fileserver/sfile/sf_plugin_man.cpp	Tue Jul 06 11:40:58 2010 +0100
@@ -745,11 +745,12 @@
 
 	FsPluginManager::LockChain();
 	TInt count = FsPluginManager::ChainCount();
+	TInt oldCount = count;
 	TInt i;
 	for(i=0; i<count; i++)
 	    {
 	    CFsPlugin* plugin = NULL;
-	    User::LeaveIfError(FsPluginManager::Plugin(plugin, i));
+	    (void) FsPluginManager::Plugin(plugin, i); // (void) as chain is locked.
 	    __ASSERT_DEBUG(plugin, User::Leave(KErrNotFound));
 	    aRequest->iCurrentPlugin = plugin;
 	    aRequest->Status() = KRequestPending;
@@ -761,6 +762,12 @@
 	    FsPluginManager::LockChain();
 	    __ASSERT_ALWAYS(aRequest->Status().Int()==KErrNone||aRequest->Status().Int()==KErrCancel,Fault(ESessionDisconnectThread2));
 	    count = FsPluginManager::ChainCount();
+	    //If a plugin was removed whilst the chain was unlocked we need to make sure we don't skip any plugins
+	    if(count != oldCount)
+	        {
+	        i=0;
+	        oldCount = count;
+	        }
 	    }
 	FsPluginManager::UnlockChain();
 	
--- a/userlibandfileserver/fileserver/sfile/sf_plugin_ops.cpp	Wed Jun 09 10:31:37 2010 +0100
+++ b/userlibandfileserver/fileserver/sfile/sf_plugin_ops.cpp	Tue Jul 06 11:40:58 2010 +0100
@@ -252,8 +252,11 @@
 	CFsPlugin* plugin=NULL;
 	FsPluginManager::LockChain();
 	TInt err = FsPluginManager::Plugin(plugin, aRequest->Message().Int2());
-	if(err != KErrNone)
+	if(err != KErrNone) //should be ok but just in case
+	    {
+	    FsPluginManager::UnlockChain();
 		return err;
+	    }
 
 	TInt r = KErrNotFound;
 	if(plugin)
--- a/userlibandfileserver/fileserver/sfile/sf_sys.cpp	Wed Jun 09 10:31:37 2010 +0100
+++ b/userlibandfileserver/fileserver/sfile/sf_sys.cpp	Tue Jul 06 11:40:58 2010 +0100
@@ -18,7 +18,7 @@
 #include "sf_std.h"
 #include <e32uid.h>
 #include "sf_file_cache.h"
-#include <kernel\localise.h>
+#include <kernel/localise.h>
 #include <f32file.h>
 
 typedef CFileSystem*(*TFileSystemNew)();
--- a/userlibandfileserver/fileserver/shostmassstorage/msproxy/hostusbmsproxy.cpp	Wed Jun 09 10:31:37 2010 +0100
+++ b/userlibandfileserver/fileserver/shostmassstorage/msproxy/hostusbmsproxy.cpp	Tue Jul 06 11:40:58 2010 +0100
@@ -604,7 +604,7 @@
         }
 	else if (KErrGeneral == r)
         {
-        RDebug::Print(_L("<<< HOST Caps Unable to communicate with media"));
+        __HOSTPRINT(_L("<<< HOST Caps Unable to communicate with media"));
 		c.iType = EMediaUnknown;		
         }
 
--- a/userlibandfileserver/fileserver/shostmassstorage/msproxy/tmsmemmap.inl	Wed Jun 09 10:31:37 2010 +0100
+++ b/userlibandfileserver/fileserver/shostmassstorage/msproxy/tmsmemmap.inl	Tue Jul 06 11:40:58 2010 +0100
@@ -42,11 +42,11 @@
 	iSectorSize = aSectorSize;
 
 	iFormatSectorShift = 0;
-	while(aSectorSize)
-		{
-		++iFormatSectorShift;
-		aSectorSize >>= 1;
-		}
+
+    while(aSectorSize >>= 1)
+        {
+        ++iFormatSectorShift;
+        }
 
 	iDataOffset = static_cast<TInt64>(aFirstDataSector) * iSectorSize;
 	iSize = static_cast<TInt64>(aNumSectors) * iSectorSize;