Introduce yuv tool and catch up with the head. YUV support in the OS is still experimental.
authorFaisal Memon <faisal.memon@nokia.com>
Fri, 07 May 2010 16:13:43 +0100
changeset 70 634f7e208f90
parent 69 c9d64fb26f98 (current diff)
parent 66 28a25193bdd9 (diff)
child 71 5158c0d3bde3
Introduce yuv tool and catch up with the head. YUV support in the OS is still experimental.
applications/Symbian_MiniGUI_TestApp/Grid.mmp
--- a/applications/SymbianLogo_TextShell/SymbianLogo.mmp	Fri Mar 26 15:45:51 2010 +0000
+++ b/applications/SymbianLogo_TextShell/SymbianLogo.mmp	Fri May 07 16:13:43 2010 +0100
@@ -14,5 +14,5 @@
 TARGETTYPE		EXE
 SOURCEPATH		.
 SOURCE			symbianlogo.cpp
-SYSTEMINCLUDE		\epoc32\include
+OS_LAYER_SYSTEMINCLUDE
 LIBRARY			efsrv.lib euser.lib hal.lib estor.lib 
--- a/baseport/syborg/bld.inf	Fri Mar 26 15:45:51 2010 +0000
+++ b/baseport/syborg/bld.inf	Fri May 07 16:13:43 2010 +0100
@@ -20,7 +20,8 @@
 
 PRJ_EXPORTS
 syborg.oby						/epoc32/rom/include/	//
-base.iby						/epoc32/rom/include/	//
+//MattD - don't export the base.iby as you end up fighting with the kernel and everyone else...
+//base.iby						/epoc32/rom/include/	//
 rom/base_syborg.iby				/epoc32/rom/include/	//
 rom/header.iby					/epoc32/rom/syborg/		//
 rom/kernel.iby					/epoc32/rom/syborg/		//
@@ -28,7 +29,8 @@
 estart.txt						/epoc32/rom/syborg/		//
 syborg.dtb						/epoc32/rom/syborg/		//
 trk_l1.ini						/epoc32/data/Z/trk/trk_syborg.ini
-
+webcamera/webcamera_driver.h				/epoc32/include/syborg/
+webcamera/webcamera_driver.inl				/epoc32/include/syborg/
 specific/variantmediadef.h /epoc32/include/syborg/variantmediadef.h
 
 PRJ_EXTENSIONS
@@ -88,6 +90,11 @@
 //Add Sound Driver
 soundsc\soundsc
 
+//Webcamera Device
+webcamera/webcamera_pdd
+webcamera/webcamera_ldd
+webcamera/webcamera_app
+
 PRJ_EXTENSIONS
 start		extension		base/config
 option		PREFIX			_syborg_
--- a/baseport/syborg/bootstrap/syborg.inc	Fri Mar 26 15:45:51 2010 +0000
+++ b/baseport/syborg/bootstrap/syborg.inc	Fri May 07 16:13:43 2010 +0100
@@ -51,7 +51,9 @@
 KHwBaseNet		EQU     KHwBaseRegisters + 0x0c000
 KHwBaseNand		EQU     KHwBaseRegisters + 0x0d000
 KHwBaseAudio		EQU     KHwBaseRegisters + 0x0e000
-KHwBasePlatform		EQU     KHwBaseRegisters + 0x0f000
+KHwBaseWebcamera	EQU     KHwBaseRegisters + 0x0f000
+KHwBasePlatform		EQU     KHwBaseRegisters + 0x10000
+
 ;-----------------------------------------------------------------------------
 ; Module linear bases
 ;-----------------------------------------------------------------------------
@@ -76,6 +78,7 @@
 KHwLinBaseNet		EQU	KHwLinBaseRegisters + 0x0c*KHwLinSeparation
 KHwLinBaseNand		EQU	KHwLinBaseRegisters + 0x0d*KHwLinSeparation
 KHwLinBaseAudio		EQU	KHwLinBaseRegisters + 0x0e*KHwLinSeparation
-KHwLinBasePlatform	EQU	KHwLinBaseRegisters + 0x0f*KHwLinSeparation
+KHwLinBaseWebcameraDevice	EQU	KHwLinBaseRegisters + 0x0f*KHwLinSeparation
+KHwLinBasePlatform	EQU	KHwLinBaseRegisters + 0x10*KHwLinSeparation;
 	
 	END
--- a/baseport/syborg/bootstrap/syborg.s	Fri Mar 26 15:45:51 2010 +0000
+++ b/baseport/syborg/bootstrap/syborg.s	Fri May 07 16:13:43 2010 +0100
@@ -182,6 +182,7 @@
 		HW_MAPPING		KHwBaseNet,			1,	HW_MULT_4K
 		HW_MAPPING		KHwBaseNand,    		1,	HW_MULT_4K
 		HW_MAPPING		KHwBaseAudio,    		1,	HW_MULT_4K
+		HW_MAPPING		KHwBaseWebcamera,    		1,	HW_MULT_4K
 		HW_MAPPING		KHwBasePlatform,    		8,	HW_MULT_4K
 	
 		DCD     0   ; terminator
--- a/baseport/syborg/ethernet/pdd/enet.mmp	Fri Mar 26 15:45:51 2010 +0000
+++ b/baseport/syborg/ethernet/pdd/enet.mmp	Fri May 07 16:13:43 2010 +0100
@@ -22,6 +22,7 @@
 TARGETTYPE		pdd
 ROMTARGET       ethernet.pdd
 
+SYMBIAN_BASE_SYSTEMINCLUDE(drivers)
 SYSTEMINCLUDE	/epoc32/include/drivers
 SYSTEMINCLUDE	AsspNKernIncludePath
 SOURCEPATH	    .
--- a/baseport/syborg/hal/hal.mmp	Fri Mar 26 15:45:51 2010 +0000
+++ b/baseport/syborg/hal/hal.mmp	Fri May 07 16:13:43 2010 +0100
@@ -28,7 +28,7 @@
 SOURCEPATH		/epoc32/build/generatedcpp/hal
 SOURCE			VariantTarget(values,cpp) VariantTarget(config,cpp)
 
-SYSTEMINCLUDE	/epoc32/include /epoc32/include/kernel
+OS_LAYER_SYSTEMINCLUDE
 
 LIBRARY			euser.lib
 DEFFILE			../../../../../os/kernelhwsrv/halservices/hal/~/hal.def
--- a/baseport/syborg/hal/values.hda	Fri Mar 26 15:45:51 2010 +0000
+++ b/baseport/syborg/hal/values.hda	Fri May 07 16:13:43 2010 +0100
@@ -7,7 +7,7 @@
 EDeviceFamily=crystal
 EDeviceFamilyRev=0x001
 ECPU=arm
-ECPUArch=0x400
+ECPUArch=0xC0
 ECPUABI=arm5
 ECPUSpeed=0
 ESystemStartupReason=cold
@@ -34,7 +34,7 @@
 EClipboardDrive=2
 ESystemDrive=0xffff
 EDisplayNumberOfScreens=1
-ENanoTickPeriod=1000
+ENanoTickPeriod=10000
 EFastCounterFrequency=1000000
 EFastCounterCountsUp=1
 
--- a/baseport/syborg/monitor/monap.mmp	Fri Mar 26 15:45:51 2010 +0000
+++ b/baseport/syborg/monitor/monap.mmp	Fri May 07 16:13:43 2010 +0100
@@ -22,6 +22,7 @@
 
 TARGET			VariantTarget(exmondebug,dll)
 
+SYMBIAN_BASE_SYSTEMINCLUDE(drivers)
 SYSTEMINCLUDE	/epoc32/include/drivers
 SYSTEMINCLUDE   ../serial
 
--- a/baseport/syborg/rom/base_syborg.iby	Fri Mar 26 15:45:51 2010 +0000
+++ b/baseport/syborg/rom/base_syborg.iby	Fri May 07 16:13:43 2010 +0100
@@ -119,6 +119,11 @@
 extension[VARID]=	KERNEL_DIR\DEBUG_DIR\_PLATFORM_NAME_svpsnapdriver.ldd	sys\bin\svpsnapdriver.ldd
 file=			KERNEL_DIR\DEBUG_DIR\snapapp.exe			sys\bin\snapapp.exe
 
+// Webcamera Driver
+device[VARID]=		KERNEL_DIR\DEBUG_DIR\_PLATFORM_NAME_webcamera.pdd	sys\bin\webcamera.pdd
+device[VARID]=		KERNEL_DIR\DEBUG_DIR\_PLATFORM_NAME_ewebcamera.ldd	sys\bin\ewebcamera.ldd
+file=			KERNEL_DIR\DEBUG_DIR\webcamera_app.exe			sys\bin\webcamera_app.exe
+
 // Estart drive mapping setup files.
 data=			EPOCROOT##epoc32\rom\syborg\estart.txt			\sys\data\estart.txt
 
@@ -131,7 +136,7 @@
 
 file=ABI_DIR\DEBUG_DIR\KEYMAP_FILE.dll	\sys\bin\ekdata.dll
 
-#define	SCDV_DLL        _PLATFORM_NAME_scdv.dll
+#define	SCDV_DLL        _generic_scdv.dll
 #define	EUSER_DLL	_PLATFORM_NAME_euser.dll
 
 device[VARID] 	=KERNEL_DIR\DEBUG_DIR\pipelib.ldd		\sys\bin\pipelib.ldd
--- a/baseport/syborg/rom/kernel.iby	Fri Mar 26 15:45:51 2010 +0000
+++ b/baseport/syborg/rom/kernel.iby	Fri May 07 16:13:43 2010 +0100
@@ -63,6 +63,11 @@
 extension[VARID]=	\epoc32\release\##KMAIN##\##BUILD##\_##VARIANT##_svpsnapdriver.ldd  \sys\bin\svpsnapdriver.ldd
 file=			\epoc32\release\##KMAIN##\##BUILD##\snapapp.exe			\sys\bin\snapapp.exe
 
+// Webcamera Driver
+device[VARID]=		\epoc32\release\##KMAIN##\##BUILD##\_##VARIANT##_webcamera.PDD    	\sys\bin\webcamera.PDD
+device[VARID]=		\epoc32\release\##KMAIN##\##BUILD##\_##VARIANT##_ewebcamera.LDD    	\sys\bin\ewebcamera.LDD
+file=			\epoc32\release\##KMAIN##\##BUILD##\webcamera_app.exe			\sys\bin\webcamera_app.exe
+
 // Estart
 data=               	\epoc32\rom\syborg\ESTART.TXT					    \sys\data\ESTART.TXT
 
--- a/baseport/syborg/serial/serial.mmp	Fri Mar 26 15:45:51 2010 +0000
+++ b/baseport/syborg/serial/serial.mmp	Fri May 07 16:13:43 2010 +0100
@@ -21,6 +21,7 @@
 TARGET			VariantTarget(eserial,pdd)
 TARGETTYPE		pdd
 
+SYMBIAN_BASE_SYSTEMINCLUDE(drivers)
 SYSTEMINCLUDE	/epoc32/include/drivers
 SYSTEMINCLUDE	AsspNKernIncludePath
 
--- a/baseport/syborg/serial/syborg_serial.cpp	Fri Mar 26 15:45:51 2010 +0000
+++ b/baseport/syborg/serial/syborg_serial.cpp	Fri May 07 16:13:43 2010 +0100
@@ -10,10 +10,10 @@
 * Nokia Corporation - initial contribution.
 *
 * Contributors:
+* NTT DOCOMO, INC. -- Fix bug 2186 - QEMU baseport serial driver doesn't work with multiple UARTs and is unreliable
 *
 * Description: Minimalistic serial driver
 *
-* TODO: Handle multiple Units, hardcoded FIFO Size
 */
 
 #include "syborg_serial.h"
@@ -24,233 +24,287 @@
 #define DPRINT(x)
 #define DPRINT2(x,y)
 
+_LIT(KSerialDfcQName,"SerialDFC");
+const TInt KDfcQuePriority = 27;
 // ---------------------------------------------------------------
 // ---------------------------------------------------------------
 
 DDriverSyborgComm::DDriverSyborgComm()
-{
-  iVersion=TVersion(KCommsMajorVersionNumber,KCommsMinorVersionNumber,KCommsBuildVersionNumber);
-}
+	{
+	DPRINT("DDriverSyborgComm::DDriverSyborgComm()");
+	iVersion=TVersion(KCommsMajorVersionNumber, KCommsMinorVersionNumber, KCommsBuildVersionNumber);
+	}
+
+ DDriverSyborgComm::~DDriverSyborgComm()
+	{
+	DPRINT("~DDriverSyborgComm::DDriverSyborgComm()");
+	}
 
 TInt DDriverSyborgComm::Install()
-{
-  DPRINT("DDriverSyborgComm::Install");
-  return SetName(&KPddName);
-}
+	{
+	DPRINT("DDriverSyborgComm::Install");
+	return SetName(&KPddName);
+	}
 
 void DDriverSyborgComm::GetCaps(TDes8 &aDes) const
-{
-  DPRINT("DDriverSyborgComm::GetCaps");
+	{
+	DPRINT("DDriverSyborgComm::GetCaps");
 
-  TCommCaps3 capsBuf;
-  TCommCapsV03 &c=capsBuf();
-  c.iRate=KCapsBps110|KCapsBps150|KCapsBps300|KCapsBps600|KCapsBps1200|KCapsBps2400|KCapsBps4800|KCapsBps9600|KCapsBps19200|KCapsBps38400|KCapsBps57600|KCapsBps115200|KCapsBps230400;
-  c.iDataBits=KCapsData5|KCapsData6|KCapsData7|KCapsData8;
-  c.iStopBits=KCapsStop1|KCapsStop2;
-  c.iParity=KCapsParityNone|KCapsParityEven|KCapsParityOdd;
-  c.iHandshake=KCapsObeyXoffSupported|KCapsSendXoffSupported|KCapsObeyCTSSupported|KCapsFailCTSSupported|KCapsObeyDSRSupported|KCapsFailDSRSupported|KCapsObeyDCDSupported|KCapsFailDCDSupported|KCapsFreeRTSSupported|KCapsFreeDTRSupported;
-  c.iSignals=KCapsSignalCTSSupported|KCapsSignalDSRSupported|KCapsSignalDCDSupported|KCapsSignalRTSSupported|KCapsSignalDTRSupported;
-  c.iSIR=0;
-  c.iNotificationCaps=KNotifyDataAvailableSupported|KNotifySignalsChangeSupported;
-  c.iFifo=KCapsHasFifo;
-  c.iRoleCaps=0;
-  c.iFlowControlCaps=0;
-  c.iBreakSupported=ETrue;
-  aDes.FillZ(aDes.MaxLength());
-  aDes=capsBuf.Left(Min(capsBuf.Length(),aDes.MaxLength()));
-}
+	TCommCaps3 capsBuf;
+	TCommCapsV03 &c=capsBuf();
+	c.iRate=KCapsBps110|KCapsBps150|KCapsBps300|KCapsBps600|KCapsBps1200|KCapsBps2400|KCapsBps4800|KCapsBps9600|KCapsBps19200|KCapsBps38400|KCapsBps57600|KCapsBps115200|KCapsBps230400;
+	c.iDataBits=KCapsData5|KCapsData6|KCapsData7|KCapsData8;
+	c.iStopBits=KCapsStop1|KCapsStop2;
+	c.iParity=KCapsParityNone|KCapsParityEven|KCapsParityOdd;
+	c.iHandshake=KCapsObeyXoffSupported|KCapsSendXoffSupported|KCapsObeyCTSSupported|KCapsFailCTSSupported|KCapsObeyDSRSupported|KCapsFailDSRSupported|KCapsObeyDCDSupported|KCapsFailDCDSupported|KCapsFreeRTSSupported|KCapsFreeDTRSupported;
+	c.iSignals=KCapsSignalCTSSupported|KCapsSignalDSRSupported|KCapsSignalDCDSupported|KCapsSignalRTSSupported|KCapsSignalDTRSupported;
+	c.iSIR=0;
+	c.iNotificationCaps=KNotifyDataAvailableSupported|KNotifySignalsChangeSupported;
+	c.iFifo=KCapsHasFifo;
+	c.iRoleCaps=0;
+	c.iFlowControlCaps=0;
+	c.iBreakSupported=ETrue;
+	aDes.FillZ(aDes.MaxLength());
+	aDes=capsBuf.Left(Min(capsBuf.Length(),aDes.MaxLength()));
+	}
 
 TInt DDriverSyborgComm::Create(DBase*& aChannel, TInt aUnit, const TDesC8* anInfo, const TVersion& aVer)
-{
-  DPRINT("DDriverSyborgComm::Create");
+	{
+	DPRINT("DDriverSyborgComm::Create");
 
-  DCommSyborgSoc* pD=new DCommSyborgSoc;
-  aChannel=pD;
-  TInt r=KErrNoMemory;
-  if (pD)
-	r=pD->DoCreate(aUnit,anInfo);
-  return r;
-}
+	DCommSyborgSoc* pD=new DCommSyborgSoc(this);
+	aChannel=pD;
+	TInt r=KErrNoMemory;
+	if (pD)
+		{
+		r=pD->DoCreate(aUnit,anInfo);
+		}
+	return r;
+	}
 
 TInt DDriverSyborgComm::Validate(TInt aUnit, const TDesC8* /*anInfo*/, const TVersion& aVer)
-{
-  DPRINT("DDriverSyborgComm::Validate");
-  if ((!Kern::QueryVersionSupported(iVersion,aVer)) || 
+	{
+	DPRINT("DDriverSyborgComm::Validate");
+	if ((!Kern::QueryVersionSupported(iVersion,aVer)) ||
 	  (!Kern::QueryVersionSupported(aVer,TVersion(KMinimumLddMajorVersion,KMinimumLddMinorVersion,KMinimumLddBuild))))
-	return KErrNotSupported;
-  return KErrNone;
-}
+		return KErrNotSupported;
+	return KErrNone;
+	}
+
+/* Reference counted open on Serial Block Drivers DfcQueue */
+TInt DDriverSyborgComm::OpenDfcQueue()
+	{
+	DPRINT("DDriverSyborgComm::OpenDfcQueue()");
+	if (iDfcQRefCount > 0)
+		{
+		iDfcQRefCount++;
+		return KErrNone;
+		}
+		
+	TInt err = Kern::DynamicDfcQCreate(iDfcQueue, KDfcQuePriority, KSerialDfcQName);
+ 
+    if (!err)
+		{
+		iDfcQRefCount++;
+		}
+    return err;
+  }
+
+/*  Reference counted open on Serial Block Drivers DfcQueue */
+void DDriverSyborgComm::CloseDfcQueue()
+	{
+	DPRINT("DDriverSyborgComm::CloseDfcQueue()");
+    iDfcQRefCount--;
+    if (iDfcQRefCount == 0)
+		{
+		iDfcQueue->Destroy();
+		}
+	}
+
+TDfcQue* DDriverSyborgComm::DfcQueue()
+	{
+    return iDfcQueue;
+	}
 
 // ---------------------------------------------------------------
 // ---------------------------------------------------------------
 
-DCommSyborgSoc::DCommSyborgSoc()
-{
-}
+DCommSyborgSoc::DCommSyborgSoc(DDriverSyborgComm* aDriverSyborgComm)
+	:iDriverSyborgComm(aDriverSyborgComm)
+	{
+	}
 
 DCommSyborgSoc::~DCommSyborgSoc()
-{
-  Interrupt::Unbind(iIrq);
-}
-
-TInt DCommSyborgSoc::DoCreate(TInt aUnit, const TDesC8* /*anInfo*/)
-{
-  DPRINT2("DCommSyborgSoc::DoCreate %d",aUnit);
-  switch(aUnit)
 	{
-	case 0:
-	  iPortAddr = KHwBaseUart0;
-	  iIrq = EIntSerial0;
-	  break;
-	case 1:
-	  iPortAddr = KHwBaseUart1;
-	  iIrq = EIntSerial1;
-	  break;
-	case 2:
-	  iPortAddr = KHwBaseUart2;
-	  iIrq = EIntSerial2;
-	  break;
-	case 3:
-	  iPortAddr = KHwBaseUart3;
-	  iIrq = EIntSerial3;
-	  break;
-	default:
-	  iPortAddr = KHwBaseUart0;
-	  iIrq = EIntSerial0;
-	  break;
+	(TInt)Interrupt::Unbind(iIrq);
+	if (iDfcQueueOpened)
+		{
+		iDriverSyborgComm->CloseDfcQueue();
+		}
 	}
 
-  Interrupt::Bind(EIntSerial0,Isr,this);
+TInt DCommSyborgSoc::DoCreate(TInt aUnit, const TDesC8* /*anInfo*/)
+	{
+	DPRINT2("DCommSyborgSoc::DoCreate %d",aUnit);
+	TInt err = KErrNone;
+	switch(aUnit)
+		{
+		case 0:
+			iPortAddr = KHwBaseUart0;
+			iIrq = EIntSerial0;
+			break;
+		case 1:
+			iPortAddr = KHwBaseUart1;
+			iIrq = EIntSerial1;
+			break;
+		case 2:
+			iPortAddr = KHwBaseUart2;
+			iIrq = EIntSerial2;
+			break;
+		case 3:
+			iPortAddr = KHwBaseUart3;
+			iIrq = EIntSerial3;
+			break;
+		default:
+			err = KErrNotSupported;
+		break;
+		}
 
-  return KErrNone;
-
-}
+	if (!err)
+		{
+		err = iDriverSyborgComm->OpenDfcQueue();
+		iDfcQueueOpened = ETrue;
+		}
+	if (!err)
+		{
+		err = Interrupt::Bind(iIrq,Isr,this);
+		}
+	return err;
+	}
 
 TInt DCommSyborgSoc::Start()
-{
-  DPRINT("DCommSyborgSoc::Start");
-  WriteReg(iPortAddr, SERIAL_INT_ENABLE, 0x1);
-  Interrupt::Enable(iIrq);
-  return KErrNone;
-}
+	{
+	DPRINT("DCommSyborgSoc::Start");
+	WriteReg(iPortAddr, SERIAL_INT_ENABLE, 0x1);
+	TInt err = Interrupt::Enable(iIrq);
+	return err;
+	}
 
 void DCommSyborgSoc::Stop(TStopMode aMode)
-{
-  DPRINT("DCommSyborgSoc::Stop");
-  WriteReg(iPortAddr, SERIAL_INT_ENABLE, 0x0);
-  Interrupt::Disable(iIrq);
-}
+	{
+	DPRINT("DCommSyborgSoc::Stop");
+	WriteReg(iPortAddr, SERIAL_INT_ENABLE, 0x0);
+	(TInt)Interrupt::Disable(iIrq);
+	}
 
 void DCommSyborgSoc::Break(TBool aState)
-{
-  DPRINT("DCommSyborgSoc::Break");
-}
+	{
+	DPRINT("DCommSyborgSoc::Break");
+	}
 
 void DCommSyborgSoc::EnableTransmit()
-{
-  DPRINT("DCommSyborgSoc::EnableTransmit");
-  while (Kern::PowerGood())
 	{
-	  TInt r=TransmitIsr();
-	  if (r<0)
-		break;
-	  WriteReg(iPortAddr, SERIAL_DATA, r);
+	DPRINT("DCommSyborgSoc::EnableTransmit");
+	while (Kern::PowerGood())
+		{
+		TInt r=TransmitIsr();
+		if (r<0)
+			{
+			break;
+			}
+		WriteReg(iPortAddr, SERIAL_DATA, r);
+		}
+
+	// Request LDD to check if more data is available in the client buffer.
+	// TransmitISR only copies data from the LDD buffer which is 1k.
+	iLdd->CheckTxBuffer();
 	}
 
-	iLdd->iTxError = KErrNone;
-	iLdd->iTxCompleteDfc.Add();
-
-}
-
 TUint DCommSyborgSoc::Signals() const
-{
-  DPRINT("DCommSyborgSoc::Signals");
-  return(0);
-}
-  
+	{
+	DPRINT("DCommSyborgSoc::Signals");
+	return(0);
+	}
+
 void DCommSyborgSoc::SetSignals(TUint aSetMask, TUint aClearMask)
-{
-  DPRINT("DCommSyborgSoc::SetSignals");
-}
+	{
+	DPRINT("DCommSyborgSoc::SetSignals");
+	}
 
 TInt DCommSyborgSoc::ValidateConfig(const TCommConfigV01 &aConfig) const
-{
-  DPRINT("DCommSyborgSoc::ValidateConfig");
-  return KErrNone;
-}
+	{
+	DPRINT("DCommSyborgSoc::ValidateConfig");
+	return KErrNone;
+	}
 
 void DCommSyborgSoc::Configure(TCommConfigV01 &aConfig)
-{
-  DPRINT("DCommSyborgSoc::Configure");
-}
+	{
+	DPRINT("DCommSyborgSoc::Configure");
+	}
 
 void DCommSyborgSoc::Caps(TDes8 &aCaps) const
-{
-  DPRINT("DCommSyborgSoc::Caps");
-  TCommCaps3 capsBuf;
-  TCommCapsV03 &c=capsBuf();
-  c.iRate=KCapsBps110|KCapsBps150|KCapsBps300|KCapsBps600|KCapsBps1200|KCapsBps2400|KCapsBps4800|KCapsBps9600|KCapsBps19200|KCapsBps38400|KCapsBps57600|KCapsBps115200|KCapsBps230400;
-  c.iDataBits=KCapsData5|KCapsData6|KCapsData7|KCapsData8;
-  c.iStopBits=KCapsStop1|KCapsStop2;
-  c.iParity=KCapsParityNone|KCapsParityEven|KCapsParityOdd;
-  c.iHandshake=KCapsObeyXoffSupported|KCapsSendXoffSupported|KCapsObeyCTSSupported|KCapsFailCTSSupported|KCapsObeyDSRSupported|KCapsFailDSRSupported|KCapsObeyDCDSupported|KCapsFailDCDSupported|KCapsFreeRTSSupported|KCapsFreeDTRSupported;
-  c.iSignals=KCapsSignalCTSSupported|KCapsSignalDSRSupported|KCapsSignalDCDSupported|KCapsSignalRTSSupported|KCapsSignalDTRSupported;
-  c.iSIR=0;
-  c.iNotificationCaps=KNotifyDataAvailableSupported|KNotifySignalsChangeSupported;
-  c.iFifo=KCapsHasFifo;
-  c.iRoleCaps=0;
-  c.iFlowControlCaps=0;
-  c.iBreakSupported=ETrue;
-  aCaps.FillZ(aCaps.MaxLength());
-  aCaps=capsBuf.Left(Min(capsBuf.Length(),aCaps.MaxLength()));
-}
+	{
+	DPRINT("DCommSyborgSoc::Caps");
+	TCommCaps3 capsBuf;
+	TCommCapsV03 &c=capsBuf();
+	c.iRate=KCapsBps110|KCapsBps150|KCapsBps300|KCapsBps600|KCapsBps1200|KCapsBps2400|KCapsBps4800|KCapsBps9600|KCapsBps19200|KCapsBps38400|KCapsBps57600|KCapsBps115200|KCapsBps230400;
+	c.iDataBits=KCapsData5|KCapsData6|KCapsData7|KCapsData8;
+	c.iStopBits=KCapsStop1|KCapsStop2;
+	c.iParity=KCapsParityNone|KCapsParityEven|KCapsParityOdd;
+	c.iHandshake=KCapsObeyXoffSupported|KCapsSendXoffSupported|KCapsObeyCTSSupported|KCapsFailCTSSupported|KCapsObeyDSRSupported|KCapsFailDSRSupported|KCapsObeyDCDSupported|KCapsFailDCDSupported|KCapsFreeRTSSupported|KCapsFreeDTRSupported;
+	c.iSignals=KCapsSignalCTSSupported|KCapsSignalDSRSupported|KCapsSignalDCDSupported|KCapsSignalRTSSupported|KCapsSignalDTRSupported;
+	c.iSIR=0;
+	c.iNotificationCaps=KNotifyDataAvailableSupported|KNotifySignalsChangeSupported;
+	c.iFifo=KCapsHasFifo;
+	c.iRoleCaps=0;
+	c.iFlowControlCaps=0;
+	c.iBreakSupported=ETrue;
+	aCaps.FillZ(aCaps.MaxLength());
+	aCaps=capsBuf.Left(Min(capsBuf.Length(),aCaps.MaxLength()));
+	}
 
 TInt DCommSyborgSoc::DisableIrqs()
-{
-  DPRINT("DCommSyborgSoc::DisableIrqs");
-  return NKern::DisableAllInterrupts();
-}
+	{
+	DPRINT("DCommSyborgSoc::DisableIrqs");
+	return NKern::DisableAllInterrupts();
+	}
 
 void DCommSyborgSoc::RestoreIrqs(TInt aIrq)
-{
-  DPRINT("DCommSyborgSoc::RestoreIrqs");
-  NKern::RestoreInterrupts(aIrq);
-}
+	{
+	DPRINT("DCommSyborgSoc::RestoreIrqs");
+	NKern::RestoreInterrupts(aIrq);
+	}
 
-TDfcQue* DCommSyborgSoc::DfcQ(TInt /*aUnit*/)
-{
-  return Kern::DfcQue0();
-}
+TDfcQue* DCommSyborgSoc::DfcQ(TInt aUnit)
+	{
+	return iDriverSyborgComm->DfcQueue();
+	}
 
 void DCommSyborgSoc::CheckConfig(TCommConfigV01& aConfig)
-{
-  DPRINT("DCommSyborgSoc::CheckConfig");
-}
+	{
+	DPRINT("DCommSyborgSoc::CheckConfig");
+	}
 
 void DCommSyborgSoc::Isr(TAny* aPtr)
-{
-  DCommSyborgSoc& d=*(DCommSyborgSoc*)aPtr;
-  TUint rx[32];
-  TInt rxi=0;
-
-  DPRINT2("DCommSyborgSoc::Isr %x",d.iIrq);
-
-  // Is now auto clear
-  //  WriteReg(d.iPortAddr, SERIAL_CLEAR_INT, 0x0); // clear interrupts
+	{
+	DCommSyborgSoc& d=*(DCommSyborgSoc*)aPtr;
+	TUint rx[32];
+	TInt rxi=0;
 
-  while(ReadReg(d.iPortAddr, SERIAL_FIFO_COUNT)!=0) {
-	TUint ch = ReadReg(d.iPortAddr, SERIAL_DATA);
-	rx[rxi++]=ch;
-  }
-  d.ReceiveIsr(rx,rxi,0);
-}
+	TInt fifo = ReadReg(d.iPortAddr, SERIAL_FIFO_COUNT );
+	while(fifo > 0 && rxi<32)
+		{
+		TUint ch = ReadReg(d.iPortAddr, SERIAL_DATA);
+		rx[rxi++]=ch;
 
-// ---------------------------------------------------------------
-// ---------------------------------------------------------------
+		fifo = ReadReg(d.iPortAddr, SERIAL_FIFO_COUNT );
+		}
+	d.ReceiveIsr(rx,rxi,0);
+	}
 
 DECLARE_STANDARD_PDD()
-{
-  DPRINT("DECLARE_STANDARD_PDD()");
-  return new DDriverSyborgComm;
-}
+	{
+	DPRINT("DECLARE_STANDARD_PDD()");
+	return new DDriverSyborgComm;
+	}
 
--- a/baseport/syborg/serial/syborg_serial.h	Fri Mar 26 15:45:51 2010 +0000
+++ b/baseport/syborg/serial/syborg_serial.h	Fri May 07 16:13:43 2010 +0100
@@ -10,6 +10,7 @@
 * Nokia Corporation - initial contribution.
 *
 * Contributors:
+* NTT DOCOMO, INC. -- Fix bug 2186 - QEMU baseport serial driver doesn't work with multiple UARTs and is unreliable
 *
 * Description: Minimalistic serial driver
 *
@@ -26,52 +27,75 @@
 const TInt KMinimumLddMinorVersion=1;
 const TInt KMinimumLddBuild=1;
 
+/**
+ * Serial Ports Device Driver
+ *
+ *
+ **/
 class DDriverSyborgComm : public DPhysicalDevice
-{
+	{
 public:
   DDriverSyborgComm();
+  ~DDriverSyborgComm();
   virtual TInt Install();
   virtual void GetCaps(TDes8 &aDes) const;
   virtual TInt Create(DBase*& aChannel, TInt aUnit, const TDesC8* anInfo, const TVersion &aVer);
   virtual TInt Validate(TInt aUnit, const TDesC8* anInfo, const TVersion &aVer);
-};
 
-class DCommSyborgSoc : public DComm
-{
-public:
-  DCommSyborgSoc();
-  ~DCommSyborgSoc();
-  TInt DoCreate(TInt aUnit, const TDesC8* anInfo);
+// interface for single comm port.
 public:
-  virtual TInt Start();
-  virtual void Stop(TStopMode aMode);
-  virtual void Break(TBool aState);
-  virtual void EnableTransmit();
-  virtual TUint Signals() const;
-  virtual void SetSignals(TUint aSetMask, TUint aClearMask);
-  virtual TInt ValidateConfig(const TCommConfigV01 &aConfig) const;
-  virtual void Configure(TCommConfigV01 &aConfig);
-  virtual void Caps(TDes8 &aCaps) const;
-  virtual TInt DisableIrqs();
-  virtual void RestoreIrqs(TInt aIrq);
-  virtual TDfcQue* DfcQ(TInt aUnit);
-  virtual void CheckConfig(TCommConfigV01& aConfig);  
-  static void Isr(TAny* aPtr);
+  TInt OpenDfcQueue();
+  void CloseDfcQueue();
+  TDfcQue* DfcQueue();
+
+private:
+	TDynamicDfcQue* 	iDfcQueue;				// single Dfc queue for all comm ports
+	TUint8  			iDfcQRefCount;			// reference count for dfc queue
+	};
+
+
+
+/**
+ * Driver for a single Comm port
+ **/
+class DCommSyborgSoc : public DComm
+	{
+public:
+	DCommSyborgSoc(DDriverSyborgComm* aDriverSyborgComm);
+	~DCommSyborgSoc();
+	TInt DoCreate(TInt aUnit, const TDesC8* anInfo);
+public:
+	virtual TInt Start();
+	virtual void Stop(TStopMode aMode);
+	virtual void Break(TBool aState);
+	virtual void EnableTransmit();
+	virtual TUint Signals() const;
+	virtual void SetSignals(TUint aSetMask, TUint aClearMask);
+	virtual TInt ValidateConfig(const TCommConfigV01 &aConfig) const;
+	virtual void Configure(TCommConfigV01 &aConfig);
+	virtual void Caps(TDes8 &aCaps) const;
+	virtual TInt DisableIrqs();
+	virtual void RestoreIrqs(TInt aIrq);
+	virtual TDfcQue* DfcQ(TInt aUnit);
+	virtual void CheckConfig(TCommConfigV01& aConfig);
+	static void Isr(TAny* aPtr);
 
 public:
-  TLinAddr iPortAddr;
-  TInt iIrq;
+	DDriverSyborgComm* iDriverSyborgComm;
+	TLinAddr iPortAddr;
+	TInt iIrq;
+	TBool iDfcQueueOpened;
 
-  enum {
-    SERIAL_ID           = 0,
-    SERIAL_DATA         = 1,
-    SERIAL_FIFO_COUNT   = 2,
-    SERIAL_INT_ENABLE   = 3,
-    SERIAL_DMA_TX_ADDR  = 4,
-    SERIAL_DMA_TX_COUNT = 5, /* triggers dma */
-    SERIAL_DMA_RX_ADDR  = 6,
-    SERIAL_DMA_RX_COUNT = 7 /* triggers dma */
-  };
-};
+	enum {
+		SERIAL_ID           = 0,
+		SERIAL_DATA         = 1,
+		SERIAL_FIFO_COUNT   = 2,
+		SERIAL_INT_ENABLE   = 3,
+		SERIAL_DMA_TX_ADDR  = 4,
+		SERIAL_DMA_TX_COUNT = 5, /* triggers dma */
+		SERIAL_DMA_RX_ADDR  = 6,
+		SERIAL_DMA_RX_COUNT = 7 /* triggers dma */
+		};
+	};
 
 #endif
--- a/baseport/syborg/soundsc/soundsc.mmp	Fri Mar 26 15:45:51 2010 +0000
+++ b/baseport/syborg/soundsc/soundsc.mmp	Fri May 07 16:13:43 2010 +0100
@@ -17,6 +17,7 @@
 #include		"../variant.mmh"
 #include		"kernel/kern_ext.mmh"
 
+SYMBIAN_BASE_SYSTEMINCLUDE(drivers)
 SYSTEMINCLUDE		/epoc32/include/drivers
 
 
--- a/baseport/syborg/specific/assp.cpp	Fri Mar 26 15:45:51 2010 +0000
+++ b/baseport/syborg/specific/assp.cpp	Fri May 07 16:13:43 2010 +0100
@@ -10,6 +10,7 @@
 * Nokia Corporation - initial contribution.
 *
 * Contributors:
+* NTT Docomo, Inc : BUG 1296
 *
 * Description: implementation of class Syborg
 *
@@ -263,7 +264,7 @@
 
 EXPORT_C TInt Syborg::MsTickPeriod()
 {
-	return 1000;
+	return KMsTickPeriod;
 }
 
 EXPORT_C TInt Syborg::SystemTimeInSecondsFrom2000(TInt& aTime)
--- a/baseport/syborg/specific/highrestimer.h	Fri Mar 26 15:45:51 2010 +0000
+++ b/baseport/syborg/specific/highrestimer.h	Fri May 07 16:13:43 2010 +0100
@@ -10,6 +10,7 @@
 * Nokia Corporation - initial contribution.
 *
 * Contributors:
+* NTT Docomo, Inc : BUG 1296
 *
 * Description:
 *
@@ -50,7 +51,7 @@
 // Hi-jacking r10 for tmp, not good if Rd is R10 -- grepping the the kernel shows it's not (for now)
 #define GET_HIGH_RES_TICK_COUNT(Rd)						         \
   asm("push {r10}");										     \
-  asm("mov r10, #2");										     \
+  asm("mov r10, #1");										     \
   asm("ldr "#Rd", =%a0"               : : "i" (KHwBaseRtc + 4)); \
   asm("str r10, ["#Rd", #%a0]"        : : "i" (0));			     \
   asm("pop {r10}");                                              \
--- a/baseport/syborg/specific/syborg.h	Fri Mar 26 15:45:51 2010 +0000
+++ b/baseport/syborg/specific/syborg.h	Fri May 07 16:13:43 2010 +0100
@@ -10,6 +10,7 @@
 * Nokia Corporation - initial contribution.
 *
 * Contributors:
+* NTT Docomo, Inc : BUG 1296
 *
 * Description:
 *
@@ -31,6 +32,7 @@
 
 const TUint KHwBasePeripherals  = KPrimaryIOBase;       
 const TUint KHwLinSeparation	= 0x1000;
+const TInt KMsTickPeriod	= 10000;
 
 const TUint KHwBaseSic				= KHwBasePeripherals + 0x00*KHwLinSeparation;
 // intended for use as a free-running counter. Reading the value register of a free-running syborg counter returns a microsec value
@@ -50,8 +52,8 @@
 const TUint KHwSVPNetDevice			= KHwBasePeripherals + 0x0c*KHwLinSeparation;
 const TUint KHwSVPNandDevice			= KHwBasePeripherals + 0x0d*KHwLinSeparation;
 const TUint KHwSVPAudioDevice			= KHwBasePeripherals + 0x0e*KHwLinSeparation;
-const TUint KHwSVPPlatformDevice		= KHwBasePeripherals + 0x0f*KHwLinSeparation;
-
+const TUint KHwSVPWebcameraDevice		= KHwBasePeripherals + 0x0f*KHwLinSeparation;
+const TUint KHwSVPPlatformDevice		= KHwBasePeripherals + 0x10*KHwLinSeparation;
 	
 enum TSyborgInterruptId
 {
--- a/baseport/syborg/svphostfs/svphostfs.mmp	Fri Mar 26 15:45:51 2010 +0000
+++ b/baseport/syborg/svphostfs/svphostfs.mmp	Fri May 07 16:13:43 2010 +0100
@@ -22,6 +22,7 @@
 LIBRARY        euser.lib efsrv.lib efile.lib hal.lib
 SYSTEMINCLUDE  inc	
 SYSTEMINCLUDE  /epoc32/include 
+OS_LAYER_SYSTEMINCLUDE
 
 CAPABILITY		DISKADMIN ALLFILES
 VENDORID 0x70000001
--- a/baseport/syborg/svphostfs/svphostfsdriver.mmp	Fri Mar 26 15:45:51 2010 +0000
+++ b/baseport/syborg/svphostfs/svphostfsdriver.mmp	Fri May 07 16:13:43 2010 +0100
@@ -24,6 +24,7 @@
 systeminclude		inc
 systeminclude		../svpplatform/libfdt
 systeminclude 		/epoc32/include/stdapis
+OS_LAYER_LIBC_SYSTEMINCLUDE
 
 target			VariantTarget(svphostfsdriver,ldd)
 linkas			svphostfsdriver.ldd
--- a/baseport/syborg/svphostfs/svphostfsstart.mmp	Fri Mar 26 15:45:51 2010 +0000
+++ b/baseport/syborg/svphostfs/svphostfsstart.mmp	Fri May 07 16:13:43 2010 +0100
@@ -22,6 +22,7 @@
 LIBRARY        euser.lib efsrv.lib efile.lib hal.lib
 SYSTEMINCLUDE  inc	
 SYSTEMINCLUDE  /epoc32/include 
+OS_LAYER_SYSTEMINCLUDE
 
 CAPABILITY		DISKADMIN ALLFILES
 VENDORID 0x70000001
--- a/baseport/syborg/svphostfs/svphostfsy.mmp	Fri Mar 26 15:45:51 2010 +0000
+++ b/baseport/syborg/svphostfs/svphostfsy.mmp	Fri May 07 16:13:43 2010 +0100
@@ -24,6 +24,7 @@
 
 SYSTEMINCLUDE	inc	
 SYSTEMINCLUDE	/epoc32/include 
+OS_LAYER_SYSTEMINCLUDE
 
 LIBRARY			efsrv.lib euser.lib hal.lib
 LIBRARY			efile.lib
--- a/baseport/syborg/svpplatform/fdt.mmp	Fri Mar 26 15:45:51 2010 +0000
+++ b/baseport/syborg/svpplatform/fdt.mmp	Fri May 07 16:13:43 2010 +0100
@@ -20,6 +20,7 @@
 
 systeminclude 		libfdt
 systeminclude 		/epoc32/include/stdapis
+OS_LAYER_LIBC_SYSTEMINCLUDE
 
 sourcepath		libfdt
 
--- a/baseport/syborg/svpsnapdriver/snapapp.mmp	Fri Mar 26 15:45:51 2010 +0000
+++ b/baseport/syborg/svpsnapdriver/snapapp.mmp	Fri May 07 16:13:43 2010 +0100
@@ -20,7 +20,7 @@
 SOURCEPATH	   src
 SOURCE         snapapp.cpp rsvpsnapdriver.cpp
 LIBRARY        euser.lib efsrv.lib
-SYSTEMINCLUDE  /epoc32/include 
+OS_LAYER_SYSTEMINCLUDE  
 
 CAPABILITY		TCB DISKADMIN ALLFILES
 VENDORID 0x70000001
Binary file baseport/syborg/syborg.dtb has changed
--- a/baseport/syborg/syborg.dts	Fri Mar 26 15:45:51 2010 +0000
+++ b/baseport/syborg/syborg.dts	Fri May 07 16:13:43 2010 +0100
@@ -32,7 +32,7 @@
         timer@0 {
             compatible = "syborg,timer";
             reg = <c0002000>;
-            frequency = <d#1000000>;
+            frequency = <d#100000>;
             interrupts = <1>;
             interrupt-parent = <&intc>;
         };
@@ -115,9 +115,15 @@
             interrupts = <a>;
             interrupt-parent = <&intc>;
         };
+        usbtest@0 {
+            compatible = "syborg,usbtest";
+            reg = <c000f000>;
+            interrupts = <b>;
+            interrupt-parent = <&intc>;
+        };
         platform@0 {
             compatible = "syborg,platform";
-            reg = <c000f000>;
+            reg = <c0010000>;
         };
     };
 };
--- a/baseport/syborg/syborg.oby	Fri Mar 26 15:45:51 2010 +0000
+++ b/baseport/syborg/syborg.oby	Fri May 07 16:13:43 2010 +0100
@@ -41,8 +41,11 @@
 
 define ROMMEGS			50		/* !! HEX !! */
 define PLATFORM_NAME		syborg
+#define BASEPORT_DRV <base_syborg.iby>
+#define COLOR
+#undef SYMBIAN_EXCLUDE_SCDV
 
-#define COLOR
+
 
 REM defines for IrDA options
 REM Uncomment the line below to enable IrDA to use a Jeteye ESI09680 pod with serial card adapter
--- a/baseport/syborg/variant.mmh	Fri Mar 26 15:45:51 2010 +0000
+++ b/baseport/syborg/variant.mmh	Fri May 07 16:13:43 2010 +0100
@@ -15,6 +15,8 @@
 *
 */
 
+#include <platform_paths.hrh>
+
 //macro   __CPU_ARM926J__
 //#define __CPU__ ARM926EJ-S
 
@@ -119,6 +121,11 @@
 systeminclude	/epoc32/include/memmodel/epoc/multiple
 systeminclude	/epoc32/include/memmodel/epoc/multiple/arm
 
+SYMBIAN_BASE_SYSTEMINCLUDE(memmodel/epoc/mmubase)
+SYMBIAN_BASE_SYSTEMINCLUDE(memmodel/epoc/multiple)
+SYMBIAN_BASE_SYSTEMINCLUDE(memmodel/epoc/multiple/arm)
+OS_LAYER_SYSTEMINCLUDE
+
 systeminclude	../../../../os/kernelhwsrv/driversupport/socassp/interface
 
 // Uncomment for T_USERCOMDEB test
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/baseport/syborg/webcamera/webcamera_app.cpp	Fri May 07 16:13:43 2010 +0100
@@ -0,0 +1,115 @@
+/*
+* Copyright (c) 2010 ISB.
+* 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:
+* ISB - initial contribution.
+*
+* Contributors:
+*
+* Description: USB driver for test
+*
+*/
+
+#include <e32test.h>
+#include <webcamera_driver.h>
+
+#include <e32debug.h>
+#define DP(format...) RDebug::Printf(format)
+
+LOCAL_D RTest test(_L("WebcameraDevice_TEST"));
+
+//Wins用ダミーなので実機では正式なものを使用する
+_LIT(KWebcameraPddFileName, "webcamera.pdd");
+_LIT(KWebcameraLddFileName, "ewebcamera.ldd");
+
+GLDEF_C TInt E32Main()
+ {
+    test.Title();
+    TInt r;
+    
+    test.Start(_L("Load Physical Device"));
+    r=User::LoadPhysicalDevice(KWebcameraPddFileName);
+    test(r==KErrNone || r==KErrAlreadyExists);
+
+    test.Next(_L("Load Logical Device"));
+    r=User::LoadLogicalDevice(KWebcameraLddFileName);
+    test(r==KErrNone || r==KErrAlreadyExists);
+//    __KHEAP_MARK;
+
+//    test.Next(_L("Open Device"));
+//    RDevice device;
+//    r=device.Open(RWebcameraDevice::Name());
+//    test(r==KErrNone);
+
+    //test.Next(_L("Close Device"));
+    //device.Close();
+
+    test.Next(_L("Open Logical Channel"));
+    RWebcameraDevice ldd;
+    r=ldd.Open();
+    test(r==KErrNone);
+
+    test.Next(_L("Check access by wrong client"));
+    RWebcameraDevice ldd2=ldd;
+    r=ldd2.Duplicate(RThread(),EOwnerProcess);
+    test(r==KErrAccessDenied);
+
+    test.Next(_L("Check handle duplication"));
+    ldd2=ldd;
+    r=ldd2.Duplicate(RThread(),EOwnerThread);
+    test(r==KErrNone);
+    ldd2.Close();
+
+    test.Next(_L("ReceiveData"));
+    TRequestStatus status;
+    HBufC8 * buffer = HBufC8::NewL(BUFSIZE);
+    TPtr8	itempPtr(buffer->Des());
+    itempPtr.SetLength(0);
+    ldd.StartViewFinder(status,itempPtr);
+
+    test.Next(_L("ReceiveDataCancel"));
+    ldd.StopViewFinder();
+    User::WaitForRequest(status);
+    r=status.Int();
+    test(r==KErrNone);
+	
+    itempPtr.SetLength(0);
+    ldd.StartViewFinder(status,itempPtr);
+    User::WaitForRequest(status);
+    r=status.Int();
+	test(r==KErrNone);
+	
+    test.Next(_L("CaptureData"));
+    HBufC8 * buffer1 = buffer;
+    TPtr8	itempPtr1(buffer1->Des());
+    itempPtr1.SetLength(0);
+    ldd.Capture(status,itempPtr1);
+    User::WaitForRequest(status);
+    r=status.Int();
+    test(r==KErrNone);
+    
+    test.Next(_L("Close Logical Channel"));
+    ldd.Close();
+
+//    __KHEAP_MARKEND;
+
+    test.Next(_L("Unload Logical Device"));
+    r=User::FreeLogicalDevice(RWebcameraDevice::Name());
+    test(r==KErrNone);
+
+    test.Next(_L("Unload Physical Device"));
+    TName pddName(RWebcameraDevice::Name());
+    _LIT(KVariantExtension,".pdd");
+    pddName.Append(KVariantExtension);
+    r=User::FreePhysicalDevice(pddName);
+    test(r==KErrNone);
+	
+    test.End();
+
+    return(0);
+ }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/baseport/syborg/webcamera/webcamera_app.mmp	Fri May 07 16:13:43 2010 +0100
@@ -0,0 +1,32 @@
+/*
+* Copyright (c) 2010 ISB.
+* 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:
+* ISB - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+TARGET		webcamera_app.exe
+TARGETTYPE	exe
+
+//UID		0x1000008d 0x101F399B   //TODO:修正する必要
+VENDORID        0x70000001
+
+CAPABILITY	DISKADMIN ALLFILES
+
+SYSTEMINCLUDE   /epoc32/include
+SYSTEMINCLUDE   /epoc32/include/platform
+
+SOURCEPATH	.
+SOURCE		webcamera_app.cpp
+
+LIBRARY		euser.lib
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/baseport/syborg/webcamera/webcamera_device.h	Fri May 07 16:13:43 2010 +0100
@@ -0,0 +1,94 @@
+/*
+* Copyright (c) 2010 ISB.
+* 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:
+* ISB - initial contribution.
+*
+* Contributors:
+*
+* Description: USB driver for test
+*
+*/
+
+#ifndef __deviceBASE_H
+#define __deviceBASE_H
+
+#include <comm.h>
+#include <e32hal.h>
+#include <e32ver.h>
+
+
+class DWebcameraLogicalChannelBase : public DLogicalChannel
+{
+public:
+	/**
+	  Called by PDD from ISR to indicate that a get oneflame operation has completed.
+	*/
+    virtual void GetOneFlameComplete(TInt aResult)=0;
+	/** 
+	call to the function if one Capture image is received.
+	*/
+    virtual void CaptureComplete(TInt aResult)=0;
+	/** 
+	call to the function if one flame is received.
+	*/
+	/** 
+	call to the function if one Capture image is received.
+	*/
+	virtual void DoCaptureComplete()=0;
+	
+public:
+  /**
+   * pointer to client.
+   */	
+	DThread* iClient;	
+};
+
+class DWebcameraDriverBase : public DBase
+{
+public:
+  /**
+  Enumeration of stop modes.
+  */
+  enum TUSBStopMode
+	{
+	USB_ViewerFinder =0,
+	USB_capture      =1,
+	USB_cancel      =2
+	};
+  /**
+  request.
+  */
+  virtual TInt StartViewerFinder(TUint aBuffer,TInt aSize)=0;
+  /**
+  Enumeration of stop modes.
+  */
+  virtual TInt StartCapture(TUint aBuffer,TInt aSize)=0;
+  /**
+  Enumeration of stop modes.
+  */
+  virtual void Stop(TUSBStopMode aMode)=0;
+//virtual void Caps(TDes8 &aCaps) const;
+ 
+public:
+  /**
+   * pointer to logic channel.
+   */		
+  DWebcameraLogicalChannelBase* iLdd;
+   /**
+   * Linear Addresses of Peripherals.
+   */		
+  TLinAddr iPortAddr;
+  /**
+   * interrupt number.
+   */		
+  TInt iIrq;
+  
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/baseport/syborg/webcamera/webcamera_driver.h	Fri May 07 16:13:43 2010 +0100
@@ -0,0 +1,144 @@
+/*
+* Copyright (c) 2010 ISB.
+* 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:
+* ISB - initial contribution.
+*
+* Contributors:
+*
+* Description: USB driver for test
+*
+*/
+#ifndef __deviceIF_H__
+#define __deviceIF_H__
+
+#include <e32cmn.h>
+#include <e32ver.h>
+
+#define BUFSIZE  (100*1024)
+
+/**
+User interface for 'WebcameraDevice'
+Define of the RBusLogicalChannel that is used in the application
+*/
+class RWebcameraDevice : public RBusLogicalChannel
+    {
+public:
+    /**
+    Structure for holding driver capabilities information
+    */
+    class TCaps
+        {
+    public:
+        TVersion iVersion;
+        };
+    /**
+    Structure for holding driver configuration data
+    */
+    class TConfig
+        {
+    public:
+        TInt iPddBufferSize;        /**< Size of the PDD's data buffer (not modifiable) */
+       //RArray<TSize> iImageSizes /**< size the PDD support*/ //TODO:implement
+        };
+    typedef TPckgBuf<TConfig> TConfigBuf;
+
+public:
+    /**
+      Opens a logical channel to the driver
+
+      @return One of the system wide error codes.
+    */
+    inline TInt Open();
+    /**
+      Gets the current configuration settings.
+
+      @param aConfig A structure which will be filled with the configuration settings.
+
+      @return KErrNone
+    */
+    inline TInt GetConfig(TConfigBuf& aConfig);
+    /**
+      Sets the current configuration settings.
+
+      @param aConfig The new configuration settings to be used.
+
+      @return KErrInUse if there are outstanding data transfer requests.
+              KErrArgument if any configuration values are invalid.
+              KErrNone otherwise
+    */
+    inline TInt SetConfig(const TConfigBuf& aConfig);
+    /**
+      Request data from device.
+      Only one send request may be pending at any time.
+
+      @param aStatus The request to be signalled when the data has been sent.
+                     The result value will be set to KErrNone on success;
+                     or set to one of the system wide error codes when an error occurs.
+      @param aData   A descriptor containing the data to send.
+    */
+    inline void StartViewFinder(TRequestStatus& aStatus,TDes8& aBuffer);
+    /**
+      Cancels a previous getdata request.
+    */
+    inline void StartViewFinderCancel();
+    /**
+      Cancels a previous getdata request and notice device not to send data       
+    */
+    inline void StopViewFinder();
+    /**
+      Request data(Capture data) from device.
+      Only one send request may be pending at any time.
+
+      @param aStatus The request to be signalled when the data has been sent.
+                     The result value will be set to KErrNone on success;
+                     or set to one of the system wide error codes when an error occurs.
+      @param aData   A descriptor containing the data to send.
+    */
+    inline void Capture(TRequestStatus& aStatus,TDes8& aBuffer);
+    /**
+      Cancels a previous getCapturedata request.     
+    */
+	inline void CaptureCancel();
+	/**
+	  Returns the driver's name
+	*/
+    inline static const TDesC& Name();
+    /**
+      Returns the version number of the driver
+    */
+    inline static TVersion VersionRequired();
+    
+public:
+    /**
+    Enumeration of Control messages.
+    */
+    enum TControl
+        {
+        EGetConfig,
+        ESetConfig
+        };
+    /**
+    Enumeration of Request messages.
+    */
+    enum TRequest
+        {
+        EStart,
+        ECapture,
+        ENumRequests,
+        EAllRequests = (1<<ENumRequests)-1
+        };
+
+    // Kernel side LDD channel is a friend
+    friend class DDriver1Channel;
+    };
+
+// Inline functions
+#include <webcamera_driver.inl>
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/baseport/syborg/webcamera/webcamera_driver.inl	Fri May 07 16:13:43 2010 +0100
@@ -0,0 +1,139 @@
+/*
+* Copyright (c) 2010 ISB.
+* 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:
+* ISB - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef __deviceIFI_H
+#define __deviceIFI_H
+
+/**
+  Returns the driver's name
+*/
+inline const TDesC& RWebcameraDevice::Name()
+    {
+    _LIT(KDriverName,"WebcameraDevice");
+    return KDriverName;
+    }
+
+/**
+  Returns the version number of the driver
+*/
+inline TVersion RWebcameraDevice::VersionRequired()
+    {
+    const TInt KMajorVersionNumber=1;
+    const TInt KMinorVersionNumber=1;
+    const TInt KBuildVersionNumber=0;
+    return TVersion(KMajorVersionNumber,KMinorVersionNumber,KBuildVersionNumber);
+    }
+
+/*
+  NOTE: The following member functions would normally be exported from a seperate client DLL
+  but are included inline in this header file for convenience.
+*/
+
+#ifndef __KERNEL_MODE__
+
+/**
+  Opens a logical channel to the driver
+
+  @return One of the system wide error codes.
+*/
+inline TInt RWebcameraDevice::Open()
+    {
+    return DoCreate(Name(),VersionRequired(),KNullUnit,NULL,NULL,EOwnerThread);
+    }
+
+
+/**
+  Gets the current configuration settings.
+
+  @param aConfig A structure which will be filled with the configuration settings.
+
+  @return KErrNone
+*/
+inline TInt RWebcameraDevice::GetConfig(TConfigBuf& aConfig)
+    {
+    return DoControl(EGetConfig,(TAny*)&aConfig);
+    }
+
+
+/**
+  Sets the current configuration settings.
+
+  @param aConfig The new configuration settings to be used.
+
+  @return KErrInUse if there are outstanding data transfer requests.
+          KErrArgument if any configuration values are invalid.
+          KErrNone otherwise
+*/
+inline TInt RWebcameraDevice::SetConfig(const TConfigBuf& aConfig)
+    {
+    return DoControl(ESetConfig,(TAny*)&aConfig);
+    }
+
+/**
+  Receives image from the device.
+  Only one receive request may be pending at any time.
+
+  @param aStatus The request to be signalled when the data has been received.
+                 The result value will be set to KErrNone on success;
+                 or set to one of the system wide error codes when an error occurs.
+  @param aData   A descriptor to which the received data will be written.
+*/
+inline void RWebcameraDevice::StartViewFinder(TRequestStatus& aStatus,TDes8& aBuffer)
+    {
+	TInt length=BUFSIZE;
+    DoRequest(EStart,aStatus,(TAny*)&aBuffer,(TAny*)&length);
+    }
+
+
+/**
+  Cancels a previous StartViewFinder request.
+*/
+inline void RWebcameraDevice::StartViewFinderCancel()
+    {
+    DoCancel(1<<EStart);
+    }
+
+inline void RWebcameraDevice::StopViewFinder()
+	{
+    DoCancel(1<<EStart);
+	}
+
+/**
+  Capture data from the device.
+  Only one Capture request may be pending at any time.
+
+  @param aStatus The request to be signalled when the data has been captureed.
+                 The result value will be set to KErrNone on success;
+                 or set to one of the system wide error codes when an error occurs.
+  @param aData   A descriptor to which the captured data will be written.
+*/
+inline void RWebcameraDevice::Capture(TRequestStatus& aStatus,TDes8& aBuffer)
+    {
+	TInt length=BUFSIZE;
+    DoRequest(ECapture,aStatus,(TAny*)&aBuffer,(TAny*)&length);
+    }
+
+/**
+  Cancels a previous capture request.
+*/
+inline void RWebcameraDevice::CaptureCancel()
+    {
+	DoCancel(1<<ECapture);
+    }
+#endif   // !__KERNEL_MODE__
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/baseport/syborg/webcamera/webcamera_ldd.cpp	Fri May 07 16:13:43 2010 +0100
@@ -0,0 +1,586 @@
+/*
+* Copyright (c) 2010 ISB.
+* 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:
+* ISB - initial contribution.
+*
+* Contributors:
+*
+* Description: USB driver for test
+*
+*/
+
+#include <kern_priv.h>
+#include "webcamera_ldd.h"
+#include <webcamera_driver.h>
+
+#define DP(format...) Kern::Printf(format)
+
+_LIT(KDriver1PanicCategory,"WebcameraDevice");
+
+/**
+ *Create Logic device.
+ *
+ */
+DECLARE_STANDARD_LDD()
+	{
+    DP("DECLARE_STANDARD_LDD()");
+    return new DWebcameraLogicalDevice;
+	}
+
+/**
+  Constructor
+*/
+DWebcameraLogicalDevice::DWebcameraLogicalDevice()
+	{
+	DP("DWebcameraLogicalDevice()");
+    // Set version number for this device
+    iVersion=RWebcameraDevice::VersionRequired();
+    // Indicate that we work with a PDD
+    iParseMask=KDeviceAllowPhysicalDevice;
+	}
+
+/**
+  Destructor
+*/
+DWebcameraLogicalDevice::~DWebcameraLogicalDevice()
+	{
+	}
+
+/**
+  Second stage constructor for DDriver1Factory.
+  This must at least set a name for the driver object.
+
+  @return KErrNone if successful, otherwise one of the other system wide error codes.
+*/
+TInt DWebcameraLogicalDevice::Install()
+	{
+	DP("DWebcameraLogicalDevice::Install()");
+
+	return SetName(&RWebcameraDevice::Name());
+	}
+
+/**
+  Return the drivers capabilities.
+  Called in the response to an RDevice::GetCaps() request.
+
+  @param aDes User-side descriptor to write capabilities information into
+*/
+void DWebcameraLogicalDevice::GetCaps(TDes8& aDes) const
+	{
+    // Create a capabilities object
+	RWebcameraDevice::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 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 aChannel Set to point to the created Logical Channel
+
+  @return KErrNone if successful, otherwise one of the other system wide error codes.
+*/
+TInt DWebcameraLogicalDevice::Create(DLogicalChannelBase*& aChannel)
+	{
+	DP("DWebcameraLogicalDevice::Create() start");
+	aChannel = new DWebcameraLogicalChannel;
+	if(!aChannel)
+		return KErrNoMemory;
+	return KErrNone;
+	DP("DWebcameraLogicalDevice::Create() end");
+	}
+
+/**
+  Constructor
+*/
+DWebcameraLogicalChannel::DWebcameraLogicalChannel()
+	: iReceiveDataDfc(GetOneFlameDfc, this, 1)
+	  ,iCaptureDfc(CaptureDfc,this,1)
+	{
+	DP("DWebcameraLogicalChannel::DWebcameraLogicalChannel() start");
+
+    // Get pointer to client threads DThread object
+	iClient=&Kern::CurrentThread();
+    // Open a reference on client thread so it's control block can't dissapear until
+    // this driver has finished with it.
+	((DObject*)iClient)->Open();
+	
+	DP("DWebcameraLogicalChannel::DWebcameraLogicalChannel() end");
+	}
+
+/**
+  Destructor
+*/
+DWebcameraLogicalChannel::~DWebcameraLogicalChannel()
+	{
+	DP("DWebcameraLogicalChannel::~DWebcameraLogicalChannel() start");
+    // Cancel all processing that we may be doing
+	DoCancel(RWebcameraDevice::EAllRequests);	
+	if (iComm)
+		{
+		delete iComm;
+		}
+    if (iChunk)
+        {
+        Epoc::FreePhysicalRam(iPhysAddr, iSize);
+        }
+    // Close our reference on the client thread
+	Kern::SafeClose((DObject*&)iClient,NULL);
+	DP("DWebcameraLogicalChannel::~DWebcameraLogicalChannel() end");
+	}
+
+/**
+  Called when a user thread requests a handle to this channel.
+*/
+TInt DWebcameraLogicalChannel::RequestUserHandle(DThread* aThread, TOwnerType aType)
+    {
+    // Make sure that only our client can get a handle
+    if (aType!=EOwnerThread || aThread!=iClient)
+        return KErrAccessDenied;
+    return KErrNone;
+    }
+
+/**
+  Second stage constructor called by the kernel's device driver framework.
+  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
+  @param aInfo The info argument supplied by the client
+  @param aVer The version argument supplied by the client
+
+  @return KErrNone if successful, otherwise one of the other system wide error codes.
+*/
+TInt DWebcameraLogicalChannel::DoCreate(TInt /*aUnit*/, const TDesC8* /*aInfo*/, const TVersion& aVer)
+	{
+	DP("DWebcameraLogicalChannel::DoCreate() start");
+    if(!Kern::CurrentThreadHasCapability(ECapability_None,__PLATSEC_DIAGNOSTIC_STRING("Checked by Webcamera")))
+    	{
+        return KErrPermissionDenied;
+    	}
+    // Check version
+	if (!Kern::QueryVersionSupported(RWebcameraDevice::VersionRequired(),aVer))
+		{
+		return KErrNotSupported;
+		}
+    // Setup LDD for receiving client messages
+	SetDfcQ(Kern::DfcQue0());
+	iMsgQ.Receive();
+    // Associate DFCs with the same queue we set above to receive client messages on
+	iReceiveDataDfc.SetDfcQ(iDfcQ);
+	iCaptureDfc.SetDfcQ(iDfcQ);
+    // Give PDD a pointer to this channel
+	Pdd()->iLdd=this;
+
+	//allocate Memory
+	iSize=Kern::RoundToPageSize(BUFSIZE);
+	TInt rtn=Epoc::AllocPhysicalRam(iSize, iPhysAddr);
+	if (rtn != KErrNone)
+		{
+		return rtn;
+		}
+	rtn=DPlatChunkHw::New(iChunk, iPhysAddr, iSize,EMapAttrUserRw|EMapAttrBufferedC);
+	if (rtn != KErrNone)
+		{
+		if (iPhysAddr)
+			{
+			Epoc::FreePhysicalRam(iPhysAddr, iSize);
+			}
+		return rtn;
+		}
+	iLAdr = reinterpret_cast<TUint8*>(iChunk->LinearAddress());
+	
+	iComm=HBuf8::New(BUFSIZE);
+	if (!iComm)
+		{
+		return KErrNotSupported;
+		}
+	iReceiveDataBuffer=iComm;
+	iCaptureBuffer=iComm;
+
+	DP("DWebcameraLogicalChannel::DoCreate() end");
+	return KErrNone;
+	}
+
+/**
+  Process a message for this logical channel.
+  This function is called in the context of a DFC thread.
+
+  @param aMessage The message to process.
+                  The iValue member of this distinguishes the message type:
+                  iValue==ECloseMsg, channel close message
+                  iValue==KMaxTInt, a 'DoCancel' message
+                  iValue>=0, a 'DoControl' message with function number equal to iValue
+                  iValue<0, a 'DoRequest' message with function number equal to ~iValue
+*/
+void DWebcameraLogicalChannel::HandleMsg(TMessageBase* aMsg)
+	{
+	DP("DWebcameraLogicalChannel::HandleMsg() start");
+	TThreadMessage& m=*(TThreadMessage*)aMsg;
+
+    // Get message type
+	TInt id=m.iValue;
+    DP("id=%d",id);
+    
+    // Decode the message type and dispatch it to the relevent handler function...
+	if (id==(TInt)ECloseMsg)
+		{
+		DoCancel(RWebcameraDevice::EAllRequests);
+		m.Complete(KErrNone, EFalse);
+		return;
+		}
+
+	if(m.Client()!=iClient)
+		{
+		Kern::ThreadKill(m.Client(),
+						 EExitPanic,
+						 ERequestFromWrongThread,
+						 KDriver1PanicCategory);
+		m.Complete(KErrNone,ETrue);
+		return;
+		}
+
+	if (id==KMaxTInt)
+		{
+		DoCancel(m.Int0());
+		m.Complete(KErrNone,ETrue);
+		return;
+		}
+
+	if (id<0)
+		{
+		// DoRequest
+		TRequestStatus* pS=(TRequestStatus*)m.Ptr0();
+		TInt rtn =DoRequest(~id,pS,m.Ptr1(),aMsg);
+
+		if (rtn != KErrNone)
+			Kern::RequestComplete(iClient,pS,rtn);
+        m.Complete(KErrNone,ETrue);
+		}
+	else
+		{
+		// DoControl
+		TInt rtn = DoControl(id,m.Ptr0(),aMsg);
+		m.Complete(rtn,ETrue);
+		}
+	DP("DWebcameraLogicalChannel::HandleMsg() end");
+	}
+
+/**
+  Process synchronous 'control' requests
+*/
+TInt DWebcameraLogicalChannel::DoControl(TInt aFunction, TAny* a1, TAny* a2)
+	{
+	DP("DWebcameraLogicalChannel::DoControl() start");
+	TInt rtn;
+	TThreadMessage& m=*(TThreadMessage*)a2;
+	TRequestStatus* pS=(TRequestStatus*)m.Ptr0();
+
+	switch (aFunction)
+		{
+		case RWebcameraDevice::EGetConfig:
+//			rtn = GetConfig((TDes8*)a1);
+			rtn = KErrNone;
+			if ( rtn != KErrNone )
+				{
+				Kern::RequestComplete(iClient,pS,rtn);
+				}
+			break;
+        case RWebcameraDevice::ESetConfig:
+ //       	rtn = SetConfig((const TDesC8*)a1);
+            break;
+            
+		default:
+			rtn = KErrNotSupported;
+			Kern::RequestComplete(iClient,pS,rtn);
+			break;
+		}
+	DP("DWebcameraLogicalChannel::DoControl() end");
+	return rtn;
+
+	}
+
+/**
+  Process asynchronous requests.
+*/
+TInt DWebcameraLogicalChannel::DoRequest(TInt aReqNo,
+											TRequestStatus* aStatus,
+											TAny* a1,
+											TAny* a2)
+	{
+	DP("DWebcameraLogicalChannel::DoRequest() start");
+	TInt rtn;
+	TThreadMessage& m=*(TThreadMessage*)a2;
+
+	iRequesting =ETrue;
+	rtn = KErrNone;
+    DP("aReqNo=%d",aReqNo);
+	switch(aReqNo)
+		{
+		case RWebcameraDevice::EStart:
+   			DP("EStart=%d",RWebcameraDevice::EStart);
+			iReceiveDataStatus = aStatus;
+			iReceiving = ETrue ;
+			iReceiveDataBuffer->FillZ(iCaptureBuffer->MaxLength());
+			iReceiveDataBuffer->Zero();
+			DP("iReceiveDataBuffer Len=%d",iReceiveDataBuffer->MaxLength());
+			DP("iReceiveDataBuffer Len=%d",iReceiveDataBuffer->Length());
+			rtn = Pdd()->StartViewerFinder(iPhysAddr,iSize);
+			if ( rtn != KErrNone ) 
+				{
+	   			DP("rtn=%d",rtn);
+				iReceiving = EFalse ;
+				Kern::RequestComplete(iClient,aStatus,rtn);
+				}
+			else
+				{
+	   			DP("rtn=%d",rtn);
+				// Example Platform Security capability check which tests the
+				// client for ECapability_None (which always passes)...
+				if ( iRequesting == EFalse )
+					{
+		   			DP("iRequesting=EFalse");
+					iReceiving = EFalse ;
+					Kern::RequestComplete(iClient,
+										  iReceiveDataStatus,
+										  iReceiveDataResult);
+					}
+				else
+					{
+					DP("iRequesting=ETrue");
+					iReceiveDataDescriptor=(TDes8*)a1;
+					}
+				}
+			break;
+		case RWebcameraDevice::ECapture:
+			iCaptureing = ETrue ;
+			iCaptureStatus = aStatus;
+			iCaptureBuffer->FillZ(iCaptureBuffer->MaxLength());
+			iCaptureBuffer->Zero();
+		    DP("iCaptureBuffer Len=%d",iCaptureBuffer->MaxLength());
+		    DP("iCaptureBuffer Len=%d",iCaptureBuffer->Length());
+			rtn = Pdd()->StartCapture(iPhysAddr,iSize);
+			DP("rtn=%d",rtn);
+			if ( rtn != KErrNone ) 
+				{
+				iCaptureing = EFalse ;
+				Kern::RequestComplete(iClient,aStatus,rtn);
+				}
+			else
+				{
+				if ( iRequesting == EFalse )
+					{
+				    DP("iRequesting=EFalse");
+					iReceiving = EFalse ;
+					Kern::RequestComplete(iClient,iCaptureStatus,iCaptureResult);
+					}
+				else
+					{
+			        DP("Capture iRequesting=ETrue");
+				    iCaptureDescriptor=(TDes8*)a1;
+					}
+				}
+			break;
+		default:
+			rtn=KErrNotSupported;
+			Kern::RequestComplete(iClient,aStatus,rtn);
+			break;
+		}
+	iRequesting = EFalse;
+
+	DP("DWebcameraLogicalChannel::DoRequest() end");
+	return rtn;
+
+	}
+
+/**
+  Process cancelling of asynchronous requests.
+*/
+void DWebcameraLogicalChannel::DoCancel(TUint aMask)
+	{
+	DP("DWebcameraLogicalChannel::DoCancel() start");
+	TInt rtn;
+	DP("aMask=%d",aMask);
+    if (aMask&(1<<RWebcameraDevice::EStart))
+    	{
+		DP("RWebcameraDevice::EStart=%d",RWebcameraDevice::EStart);
+		if (iReceiveDataStatus)
+			{
+			DP("iReceiveDataStatus=%d",iReceiveDataStatus);
+			Pdd()->Stop(DWebcameraDriverBase::USB_cancel);
+			iReceiving = EFalse ;
+			iReceiveDataDfc.Cancel();
+			Kern::RequestComplete(iClient,iReceiveDataStatus,KErrCancel);
+			}
+    	}
+    if (aMask&(1<<RWebcameraDevice::ECapture))
+    	{
+		DP("RWebcameraDevice::ECapture=%d",RWebcameraDevice::ECapture);
+		if (iCaptureStatus)
+			{
+			Pdd()->Stop(DWebcameraDriverBase::USB_cancel);
+			iReceiving = EFalse ;
+			iCaptureDfc.Cancel();
+			Kern::RequestComplete(iClient,iCaptureStatus,KErrCancel);
+			}
+    	}
+	DP("DWebcameraLogicalChannel::DoCancel() end");
+	}
+
+/**
+  Called by PDD from ISR to indicate that a ReceiveData operation has completed.
+*/
+void DWebcameraLogicalChannel::GetOneFlameComplete(TInt aDataSize)
+    {
+	DP("DWebcameraLogicalChannel::GetOneFlameComplete() start");
+	DP("datasize=%d",aDataSize);
+	iSaveSize=iSize - aDataSize;
+    // Queue DFC
+    iReceiveDataDfc.Add();
+    //set size of received data
+    if (iSaveSize > 0)
+    	{
+	    iReceiveDataResult = KErrNone;
+    	}
+    else
+    	{
+		iReceiveDataResult = KErrUnknown;//TODO:define of error
+    	}
+	DP("DWebcameraLogicalChannel::GetOneFlameComplete() end");
+    }
+
+/**
+  Called by PDD from ISR to indicate that a get capture image operation has completed.
+*/
+void DWebcameraLogicalChannel::CaptureComplete(TInt aDataSize)
+    {
+	DP("DWebcameraLogicalChannel::CaptureComplete() start");
+	DP("datasize=%d",aDataSize);
+	iSaveSize=iSize - aDataSize;
+    // Queue DFC
+	iCaptureDfc.Add();
+    //set size of received data
+    if (iSaveSize > 0)
+    	{
+		iCaptureResult = KErrNone;
+    	}
+    else
+    	{
+        iCaptureResult = KErrUnknown;//TODO:define of error
+    	}
+	DP("DWebcameraLogicalChannel::CaptureComplete() end");
+    }
+
+/**
+  DFC Callback which gets triggered after the PDD has signalled that getting oneflame completed.
+  This just casts aPtr and calls DoGetOneFlameComplete().
+*/
+void DWebcameraLogicalChannel::GetOneFlameDfc(TAny* aPtr)
+    {
+	DP("DWebcameraLogicalChannel::GetOneFlameDfc() start");
+    ((DWebcameraLogicalChannel*)aPtr)->DoGetOneFlameComplete();
+	DP("DWebcameraLogicalChannel::GetOneFlameDfc() end");
+    }
+
+/**
+  DFC Callback which gets triggered after the PDD has signalled that getting Capture image completed.
+  This just casts aPtr and calls DoCaptureComplete().
+*/
+void DWebcameraLogicalChannel::CaptureDfc(TAny* aPtr)
+    {
+	DP("DWebcameraLogicalChannel::CaptureDfc() start");
+    ((DWebcameraLogicalChannel*)aPtr)->DoCaptureComplete();
+	DP("DWebcameraLogicalChannel::CaptureDfc() end");
+    }
+
+/**
+  Called from a DFC after the PDD has signalled that getting oneflame completed.
+*/
+void DWebcameraLogicalChannel::DoGetOneFlameComplete()
+    {
+	DP("DWebcameraLogicalChannel::DoGetOneFlameComplete() start");
+	iReceiveDataBuffer->Copy(iLAdr,iSaveSize);
+    DP("iReceiveDataBuffer Len=%d",iReceiveDataBuffer->Length());
+	// Write data to client from our buffer
+    TInt result=Kern::ThreadDesWrite(iClient,iReceiveDataDescriptor,*iReceiveDataBuffer,0);
+    // Finished with client descriptor, so NULL it to help detect coding errors
+    iReceiveDataDescriptor = NULL;
+
+    // Use result code from PDD if it was an error
+    if(iReceiveDataResult!=KErrNone)
+        result = iReceiveDataResult;
+    
+    // Complete clients request
+    Kern::RequestComplete(iClient,iReceiveDataStatus,result);
+	DP("DWebcameraLogicalChannel::DoGetOneFlameComplete() end");
+    }
+
+/**
+  Called from a DFC after the PDD has signalled that getting Capture image completed.
+*/
+void DWebcameraLogicalChannel::DoCaptureComplete()
+    {
+	DP("DWebcameraLogicalChannel::DoCaptureComplete() start");
+	iCaptureBuffer->Copy(iLAdr,iSaveSize);
+    DP("iCaptureBuffer Len=%d",iCaptureBuffer->Length());
+	// Write data to client from our buffer
+   TInt result=Kern::ThreadDesWrite(iClient,iCaptureDescriptor,*iCaptureBuffer,0);  	
+    // Finished with client descriptor, so NULL it to help detect coding errors
+    iCaptureDescriptor = NULL;
+
+    // Use result code from PDD if it was an error
+    if(iCaptureResult!=KErrNone)
+        result = iCaptureResult;
+
+    // Complete clients request
+    Kern::RequestComplete(iClient,iCaptureStatus,result);
+	DP("DWebcameraLogicalChannel::DoCaptureComplete() end");
+    }
+
+/**
+  Process a GetConfig control message. This writes the current driver configuration to a
+  RWebcameraDevice::TConfigBuf supplied by the client.
+*/
+TInt DWebcameraLogicalChannel::GetConfig(TDes8* aConfigBuf)
+    {
+	//unsupported
+    }
+
+/**
+  Process a SetConfig control message. This sets the driver configuration using a
+  RWebcameraDevice::TConfigBuf supplied by the client.
+*/
+TInt DWebcameraLogicalChannel::SetConfig(const TDesC8* aConfigBuf)
+    {
+	//unsupported
+    }
+
+/**
+  Fill a TConfig with the drivers current configuration.
+*/
+/*void DWebcameraLogicalChannel::CurrentConfig(RWebcameraDevice::TConfig& aConfig)
+    {
+	//unsupported
+    }
+*/
+
+/**
+ *Get the point to Physical channel.
+ */
+DWebcameraDriverBase* DWebcameraLogicalChannel::Pdd()
+	{
+	DP("DWebcameraLogicalChannel::Pdd() start");
+	return (DWebcameraDriverBase*)iPdd;
+	}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/baseport/syborg/webcamera/webcamera_ldd.h	Fri May 07 16:13:43 2010 +0100
@@ -0,0 +1,242 @@
+/*
+* Copyright (c) 2010 ISB.
+* 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:
+* ISB - initial contribution.
+*
+* Contributors:
+*
+* Description: USB driver for test
+*
+*/
+#ifndef __deviceLDD_H__
+#define __deviceLDD_H__
+
+#include <kernel.h>
+#include "webcamera_device.h"
+
+#define BUFSIZE  (100*1024)
+/**
+ *Logical channel class
+ *
+ */
+class DWebcameraLogicalDevice : public DLogicalDevice
+	{
+public:
+	DWebcameraLogicalDevice();
+	~DWebcameraLogicalDevice();
+    /**
+      Second stage constructor for DDriver1Factory.
+      This must at least set a name for the driver object.
+
+      @return KErrNone if successful, otherwise one of the other system wide error codes.
+    */
+    virtual TInt Install();
+    /**
+      Return the drivers capabilities.
+      Called in the response to an RDevice::GetCaps() request.
+
+      @param aDes User-side descriptor to write capabilities information into
+    */
+    virtual void GetCaps(TDes8& aDes) const;
+    /**
+      Called by the kernel's device driver framework to create 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 aChannel Set to point to the created Logical Channel
+
+      @return KErrNone if successful, otherwise one of the other system wide error codes.
+    */
+    virtual TInt Create(DLogicalChannelBase*& aChannel);
+	};
+
+/**
+ *
+ * 論理チャネルベースクラス
+ *
+ * 本クラスは、論理チャネル機能を提供する。
+ *
+ * @
+ * @
+ *
+ */
+class DWebcameraLogicalChannel : public DWebcameraLogicalChannelBase
+	{
+public:
+	/**
+	  Constructor
+	*/
+	DWebcameraLogicalChannel();
+	/**
+	  Destructor
+	*/
+	~DWebcameraLogicalChannel();
+	/**
+	  Called when a user thread requests a handle to this channel.
+	*/
+    virtual TInt RequestUserHandle(DThread* aThread, TOwnerType aType);
+    /**
+      Second stage constructor called by the kernel's device driver framework.
+      This is called in the context of the user thread (client) which requested the creation of a Logical Channel
+      The thread is in a critical section.
+
+      @param aUnit The unit argument supplied by the client
+      @param aInfo The info argument supplied by the client
+      @param aVer The version argument supplied by the client
+
+      @return KErrNone if successful, otherwise one of the other system wide error codes.
+    */
+	virtual TInt DoCreate(TInt aUnit, const TDesC8* anInfo, const TVersion& aVer);
+	/**
+	  Process a message for this logical channel.
+	  This function is called in the context of a DFC thread.
+
+	  @param aMessage The message to process.
+	                  The iValue member of this distinguishes the message type:
+	                  iValue==ECloseMsg, channel close message
+	                  iValue==KMaxTInt, a 'DoCancel' message
+	                  iValue>=0, a 'DoControl' message with function number equal to iValue
+	                  iValue<0, a 'DoRequest' message with function number equal to ~iValue
+	*/
+	virtual void HandleMsg(TMessageBase* aMsg);
+	/**
+	  Process synchronous 'control' requests
+	*/
+	virtual TInt DoControl(TInt aFunction, TAny* a1, TAny* a2);
+	/**
+	  Process asynchronous requests.
+	*/
+	virtual TInt DoRequest(TInt aReqNo, TRequestStatus* aStatus, TAny* a1, TAny* a2);
+	/**
+	  Process cancelling of asynchronous requests.
+	*/
+	virtual void DoCancel(TUint aMask);
+	/**
+	  Called by PDD from ISR to indicate that a get oneflame operation has completed.
+	*/
+    virtual void GetOneFlameComplete(TInt aResult);
+    /**
+      Called by PDD from ISR to indicate that a get capture image operation has completed.
+    */
+    virtual void CaptureComplete(TInt aResult);
+    /**
+      DFC Callback which gets triggered after the PDD has signalled that get oneflame completed.
+      This just casts aPtr and calls DoGetOneFlameComplete().
+    */
+    static  void GetOneFlameDfc(TAny* aPtr);
+	/**
+	  DFC Callback which gets triggered after the PDD has signalled that getting Capture image completed.
+	  This just casts aPtr and calls DoCaptureComplete().
+	*/
+    static  void CaptureDfc(TAny* aPtr);
+    /**
+      Called from a DFC after the PDD has signalled that getting oneflame completed.
+    */
+	virtual void DoGetOneFlameComplete();
+	/**
+	  Called from a DFC after the PDD has signalled that getting Capture image completed.
+	*/
+	virtual void DoCaptureComplete();
+    
+	/**
+	  Process a GetConfig control message. This writes the current driver configuration to a
+	  RWebcameraDevice::TConfigBuf supplied by the client.
+	*/
+    TInt GetConfig(TDes8* aConfigBuf);
+    /**
+      Process a SetConfig control message. This sets the driver configuration using a
+      RWebcameraDevice::TConfigBuf supplied by the client.
+    */
+    TInt SetConfig(const TDesC8* aConfigBuf);
+//  void CurrentConfig(RWebcameraDevice::TConfig& aConfig);
+    /**
+     *Get the point to Physical channel.
+     */
+    DWebcameraDriverBase* Pdd();
+    
+private:
+    /**
+     *point to description sent by user-side.
+     */
+    TDes8* iReceiveDataDescriptor;
+    /**
+     *buffer for one flame.
+     */
+    HBuf8* iReceiveDataBuffer;
+    /**
+     *the status getting one flame.
+     */
+	TRequestStatus* iReceiveDataStatus;
+    /**
+     *DFC for getting one flame.
+     */
+	TDfc iReceiveDataDfc;
+    /**
+     *the result of the get oneflame operation.
+     */
+	TInt iReceiveDataResult;
+    /**
+     */
+	TBool iReceiving;
+    /**
+     *point to description sent by user-side.
+     */
+    TDes8* iCaptureDescriptor;
+    /**
+     *buffer for capture image.
+     */
+	HBuf8* iCaptureBuffer;
+    /**
+     *the status getting capture image.
+     */
+	TRequestStatus* iCaptureStatus;
+    /**
+     *DFC of capture.
+     */
+	TDfc iCaptureDfc;
+    /**
+     *the result of the capture operation.
+     */
+	TInt iCaptureResult;
+    /**
+     *the status getting capture image.
+     */
+	TBool iCaptureing;
+    /**
+     *the status of request.
+     */	
+	TBool iRequesting;
+    /**
+     *point to memory used to save one frame or capture image.
+     */
+    HBuf8* iComm;
+    /**
+     *Physical adress of contiguous memory.
+     */
+	TUint32 iPhysAddr;
+    /**
+     *the size of buffer used to save one frame or capture image.
+     */
+	TInt iSize;
+    /**
+     *chunck.
+     */
+	DPlatChunkHw* iChunk;
+    /**
+     *Linear adress of chunck.
+     */
+	TUint8* iLAdr;
+    /**
+     *the size of received data.
+     */
+	TInt iSaveSize;
+	};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/baseport/syborg/webcamera/webcamera_ldd.mmp	Fri May 07 16:13:43 2010 +0100
@@ -0,0 +1,41 @@
+/*
+* Copyright (c) 2010 ISB.
+* 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:
+* ISB - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include <variant.mmh>
+#include "kernel/kern_ext.mmh"
+
+TARGET			VariantTarget(ewebcamera,ldd)
+linkas			ewebcamera.ldd
+TARGETTYPE		ldd
+
+SYSTEMINCLUDE   /epoc32/include/drivers
+SYSTEMINCLUDE   /epoc32/include/platform/drivers
+SYSTEMINCLUDE	AsspNKernIncludePath
+
+SOURCEPATH		.
+SOURCE			webcamera_ldd.cpp
+
+LIBRARY			PlatformLib
+
+EPOCALLOWDLLDATA
+
+UID				0x100000af 0x1020044C   //TODO:修正する必要
+//VENDORID        0x70000001
+
+//ROMTARGET		ewebcamera.ldd
+
+CAPABILITY		all
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/baseport/syborg/webcamera/webcamera_pdd.cpp	Fri May 07 16:13:43 2010 +0100
@@ -0,0 +1,186 @@
+/*
+* Copyright (c) 2010 ISB.
+* 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:
+* ISB - initial contribution.
+*
+* Contributors:
+*
+* Description: USB driver for test
+*
+*/
+
+#include "webcamera_pdd.h"
+#include <webcamera_driver.h>
+
+#define DP(format...) Kern::Printf(format)
+
+//Name for PDD
+_LIT(KWebcameraPddName,"WebcameraDevice.pdd");
+
+// ---------------------------------------------------------------
+// ---------------------------------------------------------------
+
+DWebcameraPddFactory::DWebcameraPddFactory()
+{
+  DP("DWebcameraPddFactory::DWebcameraPddFactory()");
+  iVersion=TVersion(KCommsMajorVersionNumber,KCommsMinorVersionNumber,KCommsBuildVersionNumber);
+}
+
+TInt DWebcameraPddFactory::Install()
+{
+  DP("DWebcameraPddFactory::Install");
+  return SetName(&KWebcameraPddName);
+}
+
+void DWebcameraPddFactory::GetCaps(TDes8 &aDes) const
+{
+  DP("DWebcameraPddFactory::GetCaps start");
+  RWebcameraDevice::TCaps capsBuf;
+  capsBuf.iVersion = iVersion;
+  aDes.FillZ(aDes.MaxLength());
+  TInt size=sizeof(capsBuf);
+  if(size>aDes.MaxLength())
+	  {
+      size=aDes.MaxLength();
+	  }
+  aDes.Copy((TUint8*)&capsBuf,size);
+  DP("DWebcameraPddFactory::GetCaps end");
+}
+
+TInt DWebcameraPddFactory::Create(DBase*& aChannel, TInt aUnit, const TDesC8* anInfo, const TVersion& aVer)
+{
+  DP("DWebcameraPddFactory::Create start");
+  DWebcameraDriver* pD=new DWebcameraDriver;
+  aChannel=pD;
+  TInt r=KErrNoMemory;
+  if (pD)
+	  {
+	  r=pD->DoCreate(aUnit,anInfo);
+	  }
+  DP("DWebcameraPddFactory::Create end");
+  return r;
+}
+
+TInt DWebcameraPddFactory::Validate(TInt aUnit, const TDesC8* /*anInfo*/, const TVersion& aVer)
+{
+  DP("DWebcameraPddFactory::Validate start");
+  if ((!Kern::QueryVersionSupported(iVersion,aVer)) || 
+	  (!Kern::QueryVersionSupported(aVer,TVersion(KMinimumLddMajorVersion,KMinimumLddMinorVersion,KMinimumLddBuild))))
+	  {
+		return KErrNotSupported;
+	  }
+  DP("DWebcameraPddFactory::Validate end");
+  return KErrNone;
+}
+
+// ---------------------------------------------------------------
+// ---------------------------------------------------------------
+
+DWebcameraDriver::DWebcameraDriver()
+{
+	DP("DWebcameraDriver::DWebcameraDriver start");
+	DP("DWebcameraDriver::DWebcameraDriver end");
+}
+
+DWebcameraDriver::~DWebcameraDriver()
+{
+  DP("DWebcameraDriver::~DWebcameraDriver start");
+  Interrupt::Unbind(iIrq);
+  DP("DWebcameraDriver::~DWebcameraDriver end");
+}
+
+TInt DWebcameraDriver::DoCreate(TInt aUnit, const TDesC8* anInfo)
+{
+  DP("DWebcameraDriver::DoCreate start");
+  iPortAddr=KHwSVPWebcameraDevice;
+  iIrq = EIrqWebamera;
+  Interrupt::Bind(iIrq,Isr,this);
+  DP("DWebcameraDriver::DoCreate end");
+  return KErrNone;
+}
+
+TInt DWebcameraDriver::StartViewerFinder(TUint aBuffer,TInt aSize)
+{
+  DP("DWebcameraDriver::StartViewerFinder start");
+  iType=0;
+  TUint32 temp=(TUint32)aBuffer;
+  DP("temp=%x",temp);
+  DP("iPortAddr=%x",iPortAddr);
+  WriteReg(iPortAddr,WEBCAMERA_REG_DATA_TYPE, 0x0);
+  WriteReg(iPortAddr,WEBCAMERA_REG_DMA_ADDR,temp);
+  WriteReg(iPortAddr,WEBCAMERA_REG_DMA_SIZE, aSize);
+  WriteReg(iPortAddr,WEBCAMERA_REG_INT_ENABLE, 0x1);
+  Interrupt::Enable(iIrq);
+  
+  DP("DWebcameraDriver::StartViewerFinder END"); 
+  return KErrNone;
+}
+
+TInt DWebcameraDriver::StartCapture(TUint aBuffer,TInt aSize)
+{
+  DP("DWebcameraDriver::StartCapture start");
+  // Save a pointer to the buffer we need to put the 'recevied' data in
+  iType=1;
+  TUint32 temp=(TUint32)aBuffer;
+  DP("temp=%x",temp);
+  WriteReg(iPortAddr,WEBCAMERA_REG_DATA_TYPE, 0x1);
+  WriteReg(iPortAddr,WEBCAMERA_REG_DMA_ADDR,temp);
+  WriteReg(iPortAddr,WEBCAMERA_REG_DMA_SIZE, aSize);
+  WriteReg(iPortAddr,WEBCAMERA_REG_INT_ENABLE, 0x1);
+  Interrupt::Enable(iIrq);
+  
+  DP("DWebcameraDriver::StartCapture END"); 
+  return KErrNone;
+}
+
+void DWebcameraDriver::Stop(TUSBStopMode aMode)
+{
+  DP("DWebcameraDriver::Stop start");
+  WriteReg(iPortAddr, WEBCAMERA_REG_INT_ENABLE, 0x0);
+  Interrupt::Disable(iIrq);
+  DP("DWebcameraDriver::Stop end");
+}
+
+void DWebcameraDriver::Isr(TAny* aPtr)
+{
+  DP("DWebcameraDriver::Isr start");
+  ((DWebcameraDriver*)aPtr)->receivedatacallback();
+  DP("DWebcameraDriver::Isr end");
+}
+
+void DWebcameraDriver::receivedatacallback()
+{
+  DP("DWebcameraDriver::receivedatacallback start");
+  TInt datasize=ReadReg(iPortAddr,WEBCAMERA_REG_DMA_SIZE);
+  switch (iType)
+	  {
+	  case 0:
+		  iLdd->GetOneFlameComplete(datasize);
+		  break;
+	  case 1:
+		  iLdd->CaptureComplete(datasize);
+		  break;
+	  default:
+		  //
+	  }
+  WriteReg(iPortAddr,WEBCAMERA_REG_DMA_ADDR, 0);
+  WriteReg(iPortAddr,WEBCAMERA_REG_DMA_SIZE, 0);
+  WriteReg(iPortAddr,WEBCAMERA_REG_INT_ENABLE, 0x0);
+  DP("DWebcameraDriver::receivedatacallback end");	  
+}
+
+// ---------------------------------------------------------------
+// ---------------------------------------------------------------
+
+DECLARE_STANDARD_PDD()
+{
+  DP("DECLARE_STANDARD_PDD()");
+  return new DWebcameraPddFactory;
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/baseport/syborg/webcamera/webcamera_pdd.h	Fri May 07 16:13:43 2010 +0100
@@ -0,0 +1,120 @@
+/*
+* Copyright (c) 2010 ISB.
+* 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:
+* ISB - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef __devicePDD_H__
+#define __devicePDD_H__
+
+#include <comm.h>
+#include <e32hal.h>
+#include "system.h"
+#include "webcamera_device.h"
+
+const TInt KMinimumLddMajorVersion=1;
+const TInt KMinimumLddMinorVersion=1;
+const TInt KMinimumLddBuild=0;
+const TInt EIrqWebamera=0xb;
+
+class DWebcameraPddFactory : public DPhysicalDevice
+{
+public:
+	/**
+	  Constructor
+	*/
+	DWebcameraPddFactory();
+	
+	virtual TInt Install();
+	virtual void GetCaps(TDes8 &aDes) const;
+	virtual TInt Create(DBase*& aChannel, TInt aUnit, const TDesC8* anInfo, const TVersion &aVer);
+	virtual TInt Validate(TInt aUnit, const TDesC8* anInfo, const TVersion &aVer);
+};
+
+
+class DWebcameraDriver : public DWebcameraDriverBase
+{
+public:
+	/**
+	  Constructor
+	*/
+	DWebcameraDriver();
+	/**
+	  Destructor
+	*/
+	~DWebcameraDriver();
+    /**
+      Second stage constructor called by the kernel's device driver framework.
+      This is called in the context of the user thread (client) which requested the creation of a Logical Channel
+      The thread is in a critical section.
+
+      @param aUnit The unit argument supplied by the client
+      @param aInfo The info argument supplied by the client
+
+      @return KErrNone if successful, otherwise one of the other system wide error codes.
+    */
+	TInt DoCreate(TInt aUnit, const TDesC8* anInfo);
+    /**
+      Request data from device.
+      Only one send request may be pending at any time.
+
+      @param  aBuffer physical adress
+      @param aData   size of buffer.
+    */
+	virtual TInt StartViewerFinder(TUint aBuffer,TInt aSize);
+    /**
+      Request data from device.
+      Only one send request may be pending at any time.
+
+      @param  aBuffer physical adress
+      @param aData   size of buffer.
+    */
+	virtual TInt StartCapture(TUint aBuffer,TInt aSize);
+    /**
+      Request device not to send data.
+      Only one send request may be pending at any time.
+
+      @param  aMode stop mode
+    */
+	virtual void Stop(TUSBStopMode aMode);
+//	virtual void Caps(TDes8 &aCaps) const;
+	/**
+	  Called by ISR to indicate that interrupt occurs.
+	*/
+	static void Isr(TAny* aPtr);
+    /**
+      Called from a Isr after the Peripheral has signalled that getting oneflame completed.
+    */
+	void receivedatacallback();
+
+public:
+	  /**
+	  Enumeration of register types.
+	  */
+  enum {
+		WEBCAMERA_REG_ID           = 0,
+		WEBCAMERA_REG_INT_ENABLE   = 1,
+		WEBCAMERA_REG_DATA_TYPE    = 2,
+		WEBCAMERA_REG_DMA_ADDR     = 3,
+		WEBCAMERA_REG_DMA_SIZE     = 4
+	    };
+
+private:
+    /**
+    operation types.
+    */
+	TInt iType;
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/baseport/syborg/webcamera/webcamera_pdd.mmp	Fri May 07 16:13:43 2010 +0100
@@ -0,0 +1,41 @@
+/*
+* Copyright (c) 2010 ISB.
+* 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:
+* ISB - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include <variant.mmh>
+#include "kernel/kern_ext.mmh"
+
+TARGET			VariantTarget(webcamera,pdd)
+linkas			webcamera.pdd
+TARGETTYPE		pdd
+
+SYSTEMINCLUDE   /epoc32/include/drivers
+SYSTEMINCLUDE   /epoc32/include/platform/drivers
+SYSTEMINCLUDE	AsspNKernIncludePath
+
+SOURCEPATH		.
+SOURCE			webcamera_pdd.cpp
+
+LIBRARY			PlatformLib
+
+EPOCALLOWDLLDATA
+
+UID				0x100039d0 0x1020044D  //TODO:修正する必要
+//VENDORID        0x70000001
+
+//ROMTARGET		webcamera.pdd
+
+CAPABILITY		all
--- a/symbian-qemu-0.9.1-12/qemu-symbian-svp/boards/syborg.dts	Fri Mar 26 15:45:51 2010 +0000
+++ b/symbian-qemu-0.9.1-12/qemu-symbian-svp/boards/syborg.dts	Fri May 07 16:13:43 2010 +0100
@@ -32,7 +32,7 @@
         timer@0 {
             compatible = "syborg,timer";
             reg = <c0002000>;
-            frequency = <d#1000000>;
+            frequency = <d#0100000>;
             interrupts = <1>;
             interrupt-parent = <&intc>;
         };
--- a/symbian-qemu-0.9.1-12/qemu-symbian-svp/gui.c	Fri Mar 26 15:45:51 2010 +0000
+++ b/symbian-qemu-0.9.1-12/qemu-symbian-svp/gui.c	Fri May 07 16:13:43 2010 +0100
@@ -20,6 +20,10 @@
  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
+ *
+ * Contributors:
+ * NTT DOCOMO, INC. -- Clicking a QEMU skin button causes screen flicker on the display area
+ *
  */
 
 #include "hw/hw.h"
@@ -1608,13 +1612,14 @@
                 if (carea->type == CA_BUTTON) {
                     if (state == MOUSE_EVENT_LBUTTON) {
                         if (gui_data->current_vt->buttons[carea->id].pressed_img_id > 0)
-                            gui_show_image(current_vt_id(),
+							gui_show_image(current_vt_id(),
                                            gui_data->current_vt->buttons[carea->id].pressed_img_id);
 
                         button_actions[gui_data->current_vt->buttons[carea->id].actions].down(gui_data->current_vt->buttons[carea->id].parameter);
                     } else {
-                        gui_hide_image(current_vt_id(),
-                                       gui_data->current_vt->buttons[carea->id].pressed_img_id);
+                        if (gui_data->current_vt->buttons[carea->id].pressed_img_id > 0)
+							gui_hide_image(current_vt_id(),
+											gui_data->current_vt->buttons[carea->id].pressed_img_id);
                         button_actions[gui_data->current_vt->buttons[carea->id].actions].up(gui_data->current_vt->buttons[carea->id].parameter);
                     }
                 } else { /* pointerarea*/
--- a/symbian-qemu-0.9.1-12/qemu-symbian-svp/plugins/qemu_arm_plugins.py	Fri Mar 26 15:45:51 2010 +0000
+++ b/symbian-qemu-0.9.1-12/qemu-symbian-svp/plugins/qemu_arm_plugins.py	Fri May 07 16:13:43 2010 +0100
@@ -5,3 +5,4 @@
 import syborg_timer
 import syborg_keyboard
 import syborg_pointer
+import syborg_usbtest
--- a/symbian-qemu-0.9.1-12/qemu-symbian-svp/plugins/syborg_pointer.py	Fri Mar 26 15:45:51 2010 +0000
+++ b/symbian-qemu-0.9.1-12/qemu-symbian-svp/plugins/syborg_pointer.py	Fri May 07 16:13:43 2010 +0100
@@ -1,3 +1,8 @@
+#
+# Contributors:
+# NTT DOCOMO, INC. -- Syborg QEMU crashes when using skin + touchscreen device
+#
+
 import qemu
 
 class syborg_pointer(qemu.devclass):
@@ -32,7 +37,7 @@
     self.fifo=[]
     self.current = self.fifo_entry(0, 0, 0, 0)
     self.int_enabled = False
-    qemu.register_mouse(self.event, self.absolute)
+    qemu.register_mouse(self.event, self.absolute, self.name)
 
   def read_reg(self, offset):
     offset >>= 2
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/symbian-qemu-0.9.1-12/qemu-symbian-svp/plugins/syborg_usbtest.py	Fri May 07 16:13:43 2010 +0100
@@ -0,0 +1,113 @@
+import qemu
+import os
+
+class syborg_usbtest(qemu.devclass):
+  REG_ID           = 0
+  REG_INT_ENABLE   = 1
+  REG_DATA_TYPE    = 2
+  REG_DMA_ADDR     = 3
+  REG_DMA_SIZE     = 4
+
+  def loadIMG(self):
+    self.buf = open('test1.BMP','rb').read()
+    self.bufC = open('test.BMP','rb').read()
+    self.bmpsize = os.path.getsize('test1.BMP')
+    self.Csize = os.path.getsize('test.BMP')
+
+  def timertick(self):
+    if self.cha==0:
+        compSize=self.bmpsize
+        buf=self.buf
+        self.cha=1
+    else:
+        compSize=self.Csize
+        buf=self.bufC
+        self.cha=0
+    if self.dma_size < compSize:
+        self.dma_size = 0
+    else:
+        for x in buf:
+	    ch = ord(x)
+	    if self.dma_size > 0:
+            	self.dma_writeb(self.dma_addr, ch)
+            	self.dma_addr += 1
+		self.dma_size -= 1
+    self.set_irq_level(0, self.int_enable)
+
+  def timer_on(self):
+    self.ptimer = qemu.ptimer(self.timertick, 1)
+    self.ptimer.run(0)
+
+  def timer_off(self):
+    self.ptimer.stop()
+    self.set_irq_level(0, self.int_enable)
+
+  def capturedata(self):
+    if self.dma_size < self.Csize:
+        self.dma_size = 0
+    else:
+        for x in self.bufC:
+	    ch = ord(x)
+	    if self.dma_size > 0:
+            	self.dma_writeb(self.dma_addr, ch)
+            	self.dma_addr += 1
+		self.dma_size -= 1
+    self.set_irq_level(0, self.int_enable)
+
+  def create(self):
+    self.int_enable = 1
+    self.dma_addr = 0
+    self.dma_size =0
+    self.cha=0
+    self.loadIMG()
+
+  def write_reg(self, offset, value):
+    offset >>= 2
+    if offset==self.REG_INT_ENABLE:
+        self.int_enable=value
+        if value==1:
+	    if self.data_type==0:
+                self.timer_on()
+            elif self.data_type==1:
+                self.capturedata()
+        else:
+	    if self.data_type==0:
+           	self.timer_off()
+            elif self.data_type==1:
+	        self.set_irq_level(0, self.int_enable)
+    elif offset == self.REG_DATA_TYPE:
+      self.data_type = value
+    elif offset == self.REG_DMA_ADDR:
+      self.dma_addr = value
+    elif offset == self.REG_DMA_SIZE:
+      self.dma_size = value
+
+  def read_reg(self, offset):
+    offset >>= 2
+    if offset == self.REG_ID:
+      return 0xc600f000
+    elif offset == self.REG_INT_ENABLE:
+      return self.int_enable
+    elif offset == self.REG_DMA_ADDR:
+      return self.dma_addr
+    elif offset == self.REG_DMA_SIZE:
+      return self.dma_size
+    return 0
+
+  def save(self, f):
+    f.put_u32(self.int_enable)
+    f.put_u32(self.dma_addr)
+    f.put_u32(self.dma_size)
+
+  def load(self, f):
+    self.int_enable = f.get_u32()
+    self.dma_addr = f.get_u32()
+    self.dma_size = f.get_u32()
+
+  # Device class properties
+  regions = [qemu.ioregion(0x1000, readl=read_reg, writel=write_reg)]
+  irqs = 1
+  name = "syborg,usbtest"
+  properties={"chardev":None}
+
+qemu.register_device(syborg_usbtest)
--- a/symbian-qemu-0.9.1-12/qemu-symbian-svp/python-plugin.c	Fri Mar 26 15:45:51 2010 +0000
+++ b/symbian-qemu-0.9.1-12/qemu-symbian-svp/python-plugin.c	Fri May 07 16:13:43 2010 +0100
@@ -1,3 +1,10 @@
+/*
+*
+* Contributors:
+* NTT DOCOMO, INC. -- Syborg QEMU crashes when using skin + touchscreen device
+*
+*/
+
 #include "Python.h"
 #include "structmember.h"
 #include "hw/hw.h"
@@ -1862,11 +1869,12 @@
 static PyObject *qemu_py_register_mouse(PyObject *self, PyObject *args,
                                         PyObject *kwds)
 {
-    static char *kwlist[] = {"handler", "absolute", NULL};
+    static char *kwlist[] = {"handler", "absolute", "devid", NULL};
     PyObject *fn;
     int absolute;
+	char *devid;
 
-    if (!PyArg_ParseTupleAndKeywords(args, kwds, "Oi", kwlist, &fn, &absolute))
+    if (!PyArg_ParseTupleAndKeywords(args, kwds, "Ois", kwlist, &fn, &absolute, &devid))
         return NULL; 
 
     if (!PyCallable_Check(fn)) {
@@ -1875,7 +1883,7 @@
     }
 
     Py_INCREF(fn);
-    gui_register_mouse_event_handler(qemu_py_mouse_event, fn, absolute, "dev");
+    gui_register_mouse_event_handler(qemu_py_mouse_event, fn, absolute, devid);
 
     Py_RETURN_NONE;
 }