kernel/eka/drivers/camerasc/cameraldd.cpp
changeset 31 56f325a607ea
parent 0 a41df078684a
child 258 880ff05ad710
equal deleted inserted replaced
15:4122176ea935 31:56f325a607ea
   145 	:	iRequestQueue(&iMutex),
   145 	:	iRequestQueue(&iMutex),
   146 		iRestartDfc(DCameraScLdd::RestartDfc,this,5),
   146 		iRestartDfc(DCameraScLdd::RestartDfc,this,5),
   147 		iPowerDownDfc(DCameraScLdd::PowerDownDfc,this,3),
   147 		iPowerDownDfc(DCameraScLdd::PowerDownDfc,this,3),
   148 		iPowerUpDfc(DCameraScLdd::PowerUpDfc,this,3)
   148 		iPowerUpDfc(DCameraScLdd::PowerUpDfc,this,3)
   149 	{
   149 	{
   150 //	iState=EOpen;
   150 	iState=EOpen;
   151 //	iCaptureMode=ECaptureModeImage;
   151 //	iCaptureMode=ECaptureModeImage;
   152 //	iFrameHeight=0;
   152 //	iFrameHeight=0;
   153 //	iFrameWidth=0;
   153 //	iFrameWidth=0;
   154 //	iBufManager=NULL;
   154 //	iBufManager=NULL;
   155 //	iPowerHandler=NULL;
   155 //	iPowerHandler=NULL;
   182 	// Remove and delete the power handler.
   182 	// Remove and delete the power handler.
   183 	if (iPowerHandler)
   183 	if (iPowerHandler)
   184 		{
   184 		{
   185 		iPowerHandler->Remove();
   185 		iPowerHandler->Remove();
   186 		delete iPowerHandler;
   186 		delete iPowerHandler;
   187 		iPowerHandler=NULL;
       
   188 		}
   187 		}
   189 
   188 
   190 	if (iCaptureModeConfig)
   189 	if (iCaptureModeConfig)
   191 		{
   190 		{
   192 		// Delete any buffers, the shared chunk we created, and the buffer config struct.
   191 		// Delete any buffers and shared chunk we created.
   193 		for (captureMode=0; captureMode < ECamCaptureModeMax; captureMode++)
   192 		for (captureMode=0; captureMode < ECamCaptureModeMax; captureMode++)
   194 			{
   193 			{
   195 			if (iCaptureModeConfig[captureMode].iBufManager)
   194 			if (iCaptureModeConfig[captureMode].iBufManager)
   196 				{
       
   197 				delete iCaptureModeConfig[captureMode].iBufManager;
   195 				delete iCaptureModeConfig[captureMode].iBufManager;
   198 				iCaptureModeConfig[captureMode].iBufManager=NULL;
   196 			}
   199 				}
   197 
   200 
   198 		// Delete the buffer config. info. structure.
       
   199 		for (captureMode=0; captureMode < ECamCaptureModeMax; captureMode++)
       
   200 			{
   201 			if (iCaptureModeConfig[captureMode].iBufConfig)
   201 			if (iCaptureModeConfig[captureMode].iBufConfig)
   202 				{
       
   203 				Kern::Free(iCaptureModeConfig[captureMode].iBufConfig);
   202 				Kern::Free(iCaptureModeConfig[captureMode].iBufConfig);
   204 				iCaptureModeConfig[captureMode].iBufConfig=NULL;
   203 			}
   205 				}
   204 
   206 			}
   205 			if (iCaptureModeConfig)
   207 
   206 				delete[] iCaptureModeConfig;
   208 		delete[] iCaptureModeConfig;
   207 		}
   209 		iCaptureModeConfig=NULL;
       
   210 		}
       
   211 
       
   212 	// Close our reference on the client thread
   208 	// Close our reference on the client thread
   213 	Kern::SafeClose((DObject*&)iOwningThread,NULL);
   209 	Kern::SafeClose((DObject*&)iOwningThread,NULL);
   214 
   210 
   215 	// Clear the 'units open mask' in the LDD factory.
   211 	// Clear the 'units open mask' in the LDD factory.
   216 	if (iUnit>=0)
   212 	if (iUnit>=0)
   281 	SDevCamPixelFormat* pixelFormat = (SDevCamPixelFormat*) (caps + 1);
   277 	SDevCamPixelFormat* pixelFormat = (SDevCamPixelFormat*) (caps + 1);
   282 	SDevCamFrameSize* frameSize;
   278 	SDevCamFrameSize* frameSize;
   283 	TAny* frameSizeCapsBuf=0;
   279 	TAny* frameSizeCapsBuf=0;
   284 	TPtr8 frameSizeCapsPtr(0,0,0);
   280 	TPtr8 frameSizeCapsPtr(0,0,0);
   285 
   281 
       
   282 	// Set the cache to hold the default dynamic attribute values.
       
   283 	iBrightnessValue = caps->iDynamicRange[ECamAttributeBrightness].iDefault;
       
   284 	iContrastValue = caps->iDynamicRange[ECamAttributeContrast].iDefault;
       
   285 	iColorEffectValue = caps->iDynamicRange[ECamAttributeColorEffect].iDefault;
       
   286 	
   286 	for (captureMode=0; captureMode < ECamCaptureModeMax; captureMode++)
   287 	for (captureMode=0; captureMode < ECamCaptureModeMax; captureMode++)
   287 		{
   288 		{
   288 		if ((captureMode==ECamCaptureModeImage) && (caps->iNumImagePixelFormats==0))
   289 		if ((captureMode==ECamCaptureModeImage) && (caps->iNumImagePixelFormats==0))
   289 			continue;
   290 			continue;
   290 
   291 
   302 			{
   303 			{
   303 			Kern::Free(frameSizeCapsBuf);
   304 			Kern::Free(frameSizeCapsBuf);
   304 			return r;
   305 			return r;
   305 			}
   306 			}
   306 		frameSize=(SDevCamFrameSize*) frameSizeCapsPtr.Ptr();
   307 		frameSize=(SDevCamFrameSize*) frameSizeCapsPtr.Ptr();
   307 		iCaptureModeConfig[captureMode].iCamConfig.iFrameSize=*frameSize;
   308 		iCaptureModeConfig[captureMode].iCamConfig.iFrameSize = *frameSize;
       
   309 		iCaptureModeConfig[captureMode].iCamConfig.iFrameRate = frameSize->iMinFrameRate;
   308 		Kern::Free(frameSizeCapsBuf);
   310 		Kern::Free(frameSizeCapsBuf);
   309 
   311 
   310 		iCaptureModeConfig[captureMode].iCamConfig.iFlashMode=ECamFlashNone;
   312 		iCaptureModeConfig[captureMode].iCamConfig.iFlashMode = ECamFlashNone;
   311 		iCaptureModeConfig[captureMode].iCamConfig.iExposureMode=ECamExposureAuto;
   313 		iCaptureModeConfig[captureMode].iCamConfig.iExposureMode = ECamExposureAuto;
   312 		iCaptureModeConfig[captureMode].iCamConfig.iWhiteBalanceMode=ECamWBAuto;
   314 		iCaptureModeConfig[captureMode].iCamConfig.iWhiteBalanceMode = ECamWBAuto;
   313 		iCaptureModeConfig[captureMode].iCamConfig.iZoom=0;
   315 		iCaptureModeConfig[captureMode].iCamConfig.iZoom = 0;
   314 		iCaptureModeConfig[captureMode].iCamConfig.iPixelWidthInBytes=0;
   316 		iCaptureModeConfig[captureMode].iCamConfig.iPixelWidthInBytes = 0;
   315 		iCaptureModeConfig[captureMode].iCamConfig.iFrameRate = 0;
       
   316 		}
   317 		}
   317 	Kern::Free(capsBuf);
   318 	Kern::Free(capsBuf);
   318 	// Setup the default buffer config.
   319 	// Setup the default buffer config.
   319 	r=ReAllocBufferConfigInfo(0);	// Zeros the structure
   320 	r=ReAllocBufferConfigInfo(0);	// Zeros the structure
   320 	if (r!=KErrNone)
   321 	if (r!=KErrNone)
   575 			iRequestQueue.Cancel((TRequestStatus*)a1);
   576 			iRequestQueue.Cancel((TRequestStatus*)a1);
   576 			NKern::FMSignal(&iMutex); 		// Release the buffer/request list mutex.
   577 			NKern::FMSignal(&iMutex); 		// Release the buffer/request list mutex.
   577 			r=KErrNone;
   578 			r=KErrNone;
   578 			break;
   579 			break;
   579 			}
   580 			}
       
   581 			
   580 		case RDevCameraSc::EControlBufferIdToOffset:
   582 		case RDevCameraSc::EControlBufferIdToOffset:
   581 			{
   583 			{
   582 			// a1 has pointer to buffer for search criteria
   584 			// a1 has pointer to buffer for search criteria
   583 			// a2 has pointer to offset for result
   585 			// a2 has pointer to offset for result
   584 			TDevCamBufferModeAndId info;
   586 			TDevCamBufferModeAndId info;
   585 			TPtr8 indesc((TUint8*)&info,sizeof(info));
   587 			TPtr8 inDesc((TUint8*)(&info), sizeof(info));
   586 
   588 
   587 			r = Kern::ThreadDesRead(iOwningThread,a1,indesc,0);
   589 			r = Kern::ThreadDesRead(iOwningThread,a1,inDesc,0);
   588 			if (KErrNone==r)
   590 			if (r == KErrNone)
   589 				{
   591 				{
   590 				TInt id = info.iId;
   592 				TInt id = info.iId;
   591 				TDevCamCaptureMode captureMode = info.iCaptureMode;
   593 				TDevCamCaptureMode captureMode = info.iCaptureMode;
       
   594 
       
   595 				r = KErrNotFound;
   592 				DBufferManager* mgr = iCaptureModeConfig[captureMode].iBufManager;
   596 				DBufferManager* mgr = iCaptureModeConfig[captureMode].iBufManager;
   593 				
       
   594 				if (mgr)
   597 				if (mgr)
   595 					{
   598 					{
   596 					if (mgr->iImageBuffer[id].iId == id)
   599 					if (mgr->iImageBuffer[id].iId == id)
   597 						{
   600 						{
   598 						kumemput32(a2, &mgr->iImageBuffer[id].iChunkOffset, sizeof(TInt));
   601 						kumemput32(a2, &mgr->iImageBuffer[id].iChunkOffset, sizeof(TInt));
   599 						r = KErrNone;
   602 						r = KErrNone;
   600 						}
   603 						}
   601 					else
       
   602 						{
       
   603 						r = KErrNotFound;
       
   604 						}
       
   605 					}
   604 					}
   606 				}
   605 				}
       
   606 			
   607 			break;
   607 			break;
   608 			}
   608 			}
   609 		case RDevCameraSc::EControlCapsSize:
   609 		case RDevCameraSc::EControlCapsSize:
   610 			{
   610 			{
   611 			r = Pdd()->CapsSize();
   611 			r = Pdd()->CapsSize();
   614 		case RDevCameraSc::EControlFrameSizeCaps:
   614 		case RDevCameraSc::EControlFrameSizeCaps:
   615 			{
   615 			{
   616 			r = GetFrameSizeCaps(a1, a2);
   616 			r = GetFrameSizeCaps(a1, a2);
   617 			break;
   617 			break;
   618 			}
   618 			}
       
   619 			
   619 		case RDevCameraSc::EControlSetDynamicAttribute:
   620 		case RDevCameraSc::EControlSetDynamicAttribute:
   620 			{
   621 			{
   621 			// Set the new camera configuration.
       
   622 			NKern::ThreadEnterCS();
   622 			NKern::ThreadEnterCS();
   623 			r=SetDynamicAttribute((TInt)a1, (TUint)a2);
   623 			r = SetDynamicAttribute((TInt)a1, (TUint)a2);
   624 			NKern::ThreadLeaveCS();
   624 			NKern::ThreadLeaveCS();
   625 			break;
   625 			break;
   626 			}
   626 			}
       
   627 			
       
   628 		case RDevCameraSc::EControlGetDynamicAttribute:
       
   629 			{
       
   630 			TInt attribute = (TInt)(a1);
       
   631 			TUint value = 0;
       
   632 			
       
   633 			r = GetDynamicAttribute(attribute, value);
       
   634 			if (r == KErrNone)
       
   635 				{
       
   636 				kumemput32(a2, &value, sizeof(TUint));
       
   637 				}
       
   638 				
       
   639 			break;
       
   640 			}
       
   641 			
   627 		}
   642 		}
   628 	return(r);
   643 	return(r);
   629 	}
   644 	}
   630 
   645 
   631 /**
   646 /**
   735 /**
   750 /**
   736 Allows changing of the dynamic settings.
   751 Allows changing of the dynamic settings.
   737 Checks locally the validity of the arguments passed so as to increase performance by not
   752 Checks locally the validity of the arguments passed so as to increase performance by not
   738 forcing a context switch.
   753 forcing a context switch.
   739 
   754 
       
   755 If the setting has been accepted by the sensor the new value is cached by the LDD so further
       
   756 querying does not involve another context switch.
       
   757 
   740 @param aAttribute An enum identifying the dynamic attribute to change.
   758 @param aAttribute An enum identifying the dynamic attribute to change.
   741 @param aValue The attributes value.
   759 @param aValue The attributes value.
   742 @return KErrNone if successful, KErrNotSupported if not supported, KErrArgument if aValue out of range.
   760 @return KErrNone if successful, KErrNotSupported if not supported, KErrArgument if aValue out of range.
   743 		Otherwise, one of the system wide error codes.
   761 		Otherwise, one of the system wide error codes.
   744 @pre The thread must be in a critical section.
   762 @pre The thread must be in a critical section.
   745 */
   763 */
   746 TInt DCameraScLdd::SetDynamicAttribute(TInt aAttribute, TUint aValue)
   764 TInt DCameraScLdd::SetDynamicAttribute(TInt aAttribute, TUint aValue)
   747 	{
   765 	{
   748 	Kern::Printf(">DCameraScLdd::SetDynamicAttribute()");
   766 	TUint* attrCachePtr = NULL;
   749 	switch(aAttribute)
   767 	TInt err = KErrNotSupported;
       
   768 	
       
   769 	switch (aAttribute)
   750 		{
   770 		{
   751 		case ECamAttributeBrightness:
   771 		case ECamAttributeBrightness:
   752 			return Pdd()->SetBrightness(aValue);
   772 			err = Pdd()->SetBrightness(aValue);
       
   773 			attrCachePtr = &iBrightnessValue;
       
   774 			break;
       
   775 			
   753 		case ECamAttributeContrast:
   776 		case ECamAttributeContrast:
   754 			return Pdd()->SetContrast(aValue);
   777 			err = Pdd()->SetContrast(aValue);
       
   778 			attrCachePtr = &iContrastValue;
       
   779 			break;
       
   780 			
   755 		case ECamAttributeColorEffect:
   781 		case ECamAttributeColorEffect:
   756 			return Pdd()->SetColorEffect(aValue);
   782 			err = Pdd()->SetColorEffect(aValue);
       
   783 			attrCachePtr = &iColorEffectValue;
       
   784 			break;
       
   785 			
       
   786 		default:
       
   787 			return err;
       
   788 		}
       
   789 	
       
   790 	if (err == KErrNone)
       
   791 		{
       
   792 		// Cache the set value.
       
   793 		__ASSERT_DEBUG(attrCachePtr, Kern::Fault(KCameraLddPanic, __LINE__));
       
   794 		*attrCachePtr = aValue;
       
   795 		}
       
   796 		
       
   797 	return err;
       
   798 	}
       
   799 
       
   800 
       
   801 /**
       
   802 Allows querying of a dynamic setting.
       
   803 The value is read from the cached LDD values.
       
   804 
       
   805 @param aAttribute An enum identifying the dynamic attribute to change.
       
   806 @param aValue A reference to a variable that will receive the attribute value.
       
   807 @return KErrNone if successful, KErrNotFound if aAttribute is an unsupported
       
   808         setting. The parameter aValue is not changed if this function fails.
       
   809 */
       
   810 TInt DCameraScLdd::GetDynamicAttribute(TInt aAttribute, TUint& aValue)
       
   811 	{
       
   812 	switch (aAttribute)
       
   813 		{
       
   814 		case ECamAttributeBrightness:
       
   815 			aValue = iBrightnessValue;
       
   816 			break;
       
   817 			
       
   818 		case ECamAttributeContrast:
       
   819 			aValue = iContrastValue;
       
   820 			break;
       
   821 			
       
   822 		case ECamAttributeColorEffect:
       
   823 			aValue = iColorEffectValue;
       
   824 			break;
       
   825 			
   757 		default:
   826 		default:
   758 			return KErrNotFound;
   827 			return KErrNotFound;
   759 		}
   828 		}
   760 	}
   829 		
       
   830 	return KErrNone;
       
   831 	}
       
   832 
   761 
   833 
   762 /**
   834 /**
   763 Updates the buffer configuration of the camera for the specified capture mode.
   835 Updates the buffer configuration of the camera for the specified capture mode.
   764 @return	A handle to the shared chunk for the owning thread (a value >0), if successful;
   836 @return	A handle to the shared chunk for the owning thread (a value >0), if successful;
   765 		otherwise one of the other system wide error codes, (a value <0).
   837 		otherwise one of the other system wide error codes, (a value <0).
   861 */
   933 */
   862 TInt DCameraScLdd::ChunkClose(TInt aCaptureMode)
   934 TInt DCameraScLdd::ChunkClose(TInt aCaptureMode)
   863 	{
   935 	{
   864 	__KTRACE_CAM(Kern::Printf(">DCameraScLdd::ChunkClose(Capture Mode-%d)",aCaptureMode));
   936 	__KTRACE_CAM(Kern::Printf(">DCameraScLdd::ChunkClose(Capture Mode-%d)",aCaptureMode));
   865 
   937 
   866 	// For the active mode we need to perform extra checks.
       
   867 	if(iCaptureMode == aCaptureMode)
   938 	if(iCaptureMode == aCaptureMode)
   868 		{
   939         {
   869 		if (iState==ECapturing)
   940         if (iState==ECapturing)
   870 			{
   941             return(KErrInUse);
   871 			return(KErrInUse);
   942         }
   872 			}
       
   873 		}
       
   874 
   943 
   875 	// Delete any existing buffers
   944 	// Delete any existing buffers
   876 	if (iCaptureModeConfig[aCaptureMode].iBufManager)
   945 	if (iCaptureModeConfig[aCaptureMode].iBufManager)
   877 		{
   946 		{
   878 		delete iCaptureModeConfig[aCaptureMode].iBufManager;
   947 		delete iCaptureModeConfig[aCaptureMode].iBufManager;
   939 */
  1008 */
   940 TInt DCameraScLdd::Start()
  1009 TInt DCameraScLdd::Start()
   941 	{
  1010 	{
   942 	__KTRACE_CAM(Kern::Printf(">DCameraScLdd::Start(Current Mode-%d)",iCaptureMode));
  1011 	__KTRACE_CAM(Kern::Printf(">DCameraScLdd::Start(Current Mode-%d)",iCaptureMode));
   943 
  1012 
   944 	// We should only be able to do this for the active mode.
       
   945 	if (iState==ECapturing)
  1013 	if (iState==ECapturing)
   946 		return(KErrInUse);
  1014 		return(KErrInUse);
   947 
       
   948 	TInt r=KErrNone;
  1015 	TInt r=KErrNone;
   949 
  1016 
   950 	// Only continue if the mode being started has been configured
  1017 	// Only continue if the mode being started has been configured
   951 	if (iCaptureModeConfig[iCaptureMode].iBufManager)
  1018 	if (iCaptureModeConfig[iCaptureMode].iBufManager)
   952 		iState=EConfigured;
  1019 		iState=EConfigured;
   977 	DBufferManager* bufManager=iCaptureModeConfig[iCaptureMode].iBufManager;
  1044 	DBufferManager* bufManager=iCaptureModeConfig[iCaptureMode].iBufManager;
   978 	TLinAddr linAddr=(bufManager->iChunkBase)+(bufManager->iCurrentBuffer->iChunkOffset);
  1045 	TLinAddr linAddr=(bufManager->iChunkBase)+(bufManager->iCurrentBuffer->iChunkOffset);
   979 	TPhysAddr physAddr=bufManager->iCurrentBuffer->iPhysicalAddress;
  1046 	TPhysAddr physAddr=bufManager->iCurrentBuffer->iPhysicalAddress;
   980 	TInt r=Pdd()->Start(iCaptureMode,linAddr,physAddr);
  1047 	TInt r=Pdd()->Start(iCaptureMode,linAddr,physAddr);
   981 
  1048 
   982 	if (r==KErrNone && bufManager->iNextBuffer)
  1049 /*
       
  1050  * 	James Cooper: Uncommenting this code will cause the ASSERT_DEBUG in SetImageCaptured() to fail
       
  1051  * 	if (r==KErrNone && bufManager->iNextBuffer)
   983 		{
  1052 		{
   984 		linAddr=(bufManager->iChunkBase)+(bufManager->iNextBuffer->iChunkOffset);
  1053 		linAddr=(bufManager->iChunkBase)+(bufManager->iNextBuffer->iChunkOffset);
   985 		physAddr=bufManager->iNextBuffer->iPhysicalAddress;
  1054 		physAddr=bufManager->iNextBuffer->iPhysicalAddress;
   986 		r=Pdd()->CaptureNextImage(linAddr,physAddr);
  1055 		r=Pdd()->CaptureNextImage(linAddr,physAddr);
   987 		}
  1056 		}
       
  1057 */	
   988 	return(r);
  1058 	return(r);
   989 	}
  1059 	}
   990 
  1060 
   991 /**
  1061 /**
   992 Process a notify a new image request from the client.
  1062 Process a notify a new image request from the client.
  1224 		otherwise a system wide error code.
  1294 		otherwise a system wide error code.
  1225 */
  1295 */
  1226 TInt DCameraScLdd::DoSetConfig(TInt aCaptureMode, const TDesC8* aCamConfigBuf)
  1296 TInt DCameraScLdd::DoSetConfig(TInt aCaptureMode, const TDesC8* aCamConfigBuf)
  1227 	{
  1297 	{
  1228 	__KTRACE_CAM(Kern::Printf(">DCameraScLdd::DoSetConfig(CaptureMode=%d)",aCaptureMode));
  1298 	__KTRACE_CAM(Kern::Printf(">DCameraScLdd::DoSetConfig(CaptureMode=%d)",aCaptureMode));
  1229 
  1299 	
  1230 	// For the active mode we need to perform extra checks.
  1300     if(iCaptureMode == aCaptureMode)
  1231 	if(iCaptureMode == aCaptureMode)
  1301         {
  1232 		{
  1302         if (iState==ECapturing)
  1233 		if (iState==ECapturing)
  1303             return(KErrInUse);
  1234 			{
  1304         }
  1235 			return(KErrInUse);
       
  1236 			}
       
  1237 		}
       
  1238 
  1305 
  1239 	// Read the config structure from the client
  1306 	// Read the config structure from the client
  1240 	TCameraConfigV02 config;
  1307 	TCameraConfigV02 config;
  1241 	TPtr8 ptr((TUint8*)&config,sizeof(config));
  1308 	TPtr8 ptr((TUint8*)&config,sizeof(config));
  1242 	TInt r=Kern::ThreadDesRead(iOwningThread,aCamConfigBuf,ptr,0);
  1309 	TInt r=Kern::ThreadDesRead(iOwningThread,aCamConfigBuf,ptr,0);
  1250 		if (r == KErrNotFound)
  1317 		if (r == KErrNotFound)
  1251 			r = KErrArgument;
  1318 			r = KErrArgument;
  1252 		return(r);
  1319 		return(r);
  1253 		}
  1320 		}
  1254 
  1321 
  1255 	// For the active mode we need to perform extra tasks.
       
  1256 	// We're about to replace any previous configuration - so set the
  1322 	// We're about to replace any previous configuration - so set the
  1257 	// status back to un-configured. A new buffer configuration must be calculated as a result of that.
  1323 	// status back to un-configured. A new buffer configuration must be calculated as a result of that.
  1258 	if(iCaptureMode == aCaptureMode)
  1324 	//iState=EOpen;
  1259 		{
       
  1260 		iState=EOpen;
       
  1261 		}
       
  1262 
  1325 
  1263 	// Save the new configuration.
  1326 	// Save the new configuration.
  1264 	iCaptureModeConfig[aCaptureMode].iCamConfig=config;
  1327 	iCaptureModeConfig[aCaptureMode].iCamConfig=config;
  1265 	iCaptureModeConfig[aCaptureMode].iFrameHeight=iCaptureModeConfig[aCaptureMode].iCamConfig.iFrameSize.iHeight;
  1328 	iCaptureModeConfig[aCaptureMode].iFrameHeight=iCaptureModeConfig[aCaptureMode].iCamConfig.iFrameSize.iHeight;
  1266 	iCaptureModeConfig[aCaptureMode].iFrameWidth=iCaptureModeConfig[aCaptureMode].iCamConfig.iFrameSize.iWidth;
  1329 	iCaptureModeConfig[aCaptureMode].iFrameWidth=iCaptureModeConfig[aCaptureMode].iCamConfig.iFrameSize.iWidth;
  1388 			if ((r = Pdd()->FrameSizeCaps(info.iCaptureMode, info.iUidPixelFormat, frameSizeCapsPtr)) == KErrNone)
  1451 			if ((r = Pdd()->FrameSizeCaps(info.iCaptureMode, info.iUidPixelFormat, frameSizeCapsPtr)) == KErrNone)
  1389 				{
  1452 				{
  1390 				frameSize = (SDevCamFrameSize*) frameSizeCapsPtr.Ptr();
  1453 				frameSize = (SDevCamFrameSize*) frameSizeCapsPtr.Ptr();
  1391 				for(l=0; l<pixelFormat->iNumFrameSizes; l++ )
  1454 				for(l=0; l<pixelFormat->iNumFrameSizes; l++ )
  1392 					{
  1455 					{
  1393 					if (aConfig.iFrameSize.iWidth==frameSize->iWidth && aConfig.iFrameSize.iHeight==frameSize->iHeight &&
  1456 					if (aConfig.iFrameSize.iWidth == frameSize->iWidth &&
  1394 						aConfig.iFrameRate >= frameSize->iMinFrameRate && aConfig.iFrameRate <= frameSize->iMaxFrameRate)
  1457 						aConfig.iFrameSize.iHeight == frameSize->iHeight &&
       
  1458 						aConfig.iFrameRate >= frameSize->iMinFrameRate &&
       
  1459 						aConfig.iFrameRate <= frameSize->iMaxFrameRate)
  1395 						{
  1460 						{
  1396 						NKern::ThreadEnterCS();
  1461 						NKern::ThreadEnterCS();
  1397 						Kern::Free(frameSizeCapsBuf);
  1462 						Kern::Free(frameSizeCapsBuf);
  1398 						NKern::ThreadLeaveCS();
  1463 						NKern::ThreadLeaveCS();
  1399 						__KTRACE_CAM(Kern::Printf("<DCameraScLdd::DoValidateConfig"));
  1464 						__KTRACE_CAM(Kern::Printf("<DCameraScLdd::DoValidateConfig"));
  1537 	Kern::Free((TAny*)frameSizeCapsBuf);
  1602 	Kern::Free((TAny*)frameSizeCapsBuf);
  1538 	NKern::ThreadLeaveCS();
  1603 	NKern::ThreadLeaveCS();
  1539 	return KErrNone;
  1604 	return KErrNone;
  1540 	}
  1605 	}
  1541 
  1606 
       
  1607 
  1542 /**
  1608 /**
  1543 Constructor for the buffer manager.
  1609 Constructor for the buffer manager.
  1544 */
  1610 */
  1545 DBufferManager::DBufferManager(DCameraScLdd* aLdd)
  1611 DBufferManager::DBufferManager(DCameraScLdd* aLdd)
  1546 	: iLdd(aLdd)
  1612 	: iLdd(aLdd)
  1557 DBufferManager::~DBufferManager()
  1623 DBufferManager::~DBufferManager()
  1558 	{
  1624 	{
  1559 	if (iChunk)
  1625 	if (iChunk)
  1560 		Kern::ChunkClose(iChunk);
  1626 		Kern::ChunkClose(iChunk);
  1561 	delete[] iImageBuffer;
  1627 	delete[] iImageBuffer;
  1562 	iImageBuffer=NULL;
       
  1563 	}
  1628 	}
  1564 
  1629 
  1565 /**
  1630 /**
  1566 Second stage constructor for the buffer manager. This version creates a shared chunk and a buffer object for each
  1631 Second stage constructor for the buffer manager. This version creates a shared chunk and a buffer object for each
  1567 buffer specified within this. Then it commits memory within the chunk for each of these buffers. This also involves the
  1632 buffer specified within this. Then it commits memory within the chunk for each of these buffers. This also involves the
  1922 Destructor for the image buffer class.
  1987 Destructor for the image buffer class.
  1923 */
  1988 */
  1924 TImageBuffer::~TImageBuffer()
  1989 TImageBuffer::~TImageBuffer()
  1925 	{
  1990 	{
  1926 	delete[] iPhysicalPages;
  1991 	delete[] iPhysicalPages;
  1927 	iPhysicalPages=NULL;
       
  1928 	}
  1992 	}
  1929 
  1993 
  1930 /**
  1994 /**
  1931 Second stage constructor for the image buffer class - get information on the memory
  1995 Second stage constructor for the image buffer class - get information on the memory
  1932 allocated to this buffer.
  1996 allocated to this buffer.
  2020 Destructor for the capture request queue.
  2084 Destructor for the capture request queue.
  2021 */
  2085 */
  2022 TCameraScRequestQueue::~TCameraScRequestQueue()
  2086 TCameraScRequestQueue::~TCameraScRequestQueue()
  2023 	{
  2087 	{
  2024 	for (TInt i=0 ; i<KMaxCamScRequestsPending ; i++)
  2088 	for (TInt i=0 ; i<KMaxCamScRequestsPending ; i++)
  2025 		{
       
  2026 		delete iRequest[i];
  2089 		delete iRequest[i];
  2027 		iRequest[i]=NULL;
       
  2028 		}
       
  2029 	}
  2090 	}
  2030 
  2091 
  2031 /**
  2092 /**
  2032 Second stage constructor for the capture request queue.
  2093 Second stage constructor for the capture request queue.
  2033 @param anOwningThread A pointer to the owning client thread.
  2094 @param anOwningThread A pointer to the owning client thread.