os/kernelhwsrv/bsptemplate/asspandvariant/template_variant/camerasc/camerasc.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/kernelhwsrv/bsptemplate/asspandvariant/template_variant/camerasc/camerasc.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,535 @@
     1.4 +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of the License "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +// template\template_variant\camerasc\camerasc.cpp
    1.18 +// Implementation of the template shared chunk camera physical device driver (PDD).
    1.19 +// This file is part of the Template Base port
    1.20 +// 
    1.21 +//
    1.22 +#include "camerasc_plat.h"
    1.23 +
    1.24 +_LIT(KCameraScPddName, "CameraSc.TE");
    1.25 +_LIT(KCameraScDfcQueueName, "CameraSc.TE.DfcQ");
    1.26 +
    1.27 +/**
    1.28 +Standard export function for PDD factories.  This creates a DPhysicalDevice derived object, in this case,
    1.29 +DTemplateCameraScPddFactory.
    1.30 +*/
    1.31 +DECLARE_STANDARD_PDD()
    1.32 +	{
    1.33 +	return new DTemplateCameraScPddFactory;
    1.34 +	}
    1.35 +
    1.36 +/**
    1.37 +Constructor for the shared chunk camera PDD factory class.
    1.38 +*/
    1.39 +DTemplateCameraScPddFactory::DTemplateCameraScPddFactory()
    1.40 +	{
    1.41 +	// We currently support only unit 0
    1.42 +	iUnitsMask = 0x01;
    1.43 +
    1.44 +	// Set the version number for this device.  This is used to allow code to specify that it requires a
    1.45 +	// minimum version of the device in order to operate.  If the version requested is less than this then
    1.46 +	// the device is safe to be used
    1.47 +	iVersion = RDevCameraSc::VersionRequired();
    1.48 +	}
    1.49 +
    1.50 +/**
    1.51 +Destructor for the shared chunk camera PDD factory class.
    1.52 +*/
    1.53 +DTemplateCameraScPddFactory::~DTemplateCameraScPddFactory()
    1.54 +	{
    1.55 +	}
    1.56 +
    1.57 +/**
    1.58 +Second stage constructor for the shared chunk camera PDD factory class.  This must at least set a name for
    1.59 +the driver object.
    1.60 +@return KErrNone if successful, otherwise one of the system wide error codes.
    1.61 +*/
    1.62 +TInt DTemplateCameraScPddFactory::Install()
    1.63 +	{
    1.64 +	__KTRACE_CAM(Kern::Printf("> DTemplateCameraScPddFactory::Install()"));
    1.65 +
    1.66 +	TInt r;
    1.67 +
    1.68 +	// Create a DFC queue so that handling of both camera hardware callbacks and requests made to the LDD from
    1.69 +	// user mode can be processed in the same thread, to avoid the use of semaphores
    1.70 +	if ((r = Kern::DynamicDfcQCreate(iDfcQ, 26, KCameraScDfcQueueName)) == KErrNone)
    1.71 +		{
    1.72 +		// All PDD factories must have a unique name
    1.73 +		r = SetName(&KCameraScPddName);
    1.74 +		}
    1.75 +
    1.76 +	__KTRACE_CAM(Kern::Printf("< DTemplateCameraScPddFactory::Install() => Returning %d", r));
    1.77 +
    1.78 +	return r;
    1.79 +	}
    1.80 +
    1.81 +/**
    1.82 +Returns the PDD's capabilities.  This is not used by the Symbian OS device driver framework
    1.83 +or by the LDD but is here as some LDDs will make use of it.
    1.84 +@param aDes	A descriptor into which to write capability information.
    1.85 +*/
    1.86 +void DTemplateCameraScPddFactory::GetCaps(TDes8& /*aDes*/) const
    1.87 +	{
    1.88 +	}
    1.89 +
    1.90 +/**
    1.91 +Called by the kernel's device driver framework to check if this PDD is suitable for use
    1.92 +with a logical channel.  This is called in the context of the client thread which requested
    1.93 +the creation of a logical channel, through a call to RBusLogicalChannel::DoCreate().  The
    1.94 +thread is in a critical section.
    1.95 +@param aUnit	The unit argument supplied by the client to RBusLogicalChannel::DoCreate()
    1.96 +				This is used to determine which sensor to use.
    1.97 +@param aInfo	The info argument supplied by the client to RBusLogicalChannel::DoCreate().
    1.98 +@param aVer		The version number of the logical channel which will use this physical channel.
    1.99 +@return KErrNone if successful, otherwise one of the system wide error codes.
   1.100 +*/
   1.101 +TInt DTemplateCameraScPddFactory::Validate(TInt aUnit, const TDesC8* /*aInfo*/, const TVersion& aVer)
   1.102 +	{
   1.103 +	// Check that the version requested is less than or equal to the version of this PDD
   1.104 +	if (!Kern::QueryVersionSupported(RDevCameraSc::VersionRequired(), aVer))
   1.105 +		{
   1.106 +		return KErrNotSupported;
   1.107 +		}
   1.108 +
   1.109 +	// Check that the unit number specifies the available sensor
   1.110 +	if ((aUnit < 0) || (aUnit > 0))
   1.111 +		{
   1.112 +		return KErrNotSupported;
   1.113 +		}
   1.114 +
   1.115 +	return KErrNone;
   1.116 +	}
   1.117 +
   1.118 +/**
   1.119 +Called by the kernel's device driver framework to create a physical channel object.  This
   1.120 +is called in the context of the client thread which requested the creation of a logical
   1.121 +channel, through a call to RBusLogicalChannel::DoCreate().  The thread is in a critical section.
   1.122 +@param aChannel	Set by this function to point to the created physical channel object.
   1.123 +@param aUnit	The unit argument supplied by the client to RBusLogicalChannel::DoCreate().
   1.124 +@param aInfo	The info argument supplied by the client to RBusLogicalChannel::DoCreate().
   1.125 +@param aVer		The version number of the logical channel which will use this physical channel.
   1.126 +@return KErrNone if successful, otherwise one of the other system wide error codes.
   1.127 +*/
   1.128 +TInt DTemplateCameraScPddFactory::Create(DBase*& aChannel, TInt aUnit, const TDesC8* /*anInfo*/, const TVersion& /*aVer*/)
   1.129 +	{
   1.130 +	__KTRACE_CAM(Kern::Printf("> DTemplateCameraScPddFactory::Create()"));
   1.131 +
   1.132 +	// Create an instance of the PDD channel object that will work with the Template sensor
   1.133 +	DTemplateCameraScPdd* pD = new DTemplateCameraScPdd;
   1.134 +
   1.135 +	aChannel = pD;
   1.136 +	TInt r = KErrNoMemory;
   1.137 +
   1.138 +	if (pD)
   1.139 +		{
   1.140 +		r = pD->DoCreate(this, aUnit);
   1.141 +		}
   1.142 +
   1.143 +	__KTRACE_CAM(Kern::Printf("< DTemplateCameraScPddFactory::Create() => Returning %d", r));
   1.144 +
   1.145 +	return r;
   1.146 +	}
   1.147 +
   1.148 +/**
   1.149 +Called by SetUnitOpen() to see if a particular unit is open.  When called, the
   1.150 +iUnitInfoMutex fast mutex will be taken, ensuring safe access to iUnitsOpenMask.
   1.151 +@param aUnit	The unit number to be checked for being open.
   1.152 +@return ETrue if the unit specified by aUnit is already open, otherwise EFalse.
   1.153 +*/
   1.154 +TBool DTemplateCameraScPddFactory::IsUnitOpen(TInt aUnit)
   1.155 +	{
   1.156 +	return (iUnitsOpenMask & (1 << aUnit));
   1.157 +	}
   1.158 +
   1.159 +/**
   1.160 +Attempt to change the state of the unit open state for a particular unit.
   1.161 +@param aUnit	The unit number to be set to open or closed state.
   1.162 +@param aIsOpen	The required new state for the unit;  either ETrue to set the state
   1.163 +				to open or EFalse to set the state to closed.
   1.164 +@return KErrNone if the state was updated successfully, otherwise KErrInUse if an attempt
   1.165 +		was made to set the unit status to open while it is already open.
   1.166 +*/
   1.167 +TInt DTemplateCameraScPddFactory::SetUnitOpen(TInt aUnit, TBool aIsOpen)
   1.168 +	{
   1.169 +	// Wait until it is safe to access the unit state mask
   1.170 +	NKern::FMWait(&iUnitInfoMutex);
   1.171 +
   1.172 +	// Fail a request to open a unit that is already open
   1.173 +	if (aIsOpen && IsUnitOpen(aUnit))
   1.174 +		{
   1.175 +		__KTRACE_CAM(Kern::Printf("+ DTemplateCameraScPddFactory::SetUnitOpen() => Unit %d is already in use", aUnit));
   1.176 +
   1.177 +		// Release the unit state mask mutex
   1.178 +		NKern::FMSignal(&iUnitInfoMutex);
   1.179 +
   1.180 +		return KErrInUse;
   1.181 +		}
   1.182 +
   1.183 +	// Set or clear the unit's open status bit as required
   1.184 +	if (aIsOpen)
   1.185 +		{
   1.186 +		iUnitsOpenMask |= (1 << aUnit);
   1.187 +		}
   1.188 +	else
   1.189 +		{
   1.190 +		iUnitsOpenMask &= ~(1 << aUnit);
   1.191 +		}
   1.192 +
   1.193 +	// Release the unit state mask mutex
   1.194 +	NKern::FMSignal(&iUnitInfoMutex);
   1.195 +
   1.196 +	return KErrNone;
   1.197 +	}
   1.198 +
   1.199 +/**
   1.200 +Constructor for the shared chunk camera PDD class.
   1.201 +*/
   1.202 +DTemplateCameraScPdd::DTemplateCameraScPdd()
   1.203 +	{
   1.204 +	// Set the unit number to -1 to indicate that this channel has never been registered
   1.205 +	// with the PDD factory
   1.206 +	iUnit = -1;
   1.207 +
   1.208 +	// The channel has been created but not yet configured */
   1.209 +	iState = EUnconfigured;
   1.210 +	}
   1.211 +
   1.212 +/**
   1.213 +Destructor for the shared chunk camera PDD class.  This is called in the context of the client thread
   1.214 +once an 'ECloseMsg' message has been sent to the device driver DFC thread.
   1.215 +*/
   1.216 +DTemplateCameraScPdd::~DTemplateCameraScPdd()
   1.217 +	{
   1.218 +	delete [] iCapsBuffer;
   1.219 +	delete iSensor;
   1.220 +
   1.221 +	// Indicate that a physical channel is no longer open on this unit
   1.222 +	if (iUnit >= 0)
   1.223 +		{
   1.224 +		iPhysicalDevice->SetUnitOpen(iUnit, EFalse);
   1.225 +		}
   1.226 +	}
   1.227 +
   1.228 +/**
   1.229 +Second stage constructor for the H4 camera PDD.
   1.230 +@param aPhysicalDevice	A pointer to the factory class that is creating this PDD
   1.231 +@param aUnit			The unit argument supplied by the client to RBusLogicalChannel::DoCreate().
   1.232 +@return KErrNone if successful, otherwise one of the other system wide error codes.
   1.233 +*/
   1.234 +TInt DTemplateCameraScPdd::DoCreate(DTemplateCameraScPddFactory* aPhysicalDevice, TInt aUnit)
   1.235 +	{
   1.236 +	__KTRACE_CAM(Kern::Printf("> DTemplateCameraScPdd::DoCreate()"));
   1.237 +
   1.238 +	TInt r;
   1.239 +
   1.240 +	iPhysicalDevice = aPhysicalDevice;
   1.241 +
   1.242 +	// Check that a physical channel hasn't already been opened on this unit
   1.243 +	if ((r = iPhysicalDevice->SetUnitOpen(aUnit, ETrue)) == KErrNone)
   1.244 +		{
   1.245 +		iUnit = aUnit;
   1.246 +
   1.247 +		// Create an abstracted sensor interface
   1.248 +		if ((iSensor = new DTemplateSensorIf(*this, DfcQ(aUnit))) != NULL)
   1.249 +			{
   1.250 +			if ((r = iSensor->DoCreate()) == KErrNone)
   1.251 +				{
   1.252 +				// Setup the capabilities of this device for later reference
   1.253 +				if ((r = iSensor->GetCaps(iCaps)) > 0)
   1.254 +					{
   1.255 +					// And save the size as returned from the sensor
   1.256 +					iCapsSize = r;
   1.257 +
   1.258 +					// Although iCaps now points to a TCameraCapsV02 structure, it is actually a variable
   1.259 +					// sized structure that was allocated as an array of TUint8 so save it to a TUint8
   1.260 +					// ptr so that it can be deleted properly
   1.261 +					iCapsBuffer = (TUint8*) iCaps;
   1.262 +
   1.263 +					// Enable the clocks needed by the camera subsystem and power up the sensor
   1.264 +					r = iSensor->RequestPower();
   1.265 +
   1.266 +					// Some sensors power themselves up automatically in their DoCreate() function,
   1.267 +					// so take this into account here
   1.268 +					if (r == KErrAlreadyExists)
   1.269 +						{
   1.270 +						r = KErrNone;
   1.271 +						}
   1.272 +					}
   1.273 +				}
   1.274 +			}
   1.275 +		else
   1.276 +			{
   1.277 +			r = KErrNoMemory;
   1.278 +			}
   1.279 +		}
   1.280 +
   1.281 +	__KTRACE_CAM(Kern::Printf("< DTemplateCameraScPdd::DoCreate() => Returning %d", r));
   1.282 +
   1.283 +	return r;
   1.284 +	}
   1.285 +
   1.286 +/**
   1.287 +An appropriate DFC queue to use for processing client requests (that is, those that won't be processed
   1.288 +in the context of the client thread), and also for processing image completion requests from the sensor
   1.289 +will have been setup by the PDD factory.  Anything needing to run in this same DFC thread can access the
   1.290 +queue via this function.
   1.291 +@param	aUnit	The unit number for which to get the DFC queue.
   1.292 +@return	The DFC queue to be used.
   1.293 +*/
   1.294 +TDfcQue* DTemplateCameraScPdd::DfcQ(TInt /*aUnit*/)
   1.295 +	{
   1.296 +	return iPhysicalDevice->iDfcQ;
   1.297 +	}
   1.298 +
   1.299 +/**
   1.300 +Called by the LDD in order to query the capabilities of the PDD.
   1.301 +@param	aCapsBuf	A reference to a descriptor owned by the LDD, containing a TCameraCapsV02 structure
   1.302 +					for the capabilities.
   1.303 +*/
   1.304 +void DTemplateCameraScPdd::Caps(TDes8& aCapsBuf) const
   1.305 +	{
   1.306 +	__KTRACE_CAM(Kern::Printf("> DTemplateCameraScPdd::Caps()"));
   1.307 +
   1.308 +	// The iCaps structure will already have been created by a call to iSensor->SetCaps() in DoCreate().
   1.309 +	// Simply copy it into the supplied TPckgBuf, taking into account the fact that the TCameraCapsV02
   1.310 +	// buffer is of a variable size *and* may be smaller or larger than the iCaps structure
   1.311 +	TPtrC8 ptr((const TUint8*) iCaps, iCapsSize);
   1.312 +	aCapsBuf.FillZ(aCapsBuf.MaxLength());
   1.313 +	aCapsBuf = ptr.Left(Min(ptr.Length(), aCapsBuf.MaxLength()));
   1.314 +
   1.315 +	__KTRACE_CAM(Kern::Printf("< DTemplateCameraScPdd::Caps()"));
   1.316 +	}
   1.317 +
   1.318 +/**
   1.319 +Called by the LDD to setup a new image configuration, including such things as image size, framerate
   1.320 +and pixel format.
   1.321 +@param	aConfigBuf	A reference to a TPckgBuf containing a TCameraConfigV02 configuration structure.
   1.322 +@return KErrNone if successful, otherwise one of the system wide error codes.
   1.323 +*/
   1.324 +TInt DTemplateCameraScPdd::SetConfig(const TDesC8& aConfigBuf)
   1.325 +	{
   1.326 +	__KTRACE_CAM(Kern::Printf("> DTemplateCameraScPdd::SetConfig()"));
   1.327 +
   1.328 +	TInt r;
   1.329 +
   1.330 +	// It is only legal to call this if image capture is not already underway, so check for this
   1.331 +	// before doing anything
   1.332 +	if (iState <= EConfigured)
   1.333 +		{
   1.334 +		// Read the new configuration from the LDD into a local copy of the configuration structure,
   1.335 +		// taking into account for compatibility that the TPckgBuf may be smaller or larger than the
   1.336 +		// TCameraConfigV02 structure
   1.337 +		TCameraConfigV02 config;
   1.338 +		TPtr8 ptr((TUint8*) &config, sizeof(config));
   1.339 +		Kern::InfoCopy(ptr, aConfigBuf);
   1.340 +
   1.341 +		// Save the new configuration for later and let the sensor also know about it
   1.342 +		iConfig = config;
   1.343 +		iSensor->SetConfig(config);
   1.344 +
   1.345 +		// Signal success and set the channel to the configured state
   1.346 +		r = KErrNone;
   1.347 +		iState = EConfigured;
   1.348 +		}
   1.349 +	else
   1.350 +		{
   1.351 +		r = KErrInUse;
   1.352 +		}
   1.353 +
   1.354 +	__KTRACE_CAM(Kern::Printf("< DTemplateCameraScPdd::SetConfig() => Returning %d", r));
   1.355 +
   1.356 +	return r;
   1.357 +	}
   1.358 +
   1.359 +/**
   1.360 +Begins capture into the address pointed to by aLinAddr and aPhysAddr.  Both of these addresses point to
   1.361 +the same buffer;  The address used by the sensor is hardware dependent.
   1.362 +@param	aCaptureMode	Whether to capture in video, viewfinder or single image mode.
   1.363 +@param	aLinAddr		The virtual address of the buffer into which to capture the image.
   1.364 +@param	aPhysAddr		The physical address of the buffer into which to capture the image.
   1.365 +@return	KErrNone if successful, otherwise one of the other system wide error codes.
   1.366 +@pre	SetConfig() must first have been called.
   1.367 +*/
   1.368 +TInt DTemplateCameraScPdd::Start(TDevCamCaptureMode aCaptureMode, TLinAddr aLinAddr, TPhysAddr aPhysAddr)
   1.369 +	{
   1.370 +	__KTRACE_CAM(Kern::Printf("> DTemplateCameraScPdd::Start() => Configuring sensor for %d x %d capture", iConfig.iFrameSize.iWidth, iConfig.iFrameSize.iHeight));
   1.371 +
   1.372 +	// Ensure the precondition is met
   1.373 +	__ASSERT_DEBUG((iState == EConfigured), Kern::Fault("camerasc", ENotConfigured));
   1.374 +
   1.375 +	// Save the capture mode for use when we call back into the LDD with the captured image
   1.376 +	iCaptureMode = aCaptureMode;
   1.377 +
   1.378 +	// And start the sensor running
   1.379 +	TInt r = iSensor->Start(aCaptureMode, aLinAddr, aPhysAddr);
   1.380 +
   1.381 +	// If everything was ok, set the channel to the capturing state
   1.382 +	if (r == KErrNone)
   1.383 +		{
   1.384 +		iState = ECapturing;
   1.385 +		}
   1.386 +
   1.387 +	__KTRACE_CAM(Kern::Printf("< DTemplateCameraScPdd::Start() => Returning %d", r));
   1.388 +
   1.389 +	return r;
   1.390 +	}
   1.391 +
   1.392 +/**
   1.393 +Sets the address of the buffer info which the next image will be captured.  Called by the LDD for successive
   1.394 +images that are requested after the initial call to Start().
   1.395 +@param	aLinAddr		The virtual address of the buffer into which to capture the image.
   1.396 +@param	aPhysAddr		The physical address of the buffer into which to capture the image.
   1.397 +@return	KErrNone if successful, otherwise one of the other system wide error codes.
   1.398 +*/
   1.399 +TInt DTemplateCameraScPdd::CaptureNextImage(TLinAddr aLinAddr, TPhysAddr aPhysAddr)
   1.400 +	{
   1.401 +	__KTRACE_CAM(Kern::Printf("> DTemplateCameraScPdd::CaptureNextImage()"));
   1.402 +
   1.403 +	// Pass the call directly to the sensor abstraction
   1.404 +	TInt r = iSensor->CaptureNextImage(aLinAddr, aPhysAddr);
   1.405 +
   1.406 +	__KTRACE_CAM(Kern::Printf("< DTemplateCameraScPdd::CaptureNextImage()=> Returning %d", r));
   1.407 +
   1.408 +	return(r);
   1.409 +	}
   1.410 +
   1.411 +/**
   1.412 +Stops any image capturing that is currently underway.  It is safe to call this without having called Start().
   1.413 +@return	KErrNone if successful, otherwise one of the other system wide error codes.
   1.414 +*/
   1.415 +TInt DTemplateCameraScPdd::Stop()
   1.416 +	{
   1.417 +	__KTRACE_CAM(Kern::Printf("> DTemplateCameraScPdd::Stop()"));
   1.418 +
   1.419 +	// Pass the call directly to the sensor abstraction
   1.420 +	iSensor->Stop();
   1.421 +
   1.422 +	// Det the channel back to the configured state as it is now safe to call Start() again
   1.423 +	iState = EConfigured;
   1.424 +
   1.425 +	__KTRACE_CAM(Kern::Printf("< DTemplateCameraScPdd::Stop()"));
   1.426 +
   1.427 +	return KErrNone;
   1.428 +	}
   1.429 +
   1.430 +/**
   1.431 +Power down the camera device.  This is called by the LDD when the driver channel is being closed or
   1.432 +when the system is being powered down.  This is always called in the context of the DFC thread.
   1.433 +*/
   1.434 +void DTemplateCameraScPdd::PowerDown()
   1.435 +	{
   1.436 +
   1.437 +#ifdef _DEBUG
   1.438 +
   1.439 +	// Power off the camera
   1.440 +	TInt r = iSensor->RelinquishPower();
   1.441 +
   1.442 +	// Not being able to power down indicates a serious programming error
   1.443 +	__ASSERT_DEBUG((r == KErrNone), Kern::Fault("camerasc", ECannotPowerDown));
   1.444 +
   1.445 +#else // ! _DEBUG
   1.446 +
   1.447 +	// Power off the camera
   1.448 +	iSensor->RelinquishPower();
   1.449 +
   1.450 +#endif // ! _DEBUG
   1.451 +
   1.452 +	}
   1.453 +
   1.454 +/**
   1.455 +Return the shared chunk creation information to be used by this device.
   1.456 +@param	aChunkCreateInfo	A structure to be filled with the settings required for this device.
   1.457 +*/
   1.458 +void DTemplateCameraScPdd::GetChunkCreateInfo(TChunkCreateInfo& aChunkCreateInfo)
   1.459 +	{
   1.460 +	// Can be opened by any number of user side processes
   1.461 +	aChunkCreateInfo.iType = TChunkCreateInfo::ESharedKernelMultiple;
   1.462 +	// Use both L1 and L2 cache if available.  LDD will take care of pre and post DMA cache handling
   1.463 +#ifdef __WINS__
   1.464 +	aChunkCreateInfo.iMapAttr = 0xFF000;
   1.465 +#else
   1.466 +	aChunkCreateInfo.iMapAttr = EMapAttrCachedMax;
   1.467 +#endif
   1.468 +	// Chunk owns the memory which will be freed when the chunk is destroyed
   1.469 +	aChunkCreateInfo.iOwnsMemory = ETrue;
   1.470 +	// Don't queue the chunk's destruction on an DFC
   1.471 +	aChunkCreateInfo.iDestroyedDfc = NULL;
   1.472 +	}
   1.473 +
   1.474 +/**
   1.475 +Returns the size of the variable sized capabilities structure in bytes.  The buffer passed into
   1.476 +DTemplateCameraScPdd::GetCaps() must be at least this large to hold the fixed portion of the TCameraCapsV02
   1.477 +structure, as well as the array of SDevCamPixelFormat structures that follows it.
   1.478 +@return	The size in bytes of the variable sized capabilities structure.
   1.479 +*/
   1.480 +TInt DTemplateCameraScPdd::CapsSize()
   1.481 +	{
   1.482 +	return iCapsSize;
   1.483 +	}
   1.484 +
   1.485 +/**
   1.486 +Obtains information regarding the frame sizes and frame rates supported for a given combination of capture mode
   1.487 +and pixel format.
   1.488 +@param	aCaptureMode		The capture mode for which to obtain the information.
   1.489 +@param	aUidPixelFormat		The pixel format for which to obtain the information.
   1.490 +@param	aFrameSizeCapsBuf	A reference to an array of packaged SDevCamFrameSize structures, owned by the LDD, into
   1.491 +							which to place the information.
   1.492 +@@return	KErrNone if successful, else one of the other system wide error codes.
   1.493 +*/
   1.494 +TInt DTemplateCameraScPdd::FrameSizeCaps(TDevCamCaptureMode aCaptureMode, TUidPixelFormat aUidPixelFormat, TDes8& aFrameSizeCapsBuf)
   1.495 +	{
   1.496 +	return iSensor->FrameSizeCaps(aCaptureMode, aUidPixelFormat, aFrameSizeCapsBuf);
   1.497 +	}
   1.498 +
   1.499 +/**
   1.500 +Called by the sensor abstraction when an image is available.
   1.501 +@param	aResult	KErrNone if successful, otherwise one of the system wide error codes.
   1.502 +@param	aLinAddr		The virtual address of the buffer into which to capture the image.
   1.503 +@param	aPhysAddr		The physical address of the buffer into which to capture the image.
   1.504 +*/
   1.505 +TInt DTemplateCameraScPdd::NotifyImageCaptureEvent(TInt aResult, TLinAddr& aLinAddr, TPhysAddr& aPhysAddr)
   1.506 +	{
   1.507 +	__KTRACE_CAM(Kern::Printf("> DTemplateCameraScPdd::NotifyImageCaptureEvent() => aResult = %d", aResult));
   1.508 +
   1.509 +	// Inform the LDD that a new image has been received
   1.510 +	TInt r = iLdd->ImageCaptureCallback(iCaptureMode, aResult, &aLinAddr, &aPhysAddr);
   1.511 +
   1.512 +	// If the LDD has returned KErrAbort then something has gone wrong, and if it has returned KErrNotReady
   1.513 +	// then it has no more frames available, so call Stop()
   1.514 +	if (r != KErrNone)
   1.515 +		{
   1.516 +		Stop();
   1.517 +		}
   1.518 +
   1.519 +	__KTRACE_CAM(Kern::Printf("< DTemplateCameraScPdd::NotifyImageCaptureEvent() => Returning %d", r));
   1.520 +
   1.521 +	return r;
   1.522 +	}
   1.523 +
   1.524 +TInt DTemplateCameraScPdd::SetBrightness(TUint /*aBrightness*/)
   1.525 +	{
   1.526 +	return KErrNone;
   1.527 +	}
   1.528 +
   1.529 +TInt DTemplateCameraScPdd::SetContrast(TUint /*aContrast*/)
   1.530 +	{
   1.531 +	return KErrNone;
   1.532 +	}
   1.533 +
   1.534 +TInt DTemplateCameraScPdd::SetColorEffect(TUint /*aColorEffect*/)
   1.535 +	{
   1.536 +	return KErrNone;
   1.537 +	}
   1.538 +