os/kernelhwsrv/kerneltest/e32test/multimedia/t_camera_gen.cpp
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
sl@0
     1
// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of the License "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
// e32test\multimedia\t_camera_gen.cpp
sl@0
    15
// 
sl@0
    16
//
sl@0
    17
sl@0
    18
#include <e32test.h>
sl@0
    19
#include <d32camerasc.h>
sl@0
    20
#include <e32def.h>
sl@0
    21
#include <e32def_private.h>
sl@0
    22
#include "t_camera_display.h"
sl@0
    23
#include "d_mmcsc.h"
sl@0
    24
sl@0
    25
_LIT(KTstLddFileName,"D_MMCSC.LDD");
sl@0
    26
_LIT(KCamLddFileName,"ECAMERASC.LDD");
sl@0
    27
sl@0
    28
#ifdef __WINSCW__
sl@0
    29
_LIT(KCamPddFileName,"_TEMPLATE_CAMERASC.PDD");
sl@0
    30
#else
sl@0
    31
_LIT(KCamPddFileName,"CAMERASC.PDD");
sl@0
    32
#endif
sl@0
    33
sl@0
    34
_LIT(KCamFreePddExtension,".*");
sl@0
    35
sl@0
    36
const TInt KUnit0=0;
sl@0
    37
const TInt KFrameRate=30;		// Run the test at 30fps
sl@0
    38
sl@0
    39
class CCameraHandler;
sl@0
    40
sl@0
    41
RTest test(_L("T_CAMERA_GEN"));
sl@0
    42
CCameraHandler* camera;
sl@0
    43
sl@0
    44
/**
sl@0
    45
Wait for a key press, but timeout so automated tests
sl@0
    46
are unaffected
sl@0
    47
*/
sl@0
    48
void util_getch_withtimeout(TUint aSecs)
sl@0
    49
	{
sl@0
    50
	TRequestStatus keyStat;
sl@0
    51
	test.Console()->Read(keyStat);
sl@0
    52
	RTimer timer;
sl@0
    53
	test(timer.CreateLocal()==KErrNone);
sl@0
    54
	TRequestStatus timerStat;
sl@0
    55
	timer.After(timerStat,aSecs*1000000);
sl@0
    56
	User::WaitForRequest(timerStat,keyStat);
sl@0
    57
	if(keyStat!=KRequestPending)
sl@0
    58
		(void)test.Console()->KeyCode();
sl@0
    59
	timer.Cancel();
sl@0
    60
	timer.Close();
sl@0
    61
	test.Console()->ReadCancel();
sl@0
    62
	User::WaitForAnyRequest();
sl@0
    63
	}
sl@0
    64
sl@0
    65
// Define the frame number to capture
sl@0
    66
// For image capture this should be zero.
sl@0
    67
const TInt64 KFrameNumberToCapture= 50;
sl@0
    68
sl@0
    69
/// Defines camera handler
sl@0
    70
class CCameraHandler : public CActive
sl@0
    71
	{
sl@0
    72
public:
sl@0
    73
	static CCameraHandler* NewL();
sl@0
    74
	~CCameraHandler();
sl@0
    75
	TInt SetConfig(TDevCamCaptureMode aCaptureMode, SDevCamFrameSize aSize,SDevCamPixelFormat aPixelFormat,TBool aCreateChunk,TInt aNumBuffers);
sl@0
    76
	void GetConfig(TDevCamCaptureMode aCaptureMode);
sl@0
    77
	TInt GetCaps();
sl@0
    78
	TInt SetFirstConfig(TUint aOffset);
sl@0
    79
	TInt Start(TDevCamCaptureMode aCaptureMode);
sl@0
    80
	TInt Stop();
sl@0
    81
	void SetCaptureMode(TDevCamCaptureMode aCaptureMode);
sl@0
    82
private:
sl@0
    83
	CCameraHandler();
sl@0
    84
	virtual void RunL();
sl@0
    85
	virtual void DoCancel();
sl@0
    86
	TInt Init();
sl@0
    87
private:
sl@0
    88
	TCamDisplayHandler iDispHandler[ECamCaptureModeMax];
sl@0
    89
	RDevCameraSc iCamera;
sl@0
    90
	RChunk iChunk[ECamCaptureModeMax];
sl@0
    91
	TInt iFrameCount;
sl@0
    92
	TDevCamCaptureMode iCaptureMode;
sl@0
    93
	TInt iCapsSize;
sl@0
    94
	TAny* iCapsBufPtr;
sl@0
    95
	TCameraCapsV02* iCameraCaps;
sl@0
    96
	};
sl@0
    97
sl@0
    98
CCameraHandler::CCameraHandler() : CActive(EPriorityStandard)
sl@0
    99
//
sl@0
   100
// Constructor for the camera handler
sl@0
   101
//
sl@0
   102
	{
sl@0
   103
	// Active object priority is set to normal
sl@0
   104
	}
sl@0
   105
sl@0
   106
CCameraHandler::~CCameraHandler()
sl@0
   107
//
sl@0
   108
// Destructor for the camera handler
sl@0
   109
//
sl@0
   110
	{
sl@0
   111
	for (TInt captureMode=0; captureMode < ECamCaptureModeMax; captureMode++)
sl@0
   112
		iChunk[captureMode].Close();
sl@0
   113
	if(iCapsBufPtr)
sl@0
   114
		User::Free(iCapsBufPtr);
sl@0
   115
	iCamera.Close();
sl@0
   116
	// Cancel any active request
sl@0
   117
	CActive::Cancel();
sl@0
   118
	}
sl@0
   119
sl@0
   120
void CCameraHandler::DoCancel()
sl@0
   121
	{
sl@0
   122
sl@0
   123
	}
sl@0
   124
sl@0
   125
CCameraHandler* CCameraHandler::NewL()
sl@0
   126
//
sl@0
   127
// Create active camera
sl@0
   128
//
sl@0
   129
	{
sl@0
   130
	test.Printf(_L("NewL\r\n"));
sl@0
   131
	CCameraHandler *cc = new (ELeave) CCameraHandler;
sl@0
   132
	TInt r=cc->Init();
sl@0
   133
	if (r!=KErrNone)
sl@0
   134
		User::Leave(r);
sl@0
   135
	CActiveScheduler::Add(cc);
sl@0
   136
	return(cc);
sl@0
   137
	}
sl@0
   138
sl@0
   139
TInt CCameraHandler::Init()
sl@0
   140
//
sl@0
   141
// Initialise hardware
sl@0
   142
//
sl@0
   143
	{
sl@0
   144
	test.Printf(_L("Init\r\n"));
sl@0
   145
	TInt r;
sl@0
   146
	for (TInt captureMode=0; captureMode < ECamCaptureModeMax; captureMode++)
sl@0
   147
		{
sl@0
   148
		r=iDispHandler[captureMode].Init();
sl@0
   149
		if (r!=KErrNone)
sl@0
   150
			return(r);
sl@0
   151
		}
sl@0
   152
sl@0
   153
	// Open camera driver channel
sl@0
   154
	r=iCamera.Open(KUnit0);
sl@0
   155
	return(r);
sl@0
   156
	}
sl@0
   157
sl@0
   158
void CCameraHandler::SetCaptureMode(TDevCamCaptureMode aCaptureMode)
sl@0
   159
	{
sl@0
   160
	iCaptureMode=aCaptureMode;
sl@0
   161
	}
sl@0
   162
sl@0
   163
TInt CCameraHandler::GetCaps()
sl@0
   164
	{
sl@0
   165
	test.Printf(_L("GetCaps\r\n"));
sl@0
   166
	iCapsSize=iCamera.CapsSize();
sl@0
   167
	iCapsBufPtr = User::Alloc(iCapsSize);
sl@0
   168
	TPtr8 capsPtr( (TUint8*)iCapsBufPtr, iCapsSize, iCapsSize );
sl@0
   169
	TInt r = iCamera.Caps(capsPtr);
sl@0
   170
	if(r!=KErrNone)
sl@0
   171
		return r;
sl@0
   172
	iCameraCaps = (TCameraCapsV02*) capsPtr.Ptr();
sl@0
   173
sl@0
   174
	test.Printf(_L("Number of supported pixel formats:%d\r\n"),iCameraCaps->iNumVideoPixelFormats);
sl@0
   175
	return r;
sl@0
   176
	}
sl@0
   177
sl@0
   178
void CCameraHandler::GetConfig(TDevCamCaptureMode aCaptureMode)
sl@0
   179
	{
sl@0
   180
	test.Printf(_L("GetConfig\r\n"));
sl@0
   181
	// Config camera
sl@0
   182
	TCameraConfigV02Buf configBuf;
sl@0
   183
	TCameraConfigV02 &config=configBuf();
sl@0
   184
sl@0
   185
	iCamera.GetCamConfig(aCaptureMode, configBuf);
sl@0
   186
sl@0
   187
	test.Printf(_L("Pixel Format:%d\r\n"),config.iPixelFormat);
sl@0
   188
	test.Printf(_L("Frame Size  :%d\r\n"),config.iFrameSize);
sl@0
   189
	test.Printf(_L("Frame rate  :%dfps\r\n"),config.iFrameRate);
sl@0
   190
	}
sl@0
   191
sl@0
   192
TInt CCameraHandler::SetFirstConfig(TUint aOffset)
sl@0
   193
	{
sl@0
   194
	test.Printf(_L("SetFirstConfig\r\n"));
sl@0
   195
	TInt ret;
sl@0
   196
	TAny* frameSizeCapsBuf=0;
sl@0
   197
	SDevCamPixelFormat* pixelFormat;
sl@0
   198
	SDevCamFrameSize* frameSize;
sl@0
   199
	TPtr8 frameSizeCapsPtr(0,0,0);
sl@0
   200
	pixelFormat = (SDevCamPixelFormat*) (iCameraCaps + 1);
sl@0
   201
sl@0
   202
	if(camera->iCameraCaps->iNumVideoPixelFormats)
sl@0
   203
		{
sl@0
   204
		pixelFormat = pixelFormat + iCameraCaps->iNumImagePixelFormats + iCameraCaps->iNumVideoPixelFormats;
sl@0
   205
		frameSizeCapsBuf = User::Alloc(pixelFormat->iNumFrameSizes*sizeof(SDevCamFrameSize));
sl@0
   206
		new (&frameSizeCapsPtr) TPtr8((TUint8*)frameSizeCapsBuf, pixelFormat->iNumFrameSizes*sizeof(SDevCamFrameSize), pixelFormat->iNumFrameSizes*sizeof(SDevCamFrameSize));
sl@0
   207
		ret=iCamera.FrameSizeCaps(ECamCaptureModeImage, pixelFormat->iPixelFormat, frameSizeCapsPtr);
sl@0
   208
		test(ret==KErrNone);
sl@0
   209
		frameSize = (SDevCamFrameSize*) frameSizeCapsPtr.Ptr();
sl@0
   210
		if((pixelFormat->iNumFrameSizes>aOffset) && aOffset)
sl@0
   211
			frameSize += aOffset;
sl@0
   212
		ret=camera->SetConfig(ECamCaptureModeVideo,*frameSize,*pixelFormat,ETrue,3);
sl@0
   213
		test(ret==KErrNone);
sl@0
   214
		User::Free(frameSizeCapsBuf);
sl@0
   215
		return(KErrNone);
sl@0
   216
		}
sl@0
   217
	else
sl@0
   218
		return(KErrNotSupported);
sl@0
   219
	}
sl@0
   220
sl@0
   221
TInt CCameraHandler::SetConfig(TDevCamCaptureMode aCaptureMode, SDevCamFrameSize aSize,SDevCamPixelFormat aPixelFormat,TBool aCreateChunk,TInt aNumBuffers)
sl@0
   222
	{
sl@0
   223
	test.Printf(_L("SetConfig\r\n"));
sl@0
   224
	TInt r=iDispHandler[aCaptureMode].SetConfig(aSize,aPixelFormat);
sl@0
   225
	if (r!=KErrNone)
sl@0
   226
		return(r);
sl@0
   227
sl@0
   228
	// Config camera
sl@0
   229
	TCameraConfigV02Buf configBuf;
sl@0
   230
	TCameraConfigV02 &config=configBuf();
sl@0
   231
	iCamera.GetCamConfig(aCaptureMode, configBuf);		// Load defaults
sl@0
   232
sl@0
   233
	config.iFrameSize=aSize;
sl@0
   234
	config.iPixelFormat=aPixelFormat;
sl@0
   235
	config.iFrameRate=KFrameRate;
sl@0
   236
sl@0
   237
	TMmSharedChunkBufConfig bufferConfig;
sl@0
   238
	TPckg<TMmSharedChunkBufConfig> bufferConfigBuf(bufferConfig);
sl@0
   239
sl@0
   240
	r=iCamera.SetCamConfig(aCaptureMode,configBuf);
sl@0
   241
	if (r!=KErrNone)
sl@0
   242
		return(r);
sl@0
   243
sl@0
   244
	if (aCreateChunk)
sl@0
   245
		{
sl@0
   246
		r=iCamera.SetBufConfigChunkCreate(aCaptureMode,aNumBuffers,iChunk[aCaptureMode]);
sl@0
   247
		if (r!=KErrNone)
sl@0
   248
			return(r);
sl@0
   249
		}
sl@0
   250
	else
sl@0
   251
		{
sl@0
   252
		// 'aNumBuffers' is ignored here, D_MMCSC.LDD currently uses 2 buffers
sl@0
   253
sl@0
   254
		RMmCreateSc tstDrv;
sl@0
   255
		r=tstDrv.Open();
sl@0
   256
		if (r!=KErrNone)
sl@0
   257
			return(r);
sl@0
   258
		r=tstDrv.GetChunkHandle(iChunk[aCaptureMode]);	// Get a handle on the shared chunk created by the test driver
sl@0
   259
		if (r!=KErrNone)
sl@0
   260
			return(r);
sl@0
   261
		r=tstDrv.GetBufInfo(bufferConfigBuf);
sl@0
   262
		if (r!=KErrNone)
sl@0
   263
			return(r);
sl@0
   264
		r=iCamera.SetBufConfigChunkOpen(aCaptureMode,bufferConfigBuf,iChunk[aCaptureMode]);
sl@0
   265
		if (r!=KErrNone)
sl@0
   266
			return(r);
sl@0
   267
sl@0
   268
		tstDrv.Close();
sl@0
   269
		}
sl@0
   270
sl@0
   271
	iCamera.GetBufferConfig(aCaptureMode, bufferConfigBuf);
sl@0
   272
	PrintBufferConf(bufferConfig,test);
sl@0
   273
sl@0
   274
	return(r);
sl@0
   275
	}
sl@0
   276
sl@0
   277
TInt CCameraHandler::Start(TDevCamCaptureMode aCaptureMode)
sl@0
   278
//
sl@0
   279
// Set object active, start getting images from the camera
sl@0
   280
//
sl@0
   281
	{
sl@0
   282
	test.Printf(_L("Start\r\n"));
sl@0
   283
	// Set object active
sl@0
   284
	iFrameCount=0;
sl@0
   285
	SetActive();
sl@0
   286
	iCamera.SetCaptureMode(aCaptureMode);
sl@0
   287
	// Add request for a new image
sl@0
   288
	TInt r=iCamera.Start();
sl@0
   289
	if (r==KErrNone)
sl@0
   290
		iCamera.NotifyNewImage(iStatus);
sl@0
   291
	return(r);
sl@0
   292
	}
sl@0
   293
sl@0
   294
void CCameraHandler::RunL()
sl@0
   295
//
sl@0
   296
// Handles a new request
sl@0
   297
//
sl@0
   298
	{
sl@0
   299
	TInt retId=iStatus.Int();
sl@0
   300
	TInt retOffset=-1;
sl@0
   301
	iCamera.BufferIdToOffset(iCaptureMode,retId,retOffset);
sl@0
   302
	if (retId>=0)
sl@0
   303
		{
sl@0
   304
		TUint8* imgBase=iChunk[iCaptureMode].Base()+retOffset;
sl@0
   305
		TInt r=iDispHandler[iCaptureMode].Process(imgBase);
sl@0
   306
		
sl@0
   307
#ifdef __WINSCW__
sl@0
   308
		test(r==KErrNotSupported);
sl@0
   309
#else
sl@0
   310
		test(r==KErrNone);
sl@0
   311
#endif
sl@0
   312
		
sl@0
   313
		// Release the buffer
sl@0
   314
		test(iCamera.ReleaseBuffer(retId)==KErrNone);
sl@0
   315
		iFrameCount++;
sl@0
   316
		}
sl@0
   317
	else
sl@0
   318
		test.Printf(_L("Capture error (%d)\r\n"),retId);
sl@0
   319
sl@0
   320
	if (iFrameCount<KFrameNumberToCapture)
sl@0
   321
		{
sl@0
   322
		// Add request for a new image
sl@0
   323
		iCamera.NotifyNewImage(iStatus);
sl@0
   324
		// re-set active
sl@0
   325
		SetActive();
sl@0
   326
		}
sl@0
   327
sl@0
   328
	else
sl@0
   329
		{
sl@0
   330
		CActiveScheduler::Stop();
sl@0
   331
		}
sl@0
   332
	}
sl@0
   333
sl@0
   334
TInt CCameraHandler::Stop()
sl@0
   335
//
sl@0
   336
// Stops camera
sl@0
   337
//
sl@0
   338
	{
sl@0
   339
	test.Printf(_L("Stop\r\n"));
sl@0
   340
	CActive::Cancel();
sl@0
   341
	TInt r=iCamera.Stop();
sl@0
   342
	return(r);
sl@0
   343
	}
sl@0
   344
sl@0
   345
//
sl@0
   346
// Test for recording a certain number of frames in a particular configuration and displaying
sl@0
   347
// the results.
sl@0
   348
//
sl@0
   349
void TestRecording()
sl@0
   350
	{
sl@0
   351
	TInt ret;
sl@0
   352
sl@0
   353
	camera->GetConfig(ECamCaptureModeVideo);
sl@0
   354
	camera->SetCaptureMode(ECamCaptureModeVideo);
sl@0
   355
	test.Next(_L("Starting camera"));
sl@0
   356
	ret=camera->Start(ECamCaptureModeVideo);
sl@0
   357
	test.Printf(_L("Start returned %d\r\n"),ret);
sl@0
   358
	test(ret==KErrNone);
sl@0
   359
sl@0
   360
	// Calculate frame rate.
sl@0
   361
	// We store cuurent time before receiving data from the camera and
sl@0
   362
	// after to have received KFrameNumberToCapture pictures, we calculate
sl@0
   363
	// time elapsed during the reception.
sl@0
   364
	TTimeIntervalMicroSeconds microseconds ;
sl@0
   365
	TTime now;
sl@0
   366
	TTime iTime;
sl@0
   367
	now.HomeTime();
sl@0
   368
sl@0
   369
	test.Next(_L("Starting active scheduler"));
sl@0
   370
	// Start active scheduler
sl@0
   371
	CActiveScheduler::Start();
sl@0
   372
sl@0
   373
	// We have received all pictures, so we store the new current time
sl@0
   374
	iTime.HomeTime();
sl@0
   375
sl@0
   376
	// We keep this time in microseconds to be more precise
sl@0
   377
	microseconds = iTime.MicroSecondsFrom(now) ;
sl@0
   378
sl@0
   379
	TInt64 timeElapsed = microseconds.Int64();
sl@0
   380
sl@0
   381
	// We store in this variable, integer value of the frame rate
sl@0
   382
	TInt64 intFrameRate = (TInt64)((KFrameNumberToCapture *1000000)/timeElapsed);
sl@0
   383
sl@0
   384
	// We store in this variable, decimal value of the frame rate
sl@0
   385
	TInt64 milliFrameRate = (TInt64)((KFrameNumberToCapture *1000000)%timeElapsed);
sl@0
   386
	milliFrameRate = (milliFrameRate*1000) / timeElapsed;
sl@0
   387
sl@0
   388
	test.Printf(_L("   Frame rate for frames received : %d.%03d frames per second\r\n"), static_cast<TInt>(intFrameRate), static_cast<TInt>(milliFrameRate));
sl@0
   389
	test.Printf(_L("   Frame rate expected            : %d.000 frames per second\r\n"),KFrameRate);
sl@0
   390
	test.Next(_L("Stopping camera"));
sl@0
   391
	// Stop Camera
sl@0
   392
	ret=camera->Stop();
sl@0
   393
	test(ret==KErrNone);
sl@0
   394
	}
sl@0
   395
sl@0
   396
//
sl@0
   397
// Test program main part
sl@0
   398
//
sl@0
   399
TInt E32Main()
sl@0
   400
	{
sl@0
   401
	__UHEAP_MARK;
sl@0
   402
sl@0
   403
	test.Title();
sl@0
   404
	test.Start(_L("Camera module GEN test"));
sl@0
   405
sl@0
   406
	test.Next(_L("Loading CAMERA PDD"));
sl@0
   407
	TInt ret=User::LoadPhysicalDevice(KCamPddFileName);
sl@0
   408
	test.Printf(_L("Returned %d\r\n"),ret);
sl@0
   409
sl@0
   410
	if (ret==KErrNotFound)
sl@0
   411
		{
sl@0
   412
		test.Printf(_L("Shared chunk camera driver not supported - test skipped\r\n"));
sl@0
   413
		test.End();
sl@0
   414
		test.Close();
sl@0
   415
		__UHEAP_MARKEND;
sl@0
   416
		return(KErrNone);
sl@0
   417
		}
sl@0
   418
sl@0
   419
	test(ret==KErrNone || ret==KErrAlreadyExists);
sl@0
   420
sl@0
   421
	test.Next(_L("Loading CAMERA LDD"));
sl@0
   422
	ret=User::LoadLogicalDevice(KCamLddFileName);
sl@0
   423
	test.Printf(_L("Returned %d\r\n"),ret);
sl@0
   424
	test(ret==KErrNone || ret==KErrAlreadyExists);
sl@0
   425
sl@0
   426
	test.Next(_L("Loading D_MMCSC LDD"));
sl@0
   427
	ret=User::LoadLogicalDevice(KTstLddFileName);
sl@0
   428
	test.Printf(_L("Returned %d\r\n"),ret);
sl@0
   429
	test(ret==KErrNone||ret==KErrAlreadyExists);
sl@0
   430
sl@0
   431
	__KHEAP_MARK;
sl@0
   432
sl@0
   433
	// Construct and install the active scheduler
sl@0
   434
	test.Next(_L("Initialising active scheduler"));
sl@0
   435
	CActiveScheduler *exampleScheduler = new (ELeave) CActiveScheduler();
sl@0
   436
	// Install as the active scheduler
sl@0
   437
	CActiveScheduler::Install(exampleScheduler);
sl@0
   438
sl@0
   439
	// Create camera handler
sl@0
   440
	test.Next(_L("Creating camera handler"));
sl@0
   441
	camera = CCameraHandler::NewL();
sl@0
   442
sl@0
   443
	test.Next(_L("+ Getting Camera Capabilities"));
sl@0
   444
	ret=camera->GetCaps();
sl@0
   445
	test(ret==KErrNone);
sl@0
   446
sl@0
   447
	// SetConfig
sl@0
   448
	test.Next(_L("Setting Camera Configuration"));
sl@0
   449
	ret=camera->SetFirstConfig(0);
sl@0
   450
	test(ret==KErrNone);
sl@0
   451
	TestRecording();
sl@0
   452
sl@0
   453
	// Repeat with a different configuration
sl@0
   454
	test.Next(_L("Resetting Camera Configuration"));
sl@0
   455
	ret=camera->SetFirstConfig(1);
sl@0
   456
	test(ret==KErrNone);
sl@0
   457
	TestRecording();
sl@0
   458
sl@0
   459
	delete camera;
sl@0
   460
	delete exampleScheduler;
sl@0
   461
sl@0
   462
	__KHEAP_MARKEND;
sl@0
   463
sl@0
   464
	// Free the PDDs and LDDs
sl@0
   465
	test.Next(_L("Freeing ECAMERASC LDD"));
sl@0
   466
	ret=User::FreeLogicalDevice(KDevCameraScName);
sl@0
   467
	test(ret==KErrNone);
sl@0
   468
sl@0
   469
	test.Next(_L("Freeing CAMERASC PDD")) ;
sl@0
   470
	TFindPhysicalDevice fDr;
sl@0
   471
	TFullName drivName;
sl@0
   472
	TName searchName;
sl@0
   473
	searchName.Append(KDevCameraScName);
sl@0
   474
	searchName.Append(KCamFreePddExtension);
sl@0
   475
	fDr.Find(searchName);
sl@0
   476
	ret=fDr.Next(drivName);
sl@0
   477
	test(ret==KErrNone);
sl@0
   478
	ret=User::FreePhysicalDevice(drivName);
sl@0
   479
	test(ret==KErrNone);
sl@0
   480
sl@0
   481
	test.Next(_L("Freeing D_MMCSC LDD"));
sl@0
   482
	ret=User::FreeLogicalDevice(KDevMmCScName);
sl@0
   483
	test(ret==KErrNone);
sl@0
   484
sl@0
   485
	test.Printf(_L("Hit any key to continue\r\n"));
sl@0
   486
	util_getch_withtimeout(5);
sl@0
   487
sl@0
   488
	test.End();
sl@0
   489
	test.Close();
sl@0
   490
sl@0
   491
	__UHEAP_MARKEND;
sl@0
   492
sl@0
   493
	return KErrNone;
sl@0
   494
	}