os/kernelhwsrv/kerneltest/e32test/debug/d_perflogger_ldd.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     4 // under the terms of the License "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 // A helper test driver for testing Kernel Performance Logger implementation.
    15 // 
    16 //
    17 
    18 /**
    19  @file
    20 */
    21 
    22 
    23 #include "d_perflogger_ldd.h"
    24 #include <kernperflogger.h>
    25 
    26 _LIT(KDFCThreadName,"D_PL_DFC_THREAD");
    27 const TInt KDFCThreadPriority=27;
    28 
    29 //-----------------------------------------------------------------------------------
    30 
    31 
    32 DKPLoggerTestHelperLDD* DKPLoggerTestHelperLDD::pSelf = NULL;	//-- static pointer to the single instance of the logical channel class
    33 
    34 //-----------------------------------------------------------------------------------
    35 
    36 DLogTicker::DLogTicker() : iTimer(LogTimerCallback,this)  //-- initialize log events generator
    37 	{
    38     iLogDFC = NULL;
    39     iRequest = NULL;
    40     iUserThreadContext = NULL;
    41 	}
    42 
    43 DLogTicker::~DLogTicker()
    44 	{
    45     Cancel(); //-- cancel user request, DFC, timers etc.
    46 	Kern::DestroyClientRequest(iRequest);
    47     delete  iLogDFC;
    48 	}
    49 
    50 //-----------------------------------------------------------------------------------
    51 
    52 /**
    53 	Construct ticker object. Creates appropriate TDfc object for dealing with IDFC or DFC
    54 
    55 	@param  apUserThreadContext pointer to the user thread context where the request will be completed in
    56 	@param  apDfcQ              pointer to the DFC queue this object will be using.
    57 	@param  aLogContext         specfies the context (ISR, DFC or IDFC) the logging will be made from. Can be NKern::EIDFC, NKern::EThread, NKern::EInterrupt
    58 */
    59 void DLogTicker::Construct(DThread* aUserThreadContext, TDfcQue* aDfcQ, NKern::TContext aLogContext)
    60 	{
    61     __NK_ASSERT_DEBUG(aUserThreadContext && aDfcQ);
    62 	
    63     iLogContext = aLogContext;
    64     if(aLogContext == NKern::EIDFC)
    65 		{//-- we will deal with IDFC, create appropriate DFC object
    66         iLogDFC = new TDfc(LogDFC, this);
    67 		}
    68     else
    69 		{
    70 		if(aLogContext == NKern::EThread || aLogContext == NKern::EInterrupt)
    71 			{//-- we will deal with DFC or ISR
    72 			iLogDFC = new TDfc(LogDFC, this, aDfcQ, 0);
    73 			}
    74 		else
    75 			{//-- wrong value
    76 			__PRINT("#KPLogTest:DLogTicker::Construct() wrong context request !");
    77 			__NK_ASSERT_DEBUG(0);
    78 			}
    79 		}
    80 		
    81 	__NK_ASSERT_ALWAYS(iLogDFC);
    82 
    83 	TInt r = Kern::CreateClientRequest(iRequest);
    84 	__NK_ASSERT_ALWAYS(r == KErrNone);
    85 		
    86 	iUserThreadContext = aUserThreadContext; //-- store user thread context co complete requests correctly
    87 //	iLogDFC->SetDfcQ(aDfcQ); //-- attach to the given DFC queue. !!!!DON'T DO THIS FOR IDFC!!!!!
    88 	}
    89 
    90 //-----------------------------------------------------------------------------------
    91 
    92 /**
    93 	Start the state machine by scheduling a DFC (or IDFC)
    94 
    95 	@param  apLogControl    log parameters structure
    96 	@param  apRqStat        pointer to the user request staus object that will be completed when all loggings done.
    97 */
    98 void DLogTicker::Start(const TTestLogCtrl* aLogControl, TRequestStatus* aRqStat)
    99 	{
   100     __NK_ASSERT_DEBUG(aLogControl && aRqStat && iLogDFC);
   101     kumemget32(&iLogControl, aLogControl, sizeof(TTestLogCtrl)); //-- copy control structure from the user side
   102 	
   103 	__NK_ASSERT_DEBUG(iLogControl.iLogsNum>=0);
   104 	__PRINT1("#KPLogTest:DLogTicker::Start() for %d loggings",iLogControl.iLogsNum);
   105 
   106 	if (iRequest->SetStatus(aRqStat) != KErrNone)
   107 		{//-- current request is pending, panic client thread
   108         __PRINT("#KPLogTest:DLogTicker::Start() request is already pending !");
   109         Kern::PanicCurrentThread(KPLoggerHelperTestDrv, EReqAlreadyPending);
   110 		}
   111 	
   112     if(iLogContext == NKern::EIDFC)
   113 		{//-- DLogTicker::LogDFC() will be called as IDFC 
   114         NKern::Lock();   
   115         iLogDFC->Add();  //-- start
   116         NKern::Unlock();
   117 		}
   118     else
   119 		{//-- DLogTicker::LogDFC() will be called as DFC 
   120         iLogDFC->Enque(); //-- start
   121 		}
   122 	
   123 	}
   124 
   125 //-----------------------------------------------------------------------------------
   126 
   127 /**
   128 	Complete the user request when all logging done.
   129 	This can be called from 2 concurrent places - DFC & NTimer callback, either of them can complete the request
   130 
   131 	@param aCompletionCode request completion code
   132 */
   133 void DLogTicker::CompleteRequest(TInt aCompletionCode/*=KErrNone*/)
   134 	{
   135 	Kern::QueueRequestComplete(iUserThreadContext, iRequest, aCompletionCode);
   136 	}
   137 
   138 //-----------------------------------------------------------------------------------
   139 
   140 /**
   141 	Cancel everything
   142 */
   143 void DLogTicker::Cancel(void)
   144 	{
   145     CompleteRequest(KErrCancel); //-- cancel user request
   146 	iLogControl.iLogsNum = 0;	 // Prevent DFC from restarting the timer
   147 	iTimer.Cancel();    //-- cancel Timer
   148 	iLogDFC->Cancel(); //-- cancel DFC
   149 	}
   150 
   151 //-----------------------------------------------------------------------------------
   152 
   153 /**
   154 	Ticker timer callback. Can be called in ISR or DFC context.
   155 	If called in ISR context, makes logging, and schedules a DFC to complete the request if needed.
   156 	If called in DFC context, makes logging for DFC (not for IDFC) mode and completes the request if needed.
   157 
   158 	@param  apSelf pointer to the DLogTicker object
   159 */
   160 void DLogTicker::LogTimerCallback(TAny* aSelf)
   161 	{
   162     DLogTicker *pSelf = (DLogTicker*)aSelf;
   163     __NK_ASSERT_DEBUG(pSelf);
   164     
   165     TTestLogCtrl& logClontrol = pSelf->iLogControl;
   166     __NK_ASSERT_DEBUG(logClontrol.iLogsNum >=0);
   167 	
   168     TInt context = NKern::CurrentContext();
   169     if(context == NKern::EInterrupt)
   170 		{//-- This callback is from ISR
   171         
   172         //-- make logging from ISR context, category field is ignored, it will be FastTrace::EKernPerfLog
   173         PERF_LOG(logClontrol.iSubCategory, logClontrol.iUserData, logClontrol.iUserData2);
   174 		
   175         //-- kick DFC, it will probaly complete the request. 
   176         pSelf->iLogDFC->Add();  
   177 		}
   178     else
   179 		{//-- this is a DFC callback, but the DFC object could also have been ceated as IDFC
   180 		//-- complete user request here if necessarily.
   181         if(pSelf->iLogDFC->IsIDFC())
   182 			{//-- the logging will be made in IDFC function.
   183             if(pSelf->iLogControl.iLogsNum == 0)
   184 				{//-- all done, complete the request here, because we can't do in in IDFC
   185                 pSelf->CompleteRequest();
   186 				}
   187             else
   188 				{//-- this callback came from IDFC object, kick IDFC in a special way.
   189                 NKern::Lock();
   190                 pSelf->iLogDFC->Add(); 
   191                 NKern::Unlock();
   192 				}
   193 			}
   194         else
   195 			{//-- this callback came from IDFC object, make logging from DFC context
   196             //-- category field is ignored, it will be FastTrace::EKernPerfLog
   197             PERF_LOG(logClontrol.iSubCategory, logClontrol.iUserData, logClontrol.iUserData2);    
   198 			
   199             pSelf->iLogDFC->Enque(); //-- kick DFC 
   200 			}
   201         
   202 		}
   203 	
   204 	}
   205 
   206 //-----------------------------------------------------------------------------------
   207 
   208 /**
   209 	Ticker DFC or IDFC function. Kicks the timer; 
   210 	If is called as IDFC, makes logging in this context and schedules a timer callback in DFC context to complete the request.
   211 	If is called as DFC, schedules timer callback in DFC or ISR context. 
   212 
   213 	@param  apSelf pointer to the DLogTicker object
   214 */
   215 void DLogTicker::LogDFC(TAny* aSelf)
   216 	{
   217     DLogTicker *pSelf = (DLogTicker*)aSelf;
   218     __NK_ASSERT_DEBUG(pSelf);
   219 	
   220     TInt context = NKern::CurrentContext();
   221     (void)context; //-- avoid warning in release mode
   222 	
   223     if(pSelf->iLogControl.iLogsNum <= 0)
   224 		{//-- complete user request, all done. The request can also be completed in LogTimerCallback()
   225 		//-- in case if this is a IDFC and callback is a DFC
   226         pSelf->CompleteRequest();    
   227 		}
   228     else
   229 		{
   230         TTestLogCtrl& logClontrol = pSelf->iLogControl;
   231         logClontrol.iLogsNum--; //-- decrease remaining number of loggings
   232 		
   233         if(pSelf->iLogDFC->IsIDFC())
   234 			{//-- we are in IDFC context, make logging from here, timer callback won't be IDFC
   235             __NK_ASSERT_DEBUG(context == NKern::EIDFC);
   236 			
   237             //-- category field is ignored, it will be FastTrace::EKernPerfLog
   238             PERF_LOG(logClontrol.iSubCategory, logClontrol.iUserData, logClontrol.iUserData2);
   239 			
   240             //-- kick the timer to have a callback in a specified time in DFC context
   241             //-- timer's DFC will complete the request if necessarily.
   242             pSelf->iTimer.OneShot(logClontrol.iLogPeriodTick, ETrue); 
   243 			}
   244         else
   245 			{//-- we are in DFC context, kick the timer to have a callback in a specified time in ISR or DFC context
   246             pSelf->iTimer.OneShot(logClontrol.iLogPeriodTick, !(pSelf->iLogContext == NKern::EInterrupt));
   247 			}
   248 		}
   249 	}
   250 
   251 
   252 //-----------------------------------------------------------------------------------
   253 
   254 
   255 //###################################################################################
   256 //#            DKPLoggerTestHelperLDD   class implementation
   257 //###################################################################################
   258 
   259 DKPLoggerTestHelperLDD::DKPLoggerTestHelperLDD()
   260 
   261 	{
   262     //-- store the pointer to the current thread for request completion from ISR->DFC
   263     iClientThread = &Kern::CurrentThread();
   264 	
   265     __NK_ASSERT_DEBUG(iClientThread);
   266 	
   267 	//-- Open client's user thread, incrementing ref. counter 
   268 	TInt nRes = iClientThread->Open();
   269 	__NK_ASSERT_DEBUG(nRes == KErrNone);
   270 	(void)nRes;//-- avoid warning in release mode
   271 
   272 
   273     //-- initialize DFC machinery
   274     //iDfcQ = Kern::DfcQue0();   //-- attach to the low priority DFC queue
   275 	if (!iDfcQ)
   276  		{
   277  		TInt r = Kern::DynamicDfcQCreate(iDfcQ, KDFCThreadPriority, KDFCThreadName);
   278 		if (r!= KErrNone)
   279 			{
   280 			return;
   281 			}
   282 
   283 #ifdef CPU_AFFINITY_ANY
   284 		NKern::ThreadSetCpuAffinity((NThread*)(iDfcQ->iThread), KCpuAffinityAny);			
   285 #endif
   286  		}	
   287     
   288     iIsrLogTicker.Construct (iClientThread, iDfcQ, NKern::EInterrupt);//-- construct ISR log ticker
   289     iDfcLogTicker.Construct (iClientThread, iDfcQ, NKern::EThread);   //-- construct DFC log ticker
   290     iIDfcLogTicker.Construct(iClientThread, iDfcQ, NKern::EIDFC);     //-- construct IDFC log ticker
   291 	}
   292 
   293 //-----------------------------------------------------------------------------------
   294 
   295 DKPLoggerTestHelperLDD::~DKPLoggerTestHelperLDD()
   296 	{
   297     __PRINT("#KPLogTest:~DKPLoggerTestHelperLDD()");
   298 	
   299 	iClientThread->Close(NULL);
   300 
   301 	if (iDfcQ)
   302 		iDfcQ->Destroy();
   303 		
   304 	pSelf = NULL;  //-- clear the pointer to this class instance
   305 	}
   306 
   307 //-----------------------------------------------------------------------------------
   308 
   309 /**
   310 	static factory function for the LDD.
   311 
   312 	@return pointer to the created (or existing) instance of the class
   313 */
   314 DKPLoggerTestHelperLDD* DKPLoggerTestHelperLDD::CreateInstance()
   315 	{
   316     __PRINT("#KPLogTest:DKPLoggerTestHelperLDD::CreateInstance()");
   317     
   318     //-- create LDD channel instance
   319     if(pSelf)
   320 	    {//-- this is a singleton, can't have more than one instance
   321         __PRINT("#DKPLoggerTestHelperLDD::CreateInstance(): Attempt to create a second instance of a singleton!");
   322         return pSelf;
   323 		}
   324 
   325 	pSelf = new DKPLoggerTestHelperLDD;
   326 	
   327     if(!pSelf)
   328 		{//-- OOM 
   329         __PRINT("#KPLogTest:DKPLoggerTestHelperLDD::CreateInstance(): Unable to create class instance !");
   330 		}
   331 	
   332     return pSelf;
   333 	}
   334 
   335 //-----------------------------------------------------------------------------------
   336 
   337 /**
   338 	LDD second stage constructor
   339 */
   340 TInt DKPLoggerTestHelperLDD::DoCreate(TInt /*aUnit*/, const TDesC8* /*anInfo*/, const TVersion& aVer)
   341 	{
   342 	//-- check if the version aVer is supported
   343     if (!Kern::QueryVersionSupported(TVersion(KMajorVersionNumber,KMinorVersionNumber,KBuildVersionNumber),aVer))
   344 		return KErrNotSupported;
   345 	
   346     return KErrNone;
   347 	}
   348 
   349 //-----------------------------------------------------------------------------------
   350 
   351 /**
   352 	Requests processing function.
   353 	@return     request processing error code.
   354 */
   355 TInt DKPLoggerTestHelperLDD::Request(TInt aFunction, TAny* a1, TAny* a2)
   356 	{
   357     TInt nRes = KErrNone;
   358 	
   359 	if (aFunction == KMaxTInt)
   360 		{//-- this is DoCancel()
   361 		
   362         TUint reqMask = (TUint)a1;
   363         DoCancel(reqMask);
   364 		return KErrNone;
   365 		}
   366 	
   367     if(aFunction < 0)
   368 		{//-- This is DoRequest()
   369         
   370         //-- extract request parameters
   371         TRequestStatus* pRqStat=(TRequestStatus*)a1;
   372         
   373         TAny* params[2];
   374         kumemget32(params, a2, sizeof(params));
   375         
   376         nRes = DoRequest(~aFunction, pRqStat, params[0], params[1]); 
   377 		}
   378     else
   379 		{//-- This is DoControl()
   380         nRes = DoControl(aFunction, a1, a2);
   381 		}
   382 	
   383 	
   384     return nRes;
   385 	}
   386 
   387 //-----------------------------------------------------------------------------------
   388 
   389 /**
   390 	Cancel outstanding request(s)
   391 	@param  aReqNumber	request number to cancel
   392 */
   393 void DKPLoggerTestHelperLDD::DoCancel(TUint aReqNumber)
   394 	{
   395 	
   396     switch (aReqNumber)
   397 		{
   398 		//-- cancel logging from ISR.
   399 		case RKPLoggerTestHelper::EDoLogFromISR:  
   400 			iIsrLogTicker.Cancel();
   401 			break;
   402 			
   403 			//-- cancel logging from IDFC.
   404 		case RKPLoggerTestHelper::EDoLogFromIDFC: 
   405 			iIDfcLogTicker.Cancel();
   406 			break;
   407 			
   408 			//-- cancel logging from DFC.
   409 		case RKPLoggerTestHelper::EDoLogFromDFC:  
   410 			iDfcLogTicker.Cancel();
   411 			break;
   412 			
   413 		default:
   414 			__PRINT1("#KPLogTest:DKPLoggerTestHelperLDD::DoCancel Cancelling a wrong request number:%d!", aReqMask);
   415 			Kern::PanicCurrentThread(KPLoggerHelperTestDrv, EWrongRequest);
   416 			break;
   417 			
   418 		}
   419 	}
   420 
   421 //-----------------------------------------------------------------------------------
   422 
   423 /**
   424 	Asynchronous request processing. 
   425 
   426 	@param aFunction    request function number, see RKPLoggerTestHelper::TControl
   427   
   428     @param apRqStat     pointer to the user's request status object.
   429     @param apArg1       pointer to the 1st parameter in RKPLoggerTestHelper::DoRequest
   430     @param apArg2       pointer to the 2nd parameter in RKPLoggerTestHelper::DoRequest
   431 	
   432 	@return request scheduling result, system-wide error code.
   433 	  
   434 */
   435 TInt DKPLoggerTestHelperLDD::DoRequest(TInt aReqNumber, TRequestStatus* aRqStat, TAny* aArg1, TAny* /*apArg2*/)
   436 	{
   437     switch (aReqNumber)
   438 		{
   439 		//-- make logging from ISR.
   440 		case RKPLoggerTestHelper::EDoLogFromISR:  
   441 			{   
   442 			__PRINT("#KPLogTest: making loggings from ISR context");
   443 			iIsrLogTicker.Start((const TTestLogCtrl*)aArg1, aRqStat);
   444 			}
   445 			break;
   446 			
   447 			//-- make logging from IDFC.
   448 		case RKPLoggerTestHelper::EDoLogFromIDFC: 
   449 			{   
   450 			__PRINT("#KPLogTest: making loggings from IDFC context");			
   451 			iIDfcLogTicker.Start((const TTestLogCtrl*)aArg1, aRqStat);
   452 			}			
   453 			break;
   454 			
   455 			//-- make logging from DFC.
   456 		case RKPLoggerTestHelper::EDoLogFromDFC:  
   457 			{   
   458 			__PRINT("#KPLogTest: making loggings from DFC context");			
   459 			iDfcLogTicker.Start((const TTestLogCtrl*)aArg1, aRqStat);
   460 			}
   461 			break;
   462 			
   463 			
   464 		default:
   465 			__PRINT1("#KPLogTest:DKPLoggerTestHelperLDD::DoRequest() Wrong request number:%d!", aReqNumber);
   466 			Kern::PanicCurrentThread(KPLoggerHelperTestDrv, EWrongRequest);
   467 			break;
   468 		}
   469     
   470     return KErrNone;
   471 	}
   472 
   473 //-----------------------------------------------------------------------------------
   474 
   475 /**
   476 	Synchronous requests processing. 
   477 
   478 	@param aFunction    request function number, see RKernPerfLogger::TControl
   479 	@param apArg1       pointer to the 1st parameter in RKernPerfLogger::DoControl
   480 	@param apArg2       pointer to the 2n parameter in RKernPerfLogger::DoControl 
   481   
   482     @return request processing result
   483 */
   484 TInt DKPLoggerTestHelperLDD::DoControl(TInt aFunction, TAny* aArg1, TAny* /*apArg2*/)
   485 	{
   486 	
   487     switch (aFunction)
   488 		{
   489         //-- make test logging from the user thread
   490         case RKPLoggerTestHelper::EDoLogFromUserThread:
   491 			{    
   492             kumemget32(&iLogControlUserThread, aArg1, sizeof(iLogControlUserThread)); //-- copy control structure from the user side
   493             __PRINT1("#KPLogTest: making %d loggings from a user-thread context", iLogControlUserThread.iLogsNum);
   494             __NK_ASSERT_DEBUG(iLogControlUserThread.iLogsNum >=0 );
   495 			
   496             //-- This context is actually, a user thread. Make logging from here
   497             for(TInt i=0; i<iLogControlUserThread.iLogsNum; ++i)
   498 				{
   499                 //-- category field is ignored, it will be FastTrace::EKernPerfLog
   500                 PERF_LOG(iLogControlUserThread.iSubCategory, iLogControlUserThread.iUserData, iLogControlUserThread.iUserData2);
   501                 
   502                 NKern::Sleep(iLogControlUserThread.iLogPeriodTick);
   503 				}
   504 			}
   505 			break;
   506 			
   507 		//-- unit test for different PERF_LOG macros
   508         case RKPLoggerTestHelper::EDoTestMacros:
   509 			{
   510             kumemget32(&iLogControlUserThread, aArg1, sizeof(iLogControlUserThread)); //-- copy control structure from the user side
   511             __PRINT1("#KPLogTest: making %d loggings from a user-thread context, testing different macros", iLogControlUserThread.iLogsNum);
   512             __NK_ASSERT_DEBUG(iLogControlUserThread.iLogsNum >=0 );
   513 			
   514             for(TInt i=0; i<iLogControlUserThread.iLogsNum; ++i)
   515 				{
   516                 PERF_LOG0(iLogControlUserThread.iSubCategory);
   517                 PERF_LOG1(iLogControlUserThread.iSubCategory, iLogControlUserThread.iUserData);
   518                 PERF_LOG (iLogControlUserThread.iSubCategory, iLogControlUserThread.iUserData, iLogControlUserThread.iUserData2);
   519                 
   520                 NKern::Sleep(iLogControlUserThread.iLogPeriodTick);
   521 				}
   522 			
   523 			
   524 			}
   525 			break;
   526 			
   527         default:
   528 			__PRINT1("#KPLogTest:DKPLoggerTestHelperLDD::DoControl() Wrong function number:%d!", aFunction);
   529 			Kern::PanicCurrentThread(KPLoggerHelperTestDrv, EWrongRequest);
   530 			break;
   531 			
   532 		};
   533 	
   534 	
   535     return KErrNone;
   536 	}
   537 
   538 
   539 
   540 //###################################################################################
   541 //#            LDD factory, DKPLoggerTestHelperLDDFactory class implementation 
   542 //###################################################################################
   543 
   544 DKPLoggerTestHelperLDDFactory::DKPLoggerTestHelperLDDFactory()
   545 	{
   546     iUnitsMask = 0x00; //-- don't support units
   547     iVersion=TVersion(KMajorVersionNumber,KMinorVersionNumber,KBuildVersionNumber);	
   548 	}
   549 
   550 DKPLoggerTestHelperLDDFactory::~DKPLoggerTestHelperLDDFactory()
   551 	{
   552     __PRINT("#KPLogTest:~DKPLoggerTestHelperLDDFactory()");
   553 	}
   554 
   555 //-----------------------------------------------------------------------------------
   556 
   557 /**
   558 	static factory function for the LDD factory.
   559 
   560 	@return pointer to the created instance of the class
   561 */
   562 DKPLoggerTestHelperLDDFactory* DKPLoggerTestHelperLDDFactory::CreateInstance()
   563 	{
   564     __PRINT("#KPLogTest:DKPLoggerTestHelperLDDFactory::CreateInstance()");
   565     
   566     //-- create LDD factory
   567     DKPLoggerTestHelperLDDFactory* pSelf = new DKPLoggerTestHelperLDDFactory;
   568 	
   569     if(!pSelf)
   570 		{//-- OOM 
   571         __PRINT("#KPLogTest:DKPLoggerTestHelperLDDFactory::CreateInstance(): Unable to create class instance !");
   572 		}
   573 	
   574     return pSelf;
   575 	}
   576 
   577 //-----------------------------------------------------------------------------------
   578 
   579 /**
   580 */
   581 TInt DKPLoggerTestHelperLDDFactory::Install()
   582 	{
   583     return SetName(&KPLoggerHelperTestDrv); // Set our name and return error code
   584 	}
   585 
   586 //-----------------------------------------------------------------------------------
   587 
   588 /**
   589 */
   590 void DKPLoggerTestHelperLDDFactory::GetCaps(TDes8& /*aDes*/) const
   591 	{//-- not supported
   592 	}
   593 
   594 //-----------------------------------------------------------------------------------
   595 
   596 /**
   597 	LDD factory function. Creates LDD object.
   598 	@param  aChannel    A pointer to an LDD channel object which will be initialised on return.
   599 	@return KErrNone    if object successfully allocated, KErrNoMemory if not.
   600 	@return KErrAlreadyExists	if the client tries to creae more than 1 instance of the channel
   601 
   602 */
   603 TInt DKPLoggerTestHelperLDDFactory::Create(DLogicalChannelBase*& aChannel)
   604 	{
   605 
   606 	if(DKPLoggerTestHelperLDD::pSelf)
   607 		{//-- channel is a singleton, can't have more than one instance
   608         __PRINT("#DKPLoggerTestHelperLDDFactory::Create: Attmpt to create another instance of the LDD!");
   609         return KErrAlreadyExists;
   610 		}
   611     
   612 	aChannel = DKPLoggerTestHelperLDD::CreateInstance();
   613     if(!aChannel)
   614         return KErrNoMemory;  
   615 	
   616     return KErrNone;
   617 	}
   618 
   619 
   620 //-----------------------------------------------------------------------------------
   621 
   622 /**
   623 	"Standard LDD" entrypoint.
   624 	Is called on CreateLogicalDevice() if the user calls LoadLogicalDevice(). Creates LDD factory.
   625 
   626 	@return pointer to the LDD factory object.
   627 */
   628 DECLARE_STANDARD_LDD()
   629 	{
   630     DKPLoggerTestHelperLDDFactory* pLDDFactory = DKPLoggerTestHelperLDDFactory::CreateInstance();
   631     return  pLDDFactory;
   632 	}
   633 
   634 
   635 
   636 
   637 
   638 
   639 
   640 
   641 
   642 
   643 
   644 
   645 
   646 
   647 
   648 
   649 
   650 
   651 
   652 
   653 
   654 
   655 
   656 
   657 
   658 
   659 
   660 
   661