os/kernelhwsrv/kerneltest/e32test/debug/t_perflogger_drv.inl
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 //
    15 
    16 /**
    17  @file
    18 */
    19 
    20 #ifndef T_PERFLOGGER_DRV_INL__
    21 #define T_PERFLOGGER_DRV_INL__
    22 
    23 
    24 //-----------------------------------------------------------------------------------
    25 
    26 TTestLogCtrl::TTestLogCtrl()
    27 {
    28     iLogsNum = -1;       //-- invalid default value
    29     iLogPeriodTick = 10; //-- 10 ms by default
    30 
    31     iCategory=0x88;
    32     iSubCategory=0x99;
    33     
    34     iUserData  = 0xBEEEBEEE;
    35     iUserData2 = 0xAABBCCDD;
    36     
    37 }
    38 
    39 //-----------------------------------------------------------------------------------
    40 
    41 #ifndef __KERNEL_MODE__
    42 
    43 /**
    44     Open LDD.
    45     @param  aVer version required
    46     @return System-wide error code
    47 */
    48 TInt RKPLoggerTestHelper::Open(const TVersion& aVer)
    49 { 
    50     return DoCreate(KPLoggerHelperTestDrv, aVer, KNullUnit, NULL, NULL, EOwnerProcess);
    51 }
    52 
    53 /**
    54     Cancel all pending requests and close LDD
    55 */
    56 void RKPLoggerTestHelper::Close()
    57 {
    58     CancelLogFromISR();
    59     CancelLogFromIDFC();
    60     CancelLogFromDFC();
    61     RBusLogicalChannel::Close();
    62 }
    63 
    64 
    65 /**
    66     @return Current LDD version    
    67 */
    68 TVersion RKPLoggerTestHelper::VersionRequired() const
    69 { 
    70     return TVersion(EMajorVersionNumber,EMinorVersionNumber,EBuildVersionNumber);
    71 }
    72 
    73 
    74 
    75 /**
    76     Synchronous request to make a number of logging from user thread.
    77     Logging is performen in the context of the user caller thread
    78 
    79     @param  aLogCtrl    control parameters for logging
    80     @return             System wide error code
    81 */
    82 TInt RKPLoggerTestHelper::MakeLogFromUserThread(const TTestLogCtrl& aLogCtrl)
    83 {
    84     return DoControl(EDoLogFromUserThread, (TAny*)&aLogCtrl);
    85 }
    86 
    87 
    88 /**
    89     test different PERF_LOG macros, logging from the user thread. Just unit test
    90     @param  aLogCtrl    control parameters for logging
    91     @return             System wide error code
    92 */
    93 TInt RKPLoggerTestHelper::TestDifferentMacros(const TTestLogCtrl& aLogCtrl)
    94 {
    95     return DoControl(EDoTestMacros, (TAny*)&aLogCtrl);
    96 }
    97 
    98 
    99 /**
   100     Asynchronous request to make a number of logging from ISR. NTimer is used for this purpose.
   101 
   102     @param  aRqStat     request status, will be completed when all done.
   103     @param  aLogCtrl    control parameters for logging
   104 */
   105 void RKPLoggerTestHelper::MakeLogFromISR(TRequestStatus& aRqStat, const TTestLogCtrl& aLogCtrl)
   106 {
   107     DoRequest(EDoLogFromISR, aRqStat, (TAny*)&aLogCtrl);
   108 }
   109 
   110 /** cancel ISR logging request */
   111 void RKPLoggerTestHelper::CancelLogFromISR()
   112 {
   113     DoCancel(EDoLogFromISR);
   114 }
   115 
   116 /**
   117     Asynchronous request to make a number of logging from IDFC. NTimer is used for this purpose.
   118 
   119     @param  aRqStat     request status, will be completed when all done.
   120     @param  aLogCtrl    control parameters for logging
   121 */
   122 void RKPLoggerTestHelper::MakeLogFromIDFC(TRequestStatus& aRqStat, const TTestLogCtrl& aLogCtrl)
   123 {
   124     DoRequest(EDoLogFromIDFC, aRqStat, (TAny*)&aLogCtrl);
   125 }
   126 
   127 /** cancel IDFC logging request */
   128 void RKPLoggerTestHelper::CancelLogFromIDFC()
   129 {
   130     DoCancel(EDoLogFromIDFC);
   131 }
   132 
   133 /**
   134     Asynchronous request to make a number of logging from DFC. NTimer is used for this purpose.
   135 
   136     @param  aRqStat     request status, will be completed when all done.
   137     @param  aLogCtrl    control parameters for logging
   138 */
   139 void RKPLoggerTestHelper::MakeLogFromDFC(TRequestStatus& aRqStat, const TTestLogCtrl& aLogCtrl)
   140 {
   141     DoRequest(EDoLogFromDFC, aRqStat, (TAny*)&aLogCtrl);
   142 }
   143 
   144 /** cancel DFC logging request */
   145 void RKPLoggerTestHelper::CancelLogFromDFC()
   146 {
   147     DoCancel(EDoLogFromDFC);
   148 }
   149 
   150 
   151 #endif  //__KERNEL_MODE__
   152 
   153 
   154 
   155 #endif  //T_PERFLOGGER_DRV_INL__
   156 
   157 
   158 
   159