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