os/kernelhwsrv/kerneltest/e32test/bench/d_kernasmbm.h
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 // e32test\bench\d_kernasmbm.h
    15 // Header defining interface to d_kernasmbm ldd
    16 // 
    17 //
    18 
    19 #ifndef __D_KERNASMBM_H__
    20 #define __D_KERNASMBM_H__
    21 
    22 #include "t_asmbm.h"
    23 
    24 _LIT(KKernAsmBmLddName,"d_kernasmbm");
    25 
    26 const TInt KKernAsmBmBufferSize = 64*1024 + 32;
    27 
    28 class RKernAsmBmLdd : public RBusLogicalChannel, public MBenchmarkList
    29 	{
    30 public:
    31 	enum TControl
    32 		{
    33 		ECount,
    34 		EInfo,
    35 		ERun
    36 		};
    37 public:
    38 	inline TInt Open();
    39 	inline void Close();
    40 	inline virtual TInt Count();
    41 	inline virtual TInt Info(TInt aIndex, TBmInfo& aInfoOut);
    42 	inline virtual TInt Run(TInt aIndex, const TBmParams& aParams, TInt& aDeltaOut);
    43 private:
    44 	TAny* iBuf;  // buffer to test kern <-> user transfers
    45 	};
    46 
    47 #ifndef __KERNEL_MODE__
    48 
    49 #include <e32std.h>
    50 
    51 inline TInt RKernAsmBmLdd::Open()
    52 	{
    53 	iBuf = User::Alloc(KKernAsmBmBufferSize + 32);
    54 	if (!iBuf)
    55 		return KErrNoMemory;
    56 	return DoCreate(KKernAsmBmLddName,TVersion(0,1,1),KNullUnit,NULL,NULL);
    57 	}
    58 
    59 inline void RKernAsmBmLdd::Close()
    60 	{
    61 	User::Free(iBuf);
    62 	iBuf = NULL;
    63 	RBusLogicalChannel::Close();
    64 	}
    65 
    66 inline TInt RKernAsmBmLdd::Count()
    67 	{
    68 	return DoControl(ECount);
    69 	}
    70 
    71 inline TInt RKernAsmBmLdd::Info(TInt aIndex, TBmInfo& aInfoOut)
    72 	{
    73 	TPckg<TBmInfo> infoPckg(aInfoOut);
    74 	return DoControl(EInfo | (aIndex << 8), &infoPckg);
    75 	}
    76 
    77 inline TInt RKernAsmBmLdd::Run(TInt aIndex, const TBmParams& aParams, TInt& aDeltaOut)
    78 	{
    79 	TPckgC<TBmParams> paramsPckg(aParams);
    80 	TInt r = DoControl(ERun | (aIndex << 8), &paramsPckg, iBuf);
    81 	if (r == KErrNone)
    82 		aDeltaOut = *(TInt*)iBuf;
    83 	return r;
    84 	}
    85 
    86 #endif
    87 
    88 #endif