os/kernelhwsrv/kerneltest/e32test/system/d_kucopy.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/kernelhwsrv/kerneltest/e32test/system/d_kucopy.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,178 @@
     1.4 +// Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of the License "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +// e32test\system\d_kucopy.h
    1.18 +// 
    1.19 +//
    1.20 +
    1.21 +#if !defined(__D_KUCOPY_H__)
    1.22 +#define __D_KUCOPY_H__
    1.23 +#include <e32cmn.h>
    1.24 +#ifndef __KERNEL_MODE__
    1.25 +#include <e32std.h>
    1.26 +#endif
    1.27 +
    1.28 +_LIT(KKUCopyLddName,"KUCopy");
    1.29 +
    1.30 +class TCapsKUCopyV01
    1.31 +	{
    1.32 +public:
    1.33 +	TVersion	iVersion;
    1.34 +	};
    1.35 +
    1.36 +struct SCopyInfo
    1.37 +	{
    1.38 +	SCopyInfo()
    1.39 +		: iPtr(NULL), iOffset(0), iLength(0)
    1.40 +		{}
    1.41 +	SCopyInfo(const TUint8* aPtr, TInt aOffset, TInt aLength)
    1.42 +		: iPtr(aPtr), iOffset(aOffset), iLength(aLength)
    1.43 +		{}
    1.44 +	const TUint8* iPtr;
    1.45 +	TInt iOffset;
    1.46 +	TInt iLength;
    1.47 +	};
    1.48 +
    1.49 +struct SSetInfo
    1.50 +	{
    1.51 +	SSetInfo()
    1.52 +		: iPtr(NULL), iLength(0), iValue(0)
    1.53 +		{}
    1.54 +	SSetInfo(TUint8* aPtr, TInt aLength, TUint8 aValue)
    1.55 +		: iPtr(aPtr), iLength(aLength), iValue(aValue)
    1.56 +		{}
    1.57 +	TUint8* iPtr;
    1.58 +	TInt iLength;
    1.59 +	TUint iValue;
    1.60 +	};
    1.61 +
    1.62 +struct SDesInfo
    1.63 +	{
    1.64 +	TInt iLength;
    1.65 +	TInt iMaxLength;
    1.66 +	TAny* iPtr;
    1.67 +	};
    1.68 +
    1.69 +class RKUCopy : public RBusLogicalChannel
    1.70 +	{
    1.71 +public:
    1.72 +	enum TControl
    1.73 +		{
    1.74 +		EControlPut,
    1.75 +		EControlGet,
    1.76 +		EControlPut32,
    1.77 +		EControlGet32,
    1.78 +		EControlSet,
    1.79 +		EControlLength,
    1.80 +		EControlRead,
    1.81 +		EControlRandomLength,
    1.82 +		EControlReadRandom,
    1.83 +		EControlDesPut8,
    1.84 +		EControlDesGet8,
    1.85 +		EControlDesInfo8,
    1.86 +		EControlDesPut16,
    1.87 +		EControlDesGet16,
    1.88 +		EControlDesInfo16,
    1.89 +		EControlKernBufAddr,
    1.90 +		EControlRequestComplete, 
    1.91 +		EControlRequestCompleteLocal, 
    1.92 +		EControlQueueRequestComplete, 
    1.93 +		};
    1.94 +public:
    1.95 +#ifndef __KERNEL_MODE__
    1.96 +	inline TInt Open();
    1.97 +	inline void Put(TUint8* aDest, TInt aOffset, TInt aLength);
    1.98 +	inline void Get(const TUint8* aSrc, TInt aOffset, TInt aLength);
    1.99 +	inline void Put32(TUint32* aDest, TInt aOffset, TInt aLength);
   1.100 +	inline void Get32(const TUint32* aSrc, TInt aOffset, TInt aLength);
   1.101 +	inline void Set(TUint8* aDest, TInt aLength, TUint8 aValue);
   1.102 +	inline TInt Length();
   1.103 +	inline void Read(TUint8* aDest);
   1.104 +	inline TInt RandomLength();
   1.105 +	inline void ReadRandom(TUint8* aDest);
   1.106 +	inline void DesPut(TDes8& aDest, const TDesC8& aSrc);
   1.107 +	inline void DesGet(TDes8& aDest, const TDesC8& aSrc);
   1.108 +	inline void DesInfo(const TDesC8& aDes, SDesInfo& aInfo);
   1.109 +	inline void DesPut(TDes16& aDest, const TDesC16& aSrc);
   1.110 +	inline void DesGet(TDes16& aDest, const TDesC16& aSrc);
   1.111 +	inline void DesInfo(const TDesC16& aDes, SDesInfo& aInfo);
   1.112 +	inline TUint8* KernelBufferAddress();
   1.113 +	inline void RequestComplete(TRequestStatus* status);
   1.114 +	inline void RequestCompleteLocal(TRequestStatus* status);
   1.115 +	inline TInt QueueRequestComplete(TRequestStatus* status);
   1.116 +#endif
   1.117 +	};
   1.118 +
   1.119 +#ifndef __KERNEL_MODE__
   1.120 +inline TInt RKUCopy::Open()
   1.121 +	{ return DoCreate(KKUCopyLddName,TVersion(1,0,0),KNullUnit,NULL,NULL); }
   1.122 +
   1.123 +inline void RKUCopy::Put(TUint8* aDest, TInt aOffset, TInt aLength)
   1.124 +	{ SCopyInfo info(aDest,aOffset,aLength); DoControl(EControlPut,&info); }
   1.125 +
   1.126 +inline void RKUCopy::Get(const TUint8* aSrc, TInt aOffset, TInt aLength)
   1.127 +	{ SCopyInfo info(aSrc,aOffset,aLength); DoControl(EControlGet,&info); }
   1.128 +
   1.129 +inline void RKUCopy::Put32(TUint32* aDest, TInt aOffset, TInt aLength)
   1.130 +	{ SCopyInfo info((const TUint8*)aDest,aOffset,aLength); DoControl(EControlPut32,&info); }
   1.131 +
   1.132 +inline void RKUCopy::Get32(const TUint32* aSrc, TInt aOffset, TInt aLength)
   1.133 +	{ SCopyInfo info((const TUint8*)aSrc,aOffset,aLength); DoControl(EControlGet32,&info); }
   1.134 +
   1.135 +inline void RKUCopy::Set(TUint8* aDest, TInt aLength, TUint8 aValue)
   1.136 +	{ SSetInfo info(aDest,aLength,aValue); DoControl(EControlSet,&info); }
   1.137 +
   1.138 +inline TInt RKUCopy::Length()
   1.139 +	{ return DoControl(EControlLength); }
   1.140 +
   1.141 +inline void RKUCopy::Read(TUint8* aDest)
   1.142 +	{ DoControl(EControlRead,aDest); }
   1.143 +
   1.144 +inline TInt RKUCopy::RandomLength()
   1.145 +	{ return DoControl(EControlRandomLength); }
   1.146 +
   1.147 +inline void RKUCopy::ReadRandom(TUint8* aDest)
   1.148 +	{ DoControl(EControlReadRandom,aDest); }
   1.149 +
   1.150 +inline void RKUCopy::DesPut(TDes8& aDest, const TDesC8& aSrc)
   1.151 +	{ DoControl(EControlDesPut8, &aDest, (TAny*)&aSrc); }
   1.152 +
   1.153 +inline void RKUCopy::DesGet(TDes8& aDest, const TDesC8& aSrc)
   1.154 +	{ DoControl(EControlDesGet8, &aDest, (TAny*)&aSrc); }
   1.155 +
   1.156 +inline void RKUCopy::DesInfo(const TDesC8& aDes, SDesInfo& aInfo)
   1.157 +	{ DoControl(EControlDesInfo8, (TAny*)&aDes, &aInfo); }
   1.158 +
   1.159 +inline void RKUCopy::DesPut(TDes16& aDest, const TDesC16& aSrc)
   1.160 +	{ DoControl(EControlDesPut16, &aDest, (TAny*)&aSrc); }
   1.161 +
   1.162 +inline void RKUCopy::DesGet(TDes16& aDest, const TDesC16& aSrc)
   1.163 +	{ DoControl(EControlDesGet16, &aDest, (TAny*)&aSrc); }
   1.164 +
   1.165 +inline void RKUCopy::DesInfo(const TDesC16& aDes, SDesInfo& aInfo)
   1.166 +	{ DoControl(EControlDesInfo16, (TAny*)&aDes, &aInfo); }
   1.167 +
   1.168 +inline TUint8* RKUCopy::KernelBufferAddress()
   1.169 +	{ return (TUint8*)DoControl(EControlKernBufAddr); }
   1.170 +
   1.171 +inline void RKUCopy::RequestComplete(TRequestStatus* status)
   1.172 +	{ DoControl(EControlRequestComplete, status); }
   1.173 +
   1.174 +inline void RKUCopy::RequestCompleteLocal(TRequestStatus* status)
   1.175 +	{ DoControl(EControlRequestCompleteLocal, status); }
   1.176 +
   1.177 +inline TInt RKUCopy::QueueRequestComplete(TRequestStatus* status)
   1.178 +	{ return DoControl(EControlQueueRequestComplete, status); }
   1.179 +#endif
   1.180 +
   1.181 +#endif