os/kernelhwsrv/kerneltest/e32test/system/d_kucopy.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
// Copyright (c) 1999-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
// e32test\system\d_kucopy.h
sl@0
    15
// 
sl@0
    16
//
sl@0
    17
sl@0
    18
#if !defined(__D_KUCOPY_H__)
sl@0
    19
#define __D_KUCOPY_H__
sl@0
    20
#include <e32cmn.h>
sl@0
    21
#ifndef __KERNEL_MODE__
sl@0
    22
#include <e32std.h>
sl@0
    23
#endif
sl@0
    24
sl@0
    25
_LIT(KKUCopyLddName,"KUCopy");
sl@0
    26
sl@0
    27
class TCapsKUCopyV01
sl@0
    28
	{
sl@0
    29
public:
sl@0
    30
	TVersion	iVersion;
sl@0
    31
	};
sl@0
    32
sl@0
    33
struct SCopyInfo
sl@0
    34
	{
sl@0
    35
	SCopyInfo()
sl@0
    36
		: iPtr(NULL), iOffset(0), iLength(0)
sl@0
    37
		{}
sl@0
    38
	SCopyInfo(const TUint8* aPtr, TInt aOffset, TInt aLength)
sl@0
    39
		: iPtr(aPtr), iOffset(aOffset), iLength(aLength)
sl@0
    40
		{}
sl@0
    41
	const TUint8* iPtr;
sl@0
    42
	TInt iOffset;
sl@0
    43
	TInt iLength;
sl@0
    44
	};
sl@0
    45
sl@0
    46
struct SSetInfo
sl@0
    47
	{
sl@0
    48
	SSetInfo()
sl@0
    49
		: iPtr(NULL), iLength(0), iValue(0)
sl@0
    50
		{}
sl@0
    51
	SSetInfo(TUint8* aPtr, TInt aLength, TUint8 aValue)
sl@0
    52
		: iPtr(aPtr), iLength(aLength), iValue(aValue)
sl@0
    53
		{}
sl@0
    54
	TUint8* iPtr;
sl@0
    55
	TInt iLength;
sl@0
    56
	TUint iValue;
sl@0
    57
	};
sl@0
    58
sl@0
    59
struct SDesInfo
sl@0
    60
	{
sl@0
    61
	TInt iLength;
sl@0
    62
	TInt iMaxLength;
sl@0
    63
	TAny* iPtr;
sl@0
    64
	};
sl@0
    65
sl@0
    66
class RKUCopy : public RBusLogicalChannel
sl@0
    67
	{
sl@0
    68
public:
sl@0
    69
	enum TControl
sl@0
    70
		{
sl@0
    71
		EControlPut,
sl@0
    72
		EControlGet,
sl@0
    73
		EControlPut32,
sl@0
    74
		EControlGet32,
sl@0
    75
		EControlSet,
sl@0
    76
		EControlLength,
sl@0
    77
		EControlRead,
sl@0
    78
		EControlRandomLength,
sl@0
    79
		EControlReadRandom,
sl@0
    80
		EControlDesPut8,
sl@0
    81
		EControlDesGet8,
sl@0
    82
		EControlDesInfo8,
sl@0
    83
		EControlDesPut16,
sl@0
    84
		EControlDesGet16,
sl@0
    85
		EControlDesInfo16,
sl@0
    86
		EControlKernBufAddr,
sl@0
    87
		EControlRequestComplete, 
sl@0
    88
		EControlRequestCompleteLocal, 
sl@0
    89
		EControlQueueRequestComplete, 
sl@0
    90
		};
sl@0
    91
public:
sl@0
    92
#ifndef __KERNEL_MODE__
sl@0
    93
	inline TInt Open();
sl@0
    94
	inline void Put(TUint8* aDest, TInt aOffset, TInt aLength);
sl@0
    95
	inline void Get(const TUint8* aSrc, TInt aOffset, TInt aLength);
sl@0
    96
	inline void Put32(TUint32* aDest, TInt aOffset, TInt aLength);
sl@0
    97
	inline void Get32(const TUint32* aSrc, TInt aOffset, TInt aLength);
sl@0
    98
	inline void Set(TUint8* aDest, TInt aLength, TUint8 aValue);
sl@0
    99
	inline TInt Length();
sl@0
   100
	inline void Read(TUint8* aDest);
sl@0
   101
	inline TInt RandomLength();
sl@0
   102
	inline void ReadRandom(TUint8* aDest);
sl@0
   103
	inline void DesPut(TDes8& aDest, const TDesC8& aSrc);
sl@0
   104
	inline void DesGet(TDes8& aDest, const TDesC8& aSrc);
sl@0
   105
	inline void DesInfo(const TDesC8& aDes, SDesInfo& aInfo);
sl@0
   106
	inline void DesPut(TDes16& aDest, const TDesC16& aSrc);
sl@0
   107
	inline void DesGet(TDes16& aDest, const TDesC16& aSrc);
sl@0
   108
	inline void DesInfo(const TDesC16& aDes, SDesInfo& aInfo);
sl@0
   109
	inline TUint8* KernelBufferAddress();
sl@0
   110
	inline void RequestComplete(TRequestStatus* status);
sl@0
   111
	inline void RequestCompleteLocal(TRequestStatus* status);
sl@0
   112
	inline TInt QueueRequestComplete(TRequestStatus* status);
sl@0
   113
#endif
sl@0
   114
	};
sl@0
   115
sl@0
   116
#ifndef __KERNEL_MODE__
sl@0
   117
inline TInt RKUCopy::Open()
sl@0
   118
	{ return DoCreate(KKUCopyLddName,TVersion(1,0,0),KNullUnit,NULL,NULL); }
sl@0
   119
sl@0
   120
inline void RKUCopy::Put(TUint8* aDest, TInt aOffset, TInt aLength)
sl@0
   121
	{ SCopyInfo info(aDest,aOffset,aLength); DoControl(EControlPut,&info); }
sl@0
   122
sl@0
   123
inline void RKUCopy::Get(const TUint8* aSrc, TInt aOffset, TInt aLength)
sl@0
   124
	{ SCopyInfo info(aSrc,aOffset,aLength); DoControl(EControlGet,&info); }
sl@0
   125
sl@0
   126
inline void RKUCopy::Put32(TUint32* aDest, TInt aOffset, TInt aLength)
sl@0
   127
	{ SCopyInfo info((const TUint8*)aDest,aOffset,aLength); DoControl(EControlPut32,&info); }
sl@0
   128
sl@0
   129
inline void RKUCopy::Get32(const TUint32* aSrc, TInt aOffset, TInt aLength)
sl@0
   130
	{ SCopyInfo info((const TUint8*)aSrc,aOffset,aLength); DoControl(EControlGet32,&info); }
sl@0
   131
sl@0
   132
inline void RKUCopy::Set(TUint8* aDest, TInt aLength, TUint8 aValue)
sl@0
   133
	{ SSetInfo info(aDest,aLength,aValue); DoControl(EControlSet,&info); }
sl@0
   134
sl@0
   135
inline TInt RKUCopy::Length()
sl@0
   136
	{ return DoControl(EControlLength); }
sl@0
   137
sl@0
   138
inline void RKUCopy::Read(TUint8* aDest)
sl@0
   139
	{ DoControl(EControlRead,aDest); }
sl@0
   140
sl@0
   141
inline TInt RKUCopy::RandomLength()
sl@0
   142
	{ return DoControl(EControlRandomLength); }
sl@0
   143
sl@0
   144
inline void RKUCopy::ReadRandom(TUint8* aDest)
sl@0
   145
	{ DoControl(EControlReadRandom,aDest); }
sl@0
   146
sl@0
   147
inline void RKUCopy::DesPut(TDes8& aDest, const TDesC8& aSrc)
sl@0
   148
	{ DoControl(EControlDesPut8, &aDest, (TAny*)&aSrc); }
sl@0
   149
sl@0
   150
inline void RKUCopy::DesGet(TDes8& aDest, const TDesC8& aSrc)
sl@0
   151
	{ DoControl(EControlDesGet8, &aDest, (TAny*)&aSrc); }
sl@0
   152
sl@0
   153
inline void RKUCopy::DesInfo(const TDesC8& aDes, SDesInfo& aInfo)
sl@0
   154
	{ DoControl(EControlDesInfo8, (TAny*)&aDes, &aInfo); }
sl@0
   155
sl@0
   156
inline void RKUCopy::DesPut(TDes16& aDest, const TDesC16& aSrc)
sl@0
   157
	{ DoControl(EControlDesPut16, &aDest, (TAny*)&aSrc); }
sl@0
   158
sl@0
   159
inline void RKUCopy::DesGet(TDes16& aDest, const TDesC16& aSrc)
sl@0
   160
	{ DoControl(EControlDesGet16, &aDest, (TAny*)&aSrc); }
sl@0
   161
sl@0
   162
inline void RKUCopy::DesInfo(const TDesC16& aDes, SDesInfo& aInfo)
sl@0
   163
	{ DoControl(EControlDesInfo16, (TAny*)&aDes, &aInfo); }
sl@0
   164
sl@0
   165
inline TUint8* RKUCopy::KernelBufferAddress()
sl@0
   166
	{ return (TUint8*)DoControl(EControlKernBufAddr); }
sl@0
   167
sl@0
   168
inline void RKUCopy::RequestComplete(TRequestStatus* status)
sl@0
   169
	{ DoControl(EControlRequestComplete, status); }
sl@0
   170
sl@0
   171
inline void RKUCopy::RequestCompleteLocal(TRequestStatus* status)
sl@0
   172
	{ DoControl(EControlRequestCompleteLocal, status); }
sl@0
   173
sl@0
   174
inline TInt RKUCopy::QueueRequestComplete(TRequestStatus* status)
sl@0
   175
	{ return DoControl(EControlQueueRequestComplete, status); }
sl@0
   176
#endif
sl@0
   177
sl@0
   178
#endif