kerneltest/e32test/mmu/d_sharedio.h
changeset 0 a41df078684a
equal deleted inserted replaced
-1:000000000000 0:a41df078684a
       
     1 // Copyright (c) 2002-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\mmu\d_sharedio.h
       
    15 // 
       
    16 //
       
    17 
       
    18 #ifndef __D_SLDD_H__
       
    19 #define __D_SLDD_H__
       
    20 #include <e32cmn.h>
       
    21 #ifndef __KERNEL_MODE__
       
    22 #include <e32std.h>
       
    23 #endif
       
    24 
       
    25 const TInt KSizeGlobalBuffer=0x2000;
       
    26 const TInt KMagic1=12345;
       
    27 const TInt KMagic2=54321;
       
    28 
       
    29 class RTestLdd : public RBusLogicalChannel
       
    30 	{
       
    31 public:
       
    32 	enum TControl
       
    33 		{
       
    34 		ECreateBuffer,
       
    35 		EMapInGlobalBuffer,
       
    36 		EMapOutGlobalBuffer,
       
    37 		EDestroyGlobalBuffer,
       
    38 		ECreateBufferPhysAddr,
       
    39 		EDestroyBufferPhysAddr,
       
    40 		EMapInBuffer,
       
    41 		EMapOutBuffer,
       
    42 		EDestroyBuffer,
       
    43 		ECheckBuffer,
       
    44 		EFillBuffer,
       
    45 		EThreadRW
       
    46 		};
       
    47 public:
       
    48 	inline TInt Open();
       
    49 	inline TInt CreateBuffer(TInt aLength);
       
    50 	inline TInt MapInGlobalBuffer(TUint aProcessId,TAny*& aAddress,TUint32& aLength);
       
    51 	inline TInt MapOutGlobalBuffer();
       
    52 	inline TInt DestroyGlobalBuffer();
       
    53 	inline TInt CreateBufferPhysAddr(TInt aLength);
       
    54 	inline TInt DestroyBufferPhysAddr();
       
    55 	inline TInt MapInBuffer(TAny** aAddress,TUint32* aLength);
       
    56 	inline TInt MapOutBuffer();
       
    57 	inline TInt DestroyBuffer();
       
    58 	inline TInt CheckBuffer(TUint32 key);
       
    59 	inline TInt FillBuffer(TUint32 key);
       
    60 	inline TInt ThreadRW(TDes8& aDes,TInt aThreadId=-1);
       
    61 	};
       
    62 
       
    63 _LIT(KSharedIoTestLddName,"D_SHAREDIO");
       
    64 
       
    65 #ifndef __KERNEL_MODE__
       
    66 inline TInt RTestLdd::Open()
       
    67 	{ return DoCreate(KSharedIoTestLddName,TVersion(),KNullUnit,NULL,NULL); }
       
    68 inline TInt RTestLdd::CreateBuffer(TInt aLength)
       
    69 	{ return DoControl(ECreateBuffer,(TAny*)aLength); }
       
    70 inline TInt RTestLdd::MapInGlobalBuffer(TUint aProcessId,TAny*& aAddress,TUint32& aLength)
       
    71 	{
       
    72 	TUint a = aProcessId;
       
    73 	TInt r=DoControl(EMapInGlobalBuffer,&a,&aLength);
       
    74 	aAddress = (TAny*)a;
       
    75 	return r;
       
    76 	}
       
    77 inline TInt RTestLdd::MapOutGlobalBuffer()
       
    78 	{ return DoControl(EMapOutGlobalBuffer); }
       
    79 inline TInt RTestLdd::DestroyGlobalBuffer()
       
    80 	{ return DoControl(EDestroyGlobalBuffer); }
       
    81 inline TInt RTestLdd::CreateBufferPhysAddr(TInt aLength)
       
    82 	{ return DoControl(ECreateBufferPhysAddr,(TAny*)aLength);	}
       
    83 inline TInt RTestLdd::DestroyBufferPhysAddr()
       
    84 	{ return DoControl(EDestroyBufferPhysAddr); }
       
    85 inline TInt RTestLdd::MapInBuffer(TAny** aAddress,TUint32* aLength)
       
    86 	{ return DoControl(EMapInBuffer,aAddress,aLength); }
       
    87 inline TInt RTestLdd::MapOutBuffer()
       
    88 	{ return DoControl(EMapOutBuffer); }
       
    89 inline TInt RTestLdd::DestroyBuffer()
       
    90 	{ return DoControl(EDestroyBuffer); }
       
    91 inline TInt RTestLdd::CheckBuffer(TUint32 key)
       
    92 	{ return DoControl(ECheckBuffer,(TAny*)key); }
       
    93 inline TInt RTestLdd::FillBuffer(TUint32 key)
       
    94 	{ return DoControl(EFillBuffer,(TAny*)key); }
       
    95 inline TInt RTestLdd::ThreadRW(TDes8& aDes,TInt aThreadId)
       
    96 	{ return DoControl(EThreadRW,(TAny*)&aDes,(TAny*)aThreadId); }
       
    97 #endif
       
    98 
       
    99 #endif
       
   100