1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/kernelhwsrv/kerneltest/e32test/dll/d_export.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,113 @@
1.4 +// Copyright (c) 2004-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\mmu\d_export.cpp
1.18 +//
1.19 +//
1.20 +
1.21 +#include <kernel/kern_priv.h>
1.22 +#include "d_export.h"
1.23 +
1.24 +//
1.25 +// Class definitions
1.26 +//
1.27 +
1.28 +class DExportFactory : public DLogicalDevice
1.29 + {
1.30 +public:
1.31 + ~DExportFactory();
1.32 + virtual TInt Install();
1.33 + virtual void GetCaps(TDes8& aDes) const;
1.34 + virtual TInt Create(DLogicalChannelBase*& aChannel);
1.35 + };
1.36 +
1.37 +class DExportChannel : public DLogicalChannelBase
1.38 + {
1.39 +public:
1.40 + DExportChannel();
1.41 + ~DExportChannel();
1.42 + virtual TInt DoCreate(TInt aUnit, const TDesC8* anInfo, const TVersion& aVer);
1.43 + virtual TInt Request(TInt aFunction, TAny* a1, TAny* a2);
1.44 +public:
1.45 + DExportFactory* iFactory;
1.46 + };
1.47 +
1.48 +//
1.49 +// DExportFactory
1.50 +//
1.51 +
1.52 +TInt DExportFactory::Install()
1.53 + {
1.54 + return SetName(&KExportTestLddName);
1.55 + }
1.56 +
1.57 +DExportFactory::~DExportFactory()
1.58 + {
1.59 + }
1.60 +
1.61 +void DExportFactory::GetCaps(TDes8& /*aDes*/) const
1.62 + {
1.63 + // Not used but required as DLogicalDevice::GetCaps is pure virtual
1.64 + }
1.65 +
1.66 +TInt DExportFactory::Create(DLogicalChannelBase*& aChannel)
1.67 + {
1.68 + aChannel = NULL;
1.69 + DExportChannel* channel=new DExportChannel;
1.70 + if(!channel)
1.71 + return KErrNoMemory;
1.72 + channel->iFactory = this;
1.73 + aChannel = channel;
1.74 + return KErrNone;
1.75 + }
1.76 +
1.77 +DECLARE_STANDARD_LDD()
1.78 + {
1.79 + return new DExportFactory;
1.80 + }
1.81 +
1.82 +//
1.83 +// DExportChannel
1.84 +//
1.85 +
1.86 +TInt DExportChannel::DoCreate(TInt /*aUnit*/, const TDesC8* /*aInfo*/, const TVersion& /*aVer*/)
1.87 + {
1.88 + return KErrNone;
1.89 + }
1.90 +
1.91 +DExportChannel::DExportChannel()
1.92 + {
1.93 + }
1.94 +
1.95 +DExportChannel::~DExportChannel()
1.96 + {
1.97 + }
1.98 +
1.99 +
1.100 +TInt DExportChannel::Request(TInt aFunction, TAny* a1, TAny* a2)
1.101 + {
1.102 + TInt r=KErrNotSupported;
1.103 +
1.104 + switch(aFunction)
1.105 + {
1.106 + case RExportLdd::ERunExport:
1.107 + r = ExportMultiplyFunction((TUint)a1, (TUint)a2);
1.108 + break;
1.109 + }
1.110 + return r;
1.111 + }
1.112 +
1.113 +EXPORT_C TInt ExportMultiplyFunction(TUint aNum0, TUint aNum1)
1.114 + {
1.115 + return aNum0 * aNum1;
1.116 + }