1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/kernelhwsrv/kerneltest/e32test/device/d_lddturnaroundtimertest.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,124 @@
1.4 +// Copyright (c) 2006-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\device\d_lddturnaoundtimertest.cpp
1.18 +// LDD for getting the timer count & ticks for testing turnaround timer implementation.
1.19 +//
1.20 +//
1.21 +
1.22 +#include <kernel/kernel.h>
1.23 +#include "d_lddturnaroundtimertest.h"
1.24 +
1.25 +class DTest1;
1.26 +class DTestFactory : public DLogicalDevice
1.27 +//
1.28 +// Test LDD factory
1.29 +//
1.30 + {
1.31 +public:
1.32 + DTestFactory();
1.33 + virtual TInt Install(); //overriding pure virtual
1.34 + virtual void GetCaps(TDes8& aDes) const; //overriding pure virtual
1.35 + virtual TInt Create(DLogicalChannelBase*& aChannel); //overriding pure virtual
1.36 + };
1.37 +
1.38 +class DTest1 : public DLogicalChannelBase
1.39 +//
1.40 +// Test logical channel
1.41 +//
1.42 + {
1.43 +public:
1.44 + virtual ~DTest1();
1.45 +protected:
1.46 + virtual TInt DoCreate(TInt aUnit, const TDesC8* anInfo, const TVersion& aVer);
1.47 + virtual TInt Request(TInt aReqNo, TAny* a1, TAny* a2);
1.48 + };
1.49 +
1.50 +
1.51 +
1.52 +DECLARE_STANDARD_LDD()
1.53 + {
1.54 + return new DTestFactory;
1.55 + }
1.56 +
1.57 +//
1.58 +// Constructor
1.59 +//
1.60 +DTestFactory::DTestFactory()
1.61 + {
1.62 +
1.63 + }
1.64 +
1.65 +TInt DTestFactory::Create(DLogicalChannelBase*& aChannel)
1.66 + {
1.67 +//
1.68 +// Create new channel
1.69 +//
1.70 + aChannel=new DTest1;
1.71 + return aChannel?KErrNone:KErrNoMemory;
1.72 + }
1.73 +
1.74 +TInt DTestFactory::Install()
1.75 +//
1.76 +// Install the LDD - overriding pure virtual
1.77 +//
1.78 + {
1.79 + return SetName(&KLddName);
1.80 + }
1.81 +
1.82 +void DTestFactory::GetCaps(TDes8& /*aDes*/) const
1.83 +//
1.84 +// Get capabilities - overriding pure virtual
1.85 +//
1.86 + {
1.87 + }
1.88 +
1.89 +TInt DTest1::DoCreate(TInt /*aUnit*/, const TDesC8* /*aInfo*/, const TVersion& /*aVer*/)
1.90 +//
1.91 +// Create channel
1.92 +//
1.93 + {
1.94 + return KErrNone;
1.95 + }
1.96 +
1.97 +DTest1::~DTest1()
1.98 +//
1.99 +// Destructor
1.100 +//
1.101 + {
1.102 + }
1.103 +
1.104 +TInt DTest1::Request(TInt aReqNo, TAny* a1, TAny* /*a2*/)
1.105 + {
1.106 +//
1.107 +// Get the timer tick count & ticks
1.108 +//
1.109 + TUint temp = 0;
1.110 + switch(aReqNo)
1.111 + {
1.112 + case (RLddTest1::EGET_TIMERTICKS):
1.113 + {
1.114 + kumemget32(&temp, a1, sizeof(temp));
1.115 + temp = NKern::TimerTicks(temp);
1.116 + kumemput(a1, &temp, sizeof(temp));
1.117 + return KErrNone;
1.118 + }
1.119 + case (RLddTest1::EGET_TIMERTICKCOUNT):
1.120 + {
1.121 + temp = NKern::TickCount();
1.122 + kumemput(a1, &temp, sizeof(temp));
1.123 + return KErrNone;
1.124 + }
1.125 + }
1.126 + return KErrNone;
1.127 +}