os/kernelhwsrv/kerneltest/e32test/device/d_lddturnaroundtimertest.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
// Copyright (c) 2006-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\device\d_lddturnaoundtimertest.cpp
sl@0
    15
// LDD for getting the timer count & ticks for testing turnaround timer implementation.
sl@0
    16
// 
sl@0
    17
//
sl@0
    18
sl@0
    19
#include <kernel/kernel.h>
sl@0
    20
#include "d_lddturnaroundtimertest.h"
sl@0
    21
sl@0
    22
class DTest1;
sl@0
    23
class DTestFactory : public DLogicalDevice
sl@0
    24
//
sl@0
    25
// Test LDD factory
sl@0
    26
//
sl@0
    27
	{
sl@0
    28
public:
sl@0
    29
	DTestFactory();
sl@0
    30
	virtual TInt Install(); 					//overriding pure virtual
sl@0
    31
	virtual void GetCaps(TDes8& aDes) const;	//overriding pure virtual
sl@0
    32
	virtual TInt Create(DLogicalChannelBase*& aChannel); 	//overriding pure virtual
sl@0
    33
	};
sl@0
    34
sl@0
    35
class DTest1 : public DLogicalChannelBase
sl@0
    36
//
sl@0
    37
// Test logical channel
sl@0
    38
//
sl@0
    39
	{
sl@0
    40
public:
sl@0
    41
	virtual ~DTest1();
sl@0
    42
protected:
sl@0
    43
	virtual TInt DoCreate(TInt aUnit, const TDesC8* anInfo, const TVersion& aVer);
sl@0
    44
	virtual TInt Request(TInt aReqNo, TAny* a1, TAny* a2);
sl@0
    45
	};
sl@0
    46
sl@0
    47
sl@0
    48
sl@0
    49
DECLARE_STANDARD_LDD()
sl@0
    50
	{
sl@0
    51
	return new DTestFactory;
sl@0
    52
	}
sl@0
    53
sl@0
    54
//
sl@0
    55
// Constructor
sl@0
    56
//
sl@0
    57
DTestFactory::DTestFactory()
sl@0
    58
	{
sl@0
    59
sl@0
    60
	}
sl@0
    61
sl@0
    62
TInt DTestFactory::Create(DLogicalChannelBase*& aChannel)
sl@0
    63
	{
sl@0
    64
//
sl@0
    65
// Create new channel
sl@0
    66
//
sl@0
    67
	aChannel=new DTest1;
sl@0
    68
	return aChannel?KErrNone:KErrNoMemory;
sl@0
    69
	}
sl@0
    70
sl@0
    71
TInt DTestFactory::Install()
sl@0
    72
//
sl@0
    73
// Install the LDD - overriding pure virtual
sl@0
    74
//
sl@0
    75
	{
sl@0
    76
	return SetName(&KLddName);
sl@0
    77
	}
sl@0
    78
sl@0
    79
void DTestFactory::GetCaps(TDes8& /*aDes*/) const
sl@0
    80
//
sl@0
    81
// Get capabilities - overriding pure virtual
sl@0
    82
//
sl@0
    83
	{
sl@0
    84
	}
sl@0
    85
sl@0
    86
TInt DTest1::DoCreate(TInt /*aUnit*/, const TDesC8* /*aInfo*/, const TVersion& /*aVer*/)
sl@0
    87
//
sl@0
    88
// Create channel
sl@0
    89
//
sl@0
    90
	{
sl@0
    91
	return KErrNone;
sl@0
    92
	}
sl@0
    93
sl@0
    94
DTest1::~DTest1()
sl@0
    95
//
sl@0
    96
// Destructor
sl@0
    97
//
sl@0
    98
	{
sl@0
    99
	}
sl@0
   100
sl@0
   101
TInt DTest1::Request(TInt aReqNo, TAny* a1, TAny* /*a2*/)
sl@0
   102
	{
sl@0
   103
//
sl@0
   104
// Get the timer tick count & ticks
sl@0
   105
//
sl@0
   106
    TUint temp = 0;
sl@0
   107
	switch(aReqNo)
sl@0
   108
		{
sl@0
   109
		case (RLddTest1::EGET_TIMERTICKS):
sl@0
   110
			{
sl@0
   111
			kumemget32(&temp, a1, sizeof(temp));
sl@0
   112
			temp = NKern::TimerTicks(temp);
sl@0
   113
			kumemput(a1, &temp, sizeof(temp));
sl@0
   114
			return KErrNone;
sl@0
   115
			}
sl@0
   116
		case (RLddTest1::EGET_TIMERTICKCOUNT):
sl@0
   117
			{
sl@0
   118
			temp = NKern::TickCount();
sl@0
   119
       		kumemput(a1, &temp, sizeof(temp));
sl@0
   120
			return KErrNone;
sl@0
   121
			}
sl@0
   122
		}
sl@0
   123
	return KErrNone;	
sl@0
   124
}