os/ossrv/genericopenlibs/posixrealtimeextensions/test/testtimer/src/ttimerserver.cpp
Update contrib.
1 // Copyright (c) 2008-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 "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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // Name : ttimerserver.cpp
20 #if defined (__WINS__)
21 #define PDD_NAME _L("ECDRV")
23 #define PDD_NAME _L("EUART1")
24 #define PDD2_NAME _L("EUART2")
25 #define PDD3_NAME _L("EUART3")
26 #define PDD4_NAME _L("EUART4")
29 #define LDD_NAME _L("ECOMM")
34 * Pipe test server implementation
36 #include "ttimerserver.h"
40 _LIT(KServerName, "ttimer");
42 CTimerTestServer* CTimerTestServer::NewL()
44 CTimerTestServer *server = new(ELeave) CTimerTestServer();
45 CleanupStack::PushL(server);
46 server->ConstructL(KServerName);
47 CleanupStack::Pop(server);
51 static void InitCommsL()
53 TInt ret = User::LoadPhysicalDevice(PDD_NAME);
54 User::LeaveIfError(ret == KErrAlreadyExists?KErrNone:ret);
57 ret = User::LoadPhysicalDevice(PDD2_NAME);
58 ret = User::LoadPhysicalDevice(PDD3_NAME);
59 ret = User::LoadPhysicalDevice(PDD4_NAME);
62 ret = User::LoadLogicalDevice(LDD_NAME);
63 User::LeaveIfError(ret == KErrAlreadyExists?KErrNone:ret);
65 User::LeaveIfError(ret == KErrAlreadyExists?KErrNone:ret);
70 // Leave the hooks in for platform security
71 #if (defined __DATA_CAGING__)
72 RProcess().DataCaging(RProcess::EDataCagingOn);
73 RProcess().SecureApi(RProcess::ESecureApiOn);
77 CActiveScheduler* sched=NULL;
78 sched=new(ELeave) CActiveScheduler;
79 CActiveScheduler::Install(sched);
80 CTimerTestServer* server = NULL;
81 // Create the CTestServer derived server
82 TRAPD(err, server = CTimerTestServer::NewL());
85 // Sync with the client and enter the active scheduler
86 RProcess::Rendezvous(KErrNone);
95 * @return Standard Epoc error code on exit
100 CTrapCleanup* cleanup = CTrapCleanup::New();
105 TRAP_IGNORE(MainL());
112 CTestStep* CTimerTestServer::CreateTestStep(const TDesC& aStepName)
114 CTestStep* testStep = NULL;
116 if(aStepName == KTesttimerapi1)
118 testStep = new CTesttimer(aStepName);
120 if(aStepName == KTesttimerapi2)
122 testStep = new CTesttimer(aStepName);
124 if(aStepName == KTesttimerapi3)
126 testStep = new CTesttimer(aStepName);
128 if(aStepName == KTesttimerapi4)
130 testStep = new CTesttimer(aStepName);
132 if(aStepName == KTesttimerapi5)
134 testStep = new CTesttimer(aStepName);
136 if(aStepName == KTesttimerapi6)
138 testStep = new CTesttimer(aStepName);
140 if(aStepName == KTesttimerapi7)
142 testStep = new CTesttimer(aStepName);
144 if(aStepName == KTesttimerapi8)
146 testStep = new CTesttimer(aStepName);
148 if(aStepName == KTesttimerapi9)
150 testStep = new CTesttimer(aStepName);
152 if(aStepName == KTesttimerapi10)
154 testStep = new CTesttimer(aStepName);
156 if(aStepName == KTesttimerapi11)
158 testStep = new CTesttimer(aStepName);
160 if(aStepName == KTesttimerapi12)
162 testStep = new CTesttimer(aStepName);
164 if(aStepName == KTesttimerapi13)
166 testStep = new CTesttimer(aStepName);
168 if(aStepName == KTesttimerapi14)
170 testStep = new CTesttimer(aStepName);
172 if(aStepName == KTesttimerapi15)
174 testStep = new CTesttimer(aStepName);
176 if(aStepName == KTesttimerapi16)
178 testStep = new CTesttimer(aStepName);
180 if(aStepName == KTesttimerapi17)
182 testStep = new CTesttimer(aStepName);
184 if(aStepName == KTesttimerapi18)
186 testStep = new CTesttimer(aStepName);
188 if(aStepName == KTesttimerapi19)
190 testStep = new CTesttimer(aStepName);
192 if(aStepName == KTesttimerapi20)
194 testStep = new CTesttimer(aStepName);
196 if(aStepName == KTesttimerapi21)
198 testStep = new CTesttimer(aStepName);
200 if(aStepName == KTesttimerapi22)
202 testStep = new CTesttimer(aStepName);
204 if(aStepName == KTesttimerapi23)
206 testStep = new CTesttimer(aStepName);
208 if(aStepName == KTesttimerapi24)
210 testStep = new CTesttimer(aStepName);
212 if(aStepName == KTesttimerapi25)
214 testStep = new CTesttimer(aStepName);
216 if(aStepName == KTesttimerapi26)
218 testStep = new CTesttimer(aStepName);
220 if(aStepName == KTesttimerapi27)
222 testStep = new CTesttimer(aStepName);
224 if(aStepName == KTesttimerapi28)
226 testStep = new CTesttimer(aStepName);