os/ossrv/genericopenlibs/posixrealtimeextensions/test/testsharedmemory/src/tsharedmemoryserver.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 : tsharedmemoryserver.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 "tsharedmemoryserver.h"
37 #include "tsharedmemory.h"
40 _LIT(KServerName, "tsharedmemory");
42 CSharedmemoryTestServer* CSharedmemoryTestServer::NewL()
44 CSharedmemoryTestServer *server = new(ELeave) CSharedmemoryTestServer();
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 CSharedmemoryTestServer* server = NULL;
81 // Create the CTestServer derived server
82 TRAPD(err, server = CSharedmemoryTestServer::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* CSharedmemoryTestServer::CreateTestStep(const TDesC& aStepName)
114 CTestStep* testStep = NULL;
116 if(aStepName == KTestsharedmemory1)
118 testStep = new CTestsharedmemory(aStepName);
120 if(aStepName == KTestsharedmemory2)
122 testStep = new CTestsharedmemory(aStepName);
124 if(aStepName == KTestsharedmemory3)
126 testStep = new CTestsharedmemory(aStepName);
128 if(aStepName == KTestsharedmemory4)
130 testStep = new CTestsharedmemory(aStepName);
132 if(aStepName == KTestsharedmemory5)
134 testStep = new CTestsharedmemory(aStepName);
136 if(aStepName == KTestsharedmemory6)
138 testStep = new CTestsharedmemory(aStepName);
140 if(aStepName == KTestsharedmemory7)
142 testStep = new CTestsharedmemory(aStepName);
144 if(aStepName == KTestsharedmemory8)
146 testStep = new CTestsharedmemory(aStepName);
148 if(aStepName == KTestsharedmemory9)
150 testStep = new CTestsharedmemory(aStepName);
152 if(aStepName == KTestsharedmemory10)
154 testStep = new CTestsharedmemory(aStepName);
156 if(aStepName == KTestsharedmemory11)
158 testStep = new CTestsharedmemory(aStepName);
160 if(aStepName == KTestsharedmemory12)
162 testStep = new CTestsharedmemory(aStepName);
164 if(aStepName == KTestsharedmemory13)
166 testStep = new CTestsharedmemory(aStepName);
168 if(aStepName == KTestsharedmemory14)
170 testStep = new CTestsharedmemory(aStepName);
172 if(aStepName == KTestsharedmemory15)
174 testStep = new CTestsharedmemory(aStepName);
176 if(aStepName == KTestsharedmemory16)
178 testStep = new CTestsharedmemory(aStepName);
180 if(aStepName == KTestsharedmemory17)
182 testStep = new CTestsharedmemory(aStepName);
184 if(aStepName == KTestsharedmemory18)
186 testStep = new CTestsharedmemory(aStepName);
188 if(aStepName == KTestsharedmemory19)
190 testStep = new CTestsharedmemory(aStepName);
192 if(aStepName == KTestsharedmemory20)
194 testStep = new CTestsharedmemory(aStepName);
196 if(aStepName == KTestsharedmemory21)
198 testStep = new CTestsharedmemory(aStepName);
200 if(aStepName == KTestsharedmemory22)
202 testStep = new CTestsharedmemory(aStepName);
204 if(aStepName == KTestsharedmemory23)
206 testStep = new CTestsharedmemory(aStepName);
208 if(aStepName == KTestsharedmemory24)
210 testStep = new CTestsharedmemory(aStepName);
212 if(aStepName == KTestsharedmemory25)
214 testStep = new CTestsharedmemory(aStepName);
216 if(aStepName == KTestsharedmemory26)
218 testStep = new CTestsharedmemory(aStepName);
220 if(aStepName == KTestsharedmemory27)
222 testStep = new CTestsharedmemory(aStepName);
224 if(aStepName == KTestsharedmemory28)
226 testStep = new CTestsharedmemory(aStepName);
228 if(aStepName == KTestsharedmemory29)
230 testStep = new CTestsharedmemory(aStepName);
232 if(aStepName == KTestsharedmemory30)
234 testStep = new CTestsharedmemory(aStepName);