|
1 /* |
|
2 * Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <c32comm.h> |
|
20 |
|
21 #if defined (__WINS__) |
|
22 #define PDD_NAME _L("ECDRV") |
|
23 #else |
|
24 #define PDD_NAME _L("EUART1") |
|
25 #define PDD2_NAME _L("EUART2") |
|
26 #define PDD3_NAME _L("EUART3") |
|
27 #define PDD4_NAME _L("EUART4") |
|
28 #endif |
|
29 |
|
30 #define LDD_NAME _L("ECOMM") |
|
31 |
|
32 /** |
|
33 * @file |
|
34 * |
|
35 * Pipe test server implementation |
|
36 */ |
|
37 #include "tshmserver.h" |
|
38 #include "tshm.h" |
|
39 |
|
40 |
|
41 _LIT(KServerName, "tshm"); |
|
42 |
|
43 CShmTestServer* CShmTestServer::NewL() |
|
44 { |
|
45 CShmTestServer *server = new(ELeave) CShmTestServer(); |
|
46 CleanupStack::PushL(server); |
|
47 server->ConstructL(KServerName); |
|
48 CleanupStack::Pop(server); |
|
49 return server; |
|
50 } |
|
51 |
|
52 static void InitCommsL() |
|
53 { |
|
54 TInt ret = User::LoadPhysicalDevice(PDD_NAME); |
|
55 User::LeaveIfError(ret == KErrAlreadyExists?KErrNone:ret); |
|
56 |
|
57 #ifndef __WINS__ |
|
58 ret = User::LoadPhysicalDevice(PDD2_NAME); |
|
59 ret = User::LoadPhysicalDevice(PDD3_NAME); |
|
60 ret = User::LoadPhysicalDevice(PDD4_NAME); |
|
61 #endif |
|
62 |
|
63 ret = User::LoadLogicalDevice(LDD_NAME); |
|
64 User::LeaveIfError(ret == KErrAlreadyExists?KErrNone:ret); |
|
65 ret = StartC32(); |
|
66 User::LeaveIfError(ret == KErrAlreadyExists?KErrNone:ret); |
|
67 } |
|
68 |
|
69 LOCAL_C void MainL() |
|
70 { |
|
71 // Leave the hooks in for platform security |
|
72 #if (defined __DATA_CAGING__) |
|
73 RProcess().DataCaging(RProcess::EDataCagingOn); |
|
74 RProcess().SecureApi(RProcess::ESecureApiOn); |
|
75 #endif |
|
76 InitCommsL(); |
|
77 |
|
78 CActiveScheduler* sched=NULL; |
|
79 sched=new(ELeave) CActiveScheduler; |
|
80 CActiveScheduler::Install(sched); |
|
81 CShmTestServer* server = NULL; |
|
82 // Create the CTestServer derived server |
|
83 TRAPD(err, server = CShmTestServer::NewL()); |
|
84 if(!err) |
|
85 { |
|
86 // Sync with the client and enter the active scheduler |
|
87 RProcess::Rendezvous(KErrNone); |
|
88 sched->Start(); |
|
89 } |
|
90 delete server; |
|
91 delete sched; |
|
92 } |
|
93 |
|
94 /** |
|
95 * Server entry point |
|
96 * @return Standard Epoc error code on exit |
|
97 */ |
|
98 TInt main() |
|
99 { |
|
100 __UHEAP_MARK; |
|
101 CTrapCleanup* cleanup = CTrapCleanup::New(); |
|
102 if(cleanup == NULL) |
|
103 { |
|
104 return KErrNoMemory; |
|
105 } |
|
106 TRAP_IGNORE(MainL()); |
|
107 delete cleanup; |
|
108 __UHEAP_MARKEND; |
|
109 |
|
110 return KErrNone; |
|
111 } |
|
112 |
|
113 CTestStep* CShmTestServer::CreateTestStep(const TDesC& aStepName) |
|
114 { |
|
115 CTestStep* testStep = NULL; |
|
116 |
|
117 // This server creates just one step but create as many as you want |
|
118 // They are created "just in time" when the worker thread is created |
|
119 // install steps |
|
120 if(aStepName == KIntgTest1) |
|
121 { |
|
122 testStep = new CTestShm(aStepName); |
|
123 } |
|
124 if(aStepName == KIntgTest2) |
|
125 { |
|
126 testStep = new CTestShm(aStepName); |
|
127 } |
|
128 if(aStepName == KIntgTest3) |
|
129 { |
|
130 testStep = new CTestShm(aStepName); |
|
131 } |
|
132 if(aStepName == KIntgTest4) |
|
133 { |
|
134 testStep = new CTestShm(aStepName); |
|
135 } |
|
136 if(aStepName == KIntgTest5) |
|
137 { |
|
138 testStep = new CTestShm(aStepName); |
|
139 } |
|
140 if(aStepName == KIntgTest6) |
|
141 { |
|
142 testStep = new CTestShm(aStepName); |
|
143 } |
|
144 if(aStepName == KIntgTest7) |
|
145 { |
|
146 testStep = new CTestShm(aStepName); |
|
147 } |
|
148 if(aStepName == KShmCreate) |
|
149 { |
|
150 testStep = new CTestShm(aStepName); |
|
151 } |
|
152 if(aStepName == KShmAttach) |
|
153 { |
|
154 testStep = new CTestShm(aStepName); |
|
155 } |
|
156 if(aStepName == KShmDetach) |
|
157 { |
|
158 testStep = new CTestShm(aStepName); |
|
159 } |
|
160 if(aStepName == KShmControl) |
|
161 { |
|
162 testStep = new CTestShm(aStepName); |
|
163 } |
|
164 if(aStepName == KCreateThreadL) |
|
165 { |
|
166 testStep = new CTestShm(aStepName); |
|
167 } |
|
168 if(aStepName == KCreateThreadL1) |
|
169 { |
|
170 testStep = new CTestShm(aStepName); |
|
171 } |
|
172 if(aStepName == Kshmgettest1) |
|
173 { |
|
174 testStep = new CTestShm(aStepName); |
|
175 } |
|
176 if(aStepName == Kshmgettest2) |
|
177 { |
|
178 testStep = new CTestShm(aStepName); |
|
179 } |
|
180 if(aStepName == Kshmgettest3) |
|
181 { |
|
182 testStep = new CTestShm(aStepName); |
|
183 } |
|
184 if(aStepName == Kshmgettest4) |
|
185 { |
|
186 testStep = new CTestShm(aStepName); |
|
187 } |
|
188 if(aStepName == Kshmgettest5) |
|
189 { |
|
190 testStep = new CTestShm(aStepName); |
|
191 } |
|
192 if(aStepName == Kshmgettest6) |
|
193 { |
|
194 testStep = new CTestShm(aStepName); |
|
195 } |
|
196 if(aStepName == Kshmgettest7) |
|
197 { |
|
198 testStep = new CTestShm(aStepName); |
|
199 } |
|
200 if(aStepName == Kshmgettest8) |
|
201 { |
|
202 testStep = new CTestShm(aStepName); |
|
203 } |
|
204 if(aStepName == KShmgetCreateKey) |
|
205 { |
|
206 testStep = new CTestShm(aStepName); |
|
207 } |
|
208 if(aStepName == Kshmctltest1) |
|
209 { |
|
210 testStep = new CTestShm(aStepName); |
|
211 } |
|
212 if(aStepName == Kshmctltest2) |
|
213 { |
|
214 testStep = new CTestShm(aStepName); |
|
215 } |
|
216 if(aStepName == Kshmctltest3) |
|
217 { |
|
218 testStep = new CTestShm(aStepName); |
|
219 } |
|
220 if(aStepName == Kshmctltest4) |
|
221 { |
|
222 testStep = new CTestShm(aStepName); |
|
223 } |
|
224 if(aStepName == Kshmctltest5) |
|
225 { |
|
226 testStep = new CTestShm(aStepName); |
|
227 } |
|
228 if(aStepName == Kshmattest1) |
|
229 { |
|
230 testStep = new CTestShm(aStepName); |
|
231 } |
|
232 if(aStepName == Kshmattest2) |
|
233 { |
|
234 testStep = new CTestShm(aStepName); |
|
235 } |
|
236 if(aStepName == Kshmattest3) |
|
237 { |
|
238 testStep = new CTestShm(aStepName); |
|
239 } |
|
240 if(aStepName == Kshmattest4) |
|
241 { |
|
242 testStep = new CTestShm(aStepName); |
|
243 } |
|
244 if(aStepName == Kshmattest5) |
|
245 { |
|
246 testStep = new CTestShm(aStepName); |
|
247 } |
|
248 if(aStepName == Kshmdttest1) |
|
249 { |
|
250 testStep = new CTestShm(aStepName); |
|
251 } |
|
252 if(aStepName == Kshmopsvalidatetest) |
|
253 { |
|
254 testStep = new CTestShm(aStepName); |
|
255 } |
|
256 return testStep; |
|
257 } |
|
258 |