sl@0
|
1 |
// Copyright (c) 1997-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\t_firco.cpp
|
sl@0
|
15 |
//
|
sl@0
|
16 |
//
|
sl@0
|
17 |
|
sl@0
|
18 |
#include "t_fir.h"
|
sl@0
|
19 |
|
sl@0
|
20 |
#if defined(__VC32__) && _MSC_VER==1100
|
sl@0
|
21 |
// Disable MSVC++ 5.0 aggressive warnings about non-expansion of inline functions.
|
sl@0
|
22 |
#pragma warning(disable : 4710) // function '...' not expanded
|
sl@0
|
23 |
#endif
|
sl@0
|
24 |
|
sl@0
|
25 |
#ifdef __WINS__
|
sl@0
|
26 |
#include <es_sock.h>
|
sl@0
|
27 |
RSocketServ ss;
|
sl@0
|
28 |
#endif
|
sl@0
|
29 |
|
sl@0
|
30 |
TBuf8<2060> WriteBuf;
|
sl@0
|
31 |
TBuf8<2060> ReadBuf;
|
sl@0
|
32 |
TInt iTimeDelay=1000000;
|
sl@0
|
33 |
TInt iBufSz=2000;
|
sl@0
|
34 |
|
sl@0
|
35 |
CActiveConsole::CActiveConsole(CConsoleBase* aConsole)
|
sl@0
|
36 |
: CActive(EPriorityNormal)
|
sl@0
|
37 |
{
|
sl@0
|
38 |
iConsole=aConsole;
|
sl@0
|
39 |
iInit1 =EFalse;
|
sl@0
|
40 |
iInit2 =EFalse;
|
sl@0
|
41 |
iInit3 =EFalse;
|
sl@0
|
42 |
}
|
sl@0
|
43 |
|
sl@0
|
44 |
CActiveConsole* CActiveConsole::NewLC(CConsoleBase* aConsole)
|
sl@0
|
45 |
{
|
sl@0
|
46 |
CActiveConsole* self = new (ELeave) CActiveConsole(aConsole);
|
sl@0
|
47 |
self->ConstructL();
|
sl@0
|
48 |
return self;
|
sl@0
|
49 |
}
|
sl@0
|
50 |
|
sl@0
|
51 |
void CActiveConsole::ConstructL ()
|
sl@0
|
52 |
{
|
sl@0
|
53 |
TFirCaps aCapsBuf;
|
sl@0
|
54 |
TFirCapsV01& aCaps=aCapsBuf();
|
sl@0
|
55 |
TFirConfig aConfigBuf;
|
sl@0
|
56 |
TFirConfigV01& aConfig=aConfigBuf();
|
sl@0
|
57 |
|
sl@0
|
58 |
iConsole->Printf(_L("\r\n"));
|
sl@0
|
59 |
CActiveScheduler::Add(this); // Add to active scheduler
|
sl@0
|
60 |
|
sl@0
|
61 |
// Load Driver
|
sl@0
|
62 |
TInt ret=User::LoadPhysicalDevice(_L("Difir"));
|
sl@0
|
63 |
if (ret!=KErrNone)
|
sl@0
|
64 |
iConsole->Printf(_L("Error %d on loading Fir PDD\r\n"),ret);
|
sl@0
|
65 |
else
|
sl@0
|
66 |
iConsole->Printf(_L("Successfully loaded Fir PDD\r\n"));
|
sl@0
|
67 |
|
sl@0
|
68 |
ret=User::LoadLogicalDevice(_L("Efir"));
|
sl@0
|
69 |
if (ret!=KErrNone)
|
sl@0
|
70 |
iConsole->Printf(_L("Error %d on loading Fir LDD\r\n"),ret);
|
sl@0
|
71 |
else
|
sl@0
|
72 |
iConsole->Printf(_L("Successfully loaded Fir LDD\r\n"));
|
sl@0
|
73 |
|
sl@0
|
74 |
SetUpBuffers();
|
sl@0
|
75 |
|
sl@0
|
76 |
ret=iPort.Open(0);
|
sl@0
|
77 |
if (ret!=KErrNone)
|
sl@0
|
78 |
iConsole->Printf(_L("Error %d on opening Fastir port\r\n"),ret);
|
sl@0
|
79 |
else
|
sl@0
|
80 |
iConsole->Printf(_L("Successfully opened Fastir port\r\n"));
|
sl@0
|
81 |
|
sl@0
|
82 |
|
sl@0
|
83 |
ret=iPort.Caps(aCapsBuf);
|
sl@0
|
84 |
if (ret!=KErrNone)
|
sl@0
|
85 |
iConsole->Printf(_L("Error %d on getting caps\r\n"),ret);
|
sl@0
|
86 |
else
|
sl@0
|
87 |
iConsole->Printf(_L("Fir Caps: %d\r\n"),aCaps.iRate);
|
sl@0
|
88 |
|
sl@0
|
89 |
/* ret=iPort.Config(aConfigBuf);
|
sl@0
|
90 |
if (ret!=KErrNone)
|
sl@0
|
91 |
iConsole->Printf(_L("Error %d getting config\r\n"),ret);
|
sl@0
|
92 |
else
|
sl@0
|
93 |
{
|
sl@0
|
94 |
if(aConfig.iRate==EBps4000000)
|
sl@0
|
95 |
iConsole->Printf(_L("Fir config is 4Mbps\r\n"));
|
sl@0
|
96 |
}
|
sl@0
|
97 |
|
sl@0
|
98 |
aConfig.iRate=EBps4000000;
|
sl@0
|
99 |
ret=iPort.SetConfig(aConfigBuf);
|
sl@0
|
100 |
iConsole->Printf(_L("Error %d on SetConfig\r\n"),ret);*/
|
sl@0
|
101 |
|
sl@0
|
102 |
iWriter=CActiveWriter::NewL(iConsole,&iPort);
|
sl@0
|
103 |
if(iWriter)
|
sl@0
|
104 |
iConsole->Printf(_L("Have created writer\r\n"));
|
sl@0
|
105 |
else
|
sl@0
|
106 |
iConsole->Printf(_L("Failed to create writer\r\n"));
|
sl@0
|
107 |
|
sl@0
|
108 |
iReader=CActiveReader::NewL(iConsole,&iPort);
|
sl@0
|
109 |
if(iReader)
|
sl@0
|
110 |
iConsole->Printf(_L("Have created reader\r\n"));
|
sl@0
|
111 |
else
|
sl@0
|
112 |
iConsole->Printf(_L("Failed to create reader\r\n"));
|
sl@0
|
113 |
}
|
sl@0
|
114 |
|
sl@0
|
115 |
CActiveConsole::~CActiveConsole()
|
sl@0
|
116 |
{
|
sl@0
|
117 |
// Make sure we're cancelled
|
sl@0
|
118 |
Cancel();
|
sl@0
|
119 |
|
sl@0
|
120 |
if(iWriter)
|
sl@0
|
121 |
delete iWriter;
|
sl@0
|
122 |
if(iReader)
|
sl@0
|
123 |
delete iReader;
|
sl@0
|
124 |
|
sl@0
|
125 |
iPort.Close();
|
sl@0
|
126 |
}
|
sl@0
|
127 |
|
sl@0
|
128 |
void CActiveConsole::DoCancel()
|
sl@0
|
129 |
{
|
sl@0
|
130 |
iConsole->ReadCancel();
|
sl@0
|
131 |
}
|
sl@0
|
132 |
|
sl@0
|
133 |
void CActiveConsole::RunL()
|
sl@0
|
134 |
{
|
sl@0
|
135 |
ProcessKeyPressL(TChar(iConsole->KeyCode()));
|
sl@0
|
136 |
// iConsole->Printf(_L("CActiveConsole - Completed with code %d\r\n\r\n"), iStatus.Int ());
|
sl@0
|
137 |
}
|
sl@0
|
138 |
|
sl@0
|
139 |
void CActiveConsole::RequestCharacter()
|
sl@0
|
140 |
{
|
sl@0
|
141 |
if(!iInit1)
|
sl@0
|
142 |
{
|
sl@0
|
143 |
Options1();
|
sl@0
|
144 |
return;
|
sl@0
|
145 |
}
|
sl@0
|
146 |
if(!iInit2)
|
sl@0
|
147 |
{
|
sl@0
|
148 |
Options2();
|
sl@0
|
149 |
return;
|
sl@0
|
150 |
}
|
sl@0
|
151 |
if(!iInit3)
|
sl@0
|
152 |
{
|
sl@0
|
153 |
Options3();
|
sl@0
|
154 |
return;
|
sl@0
|
155 |
}
|
sl@0
|
156 |
// A request is issued to the CConsoleBase to accept a
|
sl@0
|
157 |
// character from the keyboard.
|
sl@0
|
158 |
iConsole->Printf(_L("*********************************\r\n"));
|
sl@0
|
159 |
iConsole->Printf(_L("press Escape to quit\r\n"));
|
sl@0
|
160 |
iConsole->Printf(_L("press '1'/'2' to start/stop reader\r\n"));
|
sl@0
|
161 |
iConsole->Printf(_L("press '3'/'4' to start/stop writer\r\n"));
|
sl@0
|
162 |
iConsole->Printf(_L("press '8' to show FIR regs\r\n"));
|
sl@0
|
163 |
iConsole->Printf(_L("press '9' to show Dma reader regs\r\n"));
|
sl@0
|
164 |
iConsole->Printf(_L("press '0' to show Dma writer regs\r\n"));
|
sl@0
|
165 |
iConsole->Printf(_L("press 'a' to show TxBuf info\r\n"));
|
sl@0
|
166 |
iConsole->Printf(_L("press 'b' to show RxBuf info\r\n"));
|
sl@0
|
167 |
iConsole->Printf(_L("press 'c' to show Chunk info\r\n"));
|
sl@0
|
168 |
iConsole->Printf(_L("press 'd' to show misc info\r\n"));
|
sl@0
|
169 |
iConsole->Read(iStatus);
|
sl@0
|
170 |
SetActive();
|
sl@0
|
171 |
}
|
sl@0
|
172 |
|
sl@0
|
173 |
void CActiveConsole::Options1()
|
sl@0
|
174 |
{
|
sl@0
|
175 |
iConsole->Printf(_L("*****Choose Delay*****\r\n"));
|
sl@0
|
176 |
iConsole->Printf(_L("press '1' 576000 baud\r\n"));
|
sl@0
|
177 |
iConsole->Printf(_L("press '2' 1152000 baud\r\n"));
|
sl@0
|
178 |
iConsole->Printf(_L("press '3' 4000000 baud\r\n"));
|
sl@0
|
179 |
iConsole->Read(iStatus);
|
sl@0
|
180 |
SetActive();
|
sl@0
|
181 |
}
|
sl@0
|
182 |
|
sl@0
|
183 |
void CActiveConsole::Options2()
|
sl@0
|
184 |
{
|
sl@0
|
185 |
iConsole->Printf(_L("*****Choose Delay*****\r\n"));
|
sl@0
|
186 |
iConsole->Printf(_L("press '1' 1.00 sec delay\r\n"));
|
sl@0
|
187 |
iConsole->Printf(_L("press '2' 0.10 sec delay\r\n"));
|
sl@0
|
188 |
iConsole->Printf(_L("press '3' 0.01 sec delay\r\n"));
|
sl@0
|
189 |
iConsole->Printf(_L("press '4' 0.00 sec delay\r\n"));
|
sl@0
|
190 |
iConsole->Read(iStatus);
|
sl@0
|
191 |
SetActive();
|
sl@0
|
192 |
}
|
sl@0
|
193 |
|
sl@0
|
194 |
void CActiveConsole::Options3()
|
sl@0
|
195 |
{
|
sl@0
|
196 |
iConsole->Printf(_L("****Choose Buf Sz*****\r\n"));
|
sl@0
|
197 |
iConsole->Printf(_L("press '1' 1 byte \r\n"));
|
sl@0
|
198 |
iConsole->Printf(_L("press '2' 4 bytes\r\n"));
|
sl@0
|
199 |
iConsole->Printf(_L("press '3' 16 bytes\r\n"));
|
sl@0
|
200 |
iConsole->Printf(_L("press '4' 64 bytes\r\n"));
|
sl@0
|
201 |
iConsole->Printf(_L("press '5' 128 bytes\r\n"));
|
sl@0
|
202 |
iConsole->Printf(_L("press '6' 2000 bytes\r\n"));
|
sl@0
|
203 |
iConsole->Printf(_L("press '7' 2051 bytes\r\n"));
|
sl@0
|
204 |
iConsole->Read(iStatus);
|
sl@0
|
205 |
SetActive();
|
sl@0
|
206 |
}
|
sl@0
|
207 |
|
sl@0
|
208 |
void CActiveConsole::ProcessKeyPressL(TChar aChar)
|
sl@0
|
209 |
{
|
sl@0
|
210 |
if (aChar == EKeyEscape)
|
sl@0
|
211 |
{
|
sl@0
|
212 |
CActiveScheduler::Stop();
|
sl@0
|
213 |
return;
|
sl@0
|
214 |
}
|
sl@0
|
215 |
|
sl@0
|
216 |
if(!iInit1)
|
sl@0
|
217 |
{
|
sl@0
|
218 |
switch(aChar)
|
sl@0
|
219 |
{
|
sl@0
|
220 |
case '1':
|
sl@0
|
221 |
iBaudRate=EBps576000;
|
sl@0
|
222 |
break;
|
sl@0
|
223 |
case '2':
|
sl@0
|
224 |
iBaudRate=EBps1152000;
|
sl@0
|
225 |
break;
|
sl@0
|
226 |
case '3':
|
sl@0
|
227 |
iBaudRate=EBps4000000;
|
sl@0
|
228 |
break;
|
sl@0
|
229 |
default:
|
sl@0
|
230 |
iBaudRate=EBps4000000;
|
sl@0
|
231 |
break;
|
sl@0
|
232 |
}
|
sl@0
|
233 |
iConsole->Printf(_L("Baud rate: %d\r\n"),iBaudRate);
|
sl@0
|
234 |
iInit1=ETrue;
|
sl@0
|
235 |
TFirConfig aConfigBuf;
|
sl@0
|
236 |
TFirConfigV01& aConfig=aConfigBuf();
|
sl@0
|
237 |
aConfig.iRate=iBaudRate;
|
sl@0
|
238 |
TInt ret=iPort.SetConfig(aConfigBuf);
|
sl@0
|
239 |
iConsole->Printf(_L("Error %d on SetConfig\r\n"),ret);
|
sl@0
|
240 |
RequestCharacter();
|
sl@0
|
241 |
return;
|
sl@0
|
242 |
}
|
sl@0
|
243 |
|
sl@0
|
244 |
if(!iInit2)
|
sl@0
|
245 |
{
|
sl@0
|
246 |
switch(aChar)
|
sl@0
|
247 |
{
|
sl@0
|
248 |
case '1'://1 sec
|
sl@0
|
249 |
iTimeDelay=1000000;
|
sl@0
|
250 |
break;
|
sl@0
|
251 |
case '2'://0.1 sec
|
sl@0
|
252 |
iTimeDelay=100000;
|
sl@0
|
253 |
break;
|
sl@0
|
254 |
case '3'://0.01 sec
|
sl@0
|
255 |
iTimeDelay=10000;
|
sl@0
|
256 |
break;
|
sl@0
|
257 |
case '4'://0 sec
|
sl@0
|
258 |
iTimeDelay=0;
|
sl@0
|
259 |
break;
|
sl@0
|
260 |
default:
|
sl@0
|
261 |
iTimeDelay=1000000;
|
sl@0
|
262 |
break;
|
sl@0
|
263 |
}
|
sl@0
|
264 |
iConsole->Printf(_L("Time Delay: %d\r\n"),iTimeDelay);
|
sl@0
|
265 |
iInit2=ETrue;
|
sl@0
|
266 |
RequestCharacter();
|
sl@0
|
267 |
return;
|
sl@0
|
268 |
}
|
sl@0
|
269 |
if(!iInit3)
|
sl@0
|
270 |
{
|
sl@0
|
271 |
switch(aChar)
|
sl@0
|
272 |
{
|
sl@0
|
273 |
case '1':
|
sl@0
|
274 |
iBufSz=1;
|
sl@0
|
275 |
break;
|
sl@0
|
276 |
case '2':
|
sl@0
|
277 |
iBufSz=4;
|
sl@0
|
278 |
break;
|
sl@0
|
279 |
case '3':
|
sl@0
|
280 |
iBufSz=16;
|
sl@0
|
281 |
break;
|
sl@0
|
282 |
case '4':
|
sl@0
|
283 |
iBufSz=64;
|
sl@0
|
284 |
break;
|
sl@0
|
285 |
case '5':
|
sl@0
|
286 |
iBufSz=128;
|
sl@0
|
287 |
break;
|
sl@0
|
288 |
case '6':
|
sl@0
|
289 |
iBufSz=2000;
|
sl@0
|
290 |
break;
|
sl@0
|
291 |
case '7':
|
sl@0
|
292 |
iBufSz=2052;
|
sl@0
|
293 |
break;
|
sl@0
|
294 |
default:
|
sl@0
|
295 |
iBufSz=2000;
|
sl@0
|
296 |
break;
|
sl@0
|
297 |
}
|
sl@0
|
298 |
iConsole->Printf(_L("Buffer size: %d\r\n"),iBufSz);
|
sl@0
|
299 |
iInit3=ETrue;
|
sl@0
|
300 |
RequestCharacter();
|
sl@0
|
301 |
return;
|
sl@0
|
302 |
}
|
sl@0
|
303 |
|
sl@0
|
304 |
switch (aChar)
|
sl@0
|
305 |
{
|
sl@0
|
306 |
case '1'://start reader
|
sl@0
|
307 |
iReader->Start();
|
sl@0
|
308 |
break;
|
sl@0
|
309 |
case '2'://stop reader
|
sl@0
|
310 |
iReader->Stop();
|
sl@0
|
311 |
break;
|
sl@0
|
312 |
case '3'://start writer
|
sl@0
|
313 |
iWriter->Start();
|
sl@0
|
314 |
break;
|
sl@0
|
315 |
case '4'://stop writer
|
sl@0
|
316 |
iWriter->Stop();
|
sl@0
|
317 |
break;
|
sl@0
|
318 |
case '8'://get fir regs
|
sl@0
|
319 |
GetFirRegs();
|
sl@0
|
320 |
break;
|
sl@0
|
321 |
case '9'://get dma reader regs
|
sl@0
|
322 |
GetDmaReaderRegs();
|
sl@0
|
323 |
break;
|
sl@0
|
324 |
case '0'://get dma writer regs
|
sl@0
|
325 |
GetDmaWriterRegs();
|
sl@0
|
326 |
break;
|
sl@0
|
327 |
case 'a'://get TxBuf info
|
sl@0
|
328 |
GetWriteBufInfo();
|
sl@0
|
329 |
break;
|
sl@0
|
330 |
case 'b'://get RxBuf info
|
sl@0
|
331 |
GetReadBufInfo();
|
sl@0
|
332 |
break;
|
sl@0
|
333 |
case 'c'://get RxBuf info
|
sl@0
|
334 |
GetChunkInfo();
|
sl@0
|
335 |
break;
|
sl@0
|
336 |
case 'd':
|
sl@0
|
337 |
GetMiscInfo();
|
sl@0
|
338 |
break;
|
sl@0
|
339 |
default:
|
sl@0
|
340 |
iConsole->Printf(_L("\r\nUnknown Command\r\n\r\n"));
|
sl@0
|
341 |
break;
|
sl@0
|
342 |
}
|
sl@0
|
343 |
RequestCharacter ();
|
sl@0
|
344 |
return;
|
sl@0
|
345 |
}
|
sl@0
|
346 |
|
sl@0
|
347 |
void CActiveConsole::GetFirRegs()
|
sl@0
|
348 |
{
|
sl@0
|
349 |
/* TInt r=0;
|
sl@0
|
350 |
TDebugFirRegs FirRegs;
|
sl@0
|
351 |
r=iPort.GetFirRegs(FirRegs);
|
sl@0
|
352 |
iConsole->Printf(_L("RxFrameStatus : 0x%x\r\n"),FirRegs.RxFrameStatus);
|
sl@0
|
353 |
iConsole->Printf(_L("RxBufferEmpty : 0x%x\r\n"),FirRegs.RxBufferEmpty);
|
sl@0
|
354 |
iConsole->Printf(_L("RxError : 0x%x\r\n"),FirRegs.RxError);
|
sl@0
|
355 |
iConsole->Printf(_L("RxOverrun : 0x%x\r\n"),FirRegs.RxOverrun);
|
sl@0
|
356 |
iConsole->Printf(_L("CrcError : 0x%x\r\n"),FirRegs.CrcError);
|
sl@0
|
357 |
iConsole->Printf(_L("TxFrameStatus : 0x%x\r\n"),FirRegs.TxFrameStatus);
|
sl@0
|
358 |
iConsole->Printf(_L("TxBufferEmpty : 0x%x\r\n"),FirRegs.TxBufferEmpty);
|
sl@0
|
359 |
iConsole->Printf(_L("TxBufferSz : 0x%x\r\n"),FirRegs.TxBufferSz);
|
sl@0
|
360 |
iConsole->Printf(_L("TxOverrun : 0x%x\r\n"),FirRegs.TxOverrun);*/
|
sl@0
|
361 |
}
|
sl@0
|
362 |
|
sl@0
|
363 |
void CActiveConsole::GetDmaReaderRegs()
|
sl@0
|
364 |
{
|
sl@0
|
365 |
/* TInt r=0;
|
sl@0
|
366 |
TDebugDmaChannelRegs DmaRxRegs;
|
sl@0
|
367 |
r=iPort.GetDmaRxRegs(DmaRxRegs);
|
sl@0
|
368 |
iConsole->Printf(_L("Rx Chan : %d\n"),DmaRxRegs.DmaRxChannel);
|
sl@0
|
369 |
iConsole->Printf(_L("Rx DmaMode : %d "),DmaRxRegs.DmaMode);
|
sl@0
|
370 |
iConsole->Printf(_L("Rx DmaState : %d "),DmaRxRegs.DmaState);
|
sl@0
|
371 |
iConsole->Printf(_L("Rx DmaBuffer : %x\n"),DmaRxRegs.DmaBuffer);
|
sl@0
|
372 |
iConsole->Printf(_L("Rx DmGauge : %d\n"),DmaRxRegs.DmaGauge);
|
sl@0
|
373 |
iConsole->Printf(_L("Rx DmaSrcAddr : %x "),DmaRxRegs.DmaSrcAddr);
|
sl@0
|
374 |
iConsole->Printf(_L("Rx DmaSrcInc : %d\n"),DmaRxRegs.DmaSrcInc);
|
sl@0
|
375 |
iConsole->Printf(_L("Rx DmaDestAddr: %x "),DmaRxRegs.DmaDestAddr);
|
sl@0
|
376 |
iConsole->Printf(_L("Rx DmaDestInc : %d\n"),DmaRxRegs.DmaDestInc);
|
sl@0
|
377 |
iConsole->Printf(_L("Rx DmaCount : %d\n"),DmaRxRegs.DmaCount);
|
sl@0
|
378 |
//iConsole->Printf(_L("Rx MatchClear : %x\n"),DmaRxRegs.MatchClear);
|
sl@0
|
379 |
//iConsole->Printf(_L("Rx MatchSet : %x\n"),DmaRxRegs.MatchSet);*/
|
sl@0
|
380 |
}
|
sl@0
|
381 |
|
sl@0
|
382 |
void CActiveConsole::GetDmaWriterRegs()
|
sl@0
|
383 |
{
|
sl@0
|
384 |
/* TInt r=0;
|
sl@0
|
385 |
TDebugDmaChannelRegs DmaTxRegs;
|
sl@0
|
386 |
r=iPort.GetDmaTxRegs(DmaTxRegs);
|
sl@0
|
387 |
iConsole->Printf(_L("Tx Chan : %d\n"),DmaTxRegs.DmaTxChannel);
|
sl@0
|
388 |
iConsole->Printf(_L("Tx DmaMode : %d"),DmaTxRegs.DmaMode);
|
sl@0
|
389 |
iConsole->Printf(_L("Tx DmaState : %d"),DmaTxRegs.DmaState);
|
sl@0
|
390 |
iConsole->Printf(_L("Tx DmaBuffer : %x\n"),DmaTxRegs.DmaBuffer);
|
sl@0
|
391 |
iConsole->Printf(_L("Tx DmGauge : %d\n"),DmaTxRegs.DmaGauge);
|
sl@0
|
392 |
iConsole->Printf(_L("Tx DmaSrcAddr : %x"),DmaTxRegs.DmaSrcAddr);
|
sl@0
|
393 |
iConsole->Printf(_L("Tx DmaSrcInc : %d\n"),DmaTxRegs.DmaSrcInc);
|
sl@0
|
394 |
iConsole->Printf(_L("Tx DmaDestAddr: %x"),DmaTxRegs.DmaDestAddr);
|
sl@0
|
395 |
iConsole->Printf(_L("Tx DmaDestInc : %d\n"),DmaTxRegs.DmaDestInc);
|
sl@0
|
396 |
iConsole->Printf(_L("Tx DmaCount : %d\n"),DmaTxRegs.DmaCount);
|
sl@0
|
397 |
//iConsole->Printf(_L("Tx MatchClear : %x\n"),DmaTxRegs.MatchClear);
|
sl@0
|
398 |
//iConsole->Printf(_L("Tx MatchSet : %x\n"),DmaTxRegs.MatchSet);*/
|
sl@0
|
399 |
}
|
sl@0
|
400 |
|
sl@0
|
401 |
void CActiveConsole::GetReadBufInfo()
|
sl@0
|
402 |
{
|
sl@0
|
403 |
/* TInt r=0;
|
sl@0
|
404 |
TDebugBufInfo RxBufInfo;
|
sl@0
|
405 |
r=iPort.GetRxBufInfo(RxBufInfo);
|
sl@0
|
406 |
iConsole->Printf(_L("Rx no frames: %d\r\n"),RxBufInfo.iNoFrames);
|
sl@0
|
407 |
iConsole->Printf(_L("Rx insert pt: %d "),RxBufInfo.iInsertPt);
|
sl@0
|
408 |
iConsole->Printf(_L("Rx remove pt: %d\r\n"),RxBufInfo.iRemovePt);
|
sl@0
|
409 |
iConsole->Printf(_L("Rx head : %d "),RxBufInfo.iHead);
|
sl@0
|
410 |
iConsole->Printf(_L("Rx tail : %d\r\n"),RxBufInfo.iTail);
|
sl@0
|
411 |
iConsole->Printf(_L("Rx active : %x "),RxBufInfo.iActive);
|
sl@0
|
412 |
iConsole->Printf(_L("Rx cancelled: %x\r\n"),RxBufInfo.iCancelled);
|
sl@0
|
413 |
iConsole->Printf(_L("Client read pending: %d\r\n"),RxBufInfo.iClientPending);*/
|
sl@0
|
414 |
}
|
sl@0
|
415 |
|
sl@0
|
416 |
void CActiveConsole::GetWriteBufInfo()
|
sl@0
|
417 |
{
|
sl@0
|
418 |
/* TInt r=0;
|
sl@0
|
419 |
TDebugBufInfo TxBufInfo;
|
sl@0
|
420 |
r=iPort.GetTxBufInfo(TxBufInfo);
|
sl@0
|
421 |
iConsole->Printf(_L("Tx no frames: %d\r\n"),TxBufInfo.iNoFrames);
|
sl@0
|
422 |
iConsole->Printf(_L("Tx insert pt: %d "),TxBufInfo.iInsertPt);
|
sl@0
|
423 |
iConsole->Printf(_L("Tx remove pt: %d\r\n"),TxBufInfo.iRemovePt);
|
sl@0
|
424 |
iConsole->Printf(_L("Tx head : %d "),TxBufInfo.iHead);
|
sl@0
|
425 |
iConsole->Printf(_L("Tx tail : %d\r\n"),TxBufInfo.iTail);
|
sl@0
|
426 |
iConsole->Printf(_L("Tx active : %x "),TxBufInfo.iActive);
|
sl@0
|
427 |
iConsole->Printf(_L("Tx cancelled: %x\r\n"),TxBufInfo.iCancelled);
|
sl@0
|
428 |
iConsole->Printf(_L("Client write pending: %d\r\n"),TxBufInfo.iClientPending);*/
|
sl@0
|
429 |
}
|
sl@0
|
430 |
|
sl@0
|
431 |
void CActiveConsole::GetChunkInfo()
|
sl@0
|
432 |
{
|
sl@0
|
433 |
/* TInt r=0;
|
sl@0
|
434 |
TDebugDmaChunkInfo DmaChunkInfo;
|
sl@0
|
435 |
r=iPort.GetDmaChunkInfo(DmaChunkInfo);
|
sl@0
|
436 |
iConsole->Printf(_L("Write Chunk Phys Addr: 0x%x\r\n"),DmaChunkInfo.iWriteChunkPhysAddr);
|
sl@0
|
437 |
iConsole->Printf(_L("Write Chunk Lin Addr: 0x%x\r\n"),DmaChunkInfo.iWriteChunkLinAddr);
|
sl@0
|
438 |
iConsole->Printf(_L("Read Chunk Phys Addr: 0x%x\r\n"),DmaChunkInfo.iReadChunkPhysAddr);
|
sl@0
|
439 |
iConsole->Printf(_L("Read Chunk Lin Addr: 0x%x\r\n"),DmaChunkInfo.iReadChunkLinAddr);
|
sl@0
|
440 |
//iConsole->Printf(_L("No pages in read chunk : %d\r\n"),DmaChunkInfo.iReaderNoPages);
|
sl@0
|
441 |
//iConsole->Printf(_L("no pages in write chunk : %d\r\n"),DmaChunkInfo.iWriterNoPages);*/
|
sl@0
|
442 |
}
|
sl@0
|
443 |
|
sl@0
|
444 |
void CActiveConsole::GetMiscInfo()
|
sl@0
|
445 |
{
|
sl@0
|
446 |
/* TInt r=0;
|
sl@0
|
447 |
TDebugInterruptInfo IntInfo;
|
sl@0
|
448 |
r=iPort.GetInterruptsInfo(IntInfo);
|
sl@0
|
449 |
iConsole->Printf(_L("NoRxDmaInts : %d\r\n"),IntInfo.NoRxDmaInts);
|
sl@0
|
450 |
iConsole->Printf(_L("NoTxDmaInts : %d\r\n"),IntInfo.NoTxDmaInts);
|
sl@0
|
451 |
iConsole->Printf(_L("NoRxBusyInts : %d\r\n"),IntInfo.NoRxBusyInts);
|
sl@0
|
452 |
iConsole->Printf(_L("NoRxIdleInts : %d\r\n"),IntInfo.NoRxIdleInts);
|
sl@0
|
453 |
iConsole->Printf(_L("NoRxInts : %d\r\n"),IntInfo.NoRxInts);
|
sl@0
|
454 |
iConsole->Printf(_L("NoTxIdleInts : %d\r\n"),IntInfo.NoTxIdleInts);
|
sl@0
|
455 |
iConsole->Printf(_L("NoTxInts : %d\r\n"),IntInfo.NoTxInts);*/
|
sl@0
|
456 |
}
|
sl@0
|
457 |
|
sl@0
|
458 |
void CActiveConsole::SetUpBuffers()
|
sl@0
|
459 |
{
|
sl@0
|
460 |
TInt i=0;
|
sl@0
|
461 |
WriteBuf.SetLength(2060);
|
sl@0
|
462 |
ReadBuf.SetLength(2060);
|
sl@0
|
463 |
for(i=0;i<2050;i++)
|
sl@0
|
464 |
{
|
sl@0
|
465 |
//WriteBuf[i]='W';
|
sl@0
|
466 |
ReadBuf[i] ='R';
|
sl@0
|
467 |
}
|
sl@0
|
468 |
|
sl@0
|
469 |
TInt j=0;
|
sl@0
|
470 |
while(j<2050-16)
|
sl@0
|
471 |
{
|
sl@0
|
472 |
WriteBuf[j ]='0';
|
sl@0
|
473 |
WriteBuf[j+1]='1';
|
sl@0
|
474 |
WriteBuf[j+2]='2';
|
sl@0
|
475 |
WriteBuf[j+3]='3';
|
sl@0
|
476 |
|
sl@0
|
477 |
WriteBuf[j+4]='4';
|
sl@0
|
478 |
WriteBuf[j+5]='5';
|
sl@0
|
479 |
WriteBuf[j+6]='6';
|
sl@0
|
480 |
WriteBuf[j+7]='7';
|
sl@0
|
481 |
|
sl@0
|
482 |
WriteBuf[j+8 ]='8';
|
sl@0
|
483 |
WriteBuf[j+9 ]='9';
|
sl@0
|
484 |
WriteBuf[j+10]='A';
|
sl@0
|
485 |
WriteBuf[j+11]='B';
|
sl@0
|
486 |
|
sl@0
|
487 |
WriteBuf[j+12]='C';
|
sl@0
|
488 |
WriteBuf[j+13]='D';
|
sl@0
|
489 |
WriteBuf[j+14]='E';
|
sl@0
|
490 |
WriteBuf[j+15]='F';
|
sl@0
|
491 |
|
sl@0
|
492 |
j=j+16;
|
sl@0
|
493 |
}
|
sl@0
|
494 |
|
sl@0
|
495 |
WriteBuf.SetLength(2000);
|
sl@0
|
496 |
}
|
sl@0
|
497 |
|
sl@0
|
498 |
//
|
sl@0
|
499 |
// class CActiveWriter
|
sl@0
|
500 |
//
|
sl@0
|
501 |
|
sl@0
|
502 |
CActiveWriter::CActiveWriter(CConsoleBase* aConsole,RDevFir* aPort)
|
sl@0
|
503 |
: CActive (EPriorityNormal)
|
sl@0
|
504 |
{
|
sl@0
|
505 |
iConsole = aConsole;
|
sl@0
|
506 |
iPort=aPort;
|
sl@0
|
507 |
iLength=0;
|
sl@0
|
508 |
}
|
sl@0
|
509 |
|
sl@0
|
510 |
CActiveWriter* CActiveWriter::NewL(CConsoleBase* aConsole,RDevFir* aPort)
|
sl@0
|
511 |
{
|
sl@0
|
512 |
CActiveWriter* self = new (ELeave) CActiveWriter(aConsole,aPort);
|
sl@0
|
513 |
|
sl@0
|
514 |
CleanupStack::PushL (self);
|
sl@0
|
515 |
self->ConstructL();
|
sl@0
|
516 |
CActiveScheduler::Add (self);
|
sl@0
|
517 |
CleanupStack::Pop ();
|
sl@0
|
518 |
return (self);
|
sl@0
|
519 |
}
|
sl@0
|
520 |
|
sl@0
|
521 |
void CActiveWriter::ConstructL()
|
sl@0
|
522 |
{
|
sl@0
|
523 |
}
|
sl@0
|
524 |
|
sl@0
|
525 |
CActiveWriter::~CActiveWriter()
|
sl@0
|
526 |
{
|
sl@0
|
527 |
Cancel();
|
sl@0
|
528 |
}
|
sl@0
|
529 |
|
sl@0
|
530 |
void CActiveWriter::RunL ()
|
sl@0
|
531 |
{
|
sl@0
|
532 |
if (iStatus != KErrNone)
|
sl@0
|
533 |
{
|
sl@0
|
534 |
iConsole->Printf(_L("Error %d on write completion\r\n"),iStatus.Int());
|
sl@0
|
535 |
return;
|
sl@0
|
536 |
}
|
sl@0
|
537 |
else
|
sl@0
|
538 |
iConsole->Printf(_L("W :%d "),WriteBuf.Length());
|
sl@0
|
539 |
|
sl@0
|
540 |
if(iTimeDelay)
|
sl@0
|
541 |
User::After(iTimeDelay);
|
sl@0
|
542 |
iLength=(iLength+1)%10;
|
sl@0
|
543 |
WriteBuf.SetLength(iBufSz+iLength);
|
sl@0
|
544 |
iPort->Write(iStatus, WriteBuf, WriteBuf.Length());
|
sl@0
|
545 |
SetActive();
|
sl@0
|
546 |
}
|
sl@0
|
547 |
|
sl@0
|
548 |
void CActiveWriter::Start()
|
sl@0
|
549 |
{
|
sl@0
|
550 |
if(IsActive())
|
sl@0
|
551 |
return;
|
sl@0
|
552 |
iConsole->Printf(_L("Starting writer.....\r\n"));
|
sl@0
|
553 |
iPort->Write(iStatus, WriteBuf, WriteBuf.Length());
|
sl@0
|
554 |
SetActive();
|
sl@0
|
555 |
}
|
sl@0
|
556 |
|
sl@0
|
557 |
void CActiveWriter::Stop()
|
sl@0
|
558 |
{
|
sl@0
|
559 |
iConsole->Printf(_L("Stopping writer.....\r\n"));
|
sl@0
|
560 |
Cancel();
|
sl@0
|
561 |
}
|
sl@0
|
562 |
|
sl@0
|
563 |
void CActiveWriter::DoCancel()
|
sl@0
|
564 |
{
|
sl@0
|
565 |
iPort->WriteCancel();
|
sl@0
|
566 |
}
|
sl@0
|
567 |
|
sl@0
|
568 |
//
|
sl@0
|
569 |
// class CActiveReader
|
sl@0
|
570 |
//
|
sl@0
|
571 |
|
sl@0
|
572 |
CActiveReader::CActiveReader(CConsoleBase* aConsole,RDevFir* aPort)
|
sl@0
|
573 |
: CActive (EPriorityNormal)//EPriorityMore)
|
sl@0
|
574 |
{
|
sl@0
|
575 |
iConsole=aConsole;
|
sl@0
|
576 |
iPort =aPort;
|
sl@0
|
577 |
}
|
sl@0
|
578 |
|
sl@0
|
579 |
CActiveReader* CActiveReader::NewL(CConsoleBase* aConsole,RDevFir* aPort)
|
sl@0
|
580 |
{
|
sl@0
|
581 |
CActiveReader* self = new (ELeave) CActiveReader(aConsole,aPort);
|
sl@0
|
582 |
|
sl@0
|
583 |
CleanupStack::PushL(self);
|
sl@0
|
584 |
self->ConstructL();
|
sl@0
|
585 |
CActiveScheduler::Add (self);
|
sl@0
|
586 |
CleanupStack::Pop();
|
sl@0
|
587 |
return (self);
|
sl@0
|
588 |
}
|
sl@0
|
589 |
|
sl@0
|
590 |
void CActiveReader::ConstructL()
|
sl@0
|
591 |
{
|
sl@0
|
592 |
}
|
sl@0
|
593 |
|
sl@0
|
594 |
CActiveReader::~CActiveReader ()
|
sl@0
|
595 |
{
|
sl@0
|
596 |
Cancel();
|
sl@0
|
597 |
}
|
sl@0
|
598 |
|
sl@0
|
599 |
void CActiveReader::Start()
|
sl@0
|
600 |
{
|
sl@0
|
601 |
if(IsActive())
|
sl@0
|
602 |
return;
|
sl@0
|
603 |
iConsole->Printf(_L("Starting reader.....\r\n"));
|
sl@0
|
604 |
ReadBuf.SetLength(2052);
|
sl@0
|
605 |
iPort->Read(iStatus, ReadBuf, ReadBuf.Length());
|
sl@0
|
606 |
SetActive();
|
sl@0
|
607 |
}
|
sl@0
|
608 |
|
sl@0
|
609 |
void CActiveReader::Stop()
|
sl@0
|
610 |
{
|
sl@0
|
611 |
iConsole->Printf(_L("Stopping reader.....\r\n"));
|
sl@0
|
612 |
Cancel();
|
sl@0
|
613 |
}
|
sl@0
|
614 |
|
sl@0
|
615 |
void CActiveReader::RunL ()
|
sl@0
|
616 |
{
|
sl@0
|
617 |
if (iStatus != KErrNone)
|
sl@0
|
618 |
iConsole->Printf(_L("Error %d\r\n"),iStatus.Int());
|
sl@0
|
619 |
else
|
sl@0
|
620 |
{
|
sl@0
|
621 |
if(!CompareBuffers(ReadBuf.Length()))
|
sl@0
|
622 |
iConsole->Printf(_L("Buffers dont compare!\r\n"));
|
sl@0
|
623 |
iConsole->Printf(_L("R:%d\r\n"),ReadBuf.Length());
|
sl@0
|
624 |
/* TInt len=ReadBuf.Length();
|
sl@0
|
625 |
for(TInt i=0;i<10;i++)
|
sl@0
|
626 |
{
|
sl@0
|
627 |
for (TInt j=0;j<16;j++)//print 16 bytes
|
sl@0
|
628 |
{
|
sl@0
|
629 |
if ((i*16)+j<len)
|
sl@0
|
630 |
{
|
sl@0
|
631 |
TInt v=ReadBuf[(i*16)+j];
|
sl@0
|
632 |
iConsole->Printf(_L("%02x "),v);
|
sl@0
|
633 |
}
|
sl@0
|
634 |
else
|
sl@0
|
635 |
iConsole->Printf(_L(" "));
|
sl@0
|
636 |
}
|
sl@0
|
637 |
iConsole->Printf(_L("\r\n"));
|
sl@0
|
638 |
}*/
|
sl@0
|
639 |
}
|
sl@0
|
640 |
|
sl@0
|
641 |
ResetReadBuffer();
|
sl@0
|
642 |
if(iTimeDelay)
|
sl@0
|
643 |
User::After(iTimeDelay);
|
sl@0
|
644 |
iPort->Read(iStatus, ReadBuf, ReadBuf.Length());
|
sl@0
|
645 |
SetActive();
|
sl@0
|
646 |
}
|
sl@0
|
647 |
|
sl@0
|
648 |
void CActiveReader::DoCancel()
|
sl@0
|
649 |
{
|
sl@0
|
650 |
iPort->ReadCancel();
|
sl@0
|
651 |
}
|
sl@0
|
652 |
|
sl@0
|
653 |
void CActiveReader::ResetReadBuffer()
|
sl@0
|
654 |
{
|
sl@0
|
655 |
TInt i=0;
|
sl@0
|
656 |
ReadBuf.SetLength(2060);
|
sl@0
|
657 |
for(i=0;i<2052;i++)
|
sl@0
|
658 |
ReadBuf[i] ='R';
|
sl@0
|
659 |
}
|
sl@0
|
660 |
|
sl@0
|
661 |
TBool CActiveReader::CompareBuffers(TInt aLen)
|
sl@0
|
662 |
{
|
sl@0
|
663 |
TInt i=0;
|
sl@0
|
664 |
while(i<aLen)
|
sl@0
|
665 |
{
|
sl@0
|
666 |
if(ReadBuf[i]!=WriteBuf[i])
|
sl@0
|
667 |
return EFalse;
|
sl@0
|
668 |
i++;
|
sl@0
|
669 |
}
|
sl@0
|
670 |
return ETrue;
|
sl@0
|
671 |
}
|
sl@0
|
672 |
#pragma warning (default:4710)
|
sl@0
|
673 |
|