Update contrib.
1 // Copyright (c) 1998-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 the License "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 // e32test\misc\t_lbk.cpp
21 RTest test(_L("LoopBack"));
23 #define TEST(c) ((void)((c)||(test.Printf(_L("Failed at line %d\n"),__LINE__),test.Getch(),test(0),0)))
25 const TInt KBufferSize=4096;
27 _LIT(KLddName,"ECOMM");
28 _LIT(KPddName,"EUART");
30 TUint8 Buffer[2*KBufferSize];
32 void LoadCommDrivers()
34 test.Printf(_L("Load LDD\n"));
35 TInt r=User::LoadLogicalDevice(KLddName);
36 TEST(r==KErrNone || r==KErrAlreadyExists);
42 TBuf<16> pddName=KPddName();
44 pddName.Append('0'+i);
45 TInt r=User::LoadPhysicalDevice(pddName);
46 if (r==KErrNone || r==KErrAlreadyExists)
49 test.Printf(_L("%S found\n"),&pddName);
55 GLDEF_C TInt E32Main()
57 RThread().SetPriority(EPriorityAbsoluteForeground);
58 test.SetLogged(EFalse);
62 User::CommandLine(cmd);
66 TUint8 c=(TUint8)cmd[0];
80 TCommConfigV01& c=cfg();
85 c.iParity=EParityNone;
89 r=comm.SetConfig(cfg);
92 TRequestStatus rxs, txs;
93 TRequestStatus* pS=&txs;
94 User::RequestComplete(pS,0);
99 TPtr8 dptr(Buffer+pos,0,KBufferSize);
100 comm.ReadOneOrMore(rxs,dptr);
101 User::WaitForRequest(rxs);
103 test.Printf(_L("RX error %d\n"),rxs.Int());
104 User::WaitForRequest(txs);
106 test.Printf(_L("TX error %d\n"),txs.Int());
107 comm.Write(txs,dptr);