author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Tue, 31 Aug 2010 16:34:26 +0300 | |
branch | RCL_3 |
changeset 43 | c1f20ce4abcf |
parent 0 | a41df078684a |
child 44 | 3e88ff8f41d5 |
permissions | -rw-r--r-- |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1 |
// Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies). |
0 | 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". |
|
7 |
// |
|
8 |
// Initial Contributors: |
|
9 |
// Nokia Corporation - initial contribution. |
|
10 |
// |
|
11 |
// Contributors: |
|
12 |
// |
|
13 |
// Description: |
|
14 |
// e32test\device\t_usb.cpp |
|
15 |
// USB Test Program, main part. |
|
16 |
// Device-side part, to work against USBRFLCT running on the host. |
|
17 |
// |
|
18 |
// |
|
19 |
||
20 |
#include "t_usb.h" |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
21 |
#include "OstTraceDefinitions.h" |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
22 |
#ifdef OST_TRACE_COMPILER_IN_USE |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
23 |
#include "t_usbTraces.h" |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
24 |
#endif |
0 | 25 |
|
26 |
||
27 |
void RunAppL(TBool aVerboseOutput) |
|
28 |
{ |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
29 |
OstTrace0(TRACE_NORMAL, RUNAPPL_RUNAPPL, "RunAppL()"); |
0 | 30 |
// Construct the active scheduler |
31 |
CActiveScheduler* myScheduler = new (ELeave) CActiveScheduler(); |
|
32 |
||
33 |
// Push active scheduler onto the cleanup stack |
|
34 |
CleanupStack::PushL(myScheduler); |
|
35 |
||
36 |
// Install as the active scheduler |
|
37 |
CActiveScheduler::Install(myScheduler); |
|
38 |
||
39 |
// Create console handler |
|
40 |
CConsoleBase* myConsole = |
|
41 |
Console::NewL(_L("T_USB - USB Client Test Program"), TSize(KConsFullScreen, KConsFullScreen)); |
|
42 |
CleanupStack::PushL(myConsole); |
|
43 |
||
44 |
CActiveConsole* myActiveConsole = CActiveConsole::NewL(myConsole, aVerboseOutput); |
|
45 |
CleanupStack::PushL(myActiveConsole); |
|
46 |
||
47 |
// Call request function |
|
48 |
myActiveConsole->RequestCharacter(); |
|
49 |
||
50 |
// Start active scheduler |
|
51 |
CActiveScheduler::Start(); |
|
52 |
||
53 |
// Suspend thread for 2 secs |
|
54 |
User::After(2000000); |
|
55 |
||
56 |
CleanupStack::PopAndDestroy(3); // myActiveConsole, myConsole, myScheduler |
|
57 |
return; |
|
58 |
} |
|
59 |
||
60 |
||
61 |
TInt E32Main() |
|
62 |
{ |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
63 |
OstTrace0(TRACE_NORMAL, E32MAIN_E32MAIN, "E32Main()"); |
0 | 64 |
|
65 |
CTrapCleanup* cleanup = CTrapCleanup::New(); // get clean-up stack |
|
66 |
||
67 |
__UHEAP_MARK; |
|
68 |
||
69 |
_LIT(KArg, "verbose"); |
|
70 |
TBuf<64> c; |
|
71 |
User::CommandLine(c); |
|
72 |
TBool verbose = EFalse; |
|
73 |
if (c.CompareF(KArg) == 0) |
|
74 |
{ |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
75 |
OstTrace0(TRACE_NORMAL, E32MAIN_E32MAIN_DUP01, "(Verbose output enabled.)\n"); |
0 | 76 |
verbose = ETrue; |
77 |
} |
|
78 |
||
79 |
TRAPD(error, RunAppL(verbose)); |
|
80 |
||
81 |
__ASSERT_ALWAYS(!error, User::Panic(_L("T_USB: EPOC32EX"), error)); |
|
82 |
||
83 |
__UHEAP_MARKEND; |
|
84 |
||
85 |
delete cleanup; // destroy clean-up stack |
|
86 |
||
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
87 |
OstTrace0(TRACE_NORMAL, E32MAIN_E32MAIN_DUP02, "Program exit: done.\n"); |
0 | 88 |
|
89 |
return 0; // and return |
|
90 |
} |
|
91 |
||
92 |
||
93 |
// -eof- |