1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/kernelhwsrv/kerneltest/e32test/device/t_usb.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,89 @@
1.4 +// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of the License "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +// e32test\device\t_usb.cpp
1.18 +// USB Test Program, main part.
1.19 +// Device-side part, to work against USBRFLCT running on the host.
1.20 +//
1.21 +//
1.22 +
1.23 +#include "t_usb.h"
1.24 +
1.25 +
1.26 +void RunAppL(TBool aVerboseOutput)
1.27 + {
1.28 + RDebug::Print(_L("RunAppL()"));
1.29 + // Construct the active scheduler
1.30 + CActiveScheduler* myScheduler = new (ELeave) CActiveScheduler();
1.31 +
1.32 + // Push active scheduler onto the cleanup stack
1.33 + CleanupStack::PushL(myScheduler);
1.34 +
1.35 + // Install as the active scheduler
1.36 + CActiveScheduler::Install(myScheduler);
1.37 +
1.38 + // Create console handler
1.39 + CConsoleBase* myConsole =
1.40 + Console::NewL(_L("T_USB - USB Client Test Program"), TSize(KConsFullScreen, KConsFullScreen));
1.41 + CleanupStack::PushL(myConsole);
1.42 +
1.43 + CActiveConsole* myActiveConsole = CActiveConsole::NewL(myConsole, aVerboseOutput);
1.44 + CleanupStack::PushL(myActiveConsole);
1.45 +
1.46 + // Call request function
1.47 + myActiveConsole->RequestCharacter();
1.48 +
1.49 + // Start active scheduler
1.50 + CActiveScheduler::Start();
1.51 +
1.52 + // Suspend thread for 2 secs
1.53 + User::After(2000000);
1.54 +
1.55 + CleanupStack::PopAndDestroy(3); // myActiveConsole, myConsole, myScheduler
1.56 + return;
1.57 + }
1.58 +
1.59 +
1.60 +TInt E32Main()
1.61 + {
1.62 + RDebug::Print(_L("E32Main()"));
1.63 +
1.64 + CTrapCleanup* cleanup = CTrapCleanup::New(); // get clean-up stack
1.65 +
1.66 + __UHEAP_MARK;
1.67 +
1.68 + _LIT(KArg, "verbose");
1.69 + TBuf<64> c;
1.70 + User::CommandLine(c);
1.71 + TBool verbose = EFalse;
1.72 + if (c.CompareF(KArg) == 0)
1.73 + {
1.74 + RDebug::Print(_L("(Verbose output enabled.)\n"));
1.75 + verbose = ETrue;
1.76 + }
1.77 +
1.78 + TRAPD(error, RunAppL(verbose));
1.79 +
1.80 + __ASSERT_ALWAYS(!error, User::Panic(_L("T_USB: EPOC32EX"), error));
1.81 +
1.82 + __UHEAP_MARKEND;
1.83 +
1.84 + delete cleanup; // destroy clean-up stack
1.85 +
1.86 + RDebug::Print(_L("Program exit: done.\n"));
1.87 +
1.88 + return 0; // and return
1.89 + }
1.90 +
1.91 +
1.92 +// -eof-