| 0 |      1 | // Copyright (c) 2008-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".
 | 
|  |      7 | //
 | 
|  |      8 | // Initial Contributors:
 | 
|  |      9 | // Nokia Corporation - initial contribution.
 | 
|  |     10 | //
 | 
|  |     11 | // Contributors:
 | 
|  |     12 | //
 | 
|  |     13 | // Description:
 | 
|  |     14 | // navienginebsp\ne1_tb\test\interrupts\t_ints.cpp
 | 
|  |     15 | //
 | 
|  |     16 | // Overview:
 | 
|  |     17 | // user-side test for Crazy-Interrupts functionality
 | 
|  |     18 | //
 | 
|  |     19 | //
 | 
|  |     20 | #include <e32test.h>
 | 
|  |     21 | #include <e32cmn.h>
 | 
|  |     22 | #include "d_crazyints.h"
 | 
|  |     23 | 
 | 
|  |     24 | _LIT(testName,"t_crazyints");
 | 
|  |     25 | _LIT(KLddFileName, "d_crazyints.ldd");
 | 
|  |     26 | _LIT(KLddFileNameRoot, "d_crazyints");
 | 
|  |     27 | 
 | 
|  |     28 | // global data..
 | 
|  |     29 | GLDEF_D RTest IntsTest(testName);
 | 
|  |     30 | GLDEF_D RBusIntTestClient IntsTestLdd; // Channel to kernel-side proxy
 | 
|  |     31 | 
 | 
|  |     32 | EXPORT_C TInt E32Main()
 | 
|  |     33 | 	{
 | 
|  |     34 | 	IntsTest.Title();
 | 
|  |     35 | 	IntsTest.Start(_L("Test crazy interrupts"));
 | 
|  |     36 | 
 | 
|  |     37 | 	// Load the Test Driver
 | 
|  |     38 | 	TInt r = User::LoadLogicalDevice(KLddFileName);
 | 
|  |     39 | 	if(r != KErrNone && r != KErrAlreadyExists)
 | 
|  |     40 | 		{
 | 
|  |     41 | 		// fail..
 | 
|  |     42 | 		IntsTest.Printf(_L("\nFailed to load the device  driver, r=%d"), r);
 | 
|  |     43 | 		IntsTest(EFalse);
 | 
|  |     44 | 		}
 | 
|  |     45 | 
 | 
|  |     46 | 	// Open the driver
 | 
|  |     47 | 	TBufC<11> proxyName(KLddFileNameRoot);
 | 
|  |     48 | 	r = IntsTestLdd.Open(proxyName);
 | 
|  |     49 | 	if(r == KErrNone)
 | 
|  |     50 | 		{
 | 
|  |     51 | 		// run the test..
 | 
|  |     52 | 		r = IntsTestLdd.TestCrazyInts();
 | 
|  |     53 | 
 | 
|  |     54 | 		if(r == KErrNotSupported)
 | 
|  |     55 | 			IntsTest.Printf(_L("CrazyInterrupts are not enabled\n\r"));
 | 
|  |     56 | 		}
 | 
|  |     57 | 	else
 | 
|  |     58 | 		{
 | 
|  |     59 | 		IntsTest.Printf(_L("Failed to open the driver (r=%d)"), r);
 | 
|  |     60 | 		if(r == KErrNotSupported)
 | 
|  |     61 | 			{
 | 
|  |     62 | 			IntsTest.Printf(_L(": Not SMP platform..\n"), r);
 | 
|  |     63 | 			}
 | 
|  |     64 | 		else
 | 
|  |     65 | 			{
 | 
|  |     66 | 			IntsTest(r); // fail..
 | 
|  |     67 | 			}
 | 
|  |     68 | 		}
 | 
|  |     69 | 
 | 
|  |     70 | 	// Close the driver
 | 
|  |     71 | 	IntsTestLdd.Close();
 | 
|  |     72 | 
 | 
|  |     73 | 	// unload the driver
 | 
|  |     74 | 	User::FreeLogicalDevice(KLddFileName);
 | 
|  |     75 | 
 | 
|  |     76 | 	// check results..
 | 
|  |     77 | 	IntsTest((r == KErrNone) || (r == KErrNotSupported));
 | 
|  |     78 | 
 | 
|  |     79 | 	IntsTest.End();
 | 
|  |     80 | 
 | 
|  |     81 | 	return KErrNone;
 | 
|  |     82 | 	}
 | 
|  |     83 | 
 |