First public contribution.
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_cp0.cpp
21 #include "../misc/prbs.h"
23 RTest test(_L("T_CP0"));
25 extern void GetAcc0(TInt64&);
26 extern void SetAcc0(const TInt64&);
27 extern void InnerProduct(TInt64& /*aResult*/, const TInt16* /*aVec1*/, const TInt16* /*aVec2*/, TInt /*aLength*/);
28 extern void InnerProduct2(TInt64& /*aResult*/, const TInt16* /*aVec1*/, const TInt16* /*aVec2*/, TInt /*aLength*/);
31 TInt DoCP0Test(TAny* aPtr)
39 for (run=0; run<100000; ++run)
41 TInt n=(Random(seed)&63)+64; // vector length
45 vec1[i]=(TInt16)(Random(seed)&0xffff);
46 vec2[i]=(TInt16)(Random(seed)&0xffff);
47 TInt64 result, result2;
48 InnerProduct(result,vec1,vec2,n);
49 InnerProduct2(result2,vec1,vec2,n);
50 if (result != result2)
52 User::Panic(_L("ERROR"),run);
59 void CheckExit(TInt aThreadNum, RThread aThread)
61 TInt exitType=aThread.ExitType();
62 TInt exitReason=aThread.ExitReason();
63 TBuf<32> exitCat=aThread.ExitCategory();
64 test.Printf(_L("Thread %d: %d,%d,%S\n"),aThreadNum,exitType,exitReason,&exitCat);
65 test(exitType==EExitKill);
66 test(exitReason==KErrNone);
72 test.Start(_L("Testing XScale DSP Coprocessor"));
76 test.Printf(_L("acc0=%lx\n"),acc0);
80 test.Printf(_L("acc0=%lx\n"),acc0);
82 test.Next(_L("Test CP0 in single thread"));
83 DoCP0Test((TAny*)487);
85 test.Next(_L("Test CP0 in multiple threads"));
87 TRequestStatus s1, s2;
88 TInt r=t1.Create(KNullDesC(),DoCP0Test,0x1000,NULL,(TAny*)0xddb3d743);
90 r=t2.Create(KNullDesC(),DoCP0Test,0x1000,NULL,(TAny*)0xb504f334);
96 User::WaitForRequest(s1);
97 User::WaitForRequest(s2);