sl@0: // Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of the License "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // e32test\misc\t_cp0.cpp sl@0: // sl@0: // sl@0: sl@0: #include sl@0: #include sl@0: #include "nk_cpu.h" sl@0: #include "../misc/prbs.h" sl@0: sl@0: RTest test(_L("T_CP0")); sl@0: sl@0: extern void GetAcc0(TInt64&); sl@0: extern void SetAcc0(const TInt64&); sl@0: extern void InnerProduct(TInt64& /*aResult*/, const TInt16* /*aVec1*/, const TInt16* /*aVec2*/, TInt /*aLength*/); sl@0: extern void InnerProduct2(TInt64& /*aResult*/, const TInt16* /*aVec1*/, const TInt16* /*aVec2*/, TInt /*aLength*/); sl@0: sl@0: sl@0: TInt DoCP0Test(TAny* aPtr) sl@0: { sl@0: TUint seed[2]; sl@0: seed[0]=(TUint)aPtr; sl@0: seed[1]=0; sl@0: TInt16 vec1[128]; sl@0: TInt16 vec2[128]; sl@0: TInt run; sl@0: for (run=0; run<100000; ++run) sl@0: { sl@0: TInt n=(Random(seed)&63)+64; // vector length sl@0: TInt i; sl@0: for (i=0; i exitCat=aThread.ExitCategory(); sl@0: test.Printf(_L("Thread %d: %d,%d,%S\n"),aThreadNum,exitType,exitReason,&exitCat); sl@0: test(exitType==EExitKill); sl@0: test(exitReason==KErrNone); sl@0: } sl@0: sl@0: TInt E32Main() sl@0: { sl@0: test.Title(); sl@0: test.Start(_L("Testing XScale DSP Coprocessor")); sl@0: sl@0: TInt64 acc0; sl@0: GetAcc0(acc0); sl@0: test.Printf(_L("acc0=%lx\n"),acc0); sl@0: sl@0: SetAcc0(0); sl@0: GetAcc0(acc0); sl@0: test.Printf(_L("acc0=%lx\n"),acc0); sl@0: sl@0: test.Next(_L("Test CP0 in single thread")); sl@0: DoCP0Test((TAny*)487); sl@0: sl@0: test.Next(_L("Test CP0 in multiple threads")); sl@0: RThread t1, t2; sl@0: TRequestStatus s1, s2; sl@0: TInt r=t1.Create(KNullDesC(),DoCP0Test,0x1000,NULL,(TAny*)0xddb3d743); sl@0: test(r==KErrNone); sl@0: r=t2.Create(KNullDesC(),DoCP0Test,0x1000,NULL,(TAny*)0xb504f334); sl@0: test(r==KErrNone); sl@0: t1.Logon(s1); sl@0: t2.Logon(s2); sl@0: t1.Resume(); sl@0: t2.Resume(); sl@0: User::WaitForRequest(s1); sl@0: User::WaitForRequest(s2); sl@0: CheckExit(1,t1); sl@0: CheckExit(2,t2); sl@0: CLOSE_AND_WAIT(t1); sl@0: CLOSE_AND_WAIT(t2); sl@0: sl@0: test.End(); sl@0: return 0; sl@0: } sl@0: