1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/kernelhwsrv/kerneltest/e32test/nkernsa/nkutils.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,80 @@
1.4 +// Copyright (c) 2006-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\nkernsa\nkutils.h
1.18 +//
1.19 +//
1.20 +
1.21 +#ifndef __NKUTILS_H__
1.22 +#define __NKUTILS_H__
1.23 +#include <nk_priv.h>
1.24 +#include <nktest/utils.h>
1.25 +
1.26 +#ifndef __SMP__
1.27 +class NThreadGroup;
1.28 +#endif
1.29 +
1.30 +
1.31 +enum TExitCallBackInstance
1.32 + {
1.33 + EInContext=0,
1.34 + EBeforeFree=1,
1.35 + EAfterFree=2,
1.36 + };
1.37 +
1.38 +typedef TInt NRequestStatus;
1.39 +
1.40 +typedef void (*TExitFunc)(TAny*, NThread*, TInt);
1.41 +
1.42 +extern NThread* CreateThread(const char* aName, NThreadFunction aFunc, TInt aPri, const TAny* aParams, TInt aPSize, TBool aResume, TInt aTimeslice, TExitFunc aExitFunc=0, TAny* aExitParam=0, TUint32 aCpuAffinity=0, NThreadGroup* aGroup=0);
1.43 +extern NThread* CreateThreadSignalOnExit(const char* aName, NThreadFunction aFunc, TInt aPri, const TAny* aParams, TInt aPSize, TInt aTimeslice, NFastSemaphore* aExitSem, TUint32 aCpuAffinity, NThreadGroup* aGroup=0);
1.44 +extern NThread* CreateUnresumedThreadSignalOnExit(const char* aName, NThreadFunction aFunc, TInt aPri, const TAny* aParams, TInt aPSize, TInt aTimeslice, NFastSemaphore* aExitSem, TUint32 aCpuAffinity, NThreadGroup* aGroup=0);
1.45 +extern void CreateThreadAndWaitForExit(const char* aName, NThreadFunction aFunc, TInt aPri, const TAny* aParams, TInt aPSize, TInt aTimeslice, TUint32 aCpuAffinity=0, NThreadGroup* aGroup=0);
1.46 +extern TDfcQue* CreateDfcQ(const char* aName, TInt aPri, TUint32 aCpuAffinity=0, NThreadGroup* aGroup=0);
1.47 +extern void DestroyDfcQ(TDfcQue* aQ);
1.48 +
1.49 +extern void FMWaitFull(NFastMutex* aMutex);
1.50 +extern void FMSignalFull(NFastMutex* aMutex);
1.51 +
1.52 +extern TInt WaitWithTimeout(NFastSemaphore* aS, TUint32 aTimeout);
1.53 +
1.54 +extern "C" TInt __timer_period();
1.55 +extern "C" TInt __microseconds_to_timeslice_ticks(TInt us);
1.56 +extern "C" TInt __fast_counter_to_timeslice_ticks(TUint64 aFCdelta);
1.57 +
1.58 +const TInt KStackSize = 4096;
1.59 +const TInt KTimeslice = 20000; // microseconds
1.60 +
1.61 +const TUint32 KMinTimeout = 1;
1.62 +#ifdef __SMP__
1.63 +const TInt KSmallTimeslice = 500;
1.64 +#else
1.65 +const TInt KSmallTimeslice = 2;
1.66 +#endif
1.67 +
1.68 +extern void WaitForRequest(NRequestStatus& aStatus);
1.69 +extern void RequestComplete(NThread* aThread, NRequestStatus*& aStatus, TInt aValue);
1.70 +
1.71 +extern void InitBTraceHandler();
1.72 +extern void DumpBTraceBuffer();
1.73 +extern void StartBTrace();
1.74 +extern void StopBTrace();
1.75 +
1.76 +extern "C" void CheckPoint();
1.77 +
1.78 +#define __CHECKPOINT() CheckPoint()
1.79 +
1.80 +
1.81 +#endif
1.82 +
1.83 +