0
|
1 |
// Copyright (c) 2006-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 |
// e32test\nkernsa\nkutils.h
|
|
15 |
//
|
|
16 |
//
|
|
17 |
|
|
18 |
#ifndef __NKUTILS_H__
|
|
19 |
#define __NKUTILS_H__
|
|
20 |
#include <nk_priv.h>
|
|
21 |
#include <nktest/utils.h>
|
|
22 |
|
|
23 |
#ifndef __SMP__
|
|
24 |
class NThreadGroup;
|
|
25 |
#endif
|
|
26 |
|
|
27 |
|
|
28 |
enum TExitCallBackInstance
|
|
29 |
{
|
|
30 |
EInContext=0,
|
|
31 |
EBeforeFree=1,
|
|
32 |
EAfterFree=2,
|
|
33 |
};
|
|
34 |
|
|
35 |
typedef TInt NRequestStatus;
|
|
36 |
|
|
37 |
typedef void (*TExitFunc)(TAny*, NThread*, TInt);
|
|
38 |
|
|
39 |
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);
|
|
40 |
extern NThread* CreateThreadSignalOnExit(const char* aName, NThreadFunction aFunc, TInt aPri, const TAny* aParams, TInt aPSize, TInt aTimeslice, NFastSemaphore* aExitSem, TUint32 aCpuAffinity, NThreadGroup* aGroup=0);
|
|
41 |
extern NThread* CreateUnresumedThreadSignalOnExit(const char* aName, NThreadFunction aFunc, TInt aPri, const TAny* aParams, TInt aPSize, TInt aTimeslice, NFastSemaphore* aExitSem, TUint32 aCpuAffinity, NThreadGroup* aGroup=0);
|
|
42 |
extern void CreateThreadAndWaitForExit(const char* aName, NThreadFunction aFunc, TInt aPri, const TAny* aParams, TInt aPSize, TInt aTimeslice, TUint32 aCpuAffinity=0, NThreadGroup* aGroup=0);
|
|
43 |
extern TDfcQue* CreateDfcQ(const char* aName, TInt aPri, TUint32 aCpuAffinity=0, NThreadGroup* aGroup=0);
|
|
44 |
extern void DestroyDfcQ(TDfcQue* aQ);
|
|
45 |
|
|
46 |
extern void FMWaitFull(NFastMutex* aMutex);
|
|
47 |
extern void FMSignalFull(NFastMutex* aMutex);
|
|
48 |
|
|
49 |
extern TInt WaitWithTimeout(NFastSemaphore* aS, TUint32 aTimeout);
|
|
50 |
|
|
51 |
extern "C" TInt __timer_period();
|
|
52 |
extern "C" TInt __microseconds_to_timeslice_ticks(TInt us);
|
|
53 |
extern "C" TInt __fast_counter_to_timeslice_ticks(TUint64 aFCdelta);
|
|
54 |
|
|
55 |
const TInt KStackSize = 4096;
|
|
56 |
const TInt KTimeslice = 20000; // microseconds
|
|
57 |
|
|
58 |
const TUint32 KMinTimeout = 1;
|
|
59 |
#ifdef __SMP__
|
|
60 |
const TInt KSmallTimeslice = 500;
|
|
61 |
#else
|
|
62 |
const TInt KSmallTimeslice = 2;
|
|
63 |
#endif
|
|
64 |
|
|
65 |
extern void WaitForRequest(NRequestStatus& aStatus);
|
|
66 |
extern void RequestComplete(NThread* aThread, NRequestStatus*& aStatus, TInt aValue);
|
|
67 |
|
|
68 |
extern void InitBTraceHandler();
|
|
69 |
extern void DumpBTraceBuffer();
|
|
70 |
extern void StartBTrace();
|
|
71 |
extern void StopBTrace();
|
|
72 |
|
|
73 |
extern "C" void CheckPoint();
|
|
74 |
|
|
75 |
#define __CHECKPOINT() CheckPoint()
|
|
76 |
|
|
77 |
|
|
78 |
#endif
|
|
79 |
|
|
80 |
|