0
|
1 |
// Copyright (c) 2005-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 |
// e32\nkernsmp\x86\ncutilf.cpp
|
|
15 |
//
|
|
16 |
//
|
|
17 |
|
|
18 |
#include <nkern.h>
|
|
19 |
|
|
20 |
extern "C" {
|
|
21 |
extern SVariantInterfaceBlock* VIB;
|
|
22 |
}
|
|
23 |
|
|
24 |
/******************************************************************************
|
|
25 |
* Spin lock
|
|
26 |
******************************************************************************/
|
|
27 |
/** Create a spin lock
|
|
28 |
|
|
29 |
@publishedPartner
|
|
30 |
@released
|
|
31 |
*/
|
|
32 |
EXPORT_C TSpinLock::TSpinLock(TUint aOrder)
|
|
33 |
{
|
|
34 |
(void)aOrder;
|
|
35 |
__NK_ASSERT_DEBUG( (aOrder==EOrderNone) || ((aOrder&0x7f)<0x20) );
|
|
36 |
if (aOrder>=0x80 && aOrder!=EOrderNone)
|
|
37 |
aOrder -= 0x60;
|
|
38 |
aOrder |= 0xFF00u;
|
|
39 |
iLock = TUint64(aOrder)<<48; // byte 6 = 00-1F for interrupt, 20-3F for preemption
|
|
40 |
// byte 7 = FF if not held
|
|
41 |
}
|
|
42 |
|
|
43 |
|
|
44 |
/******************************************************************************
|
|
45 |
* Read/Write Spin lock
|
|
46 |
******************************************************************************/
|
|
47 |
/** Create a spin lock
|
|
48 |
|
|
49 |
@publishedPartner
|
|
50 |
@released
|
|
51 |
*/
|
|
52 |
EXPORT_C TRWSpinLock::TRWSpinLock(TUint aOrder)
|
|
53 |
{
|
|
54 |
(void)aOrder;
|
|
55 |
__NK_ASSERT_DEBUG( (aOrder==TSpinLock::EOrderNone) || ((aOrder&0x7f)<0x20) );
|
|
56 |
if (aOrder>=0x80 && aOrder!=TSpinLock::EOrderNone)
|
|
57 |
aOrder -= 0x60;
|
|
58 |
aOrder |= 0xFF00u;
|
|
59 |
iLock = TUint64(aOrder)<<48; // byte 6 = 00-1F for interrupt, 20-3F for preemption
|
|
60 |
// byte 7 = FF if not held
|
|
61 |
}
|
|
62 |
|
|
63 |
|
|
64 |
/** Get the frequency of counter queried by NKern::Timestamp().
|
|
65 |
*/
|
|
66 |
EXPORT_C TUint32 NKern::TimestampFrequency()
|
|
67 |
{
|
|
68 |
return VIB->iTimestampFreq;
|
|
69 |
}
|
|
70 |
|