Update contrib.
1 // Copyright (c) 2007-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\nkernsa\nirqx.cpp
24 class NIrqXTest : public NIrqX
29 void Set(TBool aLevel);
31 static void DoEoi(NIrq* aIrq);
32 static void DoEnable(NIrq* aIrq);
33 static void DoDisable(NIrq* aIrq);
34 static void DoSetCpu(NIrq* aIrq, TUint32 aMask);
35 static void DoInit(NIrq* aIrq);
36 static TBool DoPending(NIrq* aIrq);
37 static void DoWait(NIrq* aIrq);
47 NIrqXTest::NIrqXTest()
56 void NIrqXTest::Set(TBool aLevel)
59 TInt irq = __SPIN_LOCK_IRQSAVE(iLock);
60 TUint32 f = iIrq->iStaticFlags;
63 if (f & NIrq::EPolarity)
74 if (f & NIrq::EPolarity)
76 active = aLevel && !iLevel;
80 active = !aLevel && iLevel;
83 iLevel = (TUint8)(aLevel ? 1 : 0);
84 if (active && iEnabled)
86 __SPIN_UNLOCK_IRQRESTORE(iLock,irq);
90 __NAKED__ void NIrqXTest::Kick()
93 _asm lock xchg al, [ecx]NIrqXTest.iPending
96 _asm mov eax, [ecx]NIrqXTest.iCpuMask
98 _asm jz short kick0 // no CPUs, so nothing to do
99 _asm mov ds:[X86_LOCAL_APIC_BASE + X86_LOCAL_APIC_OFFSET_ICRH], eax
100 _asm mov eax, [ecx]NIrqXTest.iIrq
101 _asm mov eax, [eax]NIrq.iVector
103 _asm mov ds:[X86_LOCAL_APIC_BASE + X86_LOCAL_APIC_OFFSET_ICRL], eax
109 void NIrqXTest::DoEoi(NIrq* aIrq)
111 NIrqXTest* pX = (NIrqXTest*)iX;
112 TInt irq = __SPIN_LOCK_IRQSAVE(pX->iLock);
116 TUint32 f = aIrq->iStaticFlags;
117 if (f & NIrq::ELevel)
119 TUint active_level = (f & NIrq::EPolarity) ? 1 : 0;
120 if (pX->iLevel==active_level && pX->iEnabled)
124 __SPIN_UNLOCK_IRQRESTORE(pX->iLock,irq);
127 void NIrqXTest::DoEnable(NIrq* aIrq)
131 void NIrqXTest::DoDisable(NIrq* aIrq)
135 void NIrqXTest::DoSetCpu(NIrq* aIrq, TUint32 aMask)
139 void NIrqXTest::DoInit(NIrq* aIrq)
144 TBool NIrqXTest::DoPending(NIrq* aIrq)
148 void NIrqXTest::DoWait(NIrq* aIrq)