Update contrib.
1 // Copyright (c) 1999-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\realtime\d_latncy.cia
22 #elif defined(__MAWD__)
23 #include <windermere.h>
24 #elif defined(__MISA__)
26 #elif defined(__MCOT__)
28 #elif defined(__MI920__) || defined(__NI1136__)
29 #include <integratorap.h>
30 #elif defined(__RVEMUBOARD__)
31 #include <rvemuboard.h>
34 #include <kernel/kern_priv.h> //temporary
38 #if !defined(__EPOC32__) || !defined(__CPU_X86)
39 __NAKED__ TUint IntStackPtr()
42 asm("bic r3, r1, #0x1f ");
44 asm("orr r3, r3, #0xd1 "); // mode_fiq, all interrupts off
46 asm("orr r3, r3, #0xd2 "); // mode_irq, all interrupts off
49 asm("mov r0, sp "); // r0=sp_irq or sp_fiq
50 asm("msr cpsr, r1 "); // restore interrupts
55 #ifdef __CAPTURE_EXTRAS
58 __NAKED__ void CaptureExtras(SLatencyResults&)
60 asm("mrs r1, spsr "); // r1=interrupted mode
61 asm("mrs r2, cpsr "); // r2=current PSR
62 asm("tst r1, #0x0f "); // check if we interrupted user mode
63 asm("orr ip, r1, #%a0" : : "i" ((TInt)KAllInterruptsMask)); // ip=interrupted mode with interrupts off
64 asm("orreq ip, ip, #0x1f "); // if we interrupted user mode, go to system mode instead
65 asm("bic ip, ip, #0x20 "); // make sure we don't go into THUMB mode
66 asm("msr cpsr, ip "); // switch to interrupted mode with ints off
67 asm("mov r3, lr "); // r3=interrupted mode R14
68 asm("msr cpsr, r2 "); // back to interrupt mode
69 asm("str r1, [r0, #%a0]" : : "i" _FOFF(SLatencyResults,iIntSpsr));
70 asm("str r3, [r0, #%a0]" : : "i" _FOFF(SLatencyResults,iIntR14));
76 #if defined (__MISA__) || defined (__MCOT__)
77 __NAKED__ void DLatency::MsCallBack(TAny* aPtr)
79 asm("ldr ip, __KHwBaseOst");
80 asm("ldr r3, [r0, #%a0]" : : "i" _FOFF(DLatency,iTickIncrement));
81 asm("ldr r1, [ip, #0x10] "); // r1=OSCR
82 asm("ldr r2, [ip, #0x00] "); // r2=OSMR0
83 asm("sub r1, r1, r2 "); // r1=int latency in ticks
84 asm("str r1, [r0, #%a0]" : : "i" _FOFF(DLatency,iResults.iIntTicks));
85 asm("str r2, [r0, #%a0]" : : "i" _FOFF(DLatency,iTriggerTime));
86 asm("add r2, r2, r3 "); // add increment to OSMR0
87 asm("ldr r1, [r0, #%a0]" : : "i" _FOFF(DLatency,iIntStackTop));
88 asm("ldrb r3, [r0, #%a0]" : : "i" _FOFF(DLatency,iOff));
89 asm("str r2, [ip, #0x00] ");
90 asm("ldr r1, [r1, #-4] "); // r1=interrupt return address
93 asm("str r1, [r0, #%a0]" : : "i" _FOFF(DLatency,iResults.iIntRetAddr));
94 asm("str r2, [ip, #0x14] "); // clear interrupt
95 asm("add r0, r0, #%a0" : : "i" _FOFF(DLatency,iMsDfc));
96 asm("beq Add__4TDfc ");
99 asm("__KHwBaseOst: "); //OS timer register locations
101 #ifdef __MEMMODEL_DIRECT__
102 asm(".word 0x90000000"); //Assabet direct MM
104 asm(".word 0x63008000"); //Assabet non-direct MM
107 #ifdef __MEMMODEL_DIRECT__
108 asm(".word 0x40A00000"); //Lubbock direct MM
110 asm(".word 0x6300A000"); //Lubbock non-direct MM