First public contribution.
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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // e32\drivers\trace\arm\btracex.cia
19 #include <kernel/kern_priv.h>
20 #include "drivers/btrace.h"
22 #include "highrestimer.h"
25 #ifdef BTRACE_DRIVER_MACHINE_CODED
27 #ifndef HAS_HIGH_RES_TIMER
28 //#undef BTRACE_INCLUDE_TIMESTAMPS
31 __NAKED__ TBool TBTraceBufferK::TraceWithTimestamp2(TUint32 aHeader,TUint32 aHeader2,TUint32 aContext,TUint32 a1,TUint32 a2,TUint32 a3,TUint32 aExtra,TUint32 aPc)
33 #ifdef BTRACE_INCLUDE_TIMESTAMPS
34 #define USE_TIMESTAMP2
35 #include "btracex_impl.cia"
37 #endif // If compiling without timestamp support this function falls through to the normal Trace()...
40 __NAKED__ TBool TBTraceBufferK::Trace(TUint32 aHeader,TUint32 aHeader2,TUint32 aContext,TUint32 a1,TUint32 a2,TUint32 a3,TUint32 aExtra,TUint32 aPc)
42 #include "btracex_impl.cia"
44 asm("trace_dropped: "); // get here with r5 = &user_buffer
46 asm("str r0, [r10, #%a0]" : : "i" _FOFF(TBTraceBufferK,iRequestDataSize));
48 asm("trace_off:"); // get here with r5 = &user_buffer
49 asm("ldr r7, [r5, #%a0]" : : "i" _FOFF(TBTraceBuffer,iGeneration));
50 asm("str r10, [r10,#%a0]" : : "i" _FOFF(TBTraceBufferK,iDropped)); // flag we dropped a trace
52 __DATA_MEMORY_BARRIER_Z__(r8); // make sure head pointer update seen before generation update
54 asm("add r7, r7, #1 ");
55 asm("str r7, [r5, #%a0]" : : "i" _FOFF(TBTraceBuffer,iGeneration)); // make sure iGeneration doesn't go out of sync
58 asm("add sp, sp, #16 "); // drop args
59 asm("ldmfd sp!, {r4-r12,lr} ");
60 asm("mov r0, #1 "); // return TRUE
62 asm("msr cpsr_c, r12 "); // restore interrupts
69 asm(".word 0x03020100 ");
71 asm(".word 0x04040404 ");
77 #endif // BTRACE_DRIVER_MACHINE_CODED