sl@0: // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of the License "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // e32\drivers\trace\arm\btracex.cia sl@0: // sl@0: // sl@0: sl@0: #include sl@0: #include sl@0: #include "drivers/btrace.h" sl@0: #ifndef __SMP__ sl@0: #include "highrestimer.h" sl@0: #endif sl@0: sl@0: #ifdef BTRACE_DRIVER_MACHINE_CODED sl@0: sl@0: #ifndef HAS_HIGH_RES_TIMER sl@0: //#undef BTRACE_INCLUDE_TIMESTAMPS sl@0: #endif sl@0: sl@0: __NAKED__ TBool TBTraceBufferK::TraceWithTimestamp2(TUint32 aHeader,TUint32 aHeader2,TUint32 aContext,TUint32 a1,TUint32 a2,TUint32 a3,TUint32 aExtra,TUint32 aPc) sl@0: { sl@0: #ifdef BTRACE_INCLUDE_TIMESTAMPS sl@0: #define USE_TIMESTAMP2 sl@0: #include "btracex_impl.cia" sl@0: #undef USE_TIMESTAMP2 sl@0: #endif // If compiling without timestamp support this function falls through to the normal Trace()... sl@0: } sl@0: sl@0: __NAKED__ TBool TBTraceBufferK::Trace(TUint32 aHeader,TUint32 aHeader2,TUint32 aContext,TUint32 a1,TUint32 a2,TUint32 a3,TUint32 aExtra,TUint32 aPc) sl@0: { sl@0: #include "btracex_impl.cia" sl@0: sl@0: asm("trace_dropped: "); // get here with r5 = &user_buffer sl@0: asm("mov r0, #0 "); sl@0: asm("str r0, [r10, #%a0]" : : "i" _FOFF(TBTraceBufferK,iRequestDataSize)); sl@0: sl@0: asm("trace_off:"); // get here with r5 = &user_buffer sl@0: asm("ldr r7, [r5, #%a0]" : : "i" _FOFF(TBTraceBuffer,iGeneration)); sl@0: asm("str r10, [r10,#%a0]" : : "i" _FOFF(TBTraceBufferK,iDropped)); // flag we dropped a trace sl@0: #ifdef __SMP__ sl@0: __DATA_MEMORY_BARRIER_Z__(r8); // make sure head pointer update seen before generation update sl@0: #endif sl@0: asm("add r7, r7, #1 "); sl@0: asm("str r7, [r5, #%a0]" : : "i" _FOFF(TBTraceBuffer,iGeneration)); // make sure iGeneration doesn't go out of sync sl@0: sl@0: asm("done:"); sl@0: asm("add sp, sp, #16 "); // drop args sl@0: asm("ldmfd sp!, {r4-r12,lr} "); sl@0: asm("mov r0, #1 "); // return TRUE sl@0: #ifndef __SMP__ sl@0: asm("msr cpsr_c, r12 "); // restore interrupts sl@0: #endif sl@0: __JUMP(,lr); sl@0: sl@0: asm("__Buffer: "); sl@0: asm(".word Buffer "); sl@0: asm("__03020100: "); sl@0: asm(".word 0x03020100 "); sl@0: asm("__04040404: "); sl@0: asm(".word 0x04040404 "); sl@0: } sl@0: sl@0: sl@0: sl@0: sl@0: #endif // BTRACE_DRIVER_MACHINE_CODED