os/kernelhwsrv/kernel/eka/debug/ost/inc/traceutils.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of the License "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
// Trace API
sl@0
    15
//
sl@0
    16
sl@0
    17
/**
sl@0
    18
* @internalTechnology
sl@0
    19
* @deprecated
sl@0
    20
*/
sl@0
    21
sl@0
    22
#ifndef TRACEUTILS_H_
sl@0
    23
#define TRACEUTILS_H_
sl@0
    24
#include <e32btrace.h>
sl@0
    25
sl@0
    26
sl@0
    27
/**
sl@0
    28
Maximum length of a formatted string
sl@0
    29
*/
sl@0
    30
const static TInt KMaxPrintfSize = 256;
sl@0
    31
sl@0
    32
/**
sl@0
    33
Dummy class to toss away overflow
sl@0
    34
sl@0
    35
@internalComponent
sl@0
    36
*/
sl@0
    37
#ifndef __KERNEL_MODE__
sl@0
    38
class TTruncateOverflow16 : public TDes16Overflow
sl@0
    39
	{
sl@0
    40
	public:
sl@0
    41
	virtual void Overflow(TDes&) {};
sl@0
    42
	};
sl@0
    43
sl@0
    44
/**
sl@0
    45
Dummy class to toss away overflow
sl@0
    46
sl@0
    47
@internalComponent
sl@0
    48
*/
sl@0
    49
class TTruncateOverflow8 : public TDes8Overflow
sl@0
    50
	{
sl@0
    51
	public:
sl@0
    52
	virtual void Overflow(TDes8&) {};
sl@0
    53
	};
sl@0
    54
#endif  //__KERNEL_MODE__
sl@0
    55
sl@0
    56
sl@0
    57
/**
sl@0
    58
@internalComponent
sl@0
    59
*/
sl@0
    60
#define OST_HEADER(aSize,aGroupId,aContext,aPc)																\
sl@0
    61
	((((aSize) + (aContext?4:0) + (aPc?4:0)) << BTrace::ESizeIndex*8)										\
sl@0
    62
	+(((aContext?BTrace::EContextIdPresent:0) | (aPc?BTrace::EPcPresent:0)) << BTrace::EFlagsIndex*8)			\
sl@0
    63
	+((aGroupId) << BTrace::ECategoryIndex*8)																				\
sl@0
    64
	+((0) << BTrace::ESubCategoryIndex*8))
sl@0
    65
sl@0
    66
sl@0
    67
/**
sl@0
    68
@internalComponent
sl@0
    69
*/
sl@0
    70
#define OST_SECONDARY_0(aGroupId,aComponentId,aThreadIdPresent,aPcPresent,aPc,aTraceId)	\
sl@0
    71
	BTrace::OutFilteredPcFormatBig(OST_HEADER(8,aGroupId,aThreadIdPresent,aPcPresent),(TUint32)(aComponentId),aPc,aTraceId,0,0)
sl@0
    72
sl@0
    73
/**
sl@0
    74
@internalComponent
sl@0
    75
*/
sl@0
    76
#define OST_SECONDARY_1(aGroupId,aComponentId,aThreadIdPresent,aPcPresent,aPc,aTraceId, aData1) \
sl@0
    77
	BTrace::OutFilteredPcFormatBig(OST_HEADER(8,aGroupId,aThreadIdPresent,aPcPresent),(TUint32)(aComponentId),aPc,aTraceId,&aData1,4)
sl@0
    78
sl@0
    79
/**
sl@0
    80
@internalComponent
sl@0
    81
*/
sl@0
    82
#define OST_SECONDARY_ANY(aGroupId, aComponentId, aThreadIdPresent, aPcPresent, aPc, aTraceId, aData, aDataSize) \
sl@0
    83
	BTrace::OutFilteredPcFormatBig(OST_HEADER(8,aGroupId,aThreadIdPresent,aPcPresent),(TUint32)(aComponentId),aPc,aTraceId,aData,(TInt)(aDataSize))
sl@0
    84
sl@0
    85
sl@0
    86
#ifdef __MARM_ARMV5__
sl@0
    87
	//armv5
sl@0
    88
#define GET_PC(pc) \
sl@0
    89
	TUint32 pc = 0; \
sl@0
    90
	asm("mov pc, __return_address()")
sl@0
    91
#elif __MARM_ARM4__
sl@0
    92
	//arm4 not implemented yet!
sl@0
    93
#define GET_PC(pc) \
sl@0
    94
	TUint32 pc = 0;
sl@0
    95
#elif __WINS__
sl@0
    96
	//wins
sl@0
    97
#define GET_PC(pc) \
sl@0
    98
	TUint32 pc = 0; \
sl@0
    99
	_asm push edx \
sl@0
   100
	_asm mov edx, [ebp+4] \
sl@0
   101
	_asm mov [pc], edx \
sl@0
   102
	_asm pop edx
sl@0
   103
	//This is instead of doing "asm(mov pc, ebp+4)" as that gives warnings about registers being spilled.
sl@0
   104
#elif __X86__ 
sl@0
   105
	//x86 not implemented yet!
sl@0
   106
#define GET_PC(pc) \
sl@0
   107
	TUint32 pc = 0;
sl@0
   108
/*	asm("push edx"); \
sl@0
   109
	asm("mov %0, [edx+4]": "=r" (pc)); \
sl@0
   110
	asm("pop edx") */
sl@0
   111
#else
sl@0
   112
//other platforms
sl@0
   113
#define GET_PC(pc) \
sl@0
   114
	TUint32 pc = 0;
sl@0
   115
#endif
sl@0
   116
sl@0
   117
#endif /*TRACEUTILS_H_*/