os/kernelhwsrv/kernel/eka/debug/ost/src/ost.cpp
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
#include <opensystemtrace.h>
sl@0
    18
#include "traceutils.h"
sl@0
    19
sl@0
    20
sl@0
    21
//Add the Doxygen macro so that Doxygen doesn't need to know about the SYMBIAN_TRACE_EXECUTABLE_IS_INCLUDED define.
sl@0
    22
//This allows doxygen to pick up the comments for the enabled implementation of the trace API.
sl@0
    23
#ifdef __DOXYGEN__
sl@0
    24
	#define SYMBIAN_TRACE_EXECUTABLE_IS_INCLUDED
sl@0
    25
#endif //__DOXYGEN__
sl@0
    26
sl@0
    27
sl@0
    28
sl@0
    29
/**
sl@0
    30
 * This method currently incorrectly returns 0, it should be returning the UID3 of the executable.
sl@0
    31
 *
sl@0
    32
 * @deprecated
sl@0
    33
 * @return Returns 0.
sl@0
    34
 */
sl@0
    35
EXPORT_C TComponentId TTraceContext::DefaultComponentId()
sl@0
    36
	{
sl@0
    37
	return 0;
sl@0
    38
	}
sl@0
    39
sl@0
    40
sl@0
    41
/**
sl@0
    42
 * Check if thread identification will be added by default.
sl@0
    43
 * @deprecated
sl@0
    44
 */
sl@0
    45
EXPORT_C THasThreadIdentification TTraceContext::HasThreadIdentification()  const
sl@0
    46
	{
sl@0
    47
	return iHasThreadIdentification;
sl@0
    48
	};
sl@0
    49
sl@0
    50
/**
sl@0
    51
 * Check if PC will be added by default.
sl@0
    52
 * @deprecated
sl@0
    53
 */
sl@0
    54
EXPORT_C THasProgramCounter TTraceContext::HasProgramCounter()  const
sl@0
    55
	{
sl@0
    56
	return iHasProgramCounter;
sl@0
    57
	};
sl@0
    58
sl@0
    59
sl@0
    60
/**
sl@0
    61
 * Get the current group ID in form of classification (although classification is deprecated)
sl@0
    62
 *
sl@0
    63
 * @deprecated Use TTraceContext::GroupId() instead.
sl@0
    64
 * @return The current group ID of the trace point context, in form of classification.
sl@0
    65
 */
sl@0
    66
EXPORT_C TClassification TTraceContext::Classification() const
sl@0
    67
	{
sl@0
    68
	return static_cast<TClassification>(iGroupId);
sl@0
    69
	};
sl@0
    70
sl@0
    71
/**
sl@0
    72
 * Get the current group ID
sl@0
    73
 *
sl@0
    74
 * @deprecated
sl@0
    75
 * @return The current group ID of the trace point context.
sl@0
    76
 */
sl@0
    77
EXPORT_C TGroupId TTraceContext::GroupId() const
sl@0
    78
    {
sl@0
    79
    return iGroupId;
sl@0
    80
    };
sl@0
    81
sl@0
    82
/**
sl@0
    83
 * Get the current Component Id
sl@0
    84
 *
sl@0
    85
 * @deprecated
sl@0
    86
 * @return The currently set Component Id
sl@0
    87
 */
sl@0
    88
EXPORT_C TComponentId TTraceContext::ComponentId() const
sl@0
    89
	{
sl@0
    90
	return iComponentId;
sl@0
    91
	}
sl@0
    92
sl@0
    93
sl@0
    94
//--------------------- OST compiled in ------------------------
sl@0
    95
#ifdef SYMBIAN_TRACE_EXECUTABLE_IS_INCLUDED
sl@0
    96
sl@0
    97
sl@0
    98
sl@0
    99
// --------- OstPrintf ------------
sl@0
   100
sl@0
   101
/**
sl@0
   102
Prints a string by outputting a trace packet with the Trace ID KFormatPrintf.
sl@0
   103
sl@0
   104
If the specified string is too long to fit into a single trace packet
sl@0
   105
a multipart trace is generated.
sl@0
   106
sl@0
   107
@deprecated
sl@0
   108
sl@0
   109
@param aContext 	The trace packet context. @see TTraceContext
sl@0
   110
@param aDes			The string. This can be of variable length.
sl@0
   111
sl@0
   112
@return 			The trace packet was/was not output.
sl@0
   113
sl@0
   114
@See BTrace::TMultipart
sl@0
   115
*/
sl@0
   116
EXPORT_C TBool OstPrint(const TTraceContext& aContext, const TDesC8& aDes)
sl@0
   117
	{
sl@0
   118
	if(IsTraceActive(aContext))
sl@0
   119
		{
sl@0
   120
		GET_PC(pc);
sl@0
   121
		return OST_SECONDARY_ANY(aContext.GroupId(), aContext.ComponentId(), aContext.HasThreadIdentification(), aContext.HasProgramCounter(), pc, KFormatPrintf, aDes.Ptr(), aDes.Size());
sl@0
   122
		}
sl@0
   123
	return EFalse;
sl@0
   124
	};
sl@0
   125
sl@0
   126
sl@0
   127
#ifdef  __KERNEL_MODE__
sl@0
   128
sl@0
   129
/**
sl@0
   130
Prints a formatted string in kernel mode only by outputting a trace packet with the Trace ID KFormatPrintf.
sl@0
   131
sl@0
   132
The function uses Kern::AppendFormat() to do the formatting.
sl@0
   133
sl@0
   134
Although it is safe to call this function from an ISR, it polls the output
sl@0
   135
serial port and may take a long time to complete, invalidating any
sl@0
   136
real-time guarantee.
sl@0
   137
sl@0
   138
If called from an ISR, it is possible for output text to be intermingled
sl@0
   139
with other output text if one set of output interrupts or preempts another.
sl@0
   140
sl@0
   141
Some of the formatting options may not work inside an ISR.
sl@0
   142
sl@0
   143
Be careful not to use a string that is too long to fit onto the stack.
sl@0
   144
If the specified string is too long to fit into a single trace packet
sl@0
   145
a multipart trace is generated.
sl@0
   146
sl@0
   147
@deprecated
sl@0
   148
sl@0
   149
@param aContext 	The trace packet context. @see TTraceContext
sl@0
   150
@param aFmt 		The format string. This must not be longer than 256 characters.
sl@0
   151
@param ...			A variable number of arguments to be converted to text as dictated
sl@0
   152
					by the format string.
sl@0
   153
sl@0
   154
@return 			The trace packet was/was not output.
sl@0
   155
sl@0
   156
@pre Calling thread can either be in a critical section or not.
sl@0
   157
@pre Interrupts must be enabled.
sl@0
   158
@pre Kernel must be unlocked
sl@0
   159
@pre Call in any context.
sl@0
   160
@pre Suitable for use in a device driver
sl@0
   161
sl@0
   162
@see Kern::AppendFormat()
sl@0
   163
@See BTrace::TMultipart
sl@0
   164
sl@0
   165
*/
sl@0
   166
EXPORT_C TBool OstPrintf(const TTraceContext& aContext, const char* aFmt, ...)
sl@0
   167
	{
sl@0
   168
	if(IsTraceActive(aContext))
sl@0
   169
		{
sl@0
   170
		GET_PC(pc);
sl@0
   171
		TBuf8<KMaxPrintfSize> buf;
sl@0
   172
		VA_LIST list;
sl@0
   173
		VA_START(list,aFmt);
sl@0
   174
		Kern::AppendFormat(buf,aFmt,list);
sl@0
   175
		return OST_SECONDARY_ANY(aContext.GroupId(), aContext.ComponentId(), aContext.HasThreadIdentification(), aContext.HasProgramCounter(), pc, KFormatPrintf, buf.Ptr(), buf.Size());
sl@0
   176
		}
sl@0
   177
	return EFalse;
sl@0
   178
	}
sl@0
   179
sl@0
   180
/**
sl@0
   181
Prints a formatted string by outputting a trace packet with the Trace ID KFormatPrintf.
sl@0
   182
sl@0
   183
If the specified string is too long to fit into a single trace packet
sl@0
   184
a multipart trace is generated.
sl@0
   185
sl@0
   186
@deprecated
sl@0
   187
sl@0
   188
@param aContext 	The trace packet context. @see TTraceContext
sl@0
   189
@param aFmt 		The format string. This must not be longer than 256 characters.
sl@0
   190
@param ...			A variable number of arguments to be converted to text as dictated
sl@0
   191
					by the format string.
sl@0
   192
sl@0
   193
@return 			The trace packet was/was not output.
sl@0
   194
sl@0
   195
@See BTrace::TMultipart
sl@0
   196
*/
sl@0
   197
EXPORT_C TBool OstPrintf(const TTraceContext& aContext, TRefByValue<const TDesC8> aFmt,...)
sl@0
   198
	{
sl@0
   199
	if(IsTraceActive(aContext))
sl@0
   200
		{
sl@0
   201
		GET_PC(pc);
sl@0
   202
		TBuf8<KMaxPrintfSize> buf;
sl@0
   203
		VA_LIST list;
sl@0
   204
		VA_START(list,aFmt);
sl@0
   205
		TDesC8 fmt = aFmt;
sl@0
   206
		Kern::AppendFormat(buf,(char*)fmt.Ptr(),list);
sl@0
   207
		return OST_SECONDARY_ANY(aContext.GroupId(), aContext.ComponentId(), aContext.HasThreadIdentification(), aContext.HasProgramCounter(), pc, KFormatPrintf, buf.Ptr(), buf.Size());
sl@0
   208
		}
sl@0
   209
	return EFalse;
sl@0
   210
	}
sl@0
   211
sl@0
   212
#endif // __KERNEL_MODE__
sl@0
   213
#ifndef __KERNEL_MODE__
sl@0
   214
sl@0
   215
/**
sl@0
   216
Prints a formatted string by outputting a trace packet with the Trace ID KFormatPrintf.
sl@0
   217
sl@0
   218
sl@0
   219
If the specified string is too long to fit into a single trace packet
sl@0
   220
a multipart trace is generated.
sl@0
   221
sl@0
   222
@deprecated
sl@0
   223
sl@0
   224
@param aContext 	The trace packet context. @see TTraceContext
sl@0
   225
@param aFmt 		The format string. This must not be longer than 256 characters.
sl@0
   226
@param ...			A variable number of arguments to be converted to text as dictated
sl@0
   227
					by the format string.
sl@0
   228
sl@0
   229
@return 			The trace packet was/was not output.
sl@0
   230
sl@0
   231
@See BTrace::TMultipart
sl@0
   232
*/
sl@0
   233
EXPORT_C TBool OstPrintf(const TTraceContext& aContext, const char* aFmt, ...)
sl@0
   234
	{
sl@0
   235
	if(IsTraceActive(aContext))
sl@0
   236
		{
sl@0
   237
		GET_PC(pc);
sl@0
   238
		TTruncateOverflow8 overflow;
sl@0
   239
		VA_LIST list;
sl@0
   240
		VA_START(list,aFmt);
sl@0
   241
		TPtrC8 fmt((const TText8*)aFmt);
sl@0
   242
		TBuf8<KMaxPrintfSize> buf;
sl@0
   243
		// coverity[uninit_use_in_call : FALSE]
sl@0
   244
		buf.AppendFormatList(fmt,list,&overflow);
sl@0
   245
		return OST_SECONDARY_ANY(aContext.GroupId(), aContext.ComponentId(), aContext.HasThreadIdentification(), aContext.HasProgramCounter(), pc, KFormatPrintf, buf.Ptr(), buf.Size());
sl@0
   246
		}
sl@0
   247
	return EFalse;
sl@0
   248
	};
sl@0
   249
sl@0
   250
/**
sl@0
   251
Prints a formatted string by outputting a trace packet with the Trace ID KFormatPrintf.
sl@0
   252
sl@0
   253
If the specified string is too long to fit into a single trace packet
sl@0
   254
a multipart trace is generated.
sl@0
   255
sl@0
   256
@deprecated
sl@0
   257
sl@0
   258
@param aContext 	The trace packet context. @see TTraceContext
sl@0
   259
@param aFmt 		The format string. This must not be longer than 256 characters.
sl@0
   260
@param ...			A variable number of arguments to be converted to text as dictated
sl@0
   261
					by the format string.
sl@0
   262
sl@0
   263
@return 			The trace packet was/was not output.
sl@0
   264
sl@0
   265
@See BTrace::TMultipart
sl@0
   266
*/
sl@0
   267
EXPORT_C TBool OstPrintf(const TTraceContext& aContext, TRefByValue<const TDesC8> aFmt,...)
sl@0
   268
	{
sl@0
   269
	if(IsTraceActive(aContext))
sl@0
   270
		{
sl@0
   271
		GET_PC(pc);
sl@0
   272
		TTruncateOverflow8 overflow;
sl@0
   273
		VA_LIST list;
sl@0
   274
		VA_START(list,aFmt);
sl@0
   275
		TBuf8<KMaxPrintfSize> buf;
sl@0
   276
		// coverity[uninit_use_in_call : FALSE]
sl@0
   277
		buf.AppendFormatList(aFmt,list,&overflow);
sl@0
   278
		return OST_SECONDARY_ANY(aContext.GroupId(), aContext.ComponentId(), aContext.HasThreadIdentification(), aContext.HasProgramCounter(), pc, KFormatPrintf, buf.Ptr(), buf.Size());
sl@0
   279
		}
sl@0
   280
	return EFalse;
sl@0
   281
	}
sl@0
   282
sl@0
   283
/**
sl@0
   284
Prints a formatted string by outputting a trace packet with the Trace ID
sl@0
   285
KFormatPrintfUnicode for unicode strings and KFormatPrintf for other strings.
sl@0
   286
sl@0
   287
If the specified string is too long to fit into a single trace packet
sl@0
   288
a multipart trace is generated.
sl@0
   289
sl@0
   290
@deprecated
sl@0
   291
sl@0
   292
@param aContext 	The trace packet context. @see TTraceContext
sl@0
   293
@param aFmt 		The format string. This must not be longer than 256 characters.
sl@0
   294
@param ...			A variable number of arguments to be converted to text as dictated
sl@0
   295
					by the format string.
sl@0
   296
sl@0
   297
@return 			The trace packet was/was not output.
sl@0
   298
sl@0
   299
@See BTrace::TMultipart
sl@0
   300
*/
sl@0
   301
EXPORT_C TBool OstPrintf(const TTraceContext& aContext, TRefByValue<const TDesC16> aFmt,...)
sl@0
   302
	{
sl@0
   303
	if(IsTraceActive(aContext))
sl@0
   304
		{
sl@0
   305
		GET_PC(pc);
sl@0
   306
		TTruncateOverflow16 overflow;
sl@0
   307
		VA_LIST list;
sl@0
   308
		VA_START(list,aFmt);
sl@0
   309
		TBuf<KMaxPrintfSize> buf;
sl@0
   310
		// coverity[uninit_use_in_call : FALSE]
sl@0
   311
		buf.AppendFormatList(aFmt,list,&overflow);
sl@0
   312
		#ifndef _UNICODE
sl@0
   313
		TPtr8 p(buf.Collapse());
sl@0
   314
		return OST_SECONDARY_ANY(aContext.GroupId(), aContext.ComponentId(), aContext.HasThreadIdentification(), aContext.HasProgramCounter(), myPc, KFormatPrintf, buf.PtrZ(), p.Size());
sl@0
   315
		#else //_UNICODE
sl@0
   316
		return OST_SECONDARY_ANY(aContext.GroupId(), aContext.ComponentId(), aContext.HasThreadIdentification(), aContext.HasProgramCounter(), pc, KFormatPrintfUnicode, buf.PtrZ(), buf.Size());
sl@0
   317
		#endif //_UNICODE
sl@0
   318
		}
sl@0
   319
	return EFalse;
sl@0
   320
	};
sl@0
   321
sl@0
   322
sl@0
   323
/**
sl@0
   324
Prints a string by outputting a trace packet with the Trace ID KFormatPrintfUnicode
sl@0
   325
sl@0
   326
If the specified string is too long to fit into a single trace packet
sl@0
   327
a multipart trace is generated.
sl@0
   328
sl@0
   329
@deprecated
sl@0
   330
sl@0
   331
@param aContext 	The trace packet context. @see TTraceContext
sl@0
   332
@param aDes			The string. This must not be longer than 256 characters.
sl@0
   333
sl@0
   334
@return 			The trace packet was/was not output.
sl@0
   335
sl@0
   336
@See BTrace::TMultipart
sl@0
   337
*/
sl@0
   338
EXPORT_C TBool OstPrint(const TTraceContext& aContext, const TDesC16& aDes)
sl@0
   339
	{
sl@0
   340
	if(IsTraceActive(aContext))
sl@0
   341
		{
sl@0
   342
		GET_PC(pc);
sl@0
   343
		return OST_SECONDARY_ANY(aContext.GroupId(), aContext.ComponentId(), aContext.HasThreadIdentification(), aContext.HasProgramCounter(), pc, KFormatPrintfUnicode, aDes.Ptr(), aDes.Size());
sl@0
   344
		}
sl@0
   345
	return EFalse;
sl@0
   346
	}
sl@0
   347
#endif // __KERNEL_MODE__
sl@0
   348
sl@0
   349
sl@0
   350
// --------- trace ------------
sl@0
   351
sl@0
   352
/**
sl@0
   353
Outputs a trace packet containing no payload data.
sl@0
   354
sl@0
   355
@deprecated
sl@0
   356
sl@0
   357
@param aContext 	The trace packet context. @see TTraceContext
sl@0
   358
@param aTraceId	    The trace point identifier as specified by @see TTraceId
sl@0
   359
sl@0
   360
@return		 		The trace packet was/was not output.
sl@0
   361
*/
sl@0
   362
EXPORT_C TBool OstTrace(const TTraceContext& aContext, TTraceId aTraceId)
sl@0
   363
	{
sl@0
   364
	GET_PC(pc);
sl@0
   365
	return OST_SECONDARY_0(aContext.GroupId(),aContext.ComponentId(),aContext.HasThreadIdentification(),aContext.HasProgramCounter(), pc, aTraceId);
sl@0
   366
	}
sl@0
   367
sl@0
   368
/**
sl@0
   369
Outputs a trace packet containing 4 bytes of data.
sl@0
   370
sl@0
   371
This method is likely to be deprecated soon.
sl@0
   372
sl@0
   373
@param aContext 	The trace packet context. @see TTraceContext
sl@0
   374
@param aTraceId	    The trace point identifier as specified by @see TTraceId
sl@0
   375
@param aData		4 bytes of data
sl@0
   376
sl@0
   377
@return 		The trace packet was/was not output.
sl@0
   378
*/
sl@0
   379
EXPORT_C TBool OstTrace(const TTraceContext& aContext, TTraceId aTraceId, TUint32 aData)
sl@0
   380
	{
sl@0
   381
	GET_PC(pc);
sl@0
   382
	return OST_SECONDARY_1(aContext.GroupId(),aContext.ComponentId(),aContext.HasThreadIdentification(),aContext.HasProgramCounter(),pc,aTraceId,aData);
sl@0
   383
	}
sl@0
   384
sl@0
   385
/**
sl@0
   386
Outputs a trace packet containing 8 bytes of data.
sl@0
   387
sl@0
   388
@deprecated
sl@0
   389
sl@0
   390
@param aContext 	The trace packet context. @see TTraceContext
sl@0
   391
@param aTraceId	    The trace point identifier as specified by @see TTraceId
sl@0
   392
@param aData1		4 bytes of data
sl@0
   393
@param aData2		4 bytes of data
sl@0
   394
sl@0
   395
@return 		The trace packet was/was not output.
sl@0
   396
*/
sl@0
   397
EXPORT_C TBool OstTrace(const TTraceContext& aContext, TTraceId aTraceId, TUint32 aData1, TUint32 aData2)
sl@0
   398
	{
sl@0
   399
	GET_PC(pc);
sl@0
   400
	TUint32 packet[2];
sl@0
   401
	packet[0] = aData1;
sl@0
   402
	packet[1] = aData2;
sl@0
   403
	return OST_SECONDARY_ANY(aContext.GroupId(), aContext.ComponentId(), aContext.HasThreadIdentification(), aContext.HasProgramCounter(), pc, aTraceId, &packet, 8);
sl@0
   404
	}
sl@0
   405
sl@0
   406
/**
sl@0
   407
Outputs a trace packet containing variable length data.
sl@0
   408
sl@0
   409
If the specified data is too big to fit into a single
sl@0
   410
trace packet a multipart trace is generated.
sl@0
   411
sl@0
   412
@deprecated
sl@0
   413
sl@0
   414
@param aContext 	The trace packet context. @see TTraceContext
sl@0
   415
@param aTraceId	    The trace point identifier as specified by @see TTraceId
sl@0
   416
@param aData		Address of additional data to add to trace packet.
sl@0
   417
					Must be word aligned, i.e. a multiple of 4.
sl@0
   418
@param aSize		Number of bytes of additional data.
sl@0
   419
sl@0
   420
@return 			The trace packet was/was not output.
sl@0
   421
sl@0
   422
@See BTrace::TMultipart
sl@0
   423
*/
sl@0
   424
EXPORT_C TBool OstTrace(const TTraceContext& aContext, TTraceId aTraceId, const TAny* aData, TInt aSize)
sl@0
   425
	{
sl@0
   426
	if(IsTraceActive(aContext))
sl@0
   427
		{
sl@0
   428
		GET_PC(pc);
sl@0
   429
		return OST_SECONDARY_ANY(aContext.GroupId(), aContext.ComponentId(), aContext.HasThreadIdentification(), aContext.HasProgramCounter(), pc, aTraceId, aData, aSize);
sl@0
   430
		}
sl@0
   431
	return EFalse;
sl@0
   432
	}
sl@0
   433
sl@0
   434
/**
sl@0
   435
Outputs a trace packet containing 4 bytes of data.
sl@0
   436
sl@0
   437
@deprecated
sl@0
   438
sl@0
   439
@param aContext 	The trace packet context. @see TTraceContext
sl@0
   440
@param aTraceId	    The trace point identifier as specified by @see TTraceId
sl@0
   441
@param aData		4 bytes of data
sl@0
   442
sl@0
   443
@return 		The trace packet was/was not output.
sl@0
   444
*/
sl@0
   445
EXPORT_C TBool OstTrace(const TTraceContext& aContext, const TTraceId aTraceId, const TUint16 aData)
sl@0
   446
	{
sl@0
   447
	GET_PC(pc);
sl@0
   448
	return OST_SECONDARY_1(aContext.GroupId(),aContext.ComponentId(),aContext.HasThreadIdentification(),aContext.HasProgramCounter(),pc,aTraceId,aData);
sl@0
   449
	}
sl@0
   450
sl@0
   451
/**
sl@0
   452
Outputs a trace packet containing 4 bytes of data.
sl@0
   453
sl@0
   454
@deprecated
sl@0
   455
sl@0
   456
@param aContext 	The trace packet context. @see TTraceContext
sl@0
   457
@param aTraceId	    The trace point identifier as specified by @see TTraceId
sl@0
   458
@param aData		4 bytes of data
sl@0
   459
sl@0
   460
@return 		The trace packet was/was not output.
sl@0
   461
*/
sl@0
   462
EXPORT_C TBool OstTrace(const TTraceContext& aContext, const TTraceId aTraceId, const TUint8 aData)
sl@0
   463
	{
sl@0
   464
	GET_PC(pc);
sl@0
   465
	return OST_SECONDARY_1(aContext.GroupId(),aContext.ComponentId(),aContext.HasThreadIdentification(),aContext.HasProgramCounter(),pc,aTraceId,aData);
sl@0
   466
	}
sl@0
   467
sl@0
   468
#ifndef __KERNEL_MODE__
sl@0
   469
/**
sl@0
   470
Outputs a trace packet containing variable length data.
sl@0
   471
sl@0
   472
If the specified data is too big to fit into a single
sl@0
   473
trace record a multipart trace is generated.
sl@0
   474
sl@0
   475
@deprecated
sl@0
   476
sl@0
   477
@param aContext 	Attributes of the trace point.
sl@0
   478
@param aTraceId	    The trace point identifier as specified by @see TTraceId
sl@0
   479
@param aData		Additional data to add to trace packet.
sl@0
   480
					Must be word aligned, i.e. a multiple of 4.
sl@0
   481
sl@0
   482
@return 			The trace packet was/was not logged.
sl@0
   483
sl@0
   484
@See BTrace::TMultipart
sl@0
   485
*/
sl@0
   486
EXPORT_C TBool OstTrace(const TTraceContext& aContext, const TTraceId aTraceId, const TDesC16& aData)
sl@0
   487
	{
sl@0
   488
	if(IsTraceActive(aContext))
sl@0
   489
		{
sl@0
   490
		GET_PC(pc);
sl@0
   491
		return OST_SECONDARY_ANY(aContext.GroupId(), aContext.ComponentId(), aContext.HasThreadIdentification(), aContext.HasProgramCounter(), pc, aTraceId, aData.Ptr(), aData.Size());
sl@0
   492
		}
sl@0
   493
	return EFalse;
sl@0
   494
	}
sl@0
   495
#endif //__KERNEL_MODE__
sl@0
   496
sl@0
   497
/**
sl@0
   498
Outputs a trace packet containing variable length data.
sl@0
   499
sl@0
   500
If the specified data is too big to fit into a single
sl@0
   501
trace record a multipart trace is generated.
sl@0
   502
sl@0
   503
@deprecated
sl@0
   504
sl@0
   505
@param aContext 	Attributes of the trace point.
sl@0
   506
@param aTraceId	    The trace point identifier as specified by @see TTraceId
sl@0
   507
@param aData		Additional data to add to trace packet.
sl@0
   508
					Must be word aligned, i.e. a multiple of 4.
sl@0
   509
sl@0
   510
@return 			The trace packet was/was not logged.
sl@0
   511
sl@0
   512
@See BTrace::TMultipart
sl@0
   513
*/
sl@0
   514
EXPORT_C TBool OstTrace(const TTraceContext& aContext, const TTraceId aTraceId, const TDesC8& aData)
sl@0
   515
	{
sl@0
   516
	if(IsTraceActive(aContext))
sl@0
   517
		{
sl@0
   518
		GET_PC(pc);
sl@0
   519
		return OST_SECONDARY_ANY(aContext.GroupId(), aContext.ComponentId(), aContext.HasThreadIdentification(), aContext.HasProgramCounter(), pc, aTraceId, aData.Ptr(), aData.Size());
sl@0
   520
		}
sl@0
   521
	return EFalse;
sl@0
   522
	}
sl@0
   523
sl@0
   524
sl@0
   525
sl@0
   526
/**
sl@0
   527
 * Check whether a trace packet would be traced or not.
sl@0
   528
 *
sl@0
   529
 * @deprecated
sl@0
   530
 *
sl@0
   531
 * @param aContext The context of the trace packet(s) to be checked.
sl@0
   532
 * @return Returns whether the trace packet would be traced or not.
sl@0
   533
 * Note: The value should never be stored since the filters can be changed without warning.
sl@0
   534
 */
sl@0
   535
EXPORT_C TBool IsTraceActive(const TTraceContext& aContext)
sl@0
   536
	{
sl@0
   537
	return BTrace::CheckFilter2(aContext.GroupId(), aContext.ComponentId());
sl@0
   538
	};
sl@0
   539
sl@0
   540
//--------------------- OST compiled out ------------------------
sl@0
   541
sl@0
   542
#else //SYMBIAN_TRACE_EXECUTABLE_IS_INCLUDED
sl@0
   543
sl@0
   544
//--------OstPrintf
sl@0
   545
EXPORT_C TBool OstPrintf(const TTraceContext&, const char*, ...) { return EFalse; }
sl@0
   546
EXPORT_C TBool OstPrint(const TTraceContext&, const TDesC8&) { return EFalse; }
sl@0
   547
EXPORT_C TBool OstPrintf(const TTraceContext&, TRefByValue<const TDesC8> ,...) { return EFalse; }
sl@0
   548
#ifndef  __KERNEL_MODE__
sl@0
   549
EXPORT_C TBool OstPrintf(const TTraceContext&, TRefByValue<const TDesC16>,...) { return EFalse; }
sl@0
   550
EXPORT_C TBool OstPrint(const TTraceContext&, const TDesC16&) { return EFalse; }
sl@0
   551
#endif //__KERNEL_MODE__
sl@0
   552
sl@0
   553
//--------OstTrace
sl@0
   554
EXPORT_C TBool OstTrace(const TTraceContext&, TTraceId) { return EFalse; }
sl@0
   555
EXPORT_C TBool OstTrace(const TTraceContext&, TTraceId, TUint32) { return EFalse; }
sl@0
   556
EXPORT_C TBool OstTrace(const TTraceContext&, TTraceId, TUint32, TUint32) { return EFalse; }
sl@0
   557
EXPORT_C TBool OstTrace(const TTraceContext&, TTraceId, const TAny*, TInt) { return EFalse; }
sl@0
   558
sl@0
   559
EXPORT_C TBool OstTrace(const TTraceContext&, const TTraceId, const TUint8) { return EFalse; }
sl@0
   560
EXPORT_C TBool OstTrace(const TTraceContext&, const TTraceId, const TUint16) { return EFalse; }
sl@0
   561
EXPORT_C TBool OstTrace(const TTraceContext&, const TTraceId, const TDesC8&) { return EFalse; }
sl@0
   562
#ifndef __KERNEL_MODE__
sl@0
   563
EXPORT_C TBool OstTrace(const TTraceContext&, const TTraceId, const TDesC16&) { return EFalse; }
sl@0
   564
#endif
sl@0
   565
EXPORT_C TBool IsTraceActive(const TTraceContext&) { return EFalse; }
sl@0
   566
sl@0
   567
sl@0
   568
#endif //SYMBIAN_TRACE_EXECUTABLE_IS_INCLUDED