1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/mm/devsound/a3ftrace/src/a3f_trace_heap.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,179 @@
1.4 +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +//
1.18 +
1.19 +
1.20 +
1.21 +
1.22 +// INCLUDE FILES
1.23 +#include <e32std.h>
1.24 +#include <e32svr.h>
1.25 +#include "a3f_trace_heap.h"
1.26 +
1.27 +// EXTERNAL DATA STRUCTURES
1.28 +//extern ?external_data;
1.29 +TUint32* TraceHeap::iTraceMask = NULL;
1.30 +TUint32* TraceHeap::iTraceLevel = NULL;
1.31 +TBool* TraceHeap::iApiOnly = NULL;
1.32 +RHeap* TraceHeap::iTraceHeap = NULL;
1.33 +
1.34 +
1.35 +// EXTERNAL FUNCTION PROTOTYPES
1.36 +//extern ?external_function( ?arg_type,?arg_type );
1.37 +
1.38 +// CONSTANTS
1.39 +//const ?type ?constant_var = ?constant;
1.40 +
1.41 +// MACROS
1.42 +//#define ?macro ?macro_def
1.43 +
1.44 +// LOCAL CONSTANTS AND MACROS
1.45 +//const ?type ?constant_var = ?constant;
1.46 +//#define ?macro_name ?macro_def
1.47 +
1.48 +// MODULE DATA STRUCTURES
1.49 +//enum ?declaration
1.50 +//typedef ?declaration
1.51 +
1.52 +// LOCAL FUNCTION PROTOTYPES
1.53 +//?type ?function_name( ?arg_type, ?arg_type );
1.54 +
1.55 +// FORWARD DECLARATIONS
1.56 +//class ?FORWARD_CLASSNAME;
1.57 +
1.58 +// ============================ MEMBER FUNCTIONS ===============================
1.59 +
1.60 +// -----------------------------------------------------------------------------
1.61 +// ?classname::?member_function
1.62 +// ?implementation_description
1.63 +// (other items were commented in a header).
1.64 +// -----------------------------------------------------------------------------
1.65 +//
1.66 +EXPORT_C void TraceHeap::CreateL(const TUint aDefaultMask)
1.67 + {
1.68 + // check that the heap is not already created
1.69 + if ( TraceHeap::iTraceHeap )
1.70 + {
1.71 + return;
1.72 + }
1.73 +
1.74 + // create a heap private to the owning process (heap can also be created as global)
1.75 + TraceHeap::iTraceHeap = UserHeap::ChunkHeap( NULL, KMinHeapSize, KMinHeapSize, KMinHeapGrowBy );
1.76 + __ASSERT_ALWAYS( TraceHeap::iTraceHeap, User::Leave(KErrGeneral));
1.77 +
1.78 + // create iTrace... variables
1.79 + TraceHeap::iTraceMask = (TUint32*)TraceHeap::iTraceHeap->AllocL( sizeof(TUint32) );
1.80 + *TraceHeap::iTraceMask = aDefaultMask;
1.81 + TraceHeap::iTraceLevel = (TUint32*)TraceHeap::iTraceHeap->AllocL( sizeof(TUint32) );
1.82 + *TraceHeap::iTraceLevel = 0;
1.83 + TraceHeap::iApiOnly = (TBool*)TraceHeap::iTraceHeap->AllocL( sizeof(TBool) );
1.84 + *TraceHeap::iApiOnly = EFalse;
1.85 + }
1.86 +
1.87 +// -----------------------------------------------------------------------------
1.88 +// ?classname::?member_function
1.89 +// ?implementation_description
1.90 +// (other items were commented in a header).
1.91 +// -----------------------------------------------------------------------------
1.92 +//
1.93 +EXPORT_C TUint32 TraceHeap::TraceMask()
1.94 + {
1.95 + return *TraceHeap::iTraceMask;
1.96 + }
1.97 +
1.98 +// -----------------------------------------------------------------------------
1.99 +// ?classname::?member_function
1.100 +// ?implementation_description
1.101 +// (other items were commented in a header).
1.102 +// -----------------------------------------------------------------------------
1.103 +//
1.104 +EXPORT_C void TraceHeap::SetTraceMask(
1.105 + const TUint32 aTraceMask )
1.106 + {
1.107 + if ( !TraceHeap::iTraceHeap )
1.108 + {
1.109 + TRAP_IGNORE(TraceHeap::CreateL());
1.110 + }
1.111 + *TraceHeap::iTraceMask = aTraceMask;
1.112 + }
1.113 +
1.114 +// -----------------------------------------------------------------------------
1.115 +// ?classname::?member_function
1.116 +// ?implementation_description
1.117 +// (other items were commented in a header).
1.118 +// -----------------------------------------------------------------------------
1.119 +//
1.120 +EXPORT_C TBool TraceHeap::IsMaskOn(
1.121 + const TUint32 aMask )
1.122 + {
1.123 + return ( *TraceHeap::iTraceMask & aMask );
1.124 + }
1.125 +
1.126 +// -----------------------------------------------------------------------------
1.127 +// ?classname::?member_function
1.128 +// ?implementation_description
1.129 +// (other items were commented in a header).
1.130 +// -----------------------------------------------------------------------------
1.131 +//
1.132 +EXPORT_C void TraceHeap::SetLevel( const TUint32 aTraceLevel )
1.133 + {
1.134 + *TraceHeap::iTraceLevel = aTraceLevel;
1.135 + }
1.136 +
1.137 +// -----------------------------------------------------------------------------
1.138 +// ?classname::?member_function
1.139 +// ?implementation_description
1.140 +// (other items were commented in a header).
1.141 +// -----------------------------------------------------------------------------
1.142 +//
1.143 +EXPORT_C TBool TraceHeap::IsBelowLevel( const TUint32 aLevel )
1.144 + {
1.145 + return (*TraceHeap::iTraceLevel > aLevel);
1.146 + }
1.147 +
1.148 +// -----------------------------------------------------------------------------
1.149 +// ?classname::?member_function
1.150 +// ?implementation_description
1.151 +// (other items were commented in a header).
1.152 +// -----------------------------------------------------------------------------
1.153 +//
1.154 +EXPORT_C TUint32 TraceHeap::TraceLevel()
1.155 + {
1.156 + return *TraceHeap::iTraceLevel;
1.157 + }
1.158 +
1.159 +// -----------------------------------------------------------------------------
1.160 +// ?classname::?member_function
1.161 +// ?implementation_description
1.162 +// (other items were commented in a header).
1.163 +// -----------------------------------------------------------------------------
1.164 +//
1.165 +EXPORT_C TBool TraceHeap::IsApiOnly()
1.166 + {
1.167 + return *iApiOnly;
1.168 + }
1.169 +
1.170 +// -----------------------------------------------------------------------------
1.171 +// ?classname::?member_function
1.172 +// ?implementation_description
1.173 +// (other items were commented in a header).
1.174 +// -----------------------------------------------------------------------------
1.175 +//
1.176 +EXPORT_C void TraceHeap::SetApiOnly( const TBool aApiOnly)
1.177 + {
1.178 + *iApiOnly = aApiOnly;
1.179 + }
1.180 +
1.181 +// End of File
1.182 +