1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/kernelhwsrv/kernel/eka/include/drivers/resmanus_trace.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,196 @@
1.4 +// Copyright (c) 2007-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 the License "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 +// e32\include\drivers\resmanus_trace.h
1.18 +//
1.19 +// WARNING: This file contains some APIs which are internal and are subject
1.20 +// to change without notice. Such APIs should therefore not be used
1.21 +// outside the Kernel and Hardware Services package.
1.22 +//
1.23 +
1.24 +/**
1.25 + @file
1.26 + @internalComponent
1.27 +*/
1.28 +#ifndef __RESMANUSCONTROL_TRACE_H__
1.29 +#define __RESMANUSCONTROL_TRACE_H__
1.30 +#ifdef BTRACE_RESMANUS
1.31 +
1.32 +//Function to format the output.
1.33 +static void UsTraceFormatPrint(TDes8& aBuf, const char* aFmt, ...)
1.34 + {
1.35 + if(!(&aBuf))
1.36 + return;
1.37 + VA_LIST list;
1.38 + VA_START(list,aFmt);
1.39 + Kern::AppendFormat(aBuf,aFmt,list);
1.40 + }
1.41 +
1.42 +//definition of subcategories.
1.43 +#define PRM_US_OPEN_CHANNEL_START BTrace::EOpenChannelUsStart
1.44 +#define PRM_US_OPEN_CHANNEL_END BTrace::EOpenChannelUsEnd
1.45 +#define PRM_US_REGISTER_CLIENT_START BTrace::ERegisterClientUsStart
1.46 +#define PRM_US_REGISTER_CLIENT_END BTrace::ERegisterClientUsEnd
1.47 +#define PRM_US_DEREGISTER_CLIENT_START BTrace::EDeRegisterClientUsStart
1.48 +#define PRM_US_DEREGISTER_CLIENT_END BTrace::EDeRegisterClientUsEnd
1.49 +#define PRM_US_GET_RESOURCE_STATE_START BTrace::EGetResourceStateUsStart
1.50 +#define PRM_US_GET_RESOURCE_STATE_END BTrace::EGetResourceStateUsEnd
1.51 +#define PRM_US_SET_RESOURCE_STATE_START BTrace::ESetResourceStateUsStart
1.52 +#define PRM_US_SET_RESOURCE_STATE_END BTrace::ESetResourceStateUsEnd
1.53 +#define PRM_US_CANCEL_GET_RESOURCE_STATE_START BTrace::ECancelGetResourceStateUsStart
1.54 +#define PRM_US_CANCEL_GET_RESOURCE_STATE_END BTrace::ECancelGetResourceStateUsEnd
1.55 +#define PRM_US_CANCEL_SET_RESOURCE_STATE_START BTrace::ECancelSetResourceStateUsStart
1.56 +#define PRM_US_CANCEL_SET_RESOURCE_STATE_END BTrace::ECancelSetResourceStateUsEnd
1.57 +
1.58 +// Macro to output identification information provided in a request to open a channel
1.59 +#define PRM_US_OPEN_CHANNEL_START_TRACE \
1.60 + { \
1.61 + TBuf8<256> printBuf; \
1.62 + printBuf.Zero(); \
1.63 + UsTraceFormatPrint(printBuf, "%S", iUserNameUsed); \
1.64 + BTraceContextN(BTrace::EResourceManagerUs, PRM_US_OPEN_CHANNEL_START, 0, (TInt)(iClient), printBuf.Ptr(), printBuf.Length()); \
1.65 + }
1.66 +
1.67 +// Macro to output identification information generated during a request to open a channel
1.68 +#define PRM_US_OPEN_CHANNEL_END_TRACE \
1.69 + { \
1.70 + TBuf8<256> printBuf; \
1.71 + printBuf.Zero(); \
1.72 + UsTraceFormatPrint(printBuf, "%S", iUserNameUsed); \
1.73 + BTraceContextN(BTrace::EResourceManagerUs, PRM_US_OPEN_CHANNEL_END, 0, (TInt)(ClientHandle()), printBuf.Ptr(), printBuf.Length()); \
1.74 + }
1.75 +
1.76 +// Macro to output information provided for a request to register with the Resource Controller
1.77 +#define PRM_US_REGISTER_CLIENT_START_TRACE \
1.78 + { \
1.79 + TBuf8<256> printBuf; \
1.80 + printBuf.Zero(); \
1.81 + UsTraceFormatPrint(printBuf, "%S 0x%x %d", iUserNameUsed, (TInt)(ClientHandle()),(TInt)(stateRes[0])); \
1.82 + BTraceContextN(BTrace::EResourceManagerUs, PRM_US_REGISTER_CLIENT_START, (TInt)(stateRes[1]), (TInt)(stateRes[2]), printBuf.Ptr(), printBuf.Length()); \
1.83 + }
1.84 +
1.85 +// Macro to output information after issuing a request to register with the Resource Controller
1.86 +#define PRM_US_REGISTER_CLIENT_END_TRACE \
1.87 + { \
1.88 + BTraceContext8(BTrace::EResourceManagerUs, PRM_US_REGISTER_CLIENT_END, (TInt)(ClientHandle()), r); \
1.89 + }
1.90 +
1.91 +// Macro to output information provided for a request to de-register with the Resource Controller
1.92 +#define PRM_US_DEREGISTER_CLIENT_START_TRACE \
1.93 + { \
1.94 + TBuf8<256> printBuf; \
1.95 + printBuf.Zero(); \
1.96 + UsTraceFormatPrint(printBuf, "%S ", iUserNameUsed); \
1.97 + BTraceContextN(BTrace::EResourceManagerUs, PRM_US_DEREGISTER_CLIENT_START, 0, (TInt)(ClientHandle()), printBuf.Ptr(), printBuf.Length()); \
1.98 + }
1.99 +
1.100 +// Macro to output information after issuing a request to de-register with the Resource Controller
1.101 +#define PRM_US_DEREGISTER_CLIENT_END_TRACE \
1.102 + { \
1.103 + BTraceContext4(BTrace::EResourceManagerUs, PRM_US_DEREGISTER_CLIENT_END, (TInt)(ClientHandle())); \
1.104 + }
1.105 +
1.106 +// Macro to output information provided for a request to get the state of a resource
1.107 +#define PRM_US_GET_RESOURCE_STATE_START_TRACE \
1.108 + { \
1.109 + TBuf8<256> printBuf; \
1.110 + printBuf.Zero(); \
1.111 + UsTraceFormatPrint(printBuf, "%S ", iUserNameUsed); \
1.112 + BTraceContextN(BTrace::EResourceManagerUs, PRM_US_GET_RESOURCE_STATE_START, resourceId, (TInt)(ClientHandle()), printBuf.Ptr(), printBuf.Length()); \
1.113 + }
1.114 +
1.115 +// Macro to output information on completion of a request to get the state of a resource
1.116 +#define PRM_US_GET_RESOURCE_STATE_END_TRACE \
1.117 + { \
1.118 + TBuf8<256> printBuf; \
1.119 + printBuf.Zero(); \
1.120 + UsTraceFormatPrint(printBuf, "%d %d", aClient, aResult); \
1.121 + BTraceContextN(BTrace::EResourceManagerUs, PRM_US_GET_RESOURCE_STATE_END, aResourceId, aLevel, printBuf.Ptr(), printBuf.Length()); \
1.122 + }
1.123 +
1.124 +// Macro to output information provided for a request to set the state of a resource
1.125 +#define PRM_US_SET_RESOURCE_STATE_START_TRACE \
1.126 + { \
1.127 + TBuf8<256> printBuf; \
1.128 + printBuf.Zero(); \
1.129 + UsTraceFormatPrint(printBuf, "%S %d", iUserNameUsed, (TInt)(ClientHandle())); \
1.130 + BTraceContextN(BTrace::EResourceManagerUs, PRM_US_SET_RESOURCE_STATE_START, resourceId, newState, printBuf.Ptr(), printBuf.Length()); \
1.131 + }
1.132 +
1.133 +// Macro to output information on completion of a request to set the state of a resource
1.134 +#define PRM_US_SET_RESOURCE_STATE_END_TRACE \
1.135 + { \
1.136 + TBuf8<256> printBuf; \
1.137 + printBuf.Zero(); \
1.138 + UsTraceFormatPrint(printBuf, "%d %d", aClient, aResult); \
1.139 + BTraceContextN(BTrace::EResourceManagerUs, PRM_US_SET_RESOURCE_STATE_END, aResourceId, aLevel, printBuf.Ptr(), printBuf.Length()); \
1.140 + }
1.141 +
1.142 +// Macro to output information provided for a request to cancel the get resource state requests for a resource
1.143 +#define PRM_US_CANCEL_GET_RESOURCE_STATE_START_TRACE \
1.144 + { \
1.145 + TBuf8<256> printBuf; \
1.146 + printBuf.Zero(); \
1.147 + UsTraceFormatPrint(printBuf, "%S ", iUserNameUsed); \
1.148 + BTraceContextN(BTrace::EResourceManagerUs, PRM_US_CANCEL_GET_RESOURCE_STATE_START, aResourceId, (TInt)(ClientHandle()), printBuf.Ptr(), printBuf.Length()); \
1.149 + }
1.150 +
1.151 +// Macro to output information on completion of a request to cancel the get resource state requests for a resource
1.152 +#define PRM_US_CANCEL_GET_RESOURCE_STATE_END_TRACE \
1.153 + { \
1.154 + TBuf8<256> printBuf; \
1.155 + printBuf.Zero(); \
1.156 + UsTraceFormatPrint(printBuf, "%S ", iUserNameUsed); \
1.157 + BTraceContextN(BTrace::EResourceManagerUs, PRM_US_CANCEL_GET_RESOURCE_STATE_END, aResourceId, (TInt)(ClientHandle()), printBuf.Ptr(), printBuf.Length()); \
1.158 + }
1.159 +
1.160 +// Macro to output information provided for a request to cancel the set resource state requests for a resource
1.161 +#define PRM_US_CANCEL_SET_RESOURCE_STATE_START_TRACE \
1.162 + { \
1.163 + TBuf8<256> printBuf; \
1.164 + printBuf.Zero(); \
1.165 + UsTraceFormatPrint(printBuf, "%S ", iUserNameUsed); \
1.166 + BTraceContextN(BTrace::EResourceManagerUs, PRM_US_CANCEL_SET_RESOURCE_STATE_START, aResourceId, (TInt)(ClientHandle()), printBuf.Ptr(), printBuf.Length()); \
1.167 + }
1.168 +
1.169 +// Macro to output information on completion of a request to cancel the get resource state requests for a resource
1.170 +#define PRM_US_CANCEL_SET_RESOURCE_STATE_END_TRACE \
1.171 + { \
1.172 + TBuf8<256> printBuf; \
1.173 + printBuf.Zero(); \
1.174 + UsTraceFormatPrint(printBuf, "%S ", iUserNameUsed); \
1.175 + BTraceContextN(BTrace::EResourceManagerUs, PRM_US_CANCEL_SET_RESOURCE_STATE_END, aResourceId, (TInt)(ClientHandle()), printBuf.Ptr(), printBuf.Length()); \
1.176 + }
1.177 +
1.178 +
1.179 +#else
1.180 +
1.181 +#define PRM_US_OPEN_CHANNEL_START_TRACE
1.182 +#define PRM_US_OPEN_CHANNEL_END_TRACE
1.183 +#define PRM_US_REGISTER_CLIENT_START_TRACE
1.184 +#define PRM_US_REGISTER_CLIENT_END_TRACE
1.185 +#define PRM_US_DEREGISTER_CLIENT_START_TRACE
1.186 +#define PRM_US_DEREGISTER_CLIENT_END_TRACE
1.187 +#define PRM_US_GET_RESOURCE_STATE_START_TRACE
1.188 +#define PRM_US_GET_RESOURCE_STATE_END_TRACE
1.189 +#define PRM_US_SET_RESOURCE_STATE_START_TRACE
1.190 +#define PRM_US_SET_RESOURCE_STATE_END_TRACE
1.191 +#define PRM_US_CANCEL_GET_RESOURCE_STATE_START_TRACE
1.192 +#define PRM_US_CANCEL_GET_RESOURCE_STATE_END_TRACE
1.193 +#define PRM_US_CANCEL_SET_RESOURCE_STATE_START_TRACE
1.194 +#define PRM_US_CANCEL_SET_RESOURCE_STATE_END_TRACE
1.195 +
1.196 +#endif //BTRACE_RESMANUS
1.197 +
1.198 +#endif //__RESMANUSCONTROL_TRACE_H__
1.199 +