sl@0: // Copyright (c) 2007-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\include\drivers\resmanus_trace.h sl@0: // sl@0: // WARNING: This file contains some APIs which are internal and are subject sl@0: // to change without notice. Such APIs should therefore not be used sl@0: // outside the Kernel and Hardware Services package. sl@0: // sl@0: sl@0: /** sl@0: @file sl@0: @internalComponent sl@0: */ sl@0: #ifndef __RESMANUSCONTROL_TRACE_H__ sl@0: #define __RESMANUSCONTROL_TRACE_H__ sl@0: #ifdef BTRACE_RESMANUS sl@0: sl@0: //Function to format the output. sl@0: static void UsTraceFormatPrint(TDes8& aBuf, const char* aFmt, ...) sl@0: { sl@0: if(!(&aBuf)) sl@0: return; sl@0: VA_LIST list; sl@0: VA_START(list,aFmt); sl@0: Kern::AppendFormat(aBuf,aFmt,list); sl@0: } sl@0: sl@0: //definition of subcategories. sl@0: #define PRM_US_OPEN_CHANNEL_START BTrace::EOpenChannelUsStart sl@0: #define PRM_US_OPEN_CHANNEL_END BTrace::EOpenChannelUsEnd sl@0: #define PRM_US_REGISTER_CLIENT_START BTrace::ERegisterClientUsStart sl@0: #define PRM_US_REGISTER_CLIENT_END BTrace::ERegisterClientUsEnd sl@0: #define PRM_US_DEREGISTER_CLIENT_START BTrace::EDeRegisterClientUsStart sl@0: #define PRM_US_DEREGISTER_CLIENT_END BTrace::EDeRegisterClientUsEnd sl@0: #define PRM_US_GET_RESOURCE_STATE_START BTrace::EGetResourceStateUsStart sl@0: #define PRM_US_GET_RESOURCE_STATE_END BTrace::EGetResourceStateUsEnd sl@0: #define PRM_US_SET_RESOURCE_STATE_START BTrace::ESetResourceStateUsStart sl@0: #define PRM_US_SET_RESOURCE_STATE_END BTrace::ESetResourceStateUsEnd sl@0: #define PRM_US_CANCEL_GET_RESOURCE_STATE_START BTrace::ECancelGetResourceStateUsStart sl@0: #define PRM_US_CANCEL_GET_RESOURCE_STATE_END BTrace::ECancelGetResourceStateUsEnd sl@0: #define PRM_US_CANCEL_SET_RESOURCE_STATE_START BTrace::ECancelSetResourceStateUsStart sl@0: #define PRM_US_CANCEL_SET_RESOURCE_STATE_END BTrace::ECancelSetResourceStateUsEnd sl@0: sl@0: // Macro to output identification information provided in a request to open a channel sl@0: #define PRM_US_OPEN_CHANNEL_START_TRACE \ sl@0: { \ sl@0: TBuf8<256> printBuf; \ sl@0: printBuf.Zero(); \ sl@0: UsTraceFormatPrint(printBuf, "%S", iUserNameUsed); \ sl@0: BTraceContextN(BTrace::EResourceManagerUs, PRM_US_OPEN_CHANNEL_START, 0, (TInt)(iClient), printBuf.Ptr(), printBuf.Length()); \ sl@0: } sl@0: sl@0: // Macro to output identification information generated during a request to open a channel sl@0: #define PRM_US_OPEN_CHANNEL_END_TRACE \ sl@0: { \ sl@0: TBuf8<256> printBuf; \ sl@0: printBuf.Zero(); \ sl@0: UsTraceFormatPrint(printBuf, "%S", iUserNameUsed); \ sl@0: BTraceContextN(BTrace::EResourceManagerUs, PRM_US_OPEN_CHANNEL_END, 0, (TInt)(ClientHandle()), printBuf.Ptr(), printBuf.Length()); \ sl@0: } sl@0: sl@0: // Macro to output information provided for a request to register with the Resource Controller sl@0: #define PRM_US_REGISTER_CLIENT_START_TRACE \ sl@0: { \ sl@0: TBuf8<256> printBuf; \ sl@0: printBuf.Zero(); \ sl@0: UsTraceFormatPrint(printBuf, "%S 0x%x %d", iUserNameUsed, (TInt)(ClientHandle()),(TInt)(stateRes[0])); \ sl@0: BTraceContextN(BTrace::EResourceManagerUs, PRM_US_REGISTER_CLIENT_START, (TInt)(stateRes[1]), (TInt)(stateRes[2]), printBuf.Ptr(), printBuf.Length()); \ sl@0: } sl@0: sl@0: // Macro to output information after issuing a request to register with the Resource Controller sl@0: #define PRM_US_REGISTER_CLIENT_END_TRACE \ sl@0: { \ sl@0: BTraceContext8(BTrace::EResourceManagerUs, PRM_US_REGISTER_CLIENT_END, (TInt)(ClientHandle()), r); \ sl@0: } sl@0: sl@0: // Macro to output information provided for a request to de-register with the Resource Controller sl@0: #define PRM_US_DEREGISTER_CLIENT_START_TRACE \ sl@0: { \ sl@0: TBuf8<256> printBuf; \ sl@0: printBuf.Zero(); \ sl@0: UsTraceFormatPrint(printBuf, "%S ", iUserNameUsed); \ sl@0: BTraceContextN(BTrace::EResourceManagerUs, PRM_US_DEREGISTER_CLIENT_START, 0, (TInt)(ClientHandle()), printBuf.Ptr(), printBuf.Length()); \ sl@0: } sl@0: sl@0: // Macro to output information after issuing a request to de-register with the Resource Controller sl@0: #define PRM_US_DEREGISTER_CLIENT_END_TRACE \ sl@0: { \ sl@0: BTraceContext4(BTrace::EResourceManagerUs, PRM_US_DEREGISTER_CLIENT_END, (TInt)(ClientHandle())); \ sl@0: } sl@0: sl@0: // Macro to output information provided for a request to get the state of a resource sl@0: #define PRM_US_GET_RESOURCE_STATE_START_TRACE \ sl@0: { \ sl@0: TBuf8<256> printBuf; \ sl@0: printBuf.Zero(); \ sl@0: UsTraceFormatPrint(printBuf, "%S ", iUserNameUsed); \ sl@0: BTraceContextN(BTrace::EResourceManagerUs, PRM_US_GET_RESOURCE_STATE_START, resourceId, (TInt)(ClientHandle()), printBuf.Ptr(), printBuf.Length()); \ sl@0: } sl@0: sl@0: // Macro to output information on completion of a request to get the state of a resource sl@0: #define PRM_US_GET_RESOURCE_STATE_END_TRACE \ sl@0: { \ sl@0: TBuf8<256> printBuf; \ sl@0: printBuf.Zero(); \ sl@0: UsTraceFormatPrint(printBuf, "%d %d", aClient, aResult); \ sl@0: BTraceContextN(BTrace::EResourceManagerUs, PRM_US_GET_RESOURCE_STATE_END, aResourceId, aLevel, printBuf.Ptr(), printBuf.Length()); \ sl@0: } sl@0: sl@0: // Macro to output information provided for a request to set the state of a resource sl@0: #define PRM_US_SET_RESOURCE_STATE_START_TRACE \ sl@0: { \ sl@0: TBuf8<256> printBuf; \ sl@0: printBuf.Zero(); \ sl@0: UsTraceFormatPrint(printBuf, "%S %d", iUserNameUsed, (TInt)(ClientHandle())); \ sl@0: BTraceContextN(BTrace::EResourceManagerUs, PRM_US_SET_RESOURCE_STATE_START, resourceId, newState, printBuf.Ptr(), printBuf.Length()); \ sl@0: } sl@0: sl@0: // Macro to output information on completion of a request to set the state of a resource sl@0: #define PRM_US_SET_RESOURCE_STATE_END_TRACE \ sl@0: { \ sl@0: TBuf8<256> printBuf; \ sl@0: printBuf.Zero(); \ sl@0: UsTraceFormatPrint(printBuf, "%d %d", aClient, aResult); \ sl@0: BTraceContextN(BTrace::EResourceManagerUs, PRM_US_SET_RESOURCE_STATE_END, aResourceId, aLevel, printBuf.Ptr(), printBuf.Length()); \ sl@0: } sl@0: sl@0: // Macro to output information provided for a request to cancel the get resource state requests for a resource sl@0: #define PRM_US_CANCEL_GET_RESOURCE_STATE_START_TRACE \ sl@0: { \ sl@0: TBuf8<256> printBuf; \ sl@0: printBuf.Zero(); \ sl@0: UsTraceFormatPrint(printBuf, "%S ", iUserNameUsed); \ sl@0: BTraceContextN(BTrace::EResourceManagerUs, PRM_US_CANCEL_GET_RESOURCE_STATE_START, aResourceId, (TInt)(ClientHandle()), printBuf.Ptr(), printBuf.Length()); \ sl@0: } sl@0: sl@0: // Macro to output information on completion of a request to cancel the get resource state requests for a resource sl@0: #define PRM_US_CANCEL_GET_RESOURCE_STATE_END_TRACE \ sl@0: { \ sl@0: TBuf8<256> printBuf; \ sl@0: printBuf.Zero(); \ sl@0: UsTraceFormatPrint(printBuf, "%S ", iUserNameUsed); \ sl@0: BTraceContextN(BTrace::EResourceManagerUs, PRM_US_CANCEL_GET_RESOURCE_STATE_END, aResourceId, (TInt)(ClientHandle()), printBuf.Ptr(), printBuf.Length()); \ sl@0: } sl@0: sl@0: // Macro to output information provided for a request to cancel the set resource state requests for a resource sl@0: #define PRM_US_CANCEL_SET_RESOURCE_STATE_START_TRACE \ sl@0: { \ sl@0: TBuf8<256> printBuf; \ sl@0: printBuf.Zero(); \ sl@0: UsTraceFormatPrint(printBuf, "%S ", iUserNameUsed); \ sl@0: BTraceContextN(BTrace::EResourceManagerUs, PRM_US_CANCEL_SET_RESOURCE_STATE_START, aResourceId, (TInt)(ClientHandle()), printBuf.Ptr(), printBuf.Length()); \ sl@0: } sl@0: sl@0: // Macro to output information on completion of a request to cancel the get resource state requests for a resource sl@0: #define PRM_US_CANCEL_SET_RESOURCE_STATE_END_TRACE \ sl@0: { \ sl@0: TBuf8<256> printBuf; \ sl@0: printBuf.Zero(); \ sl@0: UsTraceFormatPrint(printBuf, "%S ", iUserNameUsed); \ sl@0: BTraceContextN(BTrace::EResourceManagerUs, PRM_US_CANCEL_SET_RESOURCE_STATE_END, aResourceId, (TInt)(ClientHandle()), printBuf.Ptr(), printBuf.Length()); \ sl@0: } sl@0: sl@0: sl@0: #else sl@0: sl@0: #define PRM_US_OPEN_CHANNEL_START_TRACE sl@0: #define PRM_US_OPEN_CHANNEL_END_TRACE sl@0: #define PRM_US_REGISTER_CLIENT_START_TRACE sl@0: #define PRM_US_REGISTER_CLIENT_END_TRACE sl@0: #define PRM_US_DEREGISTER_CLIENT_START_TRACE sl@0: #define PRM_US_DEREGISTER_CLIENT_END_TRACE sl@0: #define PRM_US_GET_RESOURCE_STATE_START_TRACE sl@0: #define PRM_US_GET_RESOURCE_STATE_END_TRACE sl@0: #define PRM_US_SET_RESOURCE_STATE_START_TRACE sl@0: #define PRM_US_SET_RESOURCE_STATE_END_TRACE sl@0: #define PRM_US_CANCEL_GET_RESOURCE_STATE_START_TRACE sl@0: #define PRM_US_CANCEL_GET_RESOURCE_STATE_END_TRACE sl@0: #define PRM_US_CANCEL_SET_RESOURCE_STATE_START_TRACE sl@0: #define PRM_US_CANCEL_SET_RESOURCE_STATE_END_TRACE sl@0: sl@0: #endif //BTRACE_RESMANUS sl@0: sl@0: #endif //__RESMANUSCONTROL_TRACE_H__ sl@0: