kernel/eka/include/drivers/resmanus_trace.h
changeset 0 a41df078684a
child 199 189ece41fa29
equal deleted inserted replaced
-1:000000000000 0:a41df078684a
       
     1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of the License "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // e32\include\drivers\resmanus_trace.h
       
    15 // 
       
    16 // WARNING: This file contains some APIs which are internal and are subject
       
    17 //          to change without notice. Such APIs should therefore not be used
       
    18 //          outside the Kernel and Hardware Services package.
       
    19 //
       
    20 
       
    21 /**
       
    22  @file
       
    23  @internalComponent
       
    24 */
       
    25 #ifndef __RESMANUSCONTROL_TRACE_H__
       
    26 #define __RESMANUSCONTROL_TRACE_H__
       
    27 #ifdef BTRACE_RESMANUS
       
    28 
       
    29 //Function to format the output.
       
    30 static void UsTraceFormatPrint(TDes8& aBuf, const char* aFmt, ...)
       
    31 	{
       
    32 	if(!(&aBuf))
       
    33 		return;
       
    34 	VA_LIST list;
       
    35 	VA_START(list,aFmt);
       
    36 	Kern::AppendFormat(aBuf,aFmt,list);
       
    37 	}
       
    38 
       
    39 //definition of subcategories.
       
    40 #define PRM_US_OPEN_CHANNEL_START				BTrace::EOpenChannelUsStart
       
    41 #define PRM_US_OPEN_CHANNEL_END					BTrace::EOpenChannelUsEnd
       
    42 #define PRM_US_REGISTER_CLIENT_START			BTrace::ERegisterClientUsStart
       
    43 #define PRM_US_REGISTER_CLIENT_END				BTrace::ERegisterClientUsEnd
       
    44 #define PRM_US_DEREGISTER_CLIENT_START			BTrace::EDeRegisterClientUsStart
       
    45 #define PRM_US_DEREGISTER_CLIENT_END			BTrace::EDeRegisterClientUsEnd
       
    46 #define PRM_US_GET_RESOURCE_STATE_START			BTrace::EGetResourceStateUsStart
       
    47 #define PRM_US_GET_RESOURCE_STATE_END			BTrace::EGetResourceStateUsEnd
       
    48 #define PRM_US_SET_RESOURCE_STATE_START			BTrace::ESetResourceStateUsStart
       
    49 #define PRM_US_SET_RESOURCE_STATE_END			BTrace::ESetResourceStateUsEnd
       
    50 #define PRM_US_CANCEL_GET_RESOURCE_STATE_START  BTrace::ECancelGetResourceStateUsStart
       
    51 #define PRM_US_CANCEL_GET_RESOURCE_STATE_END	BTrace::ECancelGetResourceStateUsEnd
       
    52 #define PRM_US_CANCEL_SET_RESOURCE_STATE_START	BTrace::ECancelSetResourceStateUsStart
       
    53 #define PRM_US_CANCEL_SET_RESOURCE_STATE_END	BTrace::ECancelSetResourceStateUsEnd
       
    54 
       
    55 // Macro to output identification information provided in a request to open a channel
       
    56 #define PRM_US_OPEN_CHANNEL_START_TRACE						\
       
    57 	{														\
       
    58     TBuf8<256> printBuf;									\
       
    59     printBuf.Zero();										\
       
    60     UsTraceFormatPrint(printBuf, "%S", iUserNameUsed);	\
       
    61 	BTraceContextN(BTrace::EResourceManagerUs, PRM_US_OPEN_CHANNEL_START, 0, (TInt)(iClient), printBuf.Ptr(), printBuf.Length()); \
       
    62 	}
       
    63 
       
    64 // Macro to output identification information generated during a request to open a channel
       
    65 #define PRM_US_OPEN_CHANNEL_END_TRACE						\
       
    66 	{														\
       
    67     TBuf8<256> printBuf;									\
       
    68     printBuf.Zero();										\
       
    69     UsTraceFormatPrint(printBuf, "%S", iUserNameUsed);		\
       
    70 	BTraceContextN(BTrace::EResourceManagerUs, PRM_US_OPEN_CHANNEL_END, 0, (TInt)(ClientHandle()), printBuf.Ptr(), printBuf.Length()); \
       
    71 	}
       
    72 
       
    73 // Macro to output information provided for a request to register with the Resource Controller
       
    74 #define PRM_US_REGISTER_CLIENT_START_TRACE					\
       
    75 	{														\
       
    76     TBuf8<256> printBuf;									\
       
    77     printBuf.Zero();										\
       
    78     UsTraceFormatPrint(printBuf, "%S 0x%x %d", iUserNameUsed, (TInt)(ClientHandle()),(TInt)(stateRes[0]));	\
       
    79 	BTraceContextN(BTrace::EResourceManagerUs, PRM_US_REGISTER_CLIENT_START, (TInt)(stateRes[1]), (TInt)(stateRes[2]), printBuf.Ptr(), printBuf.Length()); \
       
    80 	}
       
    81 
       
    82 // Macro to output information after issuing a request to register with the Resource Controller
       
    83 #define PRM_US_REGISTER_CLIENT_END_TRACE					\
       
    84 	{														\
       
    85 	BTraceContext8(BTrace::EResourceManagerUs, PRM_US_REGISTER_CLIENT_END, (TInt)(ClientHandle()), r);	\
       
    86 	}
       
    87 
       
    88 // Macro to output information provided for a request to de-register with the Resource Controller
       
    89 #define PRM_US_DEREGISTER_CLIENT_START_TRACE				\
       
    90 	{														\
       
    91     TBuf8<256> printBuf;									\
       
    92     printBuf.Zero();										\
       
    93     UsTraceFormatPrint(printBuf, "%S ", iUserNameUsed);		\
       
    94 	BTraceContextN(BTrace::EResourceManagerUs, PRM_US_DEREGISTER_CLIENT_START, 0, (TInt)(ClientHandle()), printBuf.Ptr(), printBuf.Length()); \
       
    95 	}
       
    96 
       
    97 // Macro to output information after issuing a request to de-register with the Resource Controller
       
    98 #define PRM_US_DEREGISTER_CLIENT_END_TRACE					\
       
    99 	{														\
       
   100 	BTraceContext4(BTrace::EResourceManagerUs, PRM_US_DEREGISTER_CLIENT_END, (TInt)(ClientHandle()));	\
       
   101 	}
       
   102 
       
   103 // Macro to output information provided for a request to get the state of a resource
       
   104 #define PRM_US_GET_RESOURCE_STATE_START_TRACE				\
       
   105 	{														\
       
   106     TBuf8<256> printBuf;									\
       
   107     printBuf.Zero();										\
       
   108     UsTraceFormatPrint(printBuf, "%S ", iUserNameUsed);		\
       
   109 	BTraceContextN(BTrace::EResourceManagerUs, PRM_US_GET_RESOURCE_STATE_START, resourceId, (TInt)(ClientHandle()), printBuf.Ptr(), printBuf.Length()); \
       
   110 	}
       
   111 
       
   112 // Macro to output information on completion of a request to get the state of a resource
       
   113 #define PRM_US_GET_RESOURCE_STATE_END_TRACE					\
       
   114 	{														\
       
   115     TBuf8<256> printBuf;									\
       
   116     printBuf.Zero();										\
       
   117     UsTraceFormatPrint(printBuf, "%d %d", aClient, aResult);	\
       
   118 	BTraceContextN(BTrace::EResourceManagerUs, PRM_US_GET_RESOURCE_STATE_END, aResourceId, aLevel, printBuf.Ptr(), printBuf.Length()); \
       
   119 	}
       
   120 
       
   121 // Macro to output information provided for a request to set the state of a resource
       
   122 #define PRM_US_SET_RESOURCE_STATE_START_TRACE				\
       
   123 	{														\
       
   124     TBuf8<256> printBuf;									\
       
   125     printBuf.Zero();										\
       
   126     UsTraceFormatPrint(printBuf, "%S %d", iUserNameUsed, (TInt)(ClientHandle()));	\
       
   127 	BTraceContextN(BTrace::EResourceManagerUs, PRM_US_SET_RESOURCE_STATE_START, resourceId, newState, printBuf.Ptr(), printBuf.Length()); \
       
   128 	}
       
   129 
       
   130 // Macro to output information on completion of a request to set the state of a resource
       
   131 #define PRM_US_SET_RESOURCE_STATE_END_TRACE					\
       
   132 	{														\
       
   133     TBuf8<256> printBuf;									\
       
   134     printBuf.Zero();										\
       
   135     UsTraceFormatPrint(printBuf, "%d %d", aClient, aResult);	\
       
   136 	BTraceContextN(BTrace::EResourceManagerUs, PRM_US_SET_RESOURCE_STATE_END, aResourceId, aLevel, printBuf.Ptr(), printBuf.Length()); \
       
   137 	}
       
   138 
       
   139 // Macro to output information provided for a request to cancel the get resource state requests for a resource
       
   140 #define PRM_US_CANCEL_GET_RESOURCE_STATE_START_TRACE		\
       
   141 	{														\
       
   142     TBuf8<256> printBuf;									\
       
   143     printBuf.Zero();										\
       
   144     UsTraceFormatPrint(printBuf, "%S ", iUserNameUsed);		\
       
   145 	BTraceContextN(BTrace::EResourceManagerUs, PRM_US_CANCEL_GET_RESOURCE_STATE_START, aResourceId, (TInt)(ClientHandle()), printBuf.Ptr(), printBuf.Length()); \
       
   146 	}
       
   147 
       
   148 // Macro to output information on completion of a request to cancel the get resource state requests for a resource
       
   149 #define PRM_US_CANCEL_GET_RESOURCE_STATE_END_TRACE			\
       
   150 	{														\
       
   151     TBuf8<256> printBuf;									\
       
   152     printBuf.Zero();										\
       
   153     UsTraceFormatPrint(printBuf, "%S ", iUserNameUsed);		\
       
   154 	BTraceContextN(BTrace::EResourceManagerUs, PRM_US_CANCEL_GET_RESOURCE_STATE_END, aResourceId, (TInt)(ClientHandle()), printBuf.Ptr(), printBuf.Length()); \
       
   155 	}
       
   156 
       
   157 // Macro to output information provided for a request to cancel the set resource state requests for a resource
       
   158 #define PRM_US_CANCEL_SET_RESOURCE_STATE_START_TRACE		\
       
   159 	{														\
       
   160     TBuf8<256> printBuf;									\
       
   161     printBuf.Zero();										\
       
   162     UsTraceFormatPrint(printBuf, "%S ", iUserNameUsed);		\
       
   163 	BTraceContextN(BTrace::EResourceManagerUs, PRM_US_CANCEL_SET_RESOURCE_STATE_START, aResourceId, (TInt)(ClientHandle()), printBuf.Ptr(), printBuf.Length()); \
       
   164 	}
       
   165 
       
   166 // Macro to output information on completion of a request to cancel the get resource state requests for a resource
       
   167 #define PRM_US_CANCEL_SET_RESOURCE_STATE_END_TRACE			\
       
   168 	{														\
       
   169     TBuf8<256> printBuf;									\
       
   170     printBuf.Zero();										\
       
   171     UsTraceFormatPrint(printBuf, "%S ", iUserNameUsed);		\
       
   172 	BTraceContextN(BTrace::EResourceManagerUs, PRM_US_CANCEL_SET_RESOURCE_STATE_END, aResourceId, (TInt)(ClientHandle()), printBuf.Ptr(), printBuf.Length()); \
       
   173 	}
       
   174 
       
   175 
       
   176 #else
       
   177 
       
   178 #define PRM_US_OPEN_CHANNEL_START_TRACE
       
   179 #define PRM_US_OPEN_CHANNEL_END_TRACE
       
   180 #define PRM_US_REGISTER_CLIENT_START_TRACE
       
   181 #define PRM_US_REGISTER_CLIENT_END_TRACE
       
   182 #define PRM_US_DEREGISTER_CLIENT_START_TRACE
       
   183 #define PRM_US_DEREGISTER_CLIENT_END_TRACE
       
   184 #define PRM_US_GET_RESOURCE_STATE_START_TRACE
       
   185 #define PRM_US_GET_RESOURCE_STATE_END_TRACE
       
   186 #define PRM_US_SET_RESOURCE_STATE_START_TRACE
       
   187 #define PRM_US_SET_RESOURCE_STATE_END_TRACE
       
   188 #define PRM_US_CANCEL_GET_RESOURCE_STATE_START_TRACE
       
   189 #define PRM_US_CANCEL_GET_RESOURCE_STATE_END_TRACE
       
   190 #define PRM_US_CANCEL_SET_RESOURCE_STATE_START_TRACE
       
   191 #define PRM_US_CANCEL_SET_RESOURCE_STATE_END_TRACE
       
   192 
       
   193 #endif //BTRACE_RESMANUS
       
   194 
       
   195 #endif //__RESMANUSCONTROL_TRACE_H__
       
   196