tracesrv/tracecore/btrace_handler/inc/BTraceKernelCategoryHandler.h
changeset 56 aa2539c91954
equal deleted inserted replaced
54:a151135b0cf9 56:aa2539c91954
       
     1 // Copyright (c) 2007-2010 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 "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 // Handler for BTrace kernel categories 
       
    15 //
       
    16 
       
    17 #ifndef __BTRACEKERNELCATEGORYHANDLER_H__
       
    18 #define __BTRACEKERNELCATEGORYHANDLER_H__
       
    19 
       
    20 
       
    21 // Include files
       
    22 #include <kernel/kernel.h>
       
    23 #include "BTraceCategoryHandler.h"
       
    24 #include "TraceCoreActivation.h"
       
    25 
       
    26 
       
    27 // Forward declarations
       
    28 class DBTraceOstCategoryBitmap;
       
    29 
       
    30 
       
    31 /**
       
    32  * Category handler for Symbian BTrace categories.
       
    33  */
       
    34 NONSHARABLE_CLASS( DBTraceKernelCategoryHandler ) : public DBTraceCategoryHandler, public MTraceCoreActivationNotification
       
    35     {
       
    36 public:
       
    37 
       
    38     /**
       
    39      * Constructor
       
    40      */
       
    41     DBTraceKernelCategoryHandler();
       
    42      
       
    43      /**
       
    44       * Destructor
       
    45       */
       
    46     ~DBTraceKernelCategoryHandler();
       
    47         
       
    48     /**
       
    49      * Initializes this handler
       
    50      * 
       
    51      * @return one of the standard error codes
       
    52      */
       
    53     TInt Init();
       
    54 
       
    55     /**
       
    56      * Called before writer is changed
       
    57      *
       
    58      * @param aWriter The new writer
       
    59      */
       
    60     void PrepareSetWriter( DTraceCoreWriter* aWriter );
       
    61     
       
    62 	/**
       
    63  	 * Primes the BTrace kernel categories    
       
    64  	 */
       
    65 	void PrimeKernelCategories();
       
    66 
       
    67 private:
       
    68 
       
    69     /**
       
    70      * Notification that the activation state has changed
       
    71      * 
       
    72      * @param aActivation the activation interface that was updated
       
    73      * @param aFromSettings ETrue if activation was due to settings read, EFalse if from some other source
       
    74      * @param aComponentId Component ID of the activation
       
    75      */
       
    76     void ActivationChanged( MTraceCoreActivation& aActivation, TBool aFromSettings,
       
    77             TUint32 aComponentId);
       
    78     
       
    79     /**
       
    80      * MTraceCoreBTraceCategoryHandler implementation for Symbian-specific BTrace categories
       
    81      *
       
    82      * @param aHeader BTrace header
       
    83      * @param aHeader2 Extra header data
       
    84      * @param aContext The thread context in which this function was called
       
    85      * @param a1 The first trace parameter
       
    86      * @param a2 The second trace parameter
       
    87      * @param a3 The third trace parameter
       
    88      * @param aExtra Extra trace data
       
    89      * @param aPc The program counter value
       
    90      * @return ETrue if trace was processed
       
    91      */
       
    92     TBool HandleFrame( TUint32 aHeader, TUint32 aHeader2, const TUint32 aContext, 
       
    93                        const TUint32 a1, const TUint32 a2, const TUint32 a3, 
       
    94                        const TUint32 aExtra, const TUint32 aPc );
       
    95     
       
    96     /**
       
    97      * Maps the BTrace category / sub-category to group / trace ID
       
    98      * 
       
    99      * @param aCategory The BTrace category
       
   100      * @param aSubCategory The BTrace sub-categoory
       
   101      * @return the group / trace ID combination
       
   102      */
       
   103     TUint32 MapCategoryToID( TUint8 aCategory, TUint8 aSubCategory );
       
   104     
       
   105     /**
       
   106      * Dfc function to prime the kernel categories
       
   107      * 
       
   108      * @param aHandler pointer to this handler
       
   109      */
       
   110     static void PrimeDfc( TAny* aHandler );
       
   111     
       
   112     /**
       
   113      * Called from the static DFC function to prime kernel categories
       
   114      */
       
   115     void PrimeDfc();
       
   116 
       
   117     /**
       
   118      * Primes a category
       
   119      * 
       
   120      * @param aCategory the category to be primed
       
   121      */
       
   122     void PrimeCategory( TUint8 aCategory );
       
   123     
       
   124 private:
       
   125 
       
   126     /**
       
   127      * Handles this Multipart trace
       
   128      *
       
   129      * @param aHeader BTrace header
       
   130      * @param aHeader2 Extra header data
       
   131      * @param aContext The thread context in which this function was called
       
   132      * @param aTotalMessageLength Total message length of this multipart message 
       
   133      * @param aComponentId Component ID
       
   134      * @param aData The data
       
   135      * @param aExtra Extra trace data
       
   136      * @param aPc The program counter value
       
   137      */
       
   138     TBool HandleMultiPart( TUint32 aHeader, TUint32 aHeader2, const TUint32 aContext,
       
   139                        const TUint32 aTotalMessageLength, const TUint32 aComponentId,
       
   140                        const TUint32 aData, const TUint32 aExtra, const TUint32 aPc );
       
   141     
       
   142     /**
       
   143      * Checks if given trace is a Multipart trace
       
   144      *
       
   145      * @param aHeader Header data
       
   146      * @param aHeader2 Extra header data
       
   147      */
       
   148     inline TBool CheckMultiPart( TUint32 aHeader, TUint32 aHeader2 );
       
   149     
       
   150     /**
       
   151      * Calculates data start offset
       
   152      *
       
   153      * @param aHeader BTrace header
       
   154      */
       
   155     TUint32 CalculateDataStartOffset( TUint32 aHeader );    
       
   156     
       
   157     /**
       
   158      * This uses the same bitmap as the OST category handler
       
   159      */
       
   160     DBTraceOstCategoryBitmap* iTraceBitmap;
       
   161     
       
   162     /**
       
   163      * Dfc used when priming kernel categories
       
   164      */
       
   165     TDfc iPrimeDfc;
       
   166     
       
   167     /**
       
   168      * Saved activation item for multipart traces
       
   169      */ 
       
   170     RArray< TMultiPartActivationInfo > iMultiPartActivationInfos;
       
   171     };
       
   172     
       
   173 #endif
       
   174 
       
   175 // End of File