tracesrv/tracecore/btrace_handler/inc/TraceCoreCommon.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 // Trace Core
       
    15 //
       
    16 
       
    17 #ifndef __TRACECORECOMMON_H__
       
    18 #define __TRACECORECOMMON_H__
       
    19 
       
    20 #include <opensystemtrace.h>
       
    21 
       
    22 /**
       
    23  * Checks whether a given Group ID is valid or not
       
    24  *
       
    25  * @param aGroupId The group ID
       
    26  * @return ETrue if group ID is valid, EFalse if not
       
    27  */
       
    28 inline TBool GroupIdIsValid( TUint32 aGroupId )
       
    29     {
       
    30     return aGroupId <= KMaxGroupId ;
       
    31     }
       
    32 
       
    33 /**
       
    34  * Checks whether a given Component ID is valid or not
       
    35  *
       
    36  * @param aComponentId The component ID
       
    37  * @return ETrue if group ID is valid, EFalse if not
       
    38  */
       
    39 inline TBool ComponentIdIsValid( TUint32 aComponentId )
       
    40     {
       
    41     return  aComponentId >0 ;
       
    42     }
       
    43 
       
    44 /**
       
    45  * Converts aGroupId from a trace word to a group ID:
       
    46  * If aGroupId is 16-bit it is returned unchanged
       
    47  * If aGroupId is 32-bit the top 16-bits are returned
       
    48  * @param aGroupId The group ID
       
    49  * @return The part of the input parameter containing the group ID
       
    50  */
       
    51 inline TUint32 FixGroupId( TUint32 aGroupId )
       
    52     {
       
    53     TUint32 groupId = aGroupId;
       
    54     // Get top 16 bits of groupId
       
    55     TUint32 top16bits = (groupId & 0xffff0000) >> GROUPIDSHIFT;
       
    56     // If top 16 bits are non-zero, assume they contain the Group ID
       
    57     if ( top16bits != 0 )
       
    58         {
       
    59         groupId = top16bits;
       
    60         }
       
    61     return groupId;
       
    62     }
       
    63 
       
    64 #endif
       
    65 
       
    66 // End of File