emulator/emulatorbsp/win_drive/common.h
changeset 0 cec860690d41
equal deleted inserted replaced
-1:000000000000 0:cec860690d41
       
     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 "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 // Some common definitions for this component
       
    15 // 
       
    16 //
       
    17 
       
    18 /**
       
    19  @file
       
    20 */
       
    21 
       
    22 #ifndef WIN_DRIVE_COMMON_H
       
    23 #define WIN_DRIVE_COMMON_H
       
    24 
       
    25 #include <e32debug.h>
       
    26 #include <f32fsys.h>
       
    27 
       
    28 //-----------------------------------------------------------------------------
       
    29 
       
    30 //-- define this macro in order to enable debug print.
       
    31 #define THIS_EXT_DEBUG_PRINT
       
    32 
       
    33 #if (defined(_DEBUG) || defined(_DEBUG_RELEASE)) && defined(THIS_EXT_DEBUG_PRINT)
       
    34 #define __PRINT(t)          {RDebug::Print(t);}
       
    35 #define __PRINT1(t,a)       {RDebug::Print(t,a);}
       
    36 #define __PRINT2(t,a,b)     {RDebug::Print(t,a,b);}
       
    37 #define __PRINT3(t,a,b,c)   {RDebug::Print(t,a,b,c);}
       
    38 #define __PRINT4(t,a,b,c,d) {RDebug::Print(t,a,b,c,d);}
       
    39 #define __PRINTF(t)         {RDebug::Printf(t);}
       
    40 
       
    41 #else
       
    42 #define __PRINT(t)
       
    43 #define __PRINT1(t,a)
       
    44 #define __PRINT2(t,a,b)
       
    45 #define __PRINT3(t,a,b,c)
       
    46 #define __PRINTF(t)
       
    47 #define __PRINT4(t,a,b,c,d)
       
    48 #define __PRINTF(t)
       
    49 #endif
       
    50 
       
    51 //-- this logging is always enabled
       
    52 #define __LOG(t)          {RDebug::Print(t);}
       
    53 #define __LOG1(t,a)       {RDebug::Print(t,a);}
       
    54 #define __LOG2(t,a,b)     {RDebug::Print(t,a,b);}
       
    55 #define __LOG3(t,a,b,c)   {RDebug::Print(t,a,b,c);}
       
    56 #define __LOG4(t,a,b,c,d) {RDebug::Print(t,a,b,c,d);}
       
    57 #define __LOGF(t)         {RDebug::Printf(t);}
       
    58 
       
    59 
       
    60 //-----------------------------------------------------------------------------
       
    61 /**
       
    62     Zero-fill structure.
       
    63     @param apStruct     pointer to the data structure
       
    64 */
       
    65 template<class T>
       
    66 inline void ZeroFillStruct(T* apStruct)
       
    67 {
       
    68     Mem::FillZ(apStruct,sizeof(T));
       
    69 }
       
    70 
       
    71 /**
       
    72     Zero-fill structure.
       
    73     @param apStruct     a reference to the data structure
       
    74 */
       
    75 template<class T>
       
    76 inline void ZeroFillStruct(T& aStruct)
       
    77 {
       
    78     Mem::FillZ(&aStruct,sizeof(T));
       
    79 }
       
    80 
       
    81 /**
       
    82     Zero-fill memory. Just for consistency
       
    83     @param apStruct     pointer to the memory to be filled with zeroes
       
    84     @param aBytes       buffer size
       
    85 */
       
    86 inline void ZeroFillStruct(void* aStruct, TUint aBytes)
       
    87 {
       
    88     Mem::FillZ(aStruct,aBytes);
       
    89 }
       
    90 
       
    91 //-----------------------------------------------------------------------------
       
    92 
       
    93 inline TBool IsPowerOf2(TUint32 aVal)
       
    94 {
       
    95 	if (aVal==0)
       
    96 		return EFalse;
       
    97 
       
    98     return !(aVal & (aVal-1));
       
    99 }
       
   100 
       
   101 
       
   102 
       
   103 #endif //WIN_DRIVE_COMMON_H
       
   104 
       
   105 
       
   106 
       
   107 
       
   108 
       
   109 
       
   110 
       
   111 
       
   112 
       
   113 
       
   114 
       
   115 
       
   116 
       
   117 
       
   118 
       
   119 
       
   120 
       
   121 
       
   122 
       
   123 
       
   124 
       
   125 
       
   126 
       
   127 
       
   128 
       
   129 
       
   130 
       
   131 
       
   132 
       
   133 
       
   134 
       
   135 
       
   136 
       
   137 
       
   138 
       
   139