os/boardsupport/emulator/emulatorbsp/win_drive/common.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/boardsupport/emulator/emulatorbsp/win_drive/common.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,139 @@
     1.4 +// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +// Some common definitions for this component
    1.18 +// 
    1.19 +//
    1.20 +
    1.21 +/**
    1.22 + @file
    1.23 +*/
    1.24 +
    1.25 +#ifndef WIN_DRIVE_COMMON_H
    1.26 +#define WIN_DRIVE_COMMON_H
    1.27 +
    1.28 +#include <e32debug.h>
    1.29 +#include <f32fsys.h>
    1.30 +
    1.31 +//-----------------------------------------------------------------------------
    1.32 +
    1.33 +//-- define this macro in order to enable debug print.
    1.34 +#define THIS_EXT_DEBUG_PRINT
    1.35 +
    1.36 +#if (defined(_DEBUG) || defined(_DEBUG_RELEASE)) && defined(THIS_EXT_DEBUG_PRINT)
    1.37 +#define __PRINT(t)          {RDebug::Print(t);}
    1.38 +#define __PRINT1(t,a)       {RDebug::Print(t,a);}
    1.39 +#define __PRINT2(t,a,b)     {RDebug::Print(t,a,b);}
    1.40 +#define __PRINT3(t,a,b,c)   {RDebug::Print(t,a,b,c);}
    1.41 +#define __PRINT4(t,a,b,c,d) {RDebug::Print(t,a,b,c,d);}
    1.42 +#define __PRINTF(t)         {RDebug::Printf(t);}
    1.43 +
    1.44 +#else
    1.45 +#define __PRINT(t)
    1.46 +#define __PRINT1(t,a)
    1.47 +#define __PRINT2(t,a,b)
    1.48 +#define __PRINT3(t,a,b,c)
    1.49 +#define __PRINTF(t)
    1.50 +#define __PRINT4(t,a,b,c,d)
    1.51 +#define __PRINTF(t)
    1.52 +#endif
    1.53 +
    1.54 +//-- this logging is always enabled
    1.55 +#define __LOG(t)          {RDebug::Print(t);}
    1.56 +#define __LOG1(t,a)       {RDebug::Print(t,a);}
    1.57 +#define __LOG2(t,a,b)     {RDebug::Print(t,a,b);}
    1.58 +#define __LOG3(t,a,b,c)   {RDebug::Print(t,a,b,c);}
    1.59 +#define __LOG4(t,a,b,c,d) {RDebug::Print(t,a,b,c,d);}
    1.60 +#define __LOGF(t)         {RDebug::Printf(t);}
    1.61 +
    1.62 +
    1.63 +//-----------------------------------------------------------------------------
    1.64 +/**
    1.65 +    Zero-fill structure.
    1.66 +    @param apStruct     pointer to the data structure
    1.67 +*/
    1.68 +template<class T>
    1.69 +inline void ZeroFillStruct(T* apStruct)
    1.70 +{
    1.71 +    Mem::FillZ(apStruct,sizeof(T));
    1.72 +}
    1.73 +
    1.74 +/**
    1.75 +    Zero-fill structure.
    1.76 +    @param apStruct     a reference to the data structure
    1.77 +*/
    1.78 +template<class T>
    1.79 +inline void ZeroFillStruct(T& aStruct)
    1.80 +{
    1.81 +    Mem::FillZ(&aStruct,sizeof(T));
    1.82 +}
    1.83 +
    1.84 +/**
    1.85 +    Zero-fill memory. Just for consistency
    1.86 +    @param apStruct     pointer to the memory to be filled with zeroes
    1.87 +    @param aBytes       buffer size
    1.88 +*/
    1.89 +inline void ZeroFillStruct(void* aStruct, TUint aBytes)
    1.90 +{
    1.91 +    Mem::FillZ(aStruct,aBytes);
    1.92 +}
    1.93 +
    1.94 +//-----------------------------------------------------------------------------
    1.95 +
    1.96 +inline TBool IsPowerOf2(TUint32 aVal)
    1.97 +{
    1.98 +	if (aVal==0)
    1.99 +		return EFalse;
   1.100 +
   1.101 +    return !(aVal & (aVal-1));
   1.102 +}
   1.103 +
   1.104 +
   1.105 +
   1.106 +#endif //WIN_DRIVE_COMMON_H
   1.107 +
   1.108 +
   1.109 +
   1.110 +
   1.111 +
   1.112 +
   1.113 +
   1.114 +
   1.115 +
   1.116 +
   1.117 +
   1.118 +
   1.119 +
   1.120 +
   1.121 +
   1.122 +
   1.123 +
   1.124 +
   1.125 +
   1.126 +
   1.127 +
   1.128 +
   1.129 +
   1.130 +
   1.131 +
   1.132 +
   1.133 +
   1.134 +
   1.135 +
   1.136 +
   1.137 +
   1.138 +
   1.139 +
   1.140 +
   1.141 +
   1.142 +