os/boardsupport/emulator/emulatorbsp/win_drive/win_media.h
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
     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 // Definitions of the media abstractions. 
    15 // 
    16 //
    17 
    18 /**
    19  @file
    20 */
    21 
    22 #ifndef WIN_MEDIA_H
    23 #define WIN_MEDIA_H
    24 
    25 #include "common.h"
    26 #include "settings_manager.h"
    27 
    28 class CWinMediaDeviceBase;
    29 
    30 //-----------------------------------------------------------------------------
    31 
    32 /** 
    33     Media abstraction base class.
    34     Can be specialised to emulate different types of media (e.g. NAND, NOR FLASH),
    35     access delays and other features.
    36 
    37     This class talks to the real windows media object via CWinMediaDeviceBase interface.
    38     Actually, it's a shim between EPOC's CBaseExtProxyDrive and Windows device (file or volume).
    39 */
    40 class CMediaBase
    41 {
    42   public:    
    43     CMediaBase(TInt aEpocDrvNumber);
    44     virtual ~CMediaBase();
    45 
    46     //-- interface to the owner
    47     virtual TInt Connect() =0;
    48     virtual void Disconnect(); 
    49 
    50     virtual TInt Read(TInt64 aPos,TInt aLength, TDes8& aDataDes)=0;
    51     virtual TInt Write(TInt64 aPos,TInt aLength, const TDesC8& aDataDes)=0;
    52     virtual TInt GetEpocCaps(TLocalDriveCaps& aCaps);
    53     
    54     virtual TInt Format(TFormatInfo& anInfo) = 0;
    55     virtual TInt Format(TInt64 aPos,TInt aLength) = 0;
    56     //--
    57 
    58   protected:
    59     CMediaBase();
    60     CMediaBase(const CMediaBase&);
    61     CMediaBase& operator=(const CMediaBase&);
    62 
    63     inline TBool IsReadOnly() const {return iReadOnly;}
    64     inline TSettingsManager& Settings() const {ASSERT(ipSettingsManager); return *ipSettingsManager;}
    65 
    66   protected:
    67 
    68     TBool                iReadOnly:1;       ///< if not 0, the media is read-only.
    69     TDriveNumber         iEpocDrvNumber;    ///< EPOC drive number, specifies the drive a:..z:
    70     CWinMediaDeviceBase* ipDevice;          ///< pointer to the interface to the real Windows device
    71     TSettingsManager*    ipSettingsManager; ///< interface to the settings in 'ini' file
    72 };
    73 
    74 
    75 //-----------------------------------------------------------------------------
    76 
    77 
    78 /**
    79     Generic block media. 
    80     This is the simple media that consists of the blocks or sectors. 
    81     Nothing special about reading/writing data onto it: what you write is what you read.
    82     No addidtional seek/read/write delays emulation.
    83 
    84 */
    85 class CGenericBlockMedia: public CMediaBase
    86 {
    87   public:    
    88     CGenericBlockMedia(TInt aEpocDrvNumber);
    89    ~CGenericBlockMedia();
    90 
    91 
    92     //-- overrides from the base class
    93     virtual TInt Connect();
    94     virtual void Disconnect();
    95 
    96     virtual TInt Read(TInt64 aPos,TInt aLength, TDes8& aDataDes);
    97     virtual TInt Write(TInt64 aPos, TInt aLength, const TDesC8& aDataDes);
    98 
    99     virtual TInt Format(TFormatInfo& anInfo);
   100     virtual TInt Format(TInt64 aPos,TInt aLength);
   101 
   102   private:
   103     TUint32 iSectorsFormatted; ///< used for media formatting
   104 };
   105 
   106 
   107 
   108 
   109 
   110 
   111 #endif //WIN_MEDIA_H
   112 
   113 
   114 
   115 
   116 
   117 
   118 
   119 
   120 
   121 
   122 
   123 
   124