omap3530/beagle_drivers/medstaticrd/beagle_medstaticrd.cpp
author Lukasz Forynski <lukasz.forynski@gmail.com>
Sat, 20 Nov 2010 14:50:08 +0000
branchgeneric_fixes_and_updates
changeset 113 922af0272d29
parent 101 984b38878b1b
parent 109 c61e54f48ab5
permissions -rw-r--r--
catch-up from default
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
46
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
     1
/*
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
     2
* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
     3
* All rights reserved.
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
     4
* This component and the accompanying materials are made available
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
     5
* under the terms of the License "Eclipse Public License v1.0"
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
     6
* which accompanies this distribution, and is available
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
     8
*
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
     9
* Initial Contributors:
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    10
* Nokia Corporation - contribution.
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    11
*
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    12
* Contributors:
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    13
* Gareth Long - Symbian Foundation
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    14
*
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    15
* Description: Minimalistic non volatile memory driver
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    16
*
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    17
*/
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    18
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    19
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    20
#include "locmedia.h"
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    21
#include "platform.h"
109
c61e54f48ab5 Fix for Bug 3955 - #includes must not use absolute pathnames
Mike Kinghan <mikek@symbian.org>
parents: 108
diff changeset
    22
#include "variantmediadef.h"
46
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    23
#include "beagle_medstaticrd.h"
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    24
//#include "syborg.h"
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    25
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    26
#define NVMEM1_DRIVENAME "STATICRD"
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    27
#define NVMEM1_DRIVECOUNT 1
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    28
#define NVMEM1_DRIVELIST 1
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    29
#define NVMEM1_NUMMEDIA 1
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    30
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    31
_LIT(KNVMemPddName, "Media.MEDTATICRD");
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    32
_LIT(KNVMemDriveName,NVMEM1_DRIVENAME);
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    33
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    34
class DPhysicalDeviceMediaStaticRD : public DPhysicalDevice
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    35
	{
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    36
public:
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    37
	DPhysicalDeviceMediaStaticRD();
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    38
public:
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    39
	// Implementing the interface
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    40
	virtual TInt Install();
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    41
	virtual void GetCaps(TDes8& aDes) const;
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    42
	virtual TInt Create(DBase*& aChannel, TInt aMediaId, const TDesC8* anInfo, const TVersion& aVer);
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    43
	virtual TInt Validate(TInt aDeviceType, const TDesC8* anInfo, const TVersion& aVer);
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    44
	virtual TInt Info(TInt aFunction, TAny* a1);
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    45
	};
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    46
								
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    47
class DMediaDriverStaticRD : public DMediaDriver
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    48
	{
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    49
public:
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    50
	DMediaDriverStaticRD(TInt aMediaId);
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    51
public:
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    52
	// Implementing the interface
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    53
	virtual TInt Request(TLocDrvRequest& aRequest);
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    54
	virtual void Disconnect(DLocalDrive* aLocalDrive, TThreadMessage* aMsg);
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    55
	virtual TInt PartitionInfo(TPartitionInfo &anInfo);
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    56
	virtual void NotifyPowerDown();
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    57
	virtual void NotifyEmergencyPowerDown();
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    58
public:
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    59
	void CompleteRequest(TInt aReason);
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    60
	TInt DoCreate(TInt aMediaId);
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    61
	TInt Caps(TLocDrvRequest& aRequest);
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    62
	TInt Read();
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    63
	TInt Write();
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    64
	TInt Format();
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    65
	static void TransactionLaunchDfc(TAny* aMediaDriver);
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    66
	void DoTransactionLaunchDfc();
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    67
	static void SessionEndDfc(TAny* aMediaDriver);
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    68
	void DoSessionEndDfc();
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    69
	TUint32 GetNVMemSize( void );
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    70
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    71
public:
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    72
	TUint32 iLatestTransferSectorCount;
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    73
	TDfc iSessionEndDfc;
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    74
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    75
private:
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    76
	TInt ContinueTransaction( TUint32 aTransactionSectorOffset, TUint32 aTransactionSectorCount, TUint32 aDirection );
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    77
	static void Isr(TAny* aPtr);
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    78
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    79
private:
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    80
	TLocDrvRequest* iCurrentRequest;				// Current Request
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    81
	Int64 iTotalLength;
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    82
	Int64 iProsessedLength;
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    83
	Int64 iPos;
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    84
	TPhysAddr iTransferBufferPhys;
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    85
	TUint8* iTransferBufferLin;
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    86
	TUint8* iDiscBufferLin;
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    87
	TUint32 iHead;
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    88
	TUint32 iTail;
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    89
	TUint32 iSplitted;
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    90
	TUint32 iAlignmentOverhead;
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    91
	TBool iReadModifyWrite;
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    92
	TDfc iTransactionLaunchDfc;
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    93
	};
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    94
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    95
DPhysicalDeviceMediaStaticRD::DPhysicalDeviceMediaStaticRD()
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    96
//
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    97
// Constructor
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    98
//
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    99
	{
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   100
	__DEBUG_PRINT(">DPhysicalDeviceMediaStaticRD::DPhysicalDeviceMediaStaticRD");
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   101
	iUnitsMask=0x1;
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   102
	iVersion=TVersion(KMediaDriverInterfaceMajorVersion,KMediaDriverInterfaceMinorVersion,KMediaDriverInterfaceBuildVersion);
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   103
	}
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   104
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   105
TInt DPhysicalDeviceMediaStaticRD::Install()
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   106
//
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   107
// Install the Internal NVMem PDD.
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   108
//
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   109
	{
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   110
	__DEBUG_PRINT("DPhysicalDeviceMediaStaticRD::Install()");
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   111
	return SetName(&KNVMemPddName);
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   112
	}
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   113
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   114
void DPhysicalDeviceMediaStaticRD::GetCaps(TDes8& /*aDes*/) const
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   115
//
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   116
// Return the media drivers capabilities.
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   117
//
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   118
	{
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   119
	__DEBUG_PRINT("DPhysicalDeviceMediaStaticRD::GetCaps()");
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   120
	}
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   121
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   122
TInt DPhysicalDeviceMediaStaticRD::Create(DBase*& aChannel, TInt aMediaId, const TDesC8* /* anInfo */,const TVersion &aVer)
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   123
//
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   124
// Create an Internal Ram media driver.
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   125
//
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   126
	{
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   127
	__DEBUG_PRINT("DPhysicalDeviceMediaStaticRD::Create()");
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   128
	if (!Kern::QueryVersionSupported(iVersion,aVer))
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   129
		return KErrNotSupported;
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   130
	TInt r=KErrNoMemory;
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   131
	DMediaDriverStaticRD* pD=new DMediaDriverStaticRD(aMediaId);
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   132
	aChannel=pD;
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   133
	if (pD)
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   134
		{
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   135
		r=pD->DoCreate(aMediaId);
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   136
		}
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   137
	if( r==KErrNone )
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   138
		{
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   139
		pD->OpenMediaDriverComplete(KErrNone);
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   140
		}
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   141
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   142
	return r;
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   143
	}
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   144
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   145
TInt DPhysicalDeviceMediaStaticRD::Validate(TInt aDeviceType, const TDesC8* /*anInfo*/, const TVersion& aVer)
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   146
	{
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   147
	__DEBUG_PRINT("DPhysicalDeviceMediaStaticRD::Validate()");
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   148
	if (!Kern::QueryVersionSupported(iVersion,aVer))
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   149
		return KErrNotSupported;
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   150
	if (aDeviceType!=EFixedMedia1)
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   151
		return KErrNotSupported;
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   152
	return KErrNone;
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   153
	}
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   154
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   155
TInt DPhysicalDeviceMediaStaticRD::Info(TInt aFunction, TAny*)
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   156
//
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   157
// Return the priority of this media driver
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   158
//
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   159
	{
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   160
	__DEBUG_PRINT("DPhysicalDeviceMediaStaticRD::Info()");
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   161
	if (aFunction==EPriority)
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   162
		return KMediaDriverPriorityNormal;
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   163
	return KErrNotSupported;
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   164
	}
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   165
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   166
DMediaDriverStaticRD::DMediaDriverStaticRD(TInt aMediaId)
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   167
//
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   168
// Constructor.
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   169
//
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   170
	:	DMediaDriver(aMediaId),
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   171
		iSessionEndDfc(DMediaDriverStaticRD::SessionEndDfc, this, 1),
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   172
		iTransferBufferPhys(0),
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   173
		iTransactionLaunchDfc(DMediaDriverStaticRD::TransactionLaunchDfc, this, KMaxDfcPriority)
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   174
	{
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   175
	__DEBUG_PRINT("DMediaDriverStaticRD::DMediaDriverStaticRD()");
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   176
	}
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   177
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   178
TInt DMediaDriverStaticRD::DoCreate(TInt /*aMediaId*/)
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   179
//
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   180
// Create the media driver.
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   181
//
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   182
	{
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   183
	__DEBUG_PRINT(">DMediaDriverStaticRD::DoCreate");
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   184
	TInt r = KErrNone; 
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   185
	// Inform our size
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   186
	Int64 size=GetNVMemSize()<<KDiskSectorShift;
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   187
	if( size<=0 )
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   188
		{
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   189
		Kern::Fault("DMediaDriverStaticRD zero size nv memory array", 0);
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   190
		}
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   191
	SetTotalSizeInBytes(size);
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   192
	// Some dfc initialization
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   193
	if( r==KErrNone )
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   194
		{
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   195
		iSessionEndDfc.SetDfcQ( this->iPrimaryMedia->iDfcQ );
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   196
		iTransactionLaunchDfc.SetDfcQ( this->iPrimaryMedia->iDfcQ );
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   197
		}
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   198
	// Create our piece of physically contiguous transfer buffer. 
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   199
	r = Epoc::AllocPhysicalRam( KNVMemTransferBufferSize, iTransferBufferPhys );
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   200
	if( r != KErrNone )
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   201
		{
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   202
		Kern::Fault("DMediaDriverStaticRD Allocate Ram %d",r);
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   203
		}
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   204
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   205
    DPlatChunkHw* bufChunk = NULL;
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   206
    DPlatChunkHw* bufChunk2 = NULL;
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   207
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   208
    // Create HW Memory Chunk
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   209
    r = DPlatChunkHw::New( bufChunk, iTransferBufferPhys, KNVMemTransferBufferSize, EMapAttrUserRw | EMapAttrFullyBlocking );
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   210
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   211
    if( r != KErrNone )
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   212
        {
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   213
        // Check Physical Memory
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   214
        if( iTransferBufferPhys )
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   215
			{
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   216
            // Free Physical Memory
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   217
            Epoc::FreePhysicalRam( iTransferBufferPhys, KNVMemTransferBufferSize );
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   218
			}
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   219
		Kern::Fault("DMediaDriverStaticRD error in creating transfer buffer", r);
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   220
        }
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   221
    
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   222
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   223
    // Set Main Buffer Pointer
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   224
    iTransferBufferLin = reinterpret_cast<TUint8*>(bufChunk->LinearAddress());
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   225
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   226
    
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   227
    
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   228
    // Create HW Memory Chunk for drive image
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   229
       r = DPlatChunkHw::New( bufChunk2, 0x81000000, 0x1000000, EMapAttrUserRw | EMapAttrFullyBlocking );
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   230
       if( r != KErrNone )
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   231
              {
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   232
			   Kern::Fault("DMediaDriverStaticRD error in creating disc image linear address", r);
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   233
              }
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   234
            
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   235
           
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   236
       // Set Main Buffer Pointer
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   237
       iDiscBufferLin = reinterpret_cast<TUint8*>(bufChunk2->LinearAddress());
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   238
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   239
       
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   240
  	// Inform "hardware" about the shared memory
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   241
  	//WriteReg( KHwNVMemoryDevice, R_NVMEM_SHARED_MEMORY_BASE, iTransferBufferPhys );
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   242
  	//WriteReg( KHwNVMemoryDevice, R_NVMEM_SHARED_MEMORY_SIZE, KNVMemTransferBufferSize );
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   243
  	//WriteReg( KHwNVMemoryDevice, R_NVMEM_ENABLE, 1 );
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   244
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   245
	// Set up interrupt service
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   246
  	//r = Interrupt::Bind( EIntNVMemoryDevice, Isr, this );
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   247
  	//Interrupt::Enable( EIntNVMemoryDevice );
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   248
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   249
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   250
	__DEBUG_PRINT("<DMediaDriverStaticRD::DoCreate %d", r);
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   251
	return(r);
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   252
	}
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   253
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   254
TInt DMediaDriverStaticRD::Request(TLocDrvRequest& m)
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   255
	{
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   256
	TInt request=m.Id();
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   257
	__DEBUG_PRINT(">DMediaDriverStaticRD::Request %d",request);
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   258
	TInt r=KErrNone;
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   259
	
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   260
	// Requests that can be handled synchronously
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   261
	if( request == DLocalDrive::ECaps ) 
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   262
		{
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   263
		r=Caps(m);
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   264
		return r;
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   265
		}
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   266
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   267
	// All other requests must be deferred if a request is currently in progress
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   268
	if (iCurrentRequest)
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   269
		{
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   270
		// a request is already in progress, so hold on to this one
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   271
		r = KMediaDriverDeferRequest;
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   272
		}
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   273
	else
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   274
		{
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   275
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   276
		iCurrentRequest=&m;
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   277
		iProsessedLength = 0;
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   278
		iHead = 0;
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   279
		iTail = 0;
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   280
		iSplitted = 0;
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   281
		iAlignmentOverhead = 0;
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   282
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   283
		iPos = m.Pos();
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   284
		iTotalLength = m.Length();
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   285
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   286
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   287
		__DEBUG_PRINT(">DMediaDriverStaticRD::Request pos:0x%lx len:0x%lx", iPos, iTotalLength);
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   288
		if( iTotalLength<0 || iPos<0 )
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   289
			{
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   290
			Kern::Fault("DMediaDriverStaticRD::Request: illegal access!", 0);
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   291
			}
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   292
		// Handle unaligned operations
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   293
		iHead = iPos % KDiskSectorSize;
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   294
		TUint32 tailAlignment = ((iHead + iTotalLength) % KDiskSectorSize);
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   295
		if( tailAlignment )
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   296
			{
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   297
			iTail = KDiskSectorSize - tailAlignment;
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   298
			}
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   299
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   300
		iSplitted = (iTotalLength + iHead + iTail) / KNVMemTransferBufferSize;
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   301
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   302
		__DEBUG_PRINT(">DMediaDriverStaticRD::Request head: %d tail: %d splitted: %d\n", iHead, iTail, iSplitted );
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   303
		__DEBUG_PRINT(">DMediaDriverStaticRD::Request partitionlen: %lx", iCurrentRequest->Drive()->iPartitionLen );
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   304
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   305
		if( (iTotalLength + iPos) > iCurrentRequest->Drive()->iPartitionLen )
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   306
			{
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   307
			Kern::Fault("DMediaDriverStaticRD::Request: Access over partition boundary!", 0);
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   308
			}
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   309
		if( iTotalLength > KMaxTInt32 )
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   310
			{
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   311
			Kern::Fault("DMediaDriverStaticRD::Request: Access length overflow!", 0);
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   312
			}
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   313
		switch (request)
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   314
			{
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   315
			case DLocalDrive::ERead:
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   316
			case DLocalDrive::EWrite:
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   317
			case DLocalDrive::EFormat:
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   318
				__DEBUG_PRINT("DMediaDriverStaticRD::Request iTransactionLaunchDfc.Enque()>");
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   319
				iTransactionLaunchDfc.Enque();
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   320
				__DEBUG_PRINT("DMediaDriverStaticRD::Request iTransactionLaunchDfc.Enque()<");
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   321
			break;
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   322
			case DLocalDrive::EEnlarge:
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   323
			case DLocalDrive::EReduce:
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   324
			default:
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   325
				r=KErrNotSupported;
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   326
			break;
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   327
			}
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   328
		}
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   329
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   330
	__DEBUG_PRINT("<DMediaDriverStaticRD::Request %d",r);
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   331
	return r;
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   332
	}
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   333
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   334
void DMediaDriverStaticRD::CompleteRequest(TInt aReason)
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   335
//
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   336
// completes the request which is being currently processed
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   337
//
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   338
	{
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   339
	__DEBUG_PRINT("DMediaDriverStaticRD::CompleteRequest() reason: %d", aReason);
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   340
	TLocDrvRequest* pR=iCurrentRequest;
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   341
	if (pR)
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   342
		{
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   343
		iCurrentRequest=NULL;
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   344
		DMediaDriver::Complete(*pR,aReason);
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   345
		}
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   346
	}
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   347
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   348
void DMediaDriverStaticRD::Disconnect( DLocalDrive* aLocalDrive, TThreadMessage* aMsg )
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   349
	{
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   350
	__DEBUG_PRINT(">DMediaDriverStaticRD::Disconnect()");
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   351
	// Complete using the default implementation
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   352
	DMediaDriver::Disconnect(aLocalDrive, aMsg);
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   353
	__DEBUG_PRINT("<DMediaDriverStaticRD::Disconnect()");
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   354
	}
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   355
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   356
void DMediaDriverStaticRD::NotifyPowerDown()
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   357
	{
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   358
	__DEBUG_PRINT("DMediaDriverStaticRD::NotifyPowerDown()");
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   359
	// no action required
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   360
	}
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   361
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   362
void DMediaDriverStaticRD::NotifyEmergencyPowerDown()
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   363
	{
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   364
	__DEBUG_PRINT("DMediaDriverStaticRD::NotifyEmergencyPowerDown()");
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   365
	// no action required
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   366
	}
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   367
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   368
TInt DMediaDriverStaticRD::Caps(TLocDrvRequest& m)
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   369
	{
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   370
	__DEBUG_PRINT("DMediaDriverStaticRD::Caps()");
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   371
	TLocalDriveCapsV6& caps=*(TLocalDriveCapsV6*)m.RemoteDes();
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   372
	caps.iType=EMediaHardDisk;
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   373
	caps.iConnectionBusType=EConnectionBusInternal;
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   374
	caps.iDriveAtt=KDriveAttLocal|KDriveAttInternal;
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   375
	caps.iMediaAtt=KMediaAttFormattable;
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   376
	caps.iFileSystemId=KDriveFileSysFAT;
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   377
	caps.iPartitionType=KPartitionTypeFAT16;
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   378
	caps.iSize=m.Drive()->iPartitionLen;
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   379
	caps.iHiddenSectors=0;
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   380
	caps.iEraseBlockSize = KNVMemTransferBufferSize; 
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   381
	caps.iBlockSize=KDiskSectorSize;
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   382
	caps.iMaxBytesPerFormat = KNVMemTransferBufferSize;
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   383
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   384
	return KErrCompletion;									
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   385
	}
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   386
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   387
TInt DMediaDriverStaticRD::Read()
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   388
	{
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   389
	__DEBUG_PRINT(">DMediaDriverStaticRD::Read() pos: %lx, size: %lx", iPos, iTotalLength);
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   390
	// Set our sector offset
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   391
	TUint32 transactionSectorOffset = (TUint32)(iPos / KDiskSectorSize); 
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   392
	TUint32 transactionLength = 0;
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   393
	TUint32 transactionDirection = NVMEM_TRANSACTION_READ;
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   394
	// Do we have an operation longer than our shared memory?
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   395
	if( iSplitted > 0 )
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   396
		{
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   397
		transactionLength = KNVMemTransferBufferSize;
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   398
		}
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   399
	else
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   400
		{
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   401
		// Do the whole operation in one go since we have enough room in our memory
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   402
		transactionLength = I64LOW(iTotalLength);
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   403
		// Read the "broken" tail sector
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   404
		if( iTail )
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   405
			{
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   406
			transactionLength += iTail;
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   407
			iAlignmentOverhead += iTail;
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   408
			}
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   409
		}
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   410
	// Read the "broken" head sector
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   411
	if( iHead > 0 )
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   412
		{
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   413
		transactionLength += iHead;
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   414
		iAlignmentOverhead += iHead;
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   415
		}
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   416
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   417
	// We should be ok to continue
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   418
	ContinueTransaction( transactionSectorOffset, transactionLength/KDiskSectorSize, transactionDirection );
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   419
	__DEBUG_PRINT("<DMediaDriverStaticRD::Read()");
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   420
	return KErrNone;
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   421
	}
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   422
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   423
TInt DMediaDriverStaticRD::Write()
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   424
	{
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   425
	__DEBUG_PRINT("DMediaDriverStaticRD::Write() pos: 0x%lx, size: 0x%lx", iPos, iTotalLength);
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   426
	TInt r = KErrNone;
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   427
	// Set our sector offset
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   428
	TUint32 transactionSectorOffset = (TUint32)(iPos / KDiskSectorSize); 
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   429
	TUint32 transactionLength = 0;
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   430
	TUint32 transactionDirection = NVMEM_TRANSACTION_WRITE;
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   431
	// Do we have an operation longer than our shared memory?
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   432
	if( iSplitted > 0 )
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   433
		{
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   434
		transactionLength = KNVMemTransferBufferSize;
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   435
		}
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   436
	else
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   437
		{
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   438
		// Do the whole operation in one go since we have enough room in our memory
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   439
		transactionLength = I64LOW(iTotalLength);
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   440
		if( iTail )
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   441
			{
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   442
			iReadModifyWrite = ETrue;
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   443
			// Read the "broken" tail sector
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   444
			transactionLength += iTail;
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   445
			iAlignmentOverhead += iTail;
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   446
			}
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   447
		}
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   448
	// Is there a need to read modify write the "broken" head sector of the operation
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   449
	if( iHead > 0 )
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   450
		{
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   451
		iReadModifyWrite = ETrue;
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   452
		// If splitted operation we only need the broken sector
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   453
		if( iSplitted > 0 )
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   454
			{
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   455
			transactionLength = KDiskSectorSize;
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   456
			iAlignmentOverhead += iHead;
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   457
			}
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   458
		else
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   459
			{
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   460
			// Read the "broken" head sector in addition to everything else
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   461
			transactionLength += iHead;
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   462
			iAlignmentOverhead += iHead;
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   463
			}
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   464
		}
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   465
	
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   466
	// Was there a need to read-modify before writing
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   467
	if( iReadModifyWrite )
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   468
		{
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   469
		transactionDirection = NVMEM_TRANSACTION_READ;
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   470
		}
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   471
	else
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   472
		{
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   473
		// Handle format here
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   474
		if( iCurrentRequest->Id() == DLocalDrive::EFormat )
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   475
			{
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   476
			// Not much handling just flow through since we have filled the shared memory with zeroes already
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   477
			}
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   478
		else
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   479
			{
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   480
			// Read from client
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   481
			TPtr8 targetDescriptor(iTransferBufferLin, transactionLength);
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   482
			r = iCurrentRequest->ReadRemote(&targetDescriptor,0);
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   483
			}
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   484
		}
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   485
	
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   486
	// We should be ok to continue
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   487
	ContinueTransaction( transactionSectorOffset, transactionLength/KDiskSectorSize, transactionDirection );
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   488
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   489
	return r;
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   490
	}
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   491
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   492
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   493
TInt DMediaDriverStaticRD::Format()
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   494
	{
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   495
	__DEBUG_PRINT("DMediaDriverStaticRD::Format() pos: 0x%lx, size: 0x%lx", iPos, iTotalLength);
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   496
	memset( iTransferBufferLin, 0x00, KNVMemTransferBufferSize );
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   497
	// Stop the nonsense here. Write operations should be used for partial sector data removal operations
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   498
	if( iHead > 0 || iTail > 0 )
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   499
		{
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   500
		Kern::Fault("DMediaDriverStaticRD::Format: alignment violation!", 0);
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   501
		}
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   502
	Write();
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   503
//	DoTransaction( m, NVMEM_TRANSACTION_WRITE );
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   504
	return KErrNone;
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   505
	}
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   506
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   507
TInt DMediaDriverStaticRD::ContinueTransaction( TUint32 aTransactionSectorOffset, TUint32 aTransactionSectorCount, TUint32 aTransactionDirection )
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   508
	{
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   509
	__DEBUG_PRINT("DMediaDriverStaticRD::ContinueTransaction() sectoroffset: %d, sectorcount: %d, direction: %d", aTransactionSectorOffset, aTransactionSectorCount, aTransactionDirection);
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   510
	if( aTransactionDirection != NVMEM_TRANSACTION_UNDEFINED )
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   511
		{
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   512
	  	//WriteReg( KHwNVMemoryDevice, R_NVMEM_TRANSACTION_OFFSET, aTransactionSectorOffset );
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   513
	  	//WriteReg( KHwNVMemoryDevice, R_NVMEM_TRANSACTION_SIZE, aTransactionSectorCount );
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   514
	  	//WriteReg( KHwNVMemoryDevice, R_NVMEM_TRANSACTION_DIRECTION, aTransactionDirection );
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   515
	  	//WriteReg( KHwNVMemoryDevice, R_NVMEM_TRANSACTION_EXECUTE, aTransactionDirection );
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   516
		if ( aTransactionDirection == NVMEM_TRANSACTION_WRITE )
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   517
		{
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   518
			memcpy( (TAny *)(iDiscBufferLin+(aTransactionSectorOffset<<9)), iTransferBufferLin, aTransactionSectorCount*512 );
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   519
		}
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   520
		else if ( aTransactionDirection == NVMEM_TRANSACTION_READ )
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   521
		{
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   522
			memcpy( iTransferBufferLin, (TAny *)(iDiscBufferLin+(aTransactionSectorOffset<<9)), aTransactionSectorCount*512 );
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   523
		}
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   524
		iLatestTransferSectorCount = aTransactionSectorCount;
101
984b38878b1b updated 'terrible hack' in persistent storage that was crashing the board
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 97
diff changeset
   525
		
984b38878b1b updated 'terrible hack' in persistent storage that was crashing the board
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 97
diff changeset
   526
		// Isr(this); // terrible hack, we've yransferred all the sectors and now we pretend to generate an interrupt
984b38878b1b updated 'terrible hack' in persistent storage that was crashing the board
Lukasz Forynski <lukasz.forynski@gmail.com>
parents: 97
diff changeset
   527
		iSessionEndDfc.Enque();
46
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   528
		}
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   529
	else
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   530
		{
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   531
		Kern::Fault("DMediaDriverStaticRD::ContinueTransaction: Undefined transaction!", 0);
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   532
		}
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   533
	return KErrNone;
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   534
	}
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   535
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   536
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   537
TInt DMediaDriverStaticRD::PartitionInfo(TPartitionInfo& anInfo)
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   538
//
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   539
// Return partition information on the media.
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   540
//
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   541
	{
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   542
	__DEBUG_PRINT("DMediaDriverStaticRD::PartitionInfo()");
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   543
	anInfo.iPartitionCount=1;
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   544
	anInfo.iEntry[0].iPartitionBaseAddr=0;
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   545
	anInfo.iEntry[0].iPartitionLen=anInfo.iMediaSizeInBytes=TotalSizeInBytes();
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   546
	anInfo.iEntry[0].iPartitionType=KPartitionTypeFAT16;
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   547
	return KErrCompletion;
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   548
	}
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   549
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   550
void DMediaDriverStaticRD::TransactionLaunchDfc(TAny* aMediaDriver)
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   551
	{
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   552
	static_cast<DMediaDriverStaticRD*>(aMediaDriver)->DoTransactionLaunchDfc();
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   553
	}
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   554
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   555
void DMediaDriverStaticRD::DoTransactionLaunchDfc()
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   556
	{
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   557
	__DEBUG_PRINT(">DMediaDriverStaticRD::DoTransactionLaunchDfc()");
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   558
	TInt request = iCurrentRequest->Id();
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   559
	TInt r(KErrNone);
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   560
	switch (request)
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   561
		{
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   562
		case DLocalDrive::ERead:
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   563
			r=Read();
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   564
		break;
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   565
		case DLocalDrive::EWrite:
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   566
			r=Write();
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   567
		break;
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   568
		case DLocalDrive::EFormat:
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   569
			r=Format();
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   570
		break;
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   571
		case DLocalDrive::EEnlarge:
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   572
		case DLocalDrive::EReduce:
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   573
		default:
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   574
			r=KErrNotSupported;
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   575
		break;
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   576
		}
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   577
	if( r != KErrNone )
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   578
		{
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   579
		// TODO some proper error handling here
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   580
		}
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   581
	__DEBUG_PRINT("<MediaDriverStaticRD::DoTransactionLaunchDfc %d",r);
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   582
	}
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   583
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   584
void DMediaDriverStaticRD::SessionEndDfc(TAny* aMediaDriver)
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   585
	{
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   586
	static_cast<DMediaDriverStaticRD*>(aMediaDriver)->DoSessionEndDfc();
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   587
	}
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   588
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   589
void DMediaDriverStaticRD::DoSessionEndDfc()
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   590
	{
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   591
	__DEBUG_PRINT(">DMediaDriverStaticRD::DoSessionEndDfc()");
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   592
	TInt r = KErrNone;
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   593
	// Check that we have a request in process
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   594
	if( iCurrentRequest )
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   595
		{
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   596
		// Transaction variables
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   597
		TUint32 transactionSectorOffset(0);
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   598
		TUint32 transactionLength(0);
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   599
		TUint32 transactionDirection( NVMEM_TRANSACTION_UNDEFINED );
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   600
		// How much did we actually transfer? 
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   601
		TUint32 latestTransferSize = (iLatestTransferSectorCount * KDiskSectorSize);
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   602
		__DEBUG_PRINT("DMediaDriverStaticRD::DoSessionEndDfc() latestTransferSize: %d", latestTransferSize );
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   603
		// Subtract alignment overhead
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   604
		latestTransferSize = latestTransferSize - iAlignmentOverhead;
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   605
		// For decision whether the buffer is ready for operation already
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   606
		TBool bufferReady(EFalse);
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   607
		// For decision whether we have finished the latest request
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   608
		TBool sessionComplete(EFalse);
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   609
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   610
		// Was there a read-modify-write (RWM) for which we need to do some buffer manipulation before proceeding?
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   611
		// Note that in case of format we triggered to alignment violation in earlier method already and can not enter to following 
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   612
		// condition when there is a format operation going on
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   613
		if( iReadModifyWrite )
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   614
			{
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   615
			bufferReady = ETrue;
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   616
			iReadModifyWrite = EFalse;
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   617
			// Was it a splitted operation for which we only need to take care of the broken head sector.
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   618
			if( iSplitted > 0 )
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   619
				{
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   620
				// We have a sector here here filled with data from mass memory. Modify with client data.
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   621
				__DEBUG_PRINT("DMediaDriverStaticRD::DoSessionEndDfc() readremote splitted: %d head: %d", latestTransferSize, iHead );
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   622
				TPtr8 targetDescriptor(&iTransferBufferLin[iHead], KNVMemTransferBufferSize - iHead);
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   623
				r = iCurrentRequest->ReadRemote(&targetDescriptor,0);
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   624
				}
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   625
			// Else we need to take care of both head and tail
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   626
			else
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   627
				{
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   628
				// We have a piece of data read from mass memory. Modify with client data.
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   629
				__DEBUG_PRINT("DMediaDriverStaticRD::DoSessionEndDfc() readremote: %d head: %d", I64LOW(iTotalLength - iProsessedLength), iHead );
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   630
				TPtr8 targetDescriptor(&iTransferBufferLin[iHead], I64LOW(iTotalLength - iProsessedLength));
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   631
				r = iCurrentRequest->ReadRemote(&targetDescriptor,0);
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   632
//				latestTransferSize -= (KDiskSectorSize - iTail);
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   633
				iTail = 0;
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   634
				}
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   635
			}
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   636
		else
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   637
			{
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   638
			// Overhead is processed when we enter here
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   639
			iAlignmentOverhead = 0;
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   640
			// Update position
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   641
			iPos += latestTransferSize;
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   642
			// Save the information on how many bytes we transferred already
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   643
			iProsessedLength += latestTransferSize; 
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   644
			// Update the splitted information. We don't take head into account here anymore since it is already taken care of
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   645
			iSplitted = (iTotalLength - iProsessedLength + iTail) / KNVMemTransferBufferSize;
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   646
			// Check if we have done already
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   647
			if( iProsessedLength >= iTotalLength )
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   648
				{
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   649
				// If this was the final transfer for this request let's take tail into account as well (if not taken already)
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   650
				// iProsessedLength -= iTail;
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   651
				// latestTransferSize -= iTail;
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   652
				if( iProsessedLength > iTotalLength )
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   653
					{
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   654
					Kern::Fault("DMediaDriverStaticRD: Illegal transfer operation!", 0);
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   655
					}
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   656
				sessionComplete = ETrue;
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   657
				}
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   658
			}
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   659
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   660
		TInt request = iCurrentRequest->Id();
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   661
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   662
		// Set our sector offset
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   663
		transactionSectorOffset = (TUint32)(iPos / KDiskSectorSize); 
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   664
		
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   665
		if( bufferReady )
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   666
			{
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   667
			// Write as much as we read in RMW operation
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   668
			transactionLength = (iLatestTransferSectorCount * KDiskSectorSize);
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   669
			}
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   670
		else
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   671
			{
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   672
			// Do we have an operation longer than our shared memory?
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   673
			if( iSplitted > 0 )
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   674
				{
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   675
				transactionLength = KNVMemTransferBufferSize;
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   676
				}
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   677
			else
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   678
				{
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   679
				// Do the whole operation in one go since we have enough room in our memory
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   680
				transactionLength = I64LOW(iTotalLength - iProsessedLength);
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   681
				// Read the "broken" tail sector
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   682
				if( iTail > 0 && request == DLocalDrive::EWrite )
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   683
					{
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   684
					iReadModifyWrite = ETrue;
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   685
					// Read the "broken" tail sector
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   686
					transactionLength += iTail;
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   687
	   				iAlignmentOverhead = iTail;
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   688
	   				}
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   689
				}
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   690
			}
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   691
		
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   692
		// Was there a need to read-modify before writing
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   693
		if( iReadModifyWrite )
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   694
			{
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   695
			transactionDirection = NVMEM_TRANSACTION_READ;
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   696
			}
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   697
		else
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   698
			{
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   699
			if( request == DLocalDrive::ERead )
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   700
				{
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   701
				transactionDirection = NVMEM_TRANSACTION_READ;
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   702
				// Write to client
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   703
				__DEBUG_PRINT("DMediaDriverStaticRD::DoSessionEndDfc() WriteRemote: %d head: %d", latestTransferSize, iHead );
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   704
				TPtrC8 sourceDescriptor(&iTransferBufferLin[iHead], latestTransferSize);
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   705
				r = iCurrentRequest->WriteRemote( &sourceDescriptor, 0 );
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   706
				}
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   707
			// Head is processed
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   708
			iHead = 0;
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   709
			if( request == DLocalDrive::EWrite && !sessionComplete )
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   710
				{
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   711
				transactionDirection = NVMEM_TRANSACTION_WRITE;
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   712
				if( bufferReady )
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   713
					{
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   714
					// Actually no need for any actions here
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   715
					}
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   716
				else
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   717
					{
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   718
					// Prepare a buffer for transfer
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   719
					__DEBUG_PRINT("DMediaDriverStaticRD::DoSessionEndDfc() ReadRemote: %d head: %d", latestTransferSize, iHead );
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   720
					TPtr8 targetDescriptor(iTransferBufferLin, transactionLength);
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   721
					r = iCurrentRequest->ReadRemote(&targetDescriptor,0);
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   722
					}
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   723
				}
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   724
			if( request == DLocalDrive::EFormat )
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   725
				{
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   726
				transactionDirection = NVMEM_TRANSACTION_WRITE;
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   727
				}
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   728
			}
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   729
		if( sessionComplete )
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   730
			{
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   731
			CompleteRequest( r );
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   732
			}
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   733
		else
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   734
			{
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   735
			ContinueTransaction( transactionSectorOffset, transactionLength/KDiskSectorSize, transactionDirection );
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   736
			}
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   737
		}
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   738
	else
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   739
		{
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   740
		// Let's just flow through for now
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   741
		}
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   742
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   743
	__DEBUG_PRINT("<DMediaDriverStaticRD::DoSessionEndDfc()" );
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   744
	}
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   745
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   746
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   747
TUint32  DMediaDriverStaticRD::GetNVMemSize( void )
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   748
	{
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   749
	__DEBUG_PRINT("DMediaDriverStaticRD::GetNVMemSize()");
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   750
	TUint32 sizeInSectors = 32768;//ReadReg( KHwNVMemoryDevice, R_NVMEM_NV_MEMORY_SIZE );
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   751
	return sizeInSectors; 
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   752
	}
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   753
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   754
void DMediaDriverStaticRD::Isr(TAny* aPtr)
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   755
	{
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   756
	__DEBUG_PRINT(">DMediaDriverStaticRD::Isr");
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   757
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   758
    DMediaDriverStaticRD* nvMem = reinterpret_cast<DMediaDriverStaticRD*>(aPtr);
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   759
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   760
	// Save the amount of transferred sectors. This clears the interrupt from HW as well
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   761
	//nvMem->iLatestTransferSectorCount = ReadReg( KHwNVMemoryDevice, R_NVMEM_STATUS );
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   762
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   763
	// Clear from framework
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   764
	//Interrupt::Clear( EIntNVMemoryDevice );
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   765
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   766
	nvMem->iSessionEndDfc.Add();
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   767
	}
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   768
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   769
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   770
DECLARE_EXTENSION_PDD()
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   771
	{
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   772
	__DEBUG_PRINT(">MediaDriverStaticRD create device");
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   773
	return new DPhysicalDeviceMediaStaticRD;
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   774
	}
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   775
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   776
static const TInt NVMemDriveNumbers[NVMEM1_DRIVECOUNT]={NVMEM1_DRIVELIST};	
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   777
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   778
DECLARE_STANDARD_EXTENSION()
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   779
	{
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   780
	__DEBUG_PRINT("Registering STATICRD drive");
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   781
	TInt r=KErrNoMemory;
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   782
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   783
	DPrimaryMediaBase* pM=new DPrimaryMediaBase;
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   784
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   785
	TDynamicDfcQue* NVMemoryDfcQ;
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   786
	 
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   787
	r = Kern::DynamicDfcQCreate( NVMemoryDfcQ, KNVMemDfcThreadPriority, KNVMemDriveName );
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   788
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   789
	if( r == KErrNone )
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   790
		{
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   791
		pM->iDfcQ = NVMemoryDfcQ;
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   792
		}
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   793
	else
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   794
		{
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   795
		__DEBUG_PRINT("NVMEM DFCQ initialization failed");
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   796
		}
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   797
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   798
	if (pM)
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   799
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   800
		{
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   801
		r=LocDrv::RegisterMediaDevice(EFixedMedia1,NVMEM1_DRIVECOUNT,&NVMemDriveNumbers[0],pM,NVMEM1_NUMMEDIA,KNVMemDriveName);
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   802
		}
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   803
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   804
	pM->iMsgQ.Receive();
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   805
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   806
	__DEBUG_PRINT("Registering NVMEM drive - return %d",r);
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   807
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   808
	return r;
78c240f59c9d Changes for full working UI on 3.0.0 including Gareth's "persistent" RAM drives
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   809
	}