os/boardsupport/emulator/emulatorbsp/specific/mmcv.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/boardsupport/emulator/emulatorbsp/specific/mmcv.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,135 @@
     1.4 +// Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +// wins\specific\mmcv.cpp
    1.18 +// WINS variant
    1.19 +// 
    1.20 +//
    1.21 +
    1.22 +#include <mmccd_ifc.h>
    1.23 +#include "mmci.h"
    1.24 +#include "variantmediadef.h"
    1.25 +
    1.26 +//
    1.27 +// Factory class for creation of platform specifics
    1.28 +//
    1.29 +class TMMCardControllerInterfaceWins : public TMMCardControllerInterface
    1.30 +	{
    1.31 +	// Factory functions
    1.32 +	virtual DMMCSocket* NewSocket(TInt aSocketNum, TMMCPasswordStore* aPasswordStore);
    1.33 +	virtual DMMCStack* NewStack(TInt aStackNum, DMMCSocket* aSocket);
    1.34 +	virtual DMMCMediaChange* NewMediaChange(TInt aMcId);
    1.35 +	virtual DMMCPsu* NewVcc(TInt aVccNum, TInt aMcId);
    1.36 +	// Stack initialisation
    1.37 +	virtual TInt Init();
    1.38 +	// Machine configuration
    1.39 +	virtual TBool IsMMCSocket(TInt aSocket,SMediaDeviceInfo& aMediaDeviceInfo);
    1.40 +	virtual TInt  MediaChangeID(TInt aSocket);
    1.41 +	virtual TInt  VccID(TInt aSocket);
    1.42 +    };
    1.43 +
    1.44 +
    1.45 +TInt TMMCardControllerInterfaceWins::Init()
    1.46 +//
    1.47 +// Initialise the Controller h/w
    1.48 +// 
    1.49 +	{
    1.50 +	return KErrNone;
    1.51 +	}
    1.52 +
    1.53 +TInt TMMCardControllerInterfaceWins::MediaChangeID(TInt aSocket)
    1.54 +//
    1.55 +// Return the socket's media change index
    1.56 +//
    1.57 +	{
    1.58 +	return aSocket;
    1.59 +	}
    1.60 +
    1.61 +TInt TMMCardControllerInterfaceWins::VccID(TInt aSocket)
    1.62 +//
    1.63 +// Return the socket's PSU index
    1.64 +//
    1.65 +	{
    1.66 +	return aSocket;
    1.67 +	}
    1.68 +
    1.69 +static const TInt DriveNumbers[MMC0_DRIVECOUNT]={MMC0_DRIVELIST};
    1.70 +_LIT(KLitMmcSocketName,MMC0_DRIVENAME);
    1.71 +TBool TMMCardControllerInterfaceWins::IsMMCSocket(TInt aSocket,SMediaDeviceInfo& aMediaDeviceInfo)
    1.72 +//
    1.73 +// Confirm whether an MMC stack is supported on the specified
    1.74 +// socket and if it is, the Media Info. for that socket.
    1.75 +//
    1.76 +	{
    1.77 +	
    1.78 +	if (aSocket==0)
    1.79 +		{
    1.80 +		aMediaDeviceInfo.iDevice=MEDIA_DEVICE_MMC;
    1.81 +		aMediaDeviceInfo.iDriveCount=MMC0_DRIVECOUNT;
    1.82 +		aMediaDeviceInfo.iDriveList=&DriveNumbers[0];
    1.83 +		aMediaDeviceInfo.iNumMedia=MMC0_NUMMEDIA;
    1.84 +		aMediaDeviceInfo.iDeviceName=&KLitMmcSocketName;
    1.85 +		return(ETrue);
    1.86 +		}
    1.87 +	else
    1.88 +		return(EFalse);	
    1.89 +	}
    1.90 +
    1.91 +DMMCSocket* TMMCardControllerInterfaceWins::NewSocket(TInt aSocketNum, TMMCPasswordStore* aPasswordStore)
    1.92 +//
    1.93 +// Create a new platform-specific socket
    1.94 +//
    1.95 +	{
    1.96 +	return new DMMCSocket(aSocketNum, aPasswordStore);
    1.97 +	}
    1.98 +
    1.99 +DMMCStack* TMMCardControllerInterfaceWins::NewStack(TInt aStackNum, DMMCSocket* aSocket)
   1.100 +//
   1.101 +// Create a new platform-specific stack
   1.102 +//
   1.103 +	{
   1.104 +	return new DWinsMMCStack(aStackNum, aSocket);
   1.105 +	}
   1.106 +
   1.107 +DMMCMediaChange* TMMCardControllerInterfaceWins::NewMediaChange(TInt aMcId)
   1.108 +//
   1.109 +// Create a new platform-specific media change
   1.110 +//
   1.111 +	{
   1.112 +	return new DWinsMMCMediaChange(aMcId);
   1.113 +	}
   1.114 +
   1.115 +DMMCPsu* TMMCardControllerInterfaceWins::NewVcc(TInt aVccNum, TInt aMcId)
   1.116 +//
   1.117 +// Create a new platform-specific PSU
   1.118 +//
   1.119 +	{
   1.120 +	return new DWinsMMCPsu(aVccNum, aMcId);
   1.121 +	}
   1.122 +
   1.123 +DECLARE_STANDARD_EXTENSION()
   1.124 +//
   1.125 +// Extension Entry Point
   1.126 +//
   1.127 +	{
   1.128 +	__KTRACE_OPT(KPBUS1,Kern::Printf("Starting MMC interface"));
   1.129 +
   1.130 +	TInt r=KErrNoMemory;
   1.131 +	TMMCardControllerInterfaceWins* pI=new TMMCardControllerInterfaceWins;
   1.132 +	if (pI)
   1.133 +		r=pI->Create();
   1.134 +
   1.135 +	__KTRACE_OPT(KPBUS1,Kern::Printf("Returns %d",r));
   1.136 +	return r;
   1.137 +	}
   1.138 +