os/boardsupport/emulator/emulatorbsp/specific/sdcard/sdcard4c/pp_cprmv.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/boardsupport/emulator/emulatorbsp/specific/sdcard/sdcard4c/pp_cprmv.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,126 @@
     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\pp_cprmv.cpp
    1.18 +// WINS variant
    1.19 +// 
    1.20 +//
    1.21 +
    1.22 +#include <mmccd_ifc.h>
    1.23 +#include "pp_cprm.h"
    1.24 +#include <variantmediadef.h>
    1.25 +
    1.26 +//
    1.27 +// Factory class for creation of platform specifics
    1.28 +//
    1.29 +class TCPRMCardControllerInterfaceWins : public TMMCardControllerInterface
    1.30 +	{
    1.31 +	// Factory functions
    1.32 +	virtual DMMCStack* NewStack(TInt aStackNum, DMMCSocket* aSocket);
    1.33 +	virtual DMMCMediaChange* NewMediaChange(TInt aMcId);
    1.34 +	virtual DMMCPsu* NewVcc(TInt aVccNum, TInt aMcId);
    1.35 +	// Stack initialisation
    1.36 +	virtual TInt Init();
    1.37 +	// Machine configuration
    1.38 +	virtual TBool IsMMCSocket(TInt aSocket,SMediaDeviceInfo& aMediaDeviceInfo);
    1.39 +	virtual TInt  MediaChangeID(TInt aSocket);
    1.40 +	virtual TInt  VccID(TInt aSocket);
    1.41 +    };
    1.42 +
    1.43 +TInt TCPRMCardControllerInterfaceWins::Init()
    1.44 +//
    1.45 +// Initialise the Controller h/w
    1.46 +// 
    1.47 +	{
    1.48 +	return KErrNone;
    1.49 +	}
    1.50 +
    1.51 +TInt TCPRMCardControllerInterfaceWins::MediaChangeID(TInt aSocket)
    1.52 +//
    1.53 +// Return the socket's media change index
    1.54 +//
    1.55 +	{
    1.56 +	return aSocket;
    1.57 +	}
    1.58 +
    1.59 +TInt TCPRMCardControllerInterfaceWins::VccID(TInt aSocket)
    1.60 +//
    1.61 +// Return the socket's PSU index
    1.62 +//
    1.63 +	{
    1.64 +	return aSocket;
    1.65 +	}
    1.66 +
    1.67 +
    1.68 +static const TInt DriveNumbers[MMC0_DRIVECOUNT]={MMC0_DRIVELIST};
    1.69 +_LIT(KLitMmcSocketName,MMC0_DRIVENAME);
    1.70 +TBool TCPRMCardControllerInterfaceWins::IsMMCSocket(TInt aSocket,SMediaDeviceInfo& aMediaDeviceInfo)
    1.71 +//
    1.72 +// Confirm whether an MMC stack is supported on the specified
    1.73 +// socket and if it is, the Media Info. for that socket.
    1.74 +//
    1.75 +	{
    1.76 +	
    1.77 +	if (aSocket==0)
    1.78 +		{
    1.79 +		aMediaDeviceInfo.iDevice=MEDIA_DEVICE_MMC;
    1.80 +		aMediaDeviceInfo.iDriveCount=MMC0_DRIVECOUNT;
    1.81 +		aMediaDeviceInfo.iDriveList=&DriveNumbers[0];
    1.82 +		aMediaDeviceInfo.iNumMedia=MMC0_NUMMEDIA;
    1.83 +		aMediaDeviceInfo.iDeviceName=&KLitMmcSocketName;
    1.84 +		return(ETrue);
    1.85 +		}
    1.86 +	else
    1.87 +		return(EFalse);	
    1.88 +	}
    1.89 +
    1.90 +DMMCStack* TCPRMCardControllerInterfaceWins::NewStack(TInt aStackNum, DMMCSocket* aSocket)
    1.91 +//
    1.92 +// Create a new platform-specific stack
    1.93 +//
    1.94 +	{
    1.95 +	return new DWinsCPRMStack(aStackNum, aSocket);
    1.96 +	}
    1.97 +
    1.98 +DMMCMediaChange* TCPRMCardControllerInterfaceWins::NewMediaChange(TInt aMcId)
    1.99 +//
   1.100 +// Create a new platform-specific media change
   1.101 +//
   1.102 +	{
   1.103 +	return new DWinsMMCMediaChange(aMcId);
   1.104 +	}
   1.105 +
   1.106 +DMMCPsu* TCPRMCardControllerInterfaceWins::NewVcc(TInt aVccNum, TInt aMcId)
   1.107 +//
   1.108 +// Create a new platform-specific PSU
   1.109 +//
   1.110 +	{
   1.111 +	return new DWinsMMCPsu(aVccNum, aMcId);
   1.112 +	}
   1.113 +
   1.114 +DECLARE_STANDARD_EXTENSION()
   1.115 +//
   1.116 +// Extension Entry Point
   1.117 +//
   1.118 +	{
   1.119 +	__KTRACE_OPT(KPBUS1,Kern::Printf("Starting CPRM interface"));
   1.120 +	
   1.121 +	TInt r=KErrNoMemory;
   1.122 +	TCPRMCardControllerInterfaceWins* pI=new TCPRMCardControllerInterfaceWins;
   1.123 +	if (pI)
   1.124 +		r=pI->Create();
   1.125 +
   1.126 +	__KTRACE_OPT(KPBUS1,Kern::Printf("Returns %d",r));
   1.127 +	return r;
   1.128 +	}
   1.129 +