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