sl@0: // Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // wins\specific\pp_cprmv.cpp sl@0: // WINS variant sl@0: // sl@0: // sl@0: sl@0: #include sl@0: #include "pp_cprm.h" sl@0: #include sl@0: sl@0: // sl@0: // Factory class for creation of platform specifics sl@0: // sl@0: class TCPRMCardControllerInterfaceWins : public TMMCardControllerInterface sl@0: { sl@0: // Factory functions sl@0: virtual DMMCStack* NewStack(TInt aStackNum, DMMCSocket* aSocket); sl@0: virtual DMMCMediaChange* NewMediaChange(TInt aMcId); sl@0: virtual DMMCPsu* NewVcc(TInt aVccNum, TInt aMcId); sl@0: // Stack initialisation sl@0: virtual TInt Init(); sl@0: // Machine configuration sl@0: virtual TBool IsMMCSocket(TInt aSocket,SMediaDeviceInfo& aMediaDeviceInfo); sl@0: virtual TInt MediaChangeID(TInt aSocket); sl@0: virtual TInt VccID(TInt aSocket); sl@0: }; sl@0: sl@0: TInt TCPRMCardControllerInterfaceWins::Init() sl@0: // sl@0: // Initialise the Controller h/w sl@0: // sl@0: { sl@0: return KErrNone; sl@0: } sl@0: sl@0: TInt TCPRMCardControllerInterfaceWins::MediaChangeID(TInt aSocket) sl@0: // sl@0: // Return the socket's media change index sl@0: // sl@0: { sl@0: return aSocket; sl@0: } sl@0: sl@0: TInt TCPRMCardControllerInterfaceWins::VccID(TInt aSocket) sl@0: // sl@0: // Return the socket's PSU index sl@0: // sl@0: { sl@0: return aSocket; sl@0: } sl@0: sl@0: sl@0: static const TInt DriveNumbers[MMC0_DRIVECOUNT]={MMC0_DRIVELIST}; sl@0: _LIT(KLitMmcSocketName,MMC0_DRIVENAME); sl@0: TBool TCPRMCardControllerInterfaceWins::IsMMCSocket(TInt aSocket,SMediaDeviceInfo& aMediaDeviceInfo) sl@0: // sl@0: // Confirm whether an MMC stack is supported on the specified sl@0: // socket and if it is, the Media Info. for that socket. sl@0: // sl@0: { sl@0: sl@0: if (aSocket==0) sl@0: { sl@0: aMediaDeviceInfo.iDevice=MEDIA_DEVICE_MMC; sl@0: aMediaDeviceInfo.iDriveCount=MMC0_DRIVECOUNT; sl@0: aMediaDeviceInfo.iDriveList=&DriveNumbers[0]; sl@0: aMediaDeviceInfo.iNumMedia=MMC0_NUMMEDIA; sl@0: aMediaDeviceInfo.iDeviceName=&KLitMmcSocketName; sl@0: return(ETrue); sl@0: } sl@0: else sl@0: return(EFalse); sl@0: } sl@0: sl@0: DMMCStack* TCPRMCardControllerInterfaceWins::NewStack(TInt aStackNum, DMMCSocket* aSocket) sl@0: // sl@0: // Create a new platform-specific stack sl@0: // sl@0: { sl@0: return new DWinsCPRMStack(aStackNum, aSocket); sl@0: } sl@0: sl@0: DMMCMediaChange* TCPRMCardControllerInterfaceWins::NewMediaChange(TInt aMcId) sl@0: // sl@0: // Create a new platform-specific media change sl@0: // sl@0: { sl@0: return new DWinsMMCMediaChange(aMcId); sl@0: } sl@0: sl@0: DMMCPsu* TCPRMCardControllerInterfaceWins::NewVcc(TInt aVccNum, TInt aMcId) sl@0: // sl@0: // Create a new platform-specific PSU sl@0: // sl@0: { sl@0: return new DWinsMMCPsu(aVccNum, aMcId); sl@0: } sl@0: sl@0: DECLARE_STANDARD_EXTENSION() sl@0: // sl@0: // Extension Entry Point sl@0: // sl@0: { sl@0: __KTRACE_OPT(KPBUS1,Kern::Printf("Starting CPRM interface")); sl@0: sl@0: TInt r=KErrNoMemory; sl@0: TCPRMCardControllerInterfaceWins* pI=new TCPRMCardControllerInterfaceWins; sl@0: if (pI) sl@0: r=pI->Create(); sl@0: sl@0: __KTRACE_OPT(KPBUS1,Kern::Printf("Returns %d",r)); sl@0: return r; sl@0: } sl@0: