First public contribution.
1 // Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // wins\specific\mmcv.cpp
19 #include <mmccd_ifc.h>
21 #include "variantmediadef.h"
24 // Factory class for creation of platform specifics
26 class TMMCardControllerInterfaceWins : public TMMCardControllerInterface
29 virtual DMMCSocket* NewSocket(TInt aSocketNum, TMMCPasswordStore* aPasswordStore);
30 virtual DMMCStack* NewStack(TInt aStackNum, DMMCSocket* aSocket);
31 virtual DMMCMediaChange* NewMediaChange(TInt aMcId);
32 virtual DMMCPsu* NewVcc(TInt aVccNum, TInt aMcId);
33 // Stack initialisation
35 // Machine configuration
36 virtual TBool IsMMCSocket(TInt aSocket,SMediaDeviceInfo& aMediaDeviceInfo);
37 virtual TInt MediaChangeID(TInt aSocket);
38 virtual TInt VccID(TInt aSocket);
42 TInt TMMCardControllerInterfaceWins::Init()
44 // Initialise the Controller h/w
50 TInt TMMCardControllerInterfaceWins::MediaChangeID(TInt aSocket)
52 // Return the socket's media change index
58 TInt TMMCardControllerInterfaceWins::VccID(TInt aSocket)
60 // Return the socket's PSU index
66 static const TInt DriveNumbers[MMC0_DRIVECOUNT]={MMC0_DRIVELIST};
67 _LIT(KLitMmcSocketName,MMC0_DRIVENAME);
68 TBool TMMCardControllerInterfaceWins::IsMMCSocket(TInt aSocket,SMediaDeviceInfo& aMediaDeviceInfo)
70 // Confirm whether an MMC stack is supported on the specified
71 // socket and if it is, the Media Info. for that socket.
77 aMediaDeviceInfo.iDevice=MEDIA_DEVICE_MMC;
78 aMediaDeviceInfo.iDriveCount=MMC0_DRIVECOUNT;
79 aMediaDeviceInfo.iDriveList=&DriveNumbers[0];
80 aMediaDeviceInfo.iNumMedia=MMC0_NUMMEDIA;
81 aMediaDeviceInfo.iDeviceName=&KLitMmcSocketName;
88 DMMCSocket* TMMCardControllerInterfaceWins::NewSocket(TInt aSocketNum, TMMCPasswordStore* aPasswordStore)
90 // Create a new platform-specific socket
93 return new DMMCSocket(aSocketNum, aPasswordStore);
96 DMMCStack* TMMCardControllerInterfaceWins::NewStack(TInt aStackNum, DMMCSocket* aSocket)
98 // Create a new platform-specific stack
101 return new DWinsMMCStack(aStackNum, aSocket);
104 DMMCMediaChange* TMMCardControllerInterfaceWins::NewMediaChange(TInt aMcId)
106 // Create a new platform-specific media change
109 return new DWinsMMCMediaChange(aMcId);
112 DMMCPsu* TMMCardControllerInterfaceWins::NewVcc(TInt aVccNum, TInt aMcId)
114 // Create a new platform-specific PSU
117 return new DWinsMMCPsu(aVccNum, aMcId);
120 DECLARE_STANDARD_EXTENSION()
122 // Extension Entry Point
125 __KTRACE_OPT(KPBUS1,Kern::Printf("Starting MMC interface"));
128 TMMCardControllerInterfaceWins* pI=new TMMCardControllerInterfaceWins;
132 __KTRACE_OPT(KPBUS1,Kern::Printf("Returns %d",r));