emulator/emulatorbsp/specific/mmcv.cpp
changeset 0 cec860690d41
equal deleted inserted replaced
-1:000000000000 0:cec860690d41
       
     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".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // wins\specific\mmcv.cpp
       
    15 // WINS variant
       
    16 // 
       
    17 //
       
    18 
       
    19 #include <mmccd_ifc.h>
       
    20 #include "mmci.h"
       
    21 #include "variantmediadef.h"
       
    22 
       
    23 //
       
    24 // Factory class for creation of platform specifics
       
    25 //
       
    26 class TMMCardControllerInterfaceWins : public TMMCardControllerInterface
       
    27 	{
       
    28 	// Factory functions
       
    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
       
    34 	virtual TInt Init();
       
    35 	// Machine configuration
       
    36 	virtual TBool IsMMCSocket(TInt aSocket,SMediaDeviceInfo& aMediaDeviceInfo);
       
    37 	virtual TInt  MediaChangeID(TInt aSocket);
       
    38 	virtual TInt  VccID(TInt aSocket);
       
    39     };
       
    40 
       
    41 
       
    42 TInt TMMCardControllerInterfaceWins::Init()
       
    43 //
       
    44 // Initialise the Controller h/w
       
    45 // 
       
    46 	{
       
    47 	return KErrNone;
       
    48 	}
       
    49 
       
    50 TInt TMMCardControllerInterfaceWins::MediaChangeID(TInt aSocket)
       
    51 //
       
    52 // Return the socket's media change index
       
    53 //
       
    54 	{
       
    55 	return aSocket;
       
    56 	}
       
    57 
       
    58 TInt TMMCardControllerInterfaceWins::VccID(TInt aSocket)
       
    59 //
       
    60 // Return the socket's PSU index
       
    61 //
       
    62 	{
       
    63 	return aSocket;
       
    64 	}
       
    65 
       
    66 static const TInt DriveNumbers[MMC0_DRIVECOUNT]={MMC0_DRIVELIST};
       
    67 _LIT(KLitMmcSocketName,MMC0_DRIVENAME);
       
    68 TBool TMMCardControllerInterfaceWins::IsMMCSocket(TInt aSocket,SMediaDeviceInfo& aMediaDeviceInfo)
       
    69 //
       
    70 // Confirm whether an MMC stack is supported on the specified
       
    71 // socket and if it is, the Media Info. for that socket.
       
    72 //
       
    73 	{
       
    74 	
       
    75 	if (aSocket==0)
       
    76 		{
       
    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;
       
    82 		return(ETrue);
       
    83 		}
       
    84 	else
       
    85 		return(EFalse);	
       
    86 	}
       
    87 
       
    88 DMMCSocket* TMMCardControllerInterfaceWins::NewSocket(TInt aSocketNum, TMMCPasswordStore* aPasswordStore)
       
    89 //
       
    90 // Create a new platform-specific socket
       
    91 //
       
    92 	{
       
    93 	return new DMMCSocket(aSocketNum, aPasswordStore);
       
    94 	}
       
    95 
       
    96 DMMCStack* TMMCardControllerInterfaceWins::NewStack(TInt aStackNum, DMMCSocket* aSocket)
       
    97 //
       
    98 // Create a new platform-specific stack
       
    99 //
       
   100 	{
       
   101 	return new DWinsMMCStack(aStackNum, aSocket);
       
   102 	}
       
   103 
       
   104 DMMCMediaChange* TMMCardControllerInterfaceWins::NewMediaChange(TInt aMcId)
       
   105 //
       
   106 // Create a new platform-specific media change
       
   107 //
       
   108 	{
       
   109 	return new DWinsMMCMediaChange(aMcId);
       
   110 	}
       
   111 
       
   112 DMMCPsu* TMMCardControllerInterfaceWins::NewVcc(TInt aVccNum, TInt aMcId)
       
   113 //
       
   114 // Create a new platform-specific PSU
       
   115 //
       
   116 	{
       
   117 	return new DWinsMMCPsu(aVccNum, aMcId);
       
   118 	}
       
   119 
       
   120 DECLARE_STANDARD_EXTENSION()
       
   121 //
       
   122 // Extension Entry Point
       
   123 //
       
   124 	{
       
   125 	__KTRACE_OPT(KPBUS1,Kern::Printf("Starting MMC interface"));
       
   126 
       
   127 	TInt r=KErrNoMemory;
       
   128 	TMMCardControllerInterfaceWins* pI=new TMMCardControllerInterfaceWins;
       
   129 	if (pI)
       
   130 		r=pI->Create();
       
   131 
       
   132 	__KTRACE_OPT(KPBUS1,Kern::Printf("Returns %d",r));
       
   133 	return r;
       
   134 	}
       
   135