os/boardsupport/emulator/emulatorbsp/specific/sdcard/sdcard3c/pp_sdcv.cpp
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
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".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 // wins\specific\pp_scdv.cpp
    15 // WINS variant
    16 // 
    17 //
    18 
    19 #include <mmccd_ifc.h>
    20 #include "pp_sdc.h"
    21 #include <variantmediadef.h>
    22 
    23 class TSDCardControllerInterfaceWins : public TMMCardControllerInterface
    24 	{
    25 	// Factory functions
    26 	virtual DMMCSocket* NewSocket(TInt aSocketNum, TMMCPasswordStore* aPasswordStore);
    27 	virtual DMMCStack* NewStack(TInt aStackNum, DMMCSocket* aSocket);
    28 	virtual DMMCMediaChange* NewMediaChange(TInt aMcId);
    29 	virtual DMMCPsu* NewVcc(TInt aVccNum, TInt aMcId);
    30 	// Stack initialisation
    31 	virtual TInt Init();
    32 	// Machine configuration
    33 	virtual TBool IsMMCSocket(TInt aSocket,SMediaDeviceInfo& aMediaDeviceInfo);
    34 	virtual TInt  MediaChangeID(TInt aSocket);
    35 	virtual TInt  VccID(TInt aSocket);
    36     };
    37 
    38 
    39 TInt TSDCardControllerInterfaceWins::Init()
    40 //
    41 // Initialise the Controller h/w
    42 // 
    43 	{
    44 	return KErrNone;
    45 	}
    46 
    47 TInt TSDCardControllerInterfaceWins::MediaChangeID(TInt aSocket)
    48 //
    49 // Return the socket's media change index
    50 //
    51 	{
    52 	return aSocket;
    53 	}
    54 
    55 TInt TSDCardControllerInterfaceWins::VccID(TInt aSocket)
    56 //
    57 // Return the socket's PSU index
    58 //
    59 	{
    60 	return aSocket;
    61 	}
    62 
    63 static const TInt DriveNumbers[MMC0_DRIVECOUNT]={MMC0_DRIVELIST};
    64 _LIT(KLitMmcSocketName,MMC0_DRIVENAME);
    65 TBool TSDCardControllerInterfaceWins::IsMMCSocket(TInt aSocket,SMediaDeviceInfo& aMediaDeviceInfo)
    66 //
    67 // Confirm whether an MMC stack is supported on the specified
    68 // socket and if it is, the Media Info. for that socket.
    69 //
    70 	{
    71 	
    72 	if (aSocket==0)
    73 		{
    74 		aMediaDeviceInfo.iDevice=MEDIA_DEVICE_MMC;
    75 		aMediaDeviceInfo.iDriveCount=MMC0_DRIVECOUNT;
    76 		aMediaDeviceInfo.iDriveList=&DriveNumbers[0];
    77 		aMediaDeviceInfo.iNumMedia=MMC0_NUMMEDIA;
    78 		aMediaDeviceInfo.iDeviceName=&KLitMmcSocketName;
    79 		return(ETrue);
    80 		}
    81 	else
    82 		return(EFalse);	
    83 	}
    84 
    85 DMMCSocket* TSDCardControllerInterfaceWins::NewSocket(TInt aSocketNum, TMMCPasswordStore* aPasswordStore)
    86 //
    87 // Create a new platform-specific socket
    88 //
    89 	{
    90 	return new DMMCSocket(aSocketNum, aPasswordStore);
    91 	}
    92 
    93 DMMCStack* TSDCardControllerInterfaceWins::NewStack(TInt aStackNum, DMMCSocket* aSocket)
    94 //
    95 // Create a new platform-specific stack
    96 //
    97 	{
    98 	return new DWinsSDStack(aStackNum, aSocket);
    99 	}
   100 
   101 DMMCMediaChange* TSDCardControllerInterfaceWins::NewMediaChange(TInt aMcId)
   102 //
   103 // Create a new platform-specific media change
   104 //
   105 	{
   106 	return new DWinsMMCMediaChange(aMcId);
   107 	}
   108 
   109 DMMCPsu* TSDCardControllerInterfaceWins::NewVcc(TInt aVccNum, TInt aMcId)
   110 //
   111 // Create a new platform-specific PSU
   112 //
   113 	{
   114 	return new DWinsMMCPsu(aVccNum, aMcId);
   115 	}
   116 
   117 /********************************************
   118  * Extension entry point
   119  ********************************************/
   120 
   121 DECLARE_STANDARD_EXTENSION()
   122 	{
   123 	__KTRACE_OPT(KPBUS1,Kern::Printf("Starting SD interface"));
   124 	TInt r=KErrNoMemory;
   125 	
   126 	TSDCardControllerInterfaceWins* pI=new TSDCardControllerInterfaceWins;
   127 	if (pI)
   128 		r=pI->Create();
   129 
   130 	__KTRACE_OPT(KPBUS1,Kern::Printf("Returns %d",r));
   131 	return r;
   132 	}
   133