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