kernel/eka/include/drivers/mmc.h
changeset 287 ddfd5aa0d58f
parent 244 a77889bee936
child 291 206a6eaaeb71
equal deleted inserted replaced
286:48e57fb1237e 287:ddfd5aa0d58f
     1 // Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 1999-2010 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     3 // This component and the accompanying materials are made available
     4 // under the terms of the License "Eclipse Public License v1.0"
     4 // under the terms of the License "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
    10 //
    10 //
    11 // Contributors:
    11 // Contributors:
    12 //
    12 //
    13 // Description:
    13 // Description:
    14 // Generic MMC controller types and standard classes for MMC manipulation
    14 // Generic MMC controller types and standard classes for MMC manipulation
    15 // This controller follows MMC spec V2.1
    15 // This controller follows MMC spec V4.4+
    16 // 
    16 // 
    17 //
    17 //
    18 
    18 
    19 /**
    19 /**
    20  @file
    20  @file
    24 #if !defined(__MMC_H__)
    24 #if !defined(__MMC_H__)
    25 #define __MMC_H__
    25 #define __MMC_H__
    26 
    26 
    27 #include <drivers/pbus.h>
    27 #include <drivers/pbus.h>
    28 #include <d32locd.h>
    28 #include <d32locd.h>
       
    29 #include <drivers/rpmbpacket.h>
    29 
    30 
    30 // MMC Card maximum system settings
    31 // MMC Card maximum system settings
    31 
    32 
    32 const TInt KMaxMmcSockets = KMaxPBusSockets;
    33 const TInt KMaxMmcSockets = KMaxPBusSockets;
    33 
    34 
    54 class TMMCMachineInfo;
    55 class TMMCMachineInfo;
    55 class TMapping;
    56 class TMapping;
    56 class TMMCPasswordStore;
    57 class TMMCPasswordStore;
    57 class TMMCEraseInfo;
    58 class TMMCEraseInfo;
    58 class TMMCMachineInfoV4;
    59 class TMMCMachineInfoV4;
       
    60 class TMMCMachineInfoV44;
       
    61 typedef TPckg<TMMCMachineInfo> TMMCardMachineInfoPckg;
    59 typedef TPckg<TMMCMachineInfoV4> TMMCMachineInfoV4Pckg;
    62 typedef TPckg<TMMCMachineInfoV4> TMMCMachineInfoV4Pckg;
       
    63 typedef TPckg<TMMCMachineInfoV44> TMMCMachineInfoV44Pckg;
    60 
    64 
    61 enum TMMCAppCommand {EMMCNormalCmd,EMMCApplicationCmd};
    65 enum TMMCAppCommand {EMMCNormalCmd,EMMCApplicationCmd};
    62 
    66 
    63 // Typedefs
    67 // Typedefs
    64 
    68 
   102 @see KMMCErrAll
   106 @see KMMCErrAll
   103 @see KMMCErrBasic
   107 @see KMMCErrBasic
   104 */
   108 */
   105 typedef TUint32 TMMCErr;
   109 typedef TUint32 TMMCErr;
   106 
   110 
   107 //		MMC Enums and inline functions
   111 /**
   108 
   112 A structure to define global parameters for the initialisation of an RPMB object.
   109 
   113 This is required for devices with emmc4.4+
   110 
   114 @internalComponent
       
   115 */
       
   116 struct TRpmbDeviceParms
       
   117     {
       
   118     DMMCSocket* iSocketPtr;
       
   119     TUint iCardNumber;
       
   120     };
       
   121 
       
   122 /*
       
   123  Global counter for number or RPMB partitions. Only one partition per device 
       
   124  */
       
   125 GLREF_D TUint NumberOfRpmbs;
       
   126 /*
       
   127  Global holder for RPMB parameters
       
   128  */
       
   129 GLREF_D TRpmbDeviceParms TheRpmbs[KMaxPBusSockets*4];
       
   130 
       
   131 GLREF_D TBool RpmbParmsPopulated;
       
   132 
       
   133 /**
       
   134 Max number of RPMB devices
       
   135 */
       
   136 const TUint MaxIndexRpmb = 0;
       
   137 
       
   138 /**
       
   139 MMC Enums and inline functions
       
   140 */
   111 
   141 
   112 /**
   142 /**
   113 @publishedPartner
   143 @publishedPartner
   114 @released
   144 @released
   115 
   145 
   566 	ERespTypeR5,			// 32 bits IRQ
   596 	ERespTypeR5,			// 32 bits IRQ
   567 	ERespTypeR6,
   597 	ERespTypeR6,
   568 	ERespTypeR7				// not currently defined for MMC
   598 	ERespTypeR7				// not currently defined for MMC
   569 	};
   599 	};
   570 
   600 
       
   601 
       
   602 /**
       
   603  * Client InterfaceIDs for GetExtInterface
       
   604  * @publishedPartner
       
   605  * 
       
   606  */
       
   607 enum TMMCExtInterfaceId
       
   608     {
       
   609     KInterfaceRpmb
       
   610     };
       
   611 
       
   612 class MMCMExtInterface
       
   613     {
       
   614 public:
       
   615     virtual TInt Func() = 0;
       
   616     };
       
   617 
       
   618 /**
       
   619 Interface class to return information for an RPMB capable device.
       
   620 Used for emmc v4.4+
       
   621 */
       
   622 
       
   623 class MRpmbInfo
       
   624     {
       
   625 public:
       
   626     virtual inline TInt RpmbInfo(TUint aDeviceIndex, TRpmbDeviceParms& aParams);
       
   627     };
       
   628 
       
   629 /**
       
   630  A generic adapter function for returning an interface of specified type
       
   631  The caller should set aInterfacePtr to NULL before calling
       
   632  @aInterfaceId Denotes the required interface to be returned
       
   633  @aInterfacePtr On completion contains an interface of type specified by aInterfaceId
       
   634  @aThis Extends the interface to provide further access to DMMCSession
       
   635  */
       
   636  
       
   637 IMPORT_C TInt MMCGetExtInterface(TMMCExtInterfaceId aInterfaceId, MMCMExtInterface*& aInterfacePtr, TAny* aThis = NULL);
   571 
   638 
   572 /**
   639 /**
   573 @publishedPartner
   640 @publishedPartner
   574 @released
   641 @released
   575 
   642 
   624 	ECIMWriteIO				 =12,
   691 	ECIMWriteIO				 =12,
   625 	ECIMLockUnlock			 =13,
   692 	ECIMLockUnlock			 =13,
   626 	ECIMLockStack			 =14,
   693 	ECIMLockStack			 =14,
   627 	ECIMInitStackAfterUnlock =15,
   694 	ECIMInitStackAfterUnlock =15,
   628 	ECIMAutoUnlock			 =16,
   695 	ECIMAutoUnlock			 =16,
   629 	ECIMSleep				 =17
   696 	ECIMSleep				 =17,
       
   697     ECIMRpmbAccess           =18
   630 	};
   698 	};
   631 
   699 
   632 const TUint KMMCMaxSessionTypeNumber  = 18;
   700 const TUint KMMCMaxSessionTypeNumber  = 19;
   633 const TUint KMMCMinCustomSession	  = 1024;
   701 const TUint KMMCMinCustomSession	  = 1024;
   634 
   702 
   635 const TUint KMMCCmdDirDirBitPosition=	KBit0;			//fixed - dont change it
   703 const TUint KMMCCmdDirDirBitPosition=	KBit0;			//fixed - dont change it
   636 const TUint KMMCCmdDirIndBitPosition=	(KBit5-KBit0);	//fixed - dont change it
   704 const TUint KMMCCmdDirIndBitPosition=	(KBit5-KBit0);	//fixed - dont change it
   637 const TUint KMMCCmdDirWBitArgument=		KBit5;
   705 const TUint KMMCCmdDirWBitArgument=		KBit5;
   638 const TUint KMMCCmdDirNegate=			KBit6;
   706 const TUint KMMCCmdDirNegate=			KBit6;
   639 const TUint KMMCCmdDirWBitDirect=		KBit7;
   707 const TUint KMMCCmdDirWBitDirect=		KBit7;
   640 
   708 
   641 const TUint KMMCCmdReliableWrite	=	KBit31;
   709 const TUint KMMCCmdReliableWrite	=	KBit31;
   642 
   710 const TUint KMMCCmdTrim             =   KBit0;			//Trim command arg
   643 
   711 
   644 /**
   712 /**
   645 @publishedPartner
   713 @publishedPartner
   646 @released
   714 @released
   647 
   715 
  1461 
  1529 
  1462 class TExtendedCSD
  1530 class TExtendedCSD
  1463 /**
  1531 /**
  1464 	Extended CSD register class.
  1532 	Extended CSD register class.
  1465 	For more information about this register, see the MultimediaCard System 
  1533 	For more information about this register, see the MultimediaCard System 
  1466 	Specification, Version 4.1+
  1534 	Specification, Version 4.4
  1467 
  1535 
  1468 	@publishedPartner
  1536 	@publishedPartner
  1469 	@released
  1537 	@released
  1470 */
  1538 */
  1471 	{
  1539 	{
  1501 		EHighSpeedInterfaceTimingIndex = 185,
  1569 		EHighSpeedInterfaceTimingIndex = 185,
  1502 		/** Offset of the BUS_WIDTH field */
  1570 		/** Offset of the BUS_WIDTH field */
  1503 		EBusWidthModeIndex = 183,
  1571 		EBusWidthModeIndex = 183,
  1504 		/** Offset of the BOOT_CONFIG field */
  1572 		/** Offset of the BOOT_CONFIG field */
  1505 		EBootConfigIndex = 179,
  1573 		EBootConfigIndex = 179,
       
  1574         /** Offset of the BOOT_CONFIG_PROT field */
       
  1575         EBootConfigProtectionIndex = 178,
  1506 		/** Offset of the BOOT_BUS_WIDTH field */
  1576 		/** Offset of the BOOT_BUS_WIDTH field */
  1507 		EBootBusWidthIndex = 177,
  1577 		EBootBusWidthIndex = 177,
  1508 		/** Offset of the ERASE_GROUP_DEF field */
  1578 		/** Offset of the ERASE_GROUP_DEF field */
  1509 		EEraseGroupDefIndex = 175
  1579 		EEraseGroupDefIndex = 175,
       
  1580         /** Offset of the BOOT_WP field */
       
  1581         EBootAreaWriteProtectionIndex = 173,
       
  1582         /** Offset of the USER_WP field */
       
  1583         EUserAreaWriteProtectionIndex = 171,
       
  1584         /** Offset of the FW_CONFIG field */
       
  1585         EFwConfigIndex = 169,
       
  1586         /** Offset of the RST_n_FUNCTION field */
       
  1587         EHardwareResetFunctionIndex = 162,
       
  1588         /** Offset of the PARTITIONS_ATTRIBUTE field */
       
  1589         EPartitionsAttributeIndex = 156,
       
  1590         /** Offset of the PARTITION_SETTING_COMPLETED field */
       
  1591         EPartitionSettingIndex = 155,
       
  1592         /** Offset of the GP_SIZE_MULT field */
       
  1593 
       
  1594 
       
  1595 
  1510 		};
  1596 		};
  1511 
  1597 
  1512 	/** 
  1598 	/** 
  1513 	This enum defines various field offsets into the Properties Segment (i.e.
  1599 	This enum defines various field offsets into the Properties Segment (i.e.
  1514 	the read-only part) of the Extended CSD register.
  1600 	the read-only part) of the Extended CSD register.
  1522 		/** Offset of the ACC_SIZE field */
  1608 		/** Offset of the ACC_SIZE field */
  1523 		EAccessSizeIndex = 225,
  1609 		EAccessSizeIndex = 225,
  1524 		/** Offset of the HC_ERASE_GRP_SIZE field */
  1610 		/** Offset of the HC_ERASE_GRP_SIZE field */
  1525 		EHighCapacityEraseGroupSizeIndex = 224
  1611 		EHighCapacityEraseGroupSizeIndex = 224
  1526 		};
  1612 		};
       
  1613 		
       
  1614 	/**	This enum defines the values for the Extended CSD Revision register	*/
       
  1615 	enum TExtendedCSDRev
       
  1616 		{
       
  1617 		EExtendedCSDRev1_0 = 0,
       
  1618 		EExtendedCSDRev1_1 = 1,
       
  1619 		EExtendedCSDRev1_2 = 2,
       
  1620 		EExtendedCSDRev1_3 = 3,
       
  1621 		EExtendedCSDRev1_4 = 4,
       
  1622 		EExtendedCSDRev1_5 = 5
       
  1623 		};
  1527 
  1624 
  1528 	/** This enum defines the bus width encoding used by the BUS_WIDTH field */
  1625 	/** This enum defines the bus width encoding used by the BUS_WIDTH field */
  1529 	enum TExtCSDBusWidths
  1626 	enum TExtCSDBusWidths
  1530 		{
  1627 		{
  1531 		EExtCsdBusWidth1 = 0x00,
  1628 		EExtCsdBusWidth1 = 0x00,
  1545 		};
  1642 		};
  1546 	
  1643 	
  1547 	/**
  1644 	/**
  1548 	This enum defines the boot config encoding used by the BOOT_CONFIG field
  1645 	This enum defines the boot config encoding used by the BOOT_CONFIG field
  1549 	*/
  1646 	*/
  1550 	enum TExtCSDBootConfig
  1647 	enum TExtCSDBootConfig // in v4.4 this is now called PARTITION_CONFIG
  1551 		{
  1648 		{
  1552 		ESelectUserArea	 				= 0x00,
  1649 		ESelectUserArea	 				= 0x00,
  1553 		ESelectBootPartition1 			= 0x01,
  1650 		ESelectBootPartition1 			= 0x01,
  1554 		ESelectBootPartition2 			= 0x02,
  1651 		ESelectBootPartition2 			= 0x02,
       
  1652 		ESelectRPMB						= 0x03, // R/W Replay Protected Memory Block (RPMB)
       
  1653 		ESelectGPAPartition1			= 0x04, // Access to General Purpose Area partition 1
       
  1654 		ESelectGPAPartition2			= 0x05, // Access to General Purpose Area partition 2
       
  1655 		ESelectGPAPartition3 			= 0x06, // Access to General Purpose Area partition 3
       
  1656 		ESelectGPAPartition4 			= 0x07, // Access to General Purpose Area partition 4		
  1555 		EEnableBootPartition1forBoot 	= 0x08,
  1657 		EEnableBootPartition1forBoot 	= 0x08,
  1556 		EEnableBootPartition2forBoot 	= 0x10,
  1658 		EEnableBootPartition2forBoot 	= 0x10,
  1557 		EEnableUserAreaforBoot			= 0x38,
  1659 		EEnableUserAreaforBoot			= 0x38,
  1558 		EEnableBootAck  				= 0x40
  1660 		EEnableBootAck  				= 0x40,
       
  1661 		EPartitionTestMode              = 0x100 // Indicates test mode for eMMC partitions
  1559 		};
  1662 		};
  1560 
  1663 
  1561 	/**
  1664 	/**
  1562 	This enum defines the Boot Bus Width encoding used by the BOOT_BUS_WIDTH field
  1665 	This enum defines the Boot Bus Width encoding used by the BOOT_BUS_WIDTH field
  1563 	*/
  1666 	*/
  1696 	inline TUint BootInfo() const;
  1799 	inline TUint BootInfo() const;
  1697 	
  1800 	
  1698 	/** returns the contents of the BOOT_SIZE_MUTLI field */
  1801 	/** returns the contents of the BOOT_SIZE_MUTLI field */
  1699 	inline TUint BootSizeMultiple() const;
  1802 	inline TUint BootSizeMultiple() const;
  1700 	
  1803 	
       
  1804 	/** returns the size of the boot partitions in sectors */
       
  1805 	inline TUint32 BootSizeInSectors() const;
       
  1806 	
  1701 	/** returns the contents of the ERASE_TIMEOUT_MULT field */
  1807 	/** returns the contents of the ERASE_TIMEOUT_MULT field */
  1702 	inline TUint EraseTimeoutMultiple() const;
  1808 	inline TUint EraseTimeoutMultiple() const;
  1703 	
  1809 	
  1704 	/** returns the contents of the REL_WR_SEC_C field */
  1810 	/** returns the contents of the REL_WR_SEC_C field */
  1705 	inline TUint ReliableWriteSector() const;
  1811 	inline TUint ReliableWriteSector() const;
  1717 	inline TUint SleepAwakeTimeout() const;
  1823 	inline TUint SleepAwakeTimeout() const;
  1718 	
  1824 	
  1719 	/** returns True if the CARD_TYPE field conatains a valid value **/
  1825 	/** returns True if the CARD_TYPE field conatains a valid value **/
  1720 	inline TBool IsSupportedCardType() const;
  1826 	inline TBool IsSupportedCardType() const;
  1721 
  1827 
       
  1828     /** returns the contents of the ERASED_MEM_CONT field */
       
  1829     inline TUint ErasedMemoryContent() const;
       
  1830 
       
  1831     /** returns the contents of the BOOT_CONFIG_PROT field */
       
  1832     inline TUint BootConfigProt() const;
       
  1833 
       
  1834     /** returns the contents of the BOOT_WP field */
       
  1835     inline TUint BootAreaWriteProtectionReg() const;
       
  1836 
       
  1837     /** returns the contents of the USER_WP field */
       
  1838     inline TUint UserAreaWriteProtectionReg() const;
       
  1839 
       
  1840     /** returns the contents of the FW_CONFIG field */
       
  1841     inline TUint FwConfiguration() const;
       
  1842 
       
  1843     /** returns the RPMB size based on contents of the RPMB_SIZE_MULT field */
       
  1844     inline TUint32 RpmbSize() const;
       
  1845     
       
  1846     /** returns the RPMB size in sectors */
       
  1847     inline TUint32 RpmbSizeInSectors() const;
       
  1848 
       
  1849     /** returns the contents of the RST_n_FUNCTION field */
       
  1850     inline TUint HwResetFunction() const;
       
  1851 
       
  1852     /** returns the contents of the PARTITIONING_SUPPORT field */
       
  1853     inline TUint PartitioningSupport() const;
       
  1854 
       
  1855     /** returns the Max Enhanced Area Size base on the contents of the
       
  1856         MAX_ENH_SIZE_MULT field */
       
  1857     inline TUint32 MaxEnhancedAreaSize() const;
       
  1858 
       
  1859     /** returns the contents of the PARTITIONS_ATTRIBUTE field */
       
  1860     inline TUint PartitionsAttribute() const;
       
  1861 
       
  1862     /** returns the contents of the PARTITION_SETTING_COMPLETED field */
       
  1863     inline TUint PartitioningSetting() const;
       
  1864 
       
  1865     /** returns the General purpose partition sizes based on contents of the
       
  1866         GP_SIZE_MULT fields */
       
  1867     inline TUint64 GeneralPurposePartition1Size() const;
       
  1868     inline TUint64 GeneralPurposePartition2Size() const;
       
  1869     inline TUint64 GeneralPurposePartition3Size() const;
       
  1870     inline TUint64 GeneralPurposePartition4Size() const;
       
  1871     
       
  1872     /** returns the General Purpose Partition sizes in sectors */
       
  1873     inline TUint32 GeneralPurposePartition1SizeInSectors() const;
       
  1874     inline TUint32 GeneralPurposePartition2SizeInSectors() const;
       
  1875     inline TUint32 GeneralPurposePartition3SizeInSectors() const;
       
  1876     inline TUint32 GeneralPurposePartition4SizeInSectors() const;
       
  1877 
       
  1878     /** returns the Enhanced User Data Area Size based on thec contents of the
       
  1879         ENH_SIZE_MULT fields */
       
  1880     inline TUint64 EnhancedUserDataAreaSize() const;
       
  1881 
       
  1882     /** returns the Enhanced User Data Start Address based on the contents of
       
  1883         the ENH_START_ADDR fields */
       
  1884     inline TUint32 EnhancedUserDataStartAddress() const;
       
  1885 
       
  1886     /** returns the contents of the SEC_BAD_BLK_MGMNT field */
       
  1887     inline TUint BadBlockManagementMode() const;
       
  1888 
  1722 private:
  1889 private:
       
  1890     inline TUint64 PartitionSize(TUint8 aMult0, TUint8 aMult1, TUint8 aMult2, TUint32 aMultiplier) const;
       
  1891 
  1723 	/** 
  1892 	/** 
  1724 	@internalComponent little endian 512 byte field representing extended CSD	
  1893 	@internalComponent little endian 512 byte field representing extended CSD	
  1725 	*/
  1894 	*/
  1726 	TUint8 iData[KMMCExtendedCSDLength];
  1895 	TUint8 iData[KMMCExtendedCSDLength];
  1727 	};
  1896 	};
  1728 
  1897 
       
  1898 const TInt KMMCSelectPartitionMask		= KBit0 | KBit1 | KBit2;
  1729 
  1899 
  1730 //	32 bit MMC card status field (response R1)
  1900 //	32 bit MMC card status field (response R1)
  1731 
  1901 
  1732 const TUint32 KMMCStatAppCmd=			KBit5;
  1902 const TUint32 KMMCStatAppCmd=			KBit5;
  1733 const TUint32 KMMCStatSwitchError=		KBit7;
  1903 const TUint32 KMMCStatSwitchError=		KBit7;
  1752 const TUint32 KMMCStatErrBlockLenError=	KBit29;
  1922 const TUint32 KMMCStatErrBlockLenError=	KBit29;
  1753 const TUint32 KMMCStatErrAddressError=	KBit30;
  1923 const TUint32 KMMCStatErrAddressError=	KBit30;
  1754 const TUint32 KMMCStatErrOutOfRange=	KBit31;
  1924 const TUint32 KMMCStatErrOutOfRange=	KBit31;
  1755 
  1925 
  1756 const TUint32 KMMCStatErrorMask=		KMMCStatErrOutOfRange	|
  1926 const TUint32 KMMCStatErrorMask=		KMMCStatErrOutOfRange	|
       
  1927 										KMMCStatSwitchError		|
  1757 										KMMCStatErrAddressError	|
  1928 										KMMCStatErrAddressError	|
  1758 										KMMCStatErrBlockLenError|
  1929 										KMMCStatErrBlockLenError|
  1759 										KMMCStatErrEraseSeqError|
  1930 										KMMCStatErrEraseSeqError|
  1760 										KMMCStatErrEraseParam	|
  1931 										KMMCStatErrEraseParam	|
  1761 										KMMCStatErrWPViolation	|
  1932 										KMMCStatErrWPViolation	|
  2111 const TUint32 KMMCCmdFlagBlockAddress=	KBit5;	// Block addressing mode
  2282 const TUint32 KMMCCmdFlagBlockAddress=	KBit5;	// Block addressing mode
  2112 const TUint32 KMMCCmdFlagDMARamValid=   KBit6;  // Memory is DMA'able flag
  2283 const TUint32 KMMCCmdFlagDMARamValid=   KBit6;  // Memory is DMA'able flag
  2113 const TUint32 KMMCCmdFlagDoubleBuffer=  KBit7;  // The current DT command is double-buffered
  2284 const TUint32 KMMCCmdFlagDoubleBuffer=  KBit7;  // The current DT command is double-buffered
  2114 const TUint32 KMMCCmdFlagPhysAddr=		KBit8;  // Address is a physical address
  2285 const TUint32 KMMCCmdFlagPhysAddr=		KBit8;  // Address is a physical address
  2115 const TUint32 KMMCCmdFlagReliableWrite=	KBit9;  // Current command is Reliable Write
  2286 const TUint32 KMMCCmdFlagReliableWrite=	KBit9;  // Current command is Reliable Write
       
  2287 const TUint32 KMMCCmdFlagDeleteNotify=  KBit10; // Current command is Delete Notify
       
  2288 const TUint32 KMMCCmdFlagRpmbIO=        KBit11; // Current command is of RPMB type
  2116 
  2289 
  2117 const TUint32 KMMCCmdFlagASSPFlags=	KMMCCmdFlagBytesValid	|
  2290 const TUint32 KMMCCmdFlagASSPFlags=	KMMCCmdFlagBytesValid	|
  2118 									KMMCCmdFlagTransStopped	|
  2291 									KMMCCmdFlagTransStopped	|
  2119 									KMMCCmdFlagStatusReceived;
  2292 									KMMCCmdFlagStatusReceived;
  2120 
  2293 
  2946 	// Data transfer macros setup (block mode)
  3119 	// Data transfer macros setup (block mode)
  2947 	inline void SetupCIMReadBlock(TMMCArgument aBlockAddr, TUint8* aMemoryP, TUint32 aBlocks = 1);
  3120 	inline void SetupCIMReadBlock(TMMCArgument aBlockAddr, TUint8* aMemoryP, TUint32 aBlocks = 1);
  2948 	inline void SetupCIMWriteBlock(TMMCArgument aBlockAddr, TUint8* aMemoryP, TUint32 aBlocks = 1);
  3121 	inline void SetupCIMWriteBlock(TMMCArgument aBlockAddr, TUint8* aMemoryP, TUint32 aBlocks = 1);
  2949 	inline void SetupCIMEraseMSector(TMMCArgument aBlockAddr, TUint32 aBlocks = 1);
  3122 	inline void SetupCIMEraseMSector(TMMCArgument aBlockAddr, TUint32 aBlocks = 1);
  2950 	inline void SetupCIMEraseMGroup(TMMCArgument aBlockAddr, TUint32 aBlocks = 1);
  3123 	inline void SetupCIMEraseMGroup(TMMCArgument aBlockAddr, TUint32 aBlocks = 1);
       
  3124 	
       
  3125 	// RPMB access macros setup
       
  3126 	inline void SetupRpmbSendRequest(TBool aSetReliableWrite);
       
  3127     inline void SetupRpmbReceiveResponse();
       
  3128     inline void SetupRpmbSendReadResultRegisterRequest();
  2951 		
  3129 		
  2952 	// Raw commands (must be used in the locked bus state only)
  3130 	// Raw commands (must be used in the locked bus state only)
  2953 	// Known commands with or without (with a default) argument
  3131 	// Known commands with or without (with a default) argument
  2954 	IMPORT_C void SetupCommand(TMMCCommandEnum aCommand, TMMCArgument anArgument=0);
  3132 	IMPORT_C void SetupCommand(TMMCCommandEnum aCommand, TMMCArgument anArgument=0);
  2955 
  3133 
  3006 	IMPORT_C void FillCommandArgs(TMMCArgument anArgument, TUint32 aLength, TUint8* aMemoryP, TUint32 aBlkLen);
  3184 	IMPORT_C void FillCommandArgs(TMMCArgument anArgument, TUint32 aLength, TUint8* aMemoryP, TUint32 aBlkLen);
  3007 	inline TMMCCommandDesc& Command();	// The current command descriptor
  3185 	inline TMMCCommandDesc& Command();	// The current command descriptor
  3008 	
  3186 	
  3009 	inline void PushCommandStack();
  3187 	inline void PushCommandStack();
  3010 	inline void PopCommandStack();
  3188 	inline void PopCommandStack();
       
  3189 	
       
  3190 	inline void SetPartition(TInt aPartition);
       
  3191 	inline TInt Partition() const;
  3011 
  3192 
  3012 	// Methods for double-buffered data transfer:
  3193 	// Methods for double-buffered data transfer:
  3013 	inline TBool RequestMoreData();
  3194 	inline TBool RequestMoreData();
  3014 	inline void EnableDoubleBuffering(TUint32 aNumBlocks);							  /**< @internalTechnology */
  3195 	inline void EnableDoubleBuffering(TUint32 aNumBlocks);							  /**< @internalTechnology */
  3015 	inline void SetDataTransferCallback(TMMCCallBack& aCallback);					  /**< @internalTechnology */
  3196 	inline void SetDataTransferCallback(TMMCCallBack& aCallback);					  /**< @internalTechnology */
  3059 	
  3240 	
  3060 	TMMCCommandDesc iCommand[KMaxMMCCommandStackDepth];	// Command stack
  3241 	TMMCCommandDesc iCommand[KMaxMMCCommandStackDepth];	// Command stack
  3061 	
  3242 	
  3062 	TMMCCallBack iDataTransferCallback;	// A callback function, used to request more data when performing double-buffering
  3243 	TMMCCallBack iDataTransferCallback;	// A callback function, used to request more data when performing double-buffering
  3063 
  3244 
  3064 	TUint32 iSpare[21];				// Spare data (stolen from iCommand)
  3245 	TUint32 iSpare[20];					// Spare data (stolen from iCommand)
  3065 
  3246 	
       
  3247 	TUint32 iPartition;					// The targetted partition
       
  3248 	
  3066 	TMMCard* iSavedCardP;			// Saved copy of iCardP
  3249 	TMMCard* iSavedCardP;			// Saved copy of iCardP
  3067 
  3250 
  3068 	TMMCStateMachine iMachine;		// State Machine context
  3251 	TMMCStateMachine iMachine;		// State Machine context
  3069 #ifdef __EPOC32__
  3252 #ifdef __EPOC32__
  3070 	NTimer iPollTimer;
  3253 	NTimer iPollTimer;
  3494 	inline   TMMCErr RetryGapTimerSM();
  3677 	inline   TMMCErr RetryGapTimerSM();
  3495 	static   TMMCErr ProgramTimerSMST(TAny *aStackP);
  3678 	static   TMMCErr ProgramTimerSMST(TAny *aStackP);
  3496 	inline   TMMCErr ProgramTimerSM();
  3679 	inline   TMMCErr ProgramTimerSM();
  3497 	static   TMMCErr GoIdleSMST(TAny* aStackP);
  3680 	static   TMMCErr GoIdleSMST(TAny* aStackP);
  3498 	inline	 TMMCErr GoIdleSM();
  3681 	inline	 TMMCErr GoIdleSM();
       
  3682 	static   TMMCErr SwitchPartitionSMST(TAny* aStackP);
       
  3683 	inline	 TMMCErr SwitchPartitionSM();
  3499 
  3684 
  3500 	static   TMMCErr SwitchToLowVoltageSMST(TAny* aStackP);
  3685 	static   TMMCErr SwitchToLowVoltageSMST(TAny* aStackP);
  3501 	
  3686 	
  3502 	static   TMMCErr DoWakeUpSMST(TAny* aStackP);
  3687 	static   TMMCErr DoWakeUpSMST(TAny* aStackP);
  3503 	
  3688 	
  3521 	static   TMMCErr LowVoltagePowerupTimerSMST(TAny *aStackP);
  3706 	static   TMMCErr LowVoltagePowerupTimerSMST(TAny *aStackP);
  3522 	TMMCErr LowVoltagePowerupTimerSM();
  3707 	TMMCErr LowVoltagePowerupTimerSM();
  3523 
  3708 
  3524 	static   TMMCErr ExecBusTestSMST(TAny* aStackP);
  3709 	static   TMMCErr ExecBusTestSMST(TAny* aStackP);
  3525 	inline	 TMMCErr ExecBusTestSM();
  3710 	inline	 TMMCErr ExecBusTestSM();
       
  3711 
       
  3712 	static TMMCErr CIMRpmbAccessSMST(TAny* aStackP);
       
  3713     TMMCErr CIMRpmbAccessSM();
       
  3714 
       
  3715 	static TMMCErr  CIMRpmbWriteAuthenticationKeySMST(TAny* aStackP);
       
  3716     TMMCErr CIMRpmbWriteAuthenticationKeySM();
       
  3717 
       
  3718 	static TMMCErr CIMRpmbReadWrCounterSMST(TAny* aStackP);
       
  3719     TMMCErr CIMRpmbReadWrCounterSM();
       
  3720 
       
  3721 	static TMMCErr CIMRpmbWriteSMST(TAny* aStackP);
       
  3722     TMMCErr CIMRpmbWriteSM();
       
  3723 
       
  3724 	static TMMCErr CIMRpmbReadSMST(TAny* aStackP);
       
  3725     TMMCErr CIMRpmbReadSM();
  3526 
  3726 
  3527 	enum TBusWidthAndClock
  3727 	enum TBusWidthAndClock
  3528 		{
  3728 		{
  3529 		E1Bit20Mhz  = 0x0000,
  3729 		E1Bit20Mhz  = 0x0000,
  3530 
  3730 
  3614 	TMMCStackConfig iMasterConfig;
  3814 	TMMCStackConfig iMasterConfig;
  3615 	friend class DMMCSocket;
  3815 	friend class DMMCSocket;
  3616 	friend class DMMCSession;
  3816 	friend class DMMCSession;
  3617 	friend class TMMCardArray;
  3817 	friend class TMMCardArray;
  3618 
  3818 
  3619 private:
       
  3620     //
       
  3621     // Dummy functions to maintain binary compatibility
       
  3622     IMPORT_C virtual void Dummy1();
       
  3623 
       
  3624 protected:
  3819 protected:
  3625 	/** 
  3820 	/** 
  3626 	Gets an interface from a derived class
  3821 	Gets an interface from a derived class
  3627 	N.B the derived class should call the base class's default implementation of this function
  3822 	N.B the derived class should call the base class's default implementation of this function
  3628 	if it does not support the specified interface
  3823 	if it does not support the specified interface
  3649 	DBody* iBody;
  3844 	DBody* iBody;
  3650 	};
  3845 	};
  3651 
  3846 
  3652 
  3847 
  3653 
  3848 
  3654 
       
  3655 class TMMCMachineInfo
  3849 class TMMCMachineInfo
       
  3850 
  3656 /**
  3851 /**
  3657 	Platform-specific configuration information for the 
  3852 	Platform-specific configuration information for the 
  3658 	MultiMediaCard stack.
  3853 	MultiMediaCard stack.
  3659 	
  3854 	
  3660 	An object of this type is passed to the Variant implementation
  3855 	An object of this type is passed to the Variant implementation
  3812     TInt iBaseBusNumber;
  4007     TInt iBaseBusNumber;
  3813 	};
  4008 	};
  3814 
  4009 
  3815 
  4010 
  3816 
  4011 
  3817 
       
  3818 typedef TPckg<TMMCMachineInfo> TMMCardMachineInfoPckg;
       
  3819 
       
  3820 /**
  4012 /**
  3821 	Platform-specific configuration information for the 
  4013 	Platform-specific configuration information for the 
  3822 	MultiMediaCard stack. Contains information pertinent to 
  4014 	MultiMediaCard stack. Contains information pertinent to 
  3823 	MMC specification version 4.0/4.1
  4015 	MMC specification version 4.0/4.1
  3824 	
  4016 	
  3869 	register. i.e. 0=65mA, 1=70mA, ... 10=250mA.
  4061 	register. i.e. 0=65mA, 1=70mA, ... 10=250mA.
  3870 	See MMC sepcification version 4.1, EXT_CSD register.
  4062 	See MMC sepcification version 4.1, EXT_CSD register.
  3871     */
  4063     */
  3872 	enum TLoVoltagePowerClasses {ELo065mA, ELo070mA, ELo080mA, ELo090mA, ELo100mA, ELo120mA, ELo140mA, ELo160mA, ELo180mA, ELo200mA, ELo250mA };
  4064 	enum TLoVoltagePowerClasses {ELo065mA, ELo070mA, ELo080mA, ELo090mA, ELo100mA, ELo120mA, ELo140mA, ELo160mA, ELo180mA, ELo200mA, ELo250mA };
  3873 	TUint iLowVoltagePowerClass;
  4065 	TUint iLowVoltagePowerClass;
       
  4066 	};
       
  4067 
       
  4068 
       
  4069 
       
  4070 /**
       
  4071 	Platform-specific configuration information for the 
       
  4072 	MultiMediaCard stack. Contains information pertinent to 
       
  4073 	MMC specification version 4.4
       
  4074 	
       
  4075 	An object of this type is passed to the Variant implementation
       
  4076 	of DMMCStack::MachineInfo(), which should fill the public data
       
  4077 	members with appropriate information and values.
       
  4078 
       
  4079 @internalComponent
       
  4080 */
       
  4081 class TMMCMachineInfoV44 : public TMMCMachineInfoV4
       
  4082 	{
       
  4083 public:
       
  4084 	inline TMMCMachineInfoV44() {memclr(this, sizeof(*this));}
       
  4085 
       
  4086 	/**
       
  4087 	The version of the structure returned by the PSL in a call to 
       
  4088 	DMMStack::MachineInfo()
       
  4089 	The fields defined in TMMCMachineInfoV44 are only valid if the 
       
  4090 	version is EVersion44 or higher
       
  4091 	*/
       
  4092 	enum TVersion {EVersion3, EVersion4, EVersion44};
       
  4093 
       
  4094     /**
       
  4095     Use iRpmbSlotCount and iRpmbSlotList to define a list of up to
       
  4096 	four slots for devices containing an RPMB partitions to be 
       
  4097 	exposed
       
  4098     */
       
  4099 	TUint iRpmbSlotCount;
       
  4100 	TUint * iRpmbSlotList;
       
  4101 	
       
  4102 	TUint8 iSpare[14];
  3874 	};
  4103 	};
  3875 
  4104 
  3876 
  4105 
  3877 class DMMCPsu : public DPBusPsuBase 
  4106 class DMMCPsu : public DPBusPsuBase 
  3878 /**
  4107 /**
  4128 		EMMCInvalidDBBlockLength		=17,
  4357 		EMMCInvalidDBBlockLength		=17,
  4129 		EMMCUnblockingInWrongContext	=18,
  4358 		EMMCUnblockingInWrongContext	=18,
  4130 		EMMCInvalidCardNumber			=19,
  4359 		EMMCInvalidCardNumber			=19,
  4131 		EMMCNotInDfcContext				=20,
  4360 		EMMCNotInDfcContext				=20,
  4132 		EMMCAddressCardNotSupported		=21,
  4361 		EMMCAddressCardNotSupported		=21,
       
  4362 		EMMCInvalidPartitionNumber      =22
  4133 		};
  4363 		};
  4134     IMPORT_C static void Panic(TMMCPanic aPanic);
  4364     IMPORT_C static void Panic(TMMCPanic aPanic);
  4135 	friend class DMMCStack;
  4365 	friend class DMMCStack;
  4136 	friend class DMMCSession;
  4366 	friend class DMMCSession;
  4137 	friend class DMMCMediaChange;
  4367 	friend class DMMCMediaChange;