kernel/eka/drivers/pbus/mmc/sdcard/sdcard3c/sdcard.cpp
changeset 140 2ac1c5c27758
parent 90 947f0dc9f7a8
child 244 a77889bee936
equal deleted inserted replaced
135:5e441a173c63 140:2ac1c5c27758
     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".
    25 
    25 
    26 
    26 
    27 // ======== TSDCard ========
    27 // ======== TSDCard ========
    28 
    28 
    29 TSDCard::TSDCard()
    29 TSDCard::TSDCard()
    30 :	iProtectedAreaSize(0), iPARootDirEnd(KPARootDirEndUnknown)
    30 :	iProtectedAreaSize(0), iPARootDirEnd(KPARootDirEndUnknown), iClientCountSD(0)
    31 	{
    31 	{
    32 	// empty
    32 	// empty
    33 	}
    33 	}
    34 
    34 
    35 TInt64 TSDCard::DeviceSize64() const
    35 TInt64 TSDCard::DeviceSize64() const
   479 		AddressCard(iCxCardCount); 	// Address the next card
   479 		AddressCard(iCxCardCount); 	// Address the next card
   480 
   480 
   481 		// Before issueing commands, see if there's actually a card present
   481 		// Before issueing commands, see if there's actually a card present
   482 		if (!CardDetect(iCxCardCount))
   482 		if (!CardDetect(iCxCardCount))
   483 			SMF_GOTOS(EStMoreCardsCheck)
   483 			SMF_GOTOS(EStMoreCardsCheck)
       
   484 		
       
   485 		// Card Previously Marked as Corrupt do not re-initialise	
       
   486 		if ((CardArray().CardP(iCxCardCount)->iFlags)& KSDCardIsCorrupt)
       
   487 		    {
       
   488             SMF_GOTOS(EStMoreCardsCheck)
       
   489 		    }
   484 
   490 
   485 		m.SetTraps(KMMCErrResponseTimeOut);
   491 		m.SetTraps(KMMCErrResponseTimeOut);
   486 		SMF_INVOKES(InitialiseMemoryCardSMST, EStSendCIDIssued)
   492 		SMF_INVOKES(InitialiseMemoryCardSMST, EStSendCIDIssued)
   487 
   493 
   488 	SMF_STATE(EStSendCIDIssued)
   494 	SMF_STATE(EStSendCIDIssued)
   812 				// Card is still busy powering up. Check if we should timeout
   818 				// Card is still busy powering up. Check if we should timeout
   813 				if ( ++iCxPollRetryCount > iConfig.OpCondBusyTimeout() )
   819 				if ( ++iCxPollRetryCount > iConfig.OpCondBusyTimeout() )
   814 					{
   820 					{
   815 					__KTRACE_OPT2(KPBUS1, KPANIC, Kern::Printf("-sd:ocr busy timed out"));
   821 					__KTRACE_OPT2(KPBUS1, KPANIC, Kern::Printf("-sd:ocr busy timed out"));
   816 					OstTraceFunctionExitExt( DSDSTACK_INITIALISEMEMORYCARDSM_EXIT2, this, (TInt) KMMCErrBusTimeOut );
   822 					OstTraceFunctionExitExt( DSDSTACK_INITIALISEMEMORYCARDSM_EXIT2, this, (TInt) KMMCErrBusTimeOut );
       
   823 					(CardArray().CardP(iCxCardCount)->iFlags)|=KSDCardIsCorrupt;
   817 					return KMMCErrBusTimeOut;
   824 					return KMMCErrBusTimeOut;
   818 					}
   825 					}
   819 					
   826 					
   820 #ifdef _DEBUG
   827 #ifdef _DEBUG
   821 				if ( iCxPollRetryCount > KMMCSpecOpCondBusyTimeout )
   828 				if ( iCxPollRetryCount > KMMCSpecOpCondBusyTimeout )