3076 if( (TUint32(s.iCardP->iStatus) & KMMCStatClearByReadMask) == 0 || |
3076 if( (TUint32(s.iCardP->iStatus) & KMMCStatClearByReadMask) == 0 || |
3077 s.iCardP->iLastCommand == ECmdSendStatus || |
3077 s.iCardP->iLastCommand == ECmdSendStatus || |
3078 s.iSessionID == ECIMNakedSession ) |
3078 s.iSessionID == ECIMNakedSession ) |
3079 SMF_EXIT |
3079 SMF_EXIT |
3080 |
3080 |
3081 s.PushCommandStack(); |
3081 CurrentSessPushCmdStack(); |
3082 s.FillCommandDesc( ECmdSendStatus, 0 ); |
3082 s.FillCommandDesc( ECmdSendStatus, 0 ); |
3083 m.SetTraps( KMMCErrBasic ); // to restore command stack position to its original level |
3083 m.SetTraps( KMMCErrBasic ); // to restore command stack position to its original level |
3084 SMF_INVOKES( ExecCommandSMST, EStAttStatus ) |
3084 SMF_INVOKES( ExecCommandSMST, EStAttStatus ) |
3085 |
3085 |
3086 SMF_STATE(EStAttStatus) |
3086 SMF_STATE(EStAttStatus) |
3087 |
3087 |
3088 OstTrace0( TRACE_INTERNALS, DMMCSTACK_ATTACHCARDSM3, "EStAttStatus" ); |
3088 OstTrace0( TRACE_INTERNALS, DMMCSTACK_ATTACHCARDSM3, "EStAttStatus" ); |
3089 s.PopCommandStack(); |
3089 CurrentSessPopCmdStack(); |
3090 OstTraceFunctionExitExt( DMMCSTACK_ATTACHCARDSM_EXIT3, this, (TInt) err ); |
3090 OstTraceFunctionExitExt( DMMCSTACK_ATTACHCARDSM_EXIT3, this, (TInt) err ); |
3091 SMF_RETURN( err ) |
3091 SMF_RETURN( err ) |
3092 |
3092 |
3093 SMF_END |
3093 SMF_END |
3094 } |
3094 } |
3356 if (s.CardP()->CSD().SpecVers() < 4) |
3356 if (s.CardP()->CSD().SpecVers() < 4) |
3357 SMF_GOTOS(EStTestNextCard); |
3357 SMF_GOTOS(EStTestNextCard); |
3358 |
3358 |
3359 m.SetTraps(KMMCErrResponseTimeOut | KMMCErrStatus | KMMCErrDataCRC | KMMCErrBypass); // KMMCErrDataCRC will pick up if the card is not in 1-bit mode |
3359 m.SetTraps(KMMCErrResponseTimeOut | KMMCErrStatus | KMMCErrDataCRC | KMMCErrBypass); // KMMCErrDataCRC will pick up if the card is not in 1-bit mode |
3360 |
3360 |
3361 s.FillCommandDesc(ECmdSendExtendedCSD); |
3361 CurrentSessFillCmdDesc(ECmdSendExtendedCSD); |
3362 s.FillCommandArgs(0, KMMCExtendedCSDLength, iPSLBuf, KMMCExtendedCSDLength); |
3362 CurrentSessFillCmdArgs(0, KMMCExtendedCSDLength, iPSLBuf, KMMCExtendedCSDLength); |
3363 |
3363 |
3364 __KTRACE_OPT(KPBUS1, Kern::Printf(">ConfigureHighSpeed(), Sending ECmdSendExtendedCSD")); |
3364 __KTRACE_OPT(KPBUS1, Kern::Printf(">ConfigureHighSpeed(), Sending ECmdSendExtendedCSD")); |
3365 SMF_INVOKES(CIMReadWriteBlocksSMST, EStGotExtendedCSD) |
3365 SMF_INVOKES(CIMReadWriteBlocksSMST, EStGotExtendedCSD) |
3366 |
3366 |
3367 SMF_STATE(EStGotExtendedCSD) |
3367 SMF_STATE(EStGotExtendedCSD) |
3813 } |
3813 } |
3814 |
3814 |
3815 TMMCard &cd = *(iCardArray->CardP(iAutoUnlockIndex)); |
3815 TMMCard &cd = *(iCardArray->CardP(iAutoUnlockIndex)); |
3816 s.SetCard(&cd); |
3816 s.SetCard(&cd); |
3817 |
3817 |
3818 s.PushCommandStack(); |
3818 CurrentSessPushCmdStack(); |
3819 s.FillCommandDesc(ECmdSleepAwake, KBit15); |
3819 s.FillCommandDesc(ECmdSleepAwake, KBit15); |
3820 |
3820 |
3821 // CMD5 is an AC command, ExecCommandSMST will automatically issue a deselect |
3821 // CMD5 is an AC command, ExecCommandSMST will automatically issue a deselect |
3822 SMF_INVOKES(ExecCommandSMST, EStSleepAwakeIssued) |
3822 SMF_INVOKES(ExecCommandSMST, EStSleepAwakeIssued) |
3823 |
3823 |
3826 OstTrace0( TRACE_INTERNALS, DMMCSTACK_EXECSLEEPCOMMANDSM5, "EStSleepAwakeIssued" ); |
3826 OstTrace0( TRACE_INTERNALS, DMMCSTACK_EXECSLEEPCOMMANDSM5, "EStSleepAwakeIssued" ); |
3827 __KTRACE_OPT(KPBUS1, Kern::Printf(">EStSleepAwakeIssued!")); |
3827 __KTRACE_OPT(KPBUS1, Kern::Printf(">EStSleepAwakeIssued!")); |
3828 |
3828 |
3829 const TMMCStatus status(s.ResponseP()); |
3829 const TMMCStatus status(s.ResponseP()); |
3830 |
3830 |
3831 s.PopCommandStack(); |
3831 CurrentSessPopCmdStack(); |
3832 |
3832 |
3833 if(status.State() == ECardStateStby || status.State() == ECardStateSlp) |
3833 if(status.State() == ECardStateStby || status.State() == ECardStateSlp) |
3834 { |
3834 { |
3835 // R1b is issued before Sleep state is achieved and |
3835 // R1b is issued before Sleep state is achieved and |
3836 // will therefore return the previous state which was Standby |
3836 // will therefore return the previous state which was Standby |
3904 |
3904 |
3905 OstTrace0( TRACE_INTERNALS, DMMCSTACK_EXECAWAKECOMMANDSM3, "EStPoweredUp" ); |
3905 OstTrace0( TRACE_INTERNALS, DMMCSTACK_EXECAWAKECOMMANDSM3, "EStPoweredUp" ); |
3906 __KTRACE_OPT(KPBUS1, Kern::Printf("VccQ Powered Up")); |
3906 __KTRACE_OPT(KPBUS1, Kern::Printf("VccQ Powered Up")); |
3907 |
3907 |
3908 //Issue CMD5 to awaken media |
3908 //Issue CMD5 to awaken media |
3909 s.PushCommandStack(); |
3909 CurrentSessPushCmdStack(); |
3910 s.FillCommandDesc(ECmdSleepAwake); |
3910 s.FillCommandDesc(ECmdSleepAwake); |
3911 s.Command().iArgument.SetRCA(s.CardP()->RCA()); |
3911 s.Command().iArgument.SetRCA(s.CardP()->RCA()); |
3912 |
3912 |
3913 SMF_INVOKES(IssueCommandCheckResponseSMST, EStAwakeIssued) |
3913 SMF_INVOKES(IssueCommandCheckResponseSMST, EStAwakeIssued) |
3914 |
3914 |
3933 OstTrace1( TRACE_INTERNALS, DMMCSTACK_EXECAWAKECOMMANDSM6, "Card[%d]: UNKNOWN", iAutoUnlockIndex ); |
3933 OstTrace1( TRACE_INTERNALS, DMMCSTACK_EXECAWAKECOMMANDSM6, "Card[%d]: UNKNOWN", iAutoUnlockIndex ); |
3934 OstTraceFunctionExitExt( DMMCSTACK_EXECAWAKECOMMANDSM_EXIT, this, (TInt) KMMCErrStatus ); |
3934 OstTraceFunctionExitExt( DMMCSTACK_EXECAWAKECOMMANDSM_EXIT, this, (TInt) KMMCErrStatus ); |
3935 return KMMCErrStatus; |
3935 return KMMCErrStatus; |
3936 } |
3936 } |
3937 |
3937 |
3938 s.PopCommandStack(); |
3938 CurrentSessPopCmdStack(); |
3939 |
3939 |
3940 // Fall through to the next state |
3940 // Fall through to the next state |
3941 SMF_STATE(EStDone) |
3941 SMF_STATE(EStDone) |
3942 |
3942 |
3943 OstTrace0( TRACE_INTERNALS, DMMCSTACK_EXECAWAKECOMMANDSM7, "EStDone" ); |
3943 OstTrace0( TRACE_INTERNALS, DMMCSTACK_EXECAWAKECOMMANDSM7, "EStDone" ); |
5111 OstTrace1( TRACE_INTERNALS, DMMCSTACK_EXECCOMMANDSM1, "Current session=0x%x", &s ); |
5111 OstTrace1( TRACE_INTERNALS, DMMCSTACK_EXECCOMMANDSM1, "Current session=0x%x", &s ); |
5112 |
5112 |
5113 SMF_BEGIN |
5113 SMF_BEGIN |
5114 |
5114 |
5115 OstTrace0( TRACE_INTERNALS, DMMCSTACK_EXECCOMMANDSM2, "EStBegin" ); |
5115 OstTrace0( TRACE_INTERNALS, DMMCSTACK_EXECCOMMANDSM2, "EStBegin" ); |
5116 if ( ( s.CardRCA() != 0 ) && ( (s.CardP()->iStatus.State()) == ECardStateSlp) ) |
5116 if ( ( CurrentSessCardRCA() != 0 ) && ( (s.CardP()->iStatus.State()) == ECardStateSlp) ) |
5117 { |
5117 { |
5118 // Currently selected media is asleep, so it must be awoken |
5118 // Currently selected media is asleep, so it must be awoken |
5119 SMF_INVOKES(ExecAwakeCommandSMST,EStExecCmd) |
5119 SMF_INVOKES(ExecAwakeCommandSMST,EStExecCmd) |
5120 } |
5120 } |
5121 |
5121 |
5145 DoSetBusWidth(BusWidthEncoding(s.CardP()->BusWidth())); |
5145 DoSetBusWidth(BusWidthEncoding(s.CardP()->BusWidth())); |
5146 DoSetClock(MaxTranSpeedInKilohertz(*s.CardP())); |
5146 DoSetClock(MaxTranSpeedInKilohertz(*s.CardP())); |
5147 |
5147 |
5148 // Check if this card is already in the appropriate selected/deselected |
5148 // Check if this card is already in the appropriate selected/deselected |
5149 // state for the forthcoming command. |
5149 // state for the forthcoming command. |
5150 if (s.CardRCA() != iSelectedCard) |
5150 if (CurrentSessCardRCA() != iSelectedCard) |
5151 { |
5151 { |
5152 DeselectsToIssue(1); |
5152 DeselectsToIssue(1); |
5153 } |
5153 } |
5154 } |
5154 } |
5155 } |
5155 } |
5157 // If bus context is unknown, issue DESELECT a few times with a RetryGap between them. |
5157 // If bus context is unknown, issue DESELECT a few times with a RetryGap between them. |
5158 if ( (iStackState & KMMCStackStateDoDeselect) == 0 ) |
5158 if ( (iStackState & KMMCStackStateDoDeselect) == 0 ) |
5159 SMF_GOTOS( EStAnalyseCommand ) |
5159 SMF_GOTOS( EStAnalyseCommand ) |
5160 |
5160 |
5161 // Save the top-level command while we issue de-selects |
5161 // Save the top-level command while we issue de-selects |
5162 s.PushCommandStack(); |
5162 CurrentSessPushCmdStack(); |
5163 s.FillCommandDesc( ECmdSelectCard, 0 ); // Deselect - RCA=0 |
5163 CurrentSessFillCmdDesc( ECmdSelectCard, 0 ); // Deselect - RCA=0 |
5164 iCxDeselectCount=iDeselectsToIssue; |
5164 iCxDeselectCount=iDeselectsToIssue; |
5165 |
5165 |
5166 // Fall through to the next state |
5166 // Fall through to the next state |
5167 SMF_STATE(EStDeselectLoop) |
5167 SMF_STATE(EStDeselectLoop) |
5168 OstTrace0( TRACE_INTERNALS, DMMCSTACK_EXECCOMMANDSM5, "EStDeselectLoop" ); |
5168 OstTrace0( TRACE_INTERNALS, DMMCSTACK_EXECCOMMANDSM5, "EStDeselectLoop" ); |
5172 |
5172 |
5173 OstTrace0( TRACE_INTERNALS, DMMCSTACK_EXECCOMMANDSM6, "EStDeselectEndCheck" ); |
5173 OstTrace0( TRACE_INTERNALS, DMMCSTACK_EXECCOMMANDSM6, "EStDeselectEndCheck" ); |
5174 // If we got an error and this is the last de-select then give up |
5174 // If we got an error and this is the last de-select then give up |
5175 if (err && iCxDeselectCount == 1) |
5175 if (err && iCxDeselectCount == 1) |
5176 { |
5176 { |
5177 s.PopCommandStack(); |
5177 CurrentSessPopCmdStack(); |
5178 OstTraceFunctionExitExt( DMMCSTACK_EXECCOMMANDSM_EXIT1, this, (TInt) err ); |
5178 OstTraceFunctionExitExt( DMMCSTACK_EXECCOMMANDSM_EXIT1, this, (TInt) err ); |
5179 SMF_RETURN(err) |
5179 SMF_RETURN(err) |
5180 } |
5180 } |
5181 |
5181 |
5182 if (--iCxDeselectCount > 0) |
5182 if (--iCxDeselectCount > 0) |
5183 SMF_INVOKES(RetryGapTimerSMST,EStDeselectLoop) |
5183 SMF_INVOKES(RetryGapTimerSMST,EStDeselectLoop) |
5184 |
5184 |
5185 s.PopCommandStack(); |
5185 CurrentSessPopCmdStack(); |
5186 iStackState &= ~KMMCStackStateDoDeselect; |
5186 iStackState &= ~KMMCStackStateDoDeselect; |
5187 |
5187 |
5188 // Fall through to the next state |
5188 // Fall through to the next state |
5189 SMF_STATE(EStAnalyseCommand) |
5189 SMF_STATE(EStAnalyseCommand) |
5190 |
5190 |
5236 if (targetRCA==iSelectedCard) |
5236 if (targetRCA==iSelectedCard) |
5237 SMF_GOTONEXTS |
5237 SMF_GOTONEXTS |
5238 |
5238 |
5239 // Need to select (or deselect by using RCA(0)) the card so push the |
5239 // Need to select (or deselect by using RCA(0)) the card so push the |
5240 // top-level command onto the command stack while we issue the select command. |
5240 // top-level command onto the command stack while we issue the select command. |
5241 s.PushCommandStack(); |
5241 CurrentSessPushCmdStack(); |
5242 s.FillCommandDesc(ECmdSelectCard,targetRCA); |
5242 s.FillCommandDesc(ECmdSelectCard,targetRCA); |
5243 SMF_INVOKES(IssueCommandCheckResponseSMST,EStSelectDone) |
5243 SMF_INVOKES(IssueCommandCheckResponseSMST,EStSelectDone) |
5244 |
5244 |
5245 SMF_STATE(EStSelectDone) |
5245 SMF_STATE(EStSelectDone) |
5246 |
5246 |
5252 cmd.iFlags &= ~(KMMCCmdFlagASSPFlags|KMMCCmdFlagExecSelBusy); |
5252 cmd.iFlags &= ~(KMMCCmdFlagASSPFlags|KMMCCmdFlagExecSelBusy); |
5253 |
5253 |
5254 if (err == KMMCErrBusyTimeOut) |
5254 if (err == KMMCErrBusyTimeOut) |
5255 cmd.iFlags |= KMMCCmdFlagExecSelBusy; |
5255 cmd.iFlags |= KMMCCmdFlagExecSelBusy; |
5256 |
5256 |
5257 s.PopCommandStack(); |
5257 CurrentSessPopCmdStack(); |
5258 SMF_NEXTS(EStErrRecover) |
5258 SMF_NEXTS(EStErrRecover) |
5259 OstTraceFunctionExitExt( DMMCSTACK_EXECCOMMANDSM_EXIT4, this, (TInt) err ); |
5259 OstTraceFunctionExitExt( DMMCSTACK_EXECCOMMANDSM_EXIT4, this, (TInt) err ); |
5260 return err; // re-enter the next state with that error |
5260 return err; // re-enter the next state with that error |
5261 } |
5261 } |
5262 |
5262 |
5275 cmd.iDataMemoryP += blockLength; |
5275 cmd.iDataMemoryP += blockLength; |
5276 s.iBytesTransferred += blockLength; |
5276 s.iBytesTransferred += blockLength; |
5277 cmd.iPollAttempts = 0; |
5277 cmd.iPollAttempts = 0; |
5278 } |
5278 } |
5279 |
5279 |
5280 s.PopCommandStack(); |
5280 CurrentSessPopCmdStack(); |
5281 |
5281 |
5282 cmd = s.Command(); |
5282 cmd = s.Command(); |
5283 if (!cmd.iSpec.iUseStopTransmission && cmd.iSpec.iMultipleBlocks) |
5283 if (!cmd.iSpec.iUseStopTransmission && cmd.iSpec.iMultipleBlocks) |
5284 { |
5284 { |
5285 // Multi-block command using SET_BLOCK_COUNT |
5285 // Multi-block command using SET_BLOCK_COUNT |
5286 // This is a re-try of the data transfer, normally select (CMD7) is performed along with the issuing of CMD23, |
5286 // This is a re-try of the data transfer, normally select (CMD7) is performed along with the issuing of CMD23, |
5287 // therefore need to re-issue SET_BLOCK_COUNT..... |
5287 // therefore need to re-issue SET_BLOCK_COUNT..... |
5288 const TUint blocks = cmd.NumBlocks(); |
5288 const TUint blocks = cmd.NumBlocks(); |
5289 |
5289 |
5290 s.PushCommandStack(); |
5290 CurrentSessPushCmdStack(); |
5291 s.FillCommandDesc( ECmdSetBlockCount, blocks ); |
5291 s.FillCommandDesc( ECmdSetBlockCount, blocks ); |
5292 SMF_INVOKES( IssueCommandCheckResponseSMST, EStBlockCountCmdIssued ) |
5292 SMF_INVOKES( IssueCommandCheckResponseSMST, EStBlockCountCmdIssued ) |
5293 } |
5293 } |
5294 else |
5294 else |
5295 { |
5295 { |
5298 |
5298 |
5299 SMF_STATE(EStBlockCountCmdIssued) |
5299 SMF_STATE(EStBlockCountCmdIssued) |
5300 |
5300 |
5301 OstTrace0( TRACE_INTERNALS, DMMCSTACK_EXECCOMMANDSM9, "EStBlockCountCmdIssued" ); |
5301 OstTrace0( TRACE_INTERNALS, DMMCSTACK_EXECCOMMANDSM9, "EStBlockCountCmdIssued" ); |
5302 const TMMCStatus status(s.ResponseP()); |
5302 const TMMCStatus status(s.ResponseP()); |
5303 s.PopCommandStack(); |
5303 CurrentSessPopCmdStack(); |
5304 if (status.Error()) |
5304 if (status.Error()) |
5305 { |
5305 { |
5306 OstTraceFunctionExitExt( DMMCSTACK_EXECCOMMANDSM_EXIT5, this, (TInt) KMMCErrStatus ); |
5306 OstTraceFunctionExitExt( DMMCSTACK_EXECCOMMANDSM_EXIT5, this, (TInt) KMMCErrStatus ); |
5307 SMF_RETURN(KMMCErrStatus) |
5307 SMF_RETURN(KMMCErrStatus) |
5308 } |
5308 } |
5318 OstTrace0( TRACE_INTERNALS, DMMCSTACK_EXECCOMMANDSM10, "EStTestAppCommand" ); |
5318 OstTrace0( TRACE_INTERNALS, DMMCSTACK_EXECCOMMANDSM10, "EStTestAppCommand" ); |
5319 TMMCCommandDesc& cmd = s.Command(); |
5319 TMMCCommandDesc& cmd = s.Command(); |
5320 if (cmd.iSpec.iCommandClass != KMMCCmdClassApplication) |
5320 if (cmd.iSpec.iCommandClass != KMMCCmdClassApplication) |
5321 SMF_GOTOS( EStIssueCommand ) |
5321 SMF_GOTOS( EStIssueCommand ) |
5322 |
5322 |
5323 s.PushCommandStack(); |
5323 CurrentSessPushCmdStack(); |
5324 s.FillCommandDesc(ECmdAppCmd, s.CardRCA()); // Send APP_CMD (CMD55) |
5324 s.FillCommandDesc(ECmdAppCmd, s.CardRCA()); // Send APP_CMD (CMD55) |
5325 SMF_INVOKES(IssueCommandCheckResponseSMST,EStIssueAppCommandDone) |
5325 SMF_INVOKES(IssueCommandCheckResponseSMST,EStIssueAppCommandDone) |
5326 |
5326 |
5327 SMF_STATE(EStIssueAppCommandDone) |
5327 SMF_STATE(EStIssueAppCommandDone) |
5328 OstTrace0( TRACE_INTERNALS, DMMCSTACK_EXECCOMMANDSM11, "EStIssueAppCommandDone" ); |
5328 OstTrace0( TRACE_INTERNALS, DMMCSTACK_EXECCOMMANDSM11, "EStIssueAppCommandDone" ); |
5329 s.PopCommandStack(); |
5329 CurrentSessPopCmdStack(); |
5330 if ( err ) |
5330 if ( err ) |
5331 { |
5331 { |
5332 SMF_NEXTS(EStErrRecover) |
5332 SMF_NEXTS(EStErrRecover) |
5333 OstTraceFunctionExitExt( DMMCSTACK_EXECCOMMANDSM_EXIT6, this, (TInt) err ); |
5333 OstTraceFunctionExitExt( DMMCSTACK_EXECCOMMANDSM_EXIT6, this, (TInt) err ); |
5334 return err; // re-enter the next state with that error |
5334 return err; // re-enter the next state with that error |
5758 __KTRACE_OPT(KPBUS1,Kern::Printf(">MMC:RWBlocksSM %x",TUint(s.iLastStatus))); |
5758 __KTRACE_OPT(KPBUS1,Kern::Printf(">MMC:RWBlocksSM %x",TUint(s.iLastStatus))); |
5759 |
5759 |
5760 SMF_BEGIN |
5760 SMF_BEGIN |
5761 |
5761 |
5762 OstTrace0( TRACE_INTERNALS, DMMCSTACK_CIMREADWRITEBLOCKSSM2, "EStBegin" ); |
5762 OstTrace0( TRACE_INTERNALS, DMMCSTACK_CIMREADWRITEBLOCKSSM2, "EStBegin" ); |
5763 if(s.iSessionID == ECIMWriteBlock || s.iSessionID == ECIMWriteMBlock) |
5763 if(s.SessionID() == ECIMWriteBlock || s.SessionID() == ECIMWriteMBlock) |
5764 { |
5764 { |
5765 // Check that the card supports class 4 (Write) commands |
5765 // Check that the card supports class 4 (Write) commands |
5766 const TUint ccc = s.iCardP->CSD().CCC(); |
5766 const TUint ccc = s.iCardP->CSD().CCC(); |
5767 if(!(ccc & KMMCCmdClassBlockWrite)) |
5767 if(!(ccc & KMMCCmdClassBlockWrite)) |
5768 { |
5768 { |
5816 { |
5816 { |
5817 SMF_GOTOS( EStLengthSet ) |
5817 SMF_GOTOS( EStLengthSet ) |
5818 } |
5818 } |
5819 |
5819 |
5820 s.iCardP->iSetBlockLen = 0; |
5820 s.iCardP->iSetBlockLen = 0; |
5821 s.PushCommandStack(); |
5821 CurrentSessPushCmdStack(); |
5822 s.FillCommandDesc( ECmdSetBlockLen, blockLength ); |
5822 s.FillCommandDesc( ECmdSetBlockLen, blockLength ); |
5823 SMF_INVOKES( ExecCommandSMST, EStLength1 ) |
5823 SMF_INVOKES( ExecCommandSMST, EStLength1 ) |
5824 |
5824 |
5825 SMF_STATE(EStLength1) |
5825 SMF_STATE(EStLength1) |
5826 |
5826 |
5827 OstTrace0( TRACE_INTERNALS, DMMCSTACK_CIMREADWRITEBLOCKSSM5, "EStAttached" ); |
5827 OstTrace0( TRACE_INTERNALS, DMMCSTACK_CIMREADWRITEBLOCKSSM5, "EStAttached" ); |
5828 const TMMCStatus status(s.ResponseP()); |
5828 const TMMCStatus status(s.ResponseP()); |
5829 s.PopCommandStack(); |
5829 CurrentSessPopCmdStack(); |
5830 if (status.Error()) |
5830 if (status.Error()) |
5831 { |
5831 { |
5832 OstTraceFunctionExitExt( DMMCSTACK_CIMREADWRITEBLOCKSSM_EXIT4, this, (TInt) KMMCErrStatus ); |
5832 OstTraceFunctionExitExt( DMMCSTACK_CIMREADWRITEBLOCKSSM_EXIT4, this, (TInt) KMMCErrStatus ); |
5833 SMF_RETURN(KMMCErrStatus) |
5833 SMF_RETURN(KMMCErrStatus) |
5834 } |
5834 } |
5928 // Command marked as Reliable Write |
5928 // Command marked as Reliable Write |
5929 // set Bit31 in CMD23 argument |
5929 // set Bit31 in CMD23 argument |
5930 args |= KMMCCmdReliableWrite; |
5930 args |= KMMCCmdReliableWrite; |
5931 } |
5931 } |
5932 |
5932 |
5933 s.PushCommandStack(); |
5933 CurrentSessPushCmdStack(); |
5934 s.FillCommandDesc( ECmdSetBlockCount, args ); |
5934 s.FillCommandDesc( ECmdSetBlockCount, args ); |
5935 SMF_INVOKES( ExecCommandSMST, EStBlockCountCmdIssued ) |
5935 SMF_INVOKES( ExecCommandSMST, EStBlockCountCmdIssued ) |
5936 |
5936 |
5937 SMF_STATE(EStBlockCountCmdIssued) |
5937 SMF_STATE(EStBlockCountCmdIssued) |
5938 |
5938 |
5939 OstTrace0( TRACE_INTERNALS, DMMCSTACK_CIMREADWRITEBLOCKSSM9, "EStBlockCountCmdIssued" ); |
5939 OstTrace0( TRACE_INTERNALS, DMMCSTACK_CIMREADWRITEBLOCKSSM9, "EStBlockCountCmdIssued" ); |
5940 const TMMCStatus status(s.ResponseP()); |
5940 const TMMCStatus status(s.ResponseP()); |
5941 s.PopCommandStack(); |
5941 CurrentSessPopCmdStack(); |
5942 if (status.Error()) |
5942 if (status.Error()) |
5943 { |
5943 { |
5944 OstTraceFunctionExitExt( DMMCSTACK_CIMREADWRITEBLOCKSSM_EXIT5, this, (TInt) KMMCErrStatus ); |
5944 OstTraceFunctionExitExt( DMMCSTACK_CIMREADWRITEBLOCKSSM_EXIT5, this, (TInt) KMMCErrStatus ); |
5945 SMF_RETURN(KMMCErrStatus) |
5945 SMF_RETURN(KMMCErrStatus) |
5946 } |
5946 } |
5955 |
5955 |
5956 SMF_STATE(EStAppCmdIssued) |
5956 SMF_STATE(EStAppCmdIssued) |
5957 |
5957 |
5958 OstTrace0( TRACE_INTERNALS, DMMCSTACK_CIMREADWRITEBLOCKSSM10, "EStAppCmdIssued" ); |
5958 OstTrace0( TRACE_INTERNALS, DMMCSTACK_CIMREADWRITEBLOCKSSM10, "EStAppCmdIssued" ); |
5959 const TMMCStatus status(s.ResponseP()); |
5959 const TMMCStatus status(s.ResponseP()); |
5960 s.PopCommandStack(); |
5960 CurrentSessPopCmdStack(); |
5961 if (status.Error()) |
5961 if (status.Error()) |
5962 { |
5962 { |
5963 OstTraceFunctionExitExt( DMMCSTACK_CIMREADWRITEBLOCKSSM_EXIT6, this, (TInt) KMMCErrStatus ); |
5963 OstTraceFunctionExitExt( DMMCSTACK_CIMREADWRITEBLOCKSSM_EXIT6, this, (TInt) KMMCErrStatus ); |
5964 SMF_RETURN(KMMCErrStatus) |
5964 SMF_RETURN(KMMCErrStatus) |
5965 } |
5965 } |
5991 // Save the status and examine it after issuing CMD13... |
5991 // Save the status and examine it after issuing CMD13... |
5992 // NB We don't know where in the command stack the last response is stored (e.g. there may |
5992 // NB We don't know where in the command stack the last response is stored (e.g. there may |
5993 // have bee a Deselect/Select issued), but we do know last response is stored in iLastStatus |
5993 // have bee a Deselect/Select issued), but we do know last response is stored in iLastStatus |
5994 TMMC::BigEndian4Bytes(s.ResponseP(), s.iLastStatus); |
5994 TMMC::BigEndian4Bytes(s.ResponseP(), s.iLastStatus); |
5995 |
5995 |
5996 s.PushCommandStack(); |
5996 CurrentSessPushCmdStack(); |
5997 s.FillCommandDesc(ECmdSendStatus, 0); |
5997 s.FillCommandDesc(ECmdSendStatus, 0); |
5998 SMF_INVOKES(ExecCommandSMST, EStWaitFinish1) |
5998 SMF_INVOKES(ExecCommandSMST, EStWaitFinish1) |
5999 |
5999 |
6000 SMF_STATE(EStWaitFinish1) |
6000 SMF_STATE(EStWaitFinish1) |
6001 OstTrace0( TRACE_INTERNALS, DMMCSTACK_CIMREADWRITEBLOCKSSM14, "EStWaitFinish1" ); |
6001 OstTrace0( TRACE_INTERNALS, DMMCSTACK_CIMREADWRITEBLOCKSSM14, "EStWaitFinish1" ); |
6002 const TMMCStatus status(s.ResponseP()); |
6002 const TMMCStatus status(s.ResponseP()); |
6003 s.PopCommandStack(); |
6003 CurrentSessPopCmdStack(); |
6004 |
6004 |
6005 #ifdef __WINS__ |
6005 #ifdef __WINS__ |
6006 SMF_GOTOS(EStRWFinish); |
6006 SMF_GOTOS(EStRWFinish); |
6007 #else |
6007 #else |
6008 const TMMCardStateEnum st1 = status.State(); |
6008 const TMMCardStateEnum st1 = status.State(); |
6159 } |
6159 } |
6160 |
6160 |
6161 command = ECmdTagEraseGroupEnd; |
6161 command = ECmdTagEraseGroupEnd; |
6162 } |
6162 } |
6163 |
6163 |
6164 s.PushCommandStack(); |
6164 CurrentSessPushCmdStack(); |
6165 s.FillCommandDesc( command, endAddr ); |
6165 s.FillCommandDesc( command, endAddr ); |
6166 SMF_INVOKES( ExecCommandSMST, EStEndTagged ) |
6166 SMF_INVOKES( ExecCommandSMST, EStEndTagged ) |
6167 |
6167 |
6168 SMF_STATE(EStEndTagged) |
6168 SMF_STATE(EStEndTagged) |
6169 |
6169 |
6189 |
6189 |
6190 |
6190 |
6191 SMF_STATE(EStWaitFinish) |
6191 SMF_STATE(EStWaitFinish) |
6192 |
6192 |
6193 OstTrace0( TRACE_INTERNALS, DMMCSTACK_CIMERASESM10, "EStWaitFinish" ); |
6193 OstTrace0( TRACE_INTERNALS, DMMCSTACK_CIMERASESM10, "EStWaitFinish" ); |
6194 s.PushCommandStack(); |
6194 CurrentSessPushCmdStack(); |
6195 s.FillCommandDesc(ECmdSendStatus, 0); |
6195 s.FillCommandDesc(ECmdSendStatus, 0); |
6196 SMF_INVOKES(ExecCommandSMST, EStWaitFinish1) |
6196 SMF_INVOKES(ExecCommandSMST, EStWaitFinish1) |
6197 |
6197 |
6198 SMF_STATE(EStWaitFinish1) |
6198 SMF_STATE(EStWaitFinish1) |
6199 |
6199 |
6200 OstTrace0( TRACE_INTERNALS, DMMCSTACK_CIMERASESM11, "EStWaitFinish1" ); |
6200 OstTrace0( TRACE_INTERNALS, DMMCSTACK_CIMERASESM11, "EStWaitFinish1" ); |
6201 const TMMCStatus st(s.ResponseP()); |
6201 const TMMCStatus st(s.ResponseP()); |
6202 s.PopCommandStack(); |
6202 CurrentSessPopCmdStack(); |
6203 |
6203 |
6204 #ifdef __WINS__ |
6204 #ifdef __WINS__ |
6205 SMF_GOTOS(EStEraseFinish); |
6205 SMF_GOTOS(EStEraseFinish); |
6206 #else |
6206 #else |
6207 const TMMCardStateEnum st1 = st.State(); |
6207 const TMMCardStateEnum st1 = st.State(); |