Texas Instruments TMS320DM644x Camera Accessories User Manual


 
www.ti.com
3.6MMC/SDModeMultiple-BlockWriteOperationUsingCPU
ProceduresforCommonOperations
Toperformamultiple-blockwrite,thesameblocklengthneedstobesetinboththeMMC/SDcontroller
andthecard.
Note:TheprocedureinthissectionusesaSTOP_TRANSMISSIONcommandtoendtheblocktransfer.
ThisassumesthatthevalueintheMMCnumberofblockscounterregister(MMCNBLK)is0.A
multiple-blockoperationterminatesitselfifyouloadMMCNBLKwiththeexactnumberofblocksyouwant
transferred.
Theprocedureforthisoperationis:
1.Writethecard’srelativeaddresstotheMMCargumentregisters(MMCARGHandMMCARGL).Load
thehighpartoftheaddresstoMMCARGHandthelowpartoftheaddresstoMMCARGL.
2.ReadcardCSDtodeterminethecard'smaximumblocklength.
3.UsetheMMCcommandregister(MMCCMD)tosendtheSET_BLOCKLENcommand(iftheblock
lengthisdifferentthanthelengthusedinthepreviousoperation).Theblocklengthmustbeamultiple
of512bytesandlessthenthemaximumblocklengthspecifiedintheCSD.
4.ResettheFIFO(FIFORSTbitinMMCFIFOCTL).
5.SettheFIFOdirectiontotransmit(FIFODIRbitinMMCFIFOCTL).
6.Settheaccesswidth(ACCWDbitsinMMCFIFOCTL).
7.SettheFIFOthreshold(FIFOLEVbitinMMCFIFOCTL).
8.EnabletheMMCinterrupt.
9.EnableDXRDYINTinterrupt.
10.Writethefirst32bytesofthedatablocktotheMMCdatatransmitregister(MMCDXR).
11.UseMMCCMDtosendtheWRITE_MULTI_BLOCKcommandtothecard.
12.WaitforMMCinterrupt.
13.UsetheMMCstatusregister0(MMCST0)tocheckforerrorsandtodeterminethestatusoftheFIFO.
IfmorebytesaretobewrittenandtheFIFOisnotfull,gotostep14.Iftheallofthedatahasbeen
written,gotostep15.
14.Writethenextnbytes(dependsonsettingofFIFOLEVinMMCFIFOCTL:0=16bytes,1=32bytes)
ofthedatablocktoMMCDXR,andgotostep12.
15.UseMMCCMDtosendtheSTOP_TRANSMISSIONcommand.
ThesequenceofeventsinthisoperationisshowninFigure16.
36MultimediaCard(MMC)/SecureDigital(SD)CardControllerSPRUE30BSeptember2006
SubmitDocumentationFeedback