Texas Instruments TMS320DM644x Camera Accessories User Manual


 
www.ti.com
3.7MMC/SDModeMultiple-BlockWriteOperationUsingEDMA
3.8MMC/SDModeMultiple-BlockReadOperationUsingCPU
ProceduresforCommonOperations
Toperformamultiple-blockwrite,thesameblocklengthneedstobesetinboththeMMC/SDcontroller
andthecard.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.SettheFIFOthreshold(FIFOLEVbitinMMCFIFOCTL).
7.Settheaccesswidth(ACCWDbitsinMMCFIFOCTL).
8.SetupDMA(DMAsizeneedstobegreaterthanorequaltoFIFOLEVsetting).
9.UseMMCCMDtosendtheWRITE_MULTI_BLOCKcommandtothecard(setDMATRIGbitin
MMCCMDtotriggerfirstDMA).
10.WaitforDMAsequencetocompleteortheDATADNEflagintheMMCstatusregister0(MMCST0)is
set.
11.UseMMCST0tocheckforerrors.
12.UseMMCCMDtosendtheSTOP_TRANSMISSIONcommand.
Toperformamultiple-blockread,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.SettheFIFOdirectiontoreceive(FIFODIRbitinMMCFIFOCTL).
6.SetFIFOthreshold(FIFOLEVbitinMMCFIFOCTL).
7.Settheaccesswidth(ACCWDbitsinMMCFIFOCTL).
8.EnabletheMMCinterrupt.
9.EnableDRRDYINTinterrupt.
10.UseMMCCMDtosendtheREAD_MULT_BLOCKScommand.
11.WaitforMMCinterrupt.
12.UsetheMMCstatusregister0(MMCST0)tocheckforerrorsandtodeterminethestatusoftheFIFO.
IfFIFOisnotemptyandmorebytesaretoberead,gotostep13.Iftheallofthedatahasbeenread,
gotostep14.
13.Readnbytes(dependsonsettingofFIFOLEVinMMCFIFOCTL:0=16bytes,1=32bytes)ofdata
fromtheMMCdatareceiveregister(MMCDRR)andgotostep10.
14.UseMMCCMDtosendtheSTOP_TRANSMISSIONcommand.
ThesequenceofeventsinthisoperationisshowninFigure17.
38MultimediaCard(MMC)/SecureDigital(SD)CardControllerSPRUE30BSeptember2006
SubmitDocumentationFeedback