Texas Instruments TMS320DM644x Camera Accessories User Manual


 
www.ti.com
3.3MMC/SDModeSingle-BlockWriteOperationUsingtheEDMA
3.4MMC/SDModeSingle-BlockReadOperationUsingtheCPU
ProceduresforCommonOperations
Toperformasingle-blockwrite,theblocklengthmustbe512bytesandthesamelengthmustbesetin
boththeMMC/SDcontrollerandthecard.
Theprocedureforthisoperationisasfollows:
1.Writethecard’srelativeaddresstotheMMCargumentregisters(MMCARGHandMMCARGL).Load
thehighpartoftheaddresstoMMCARGHandthelowpartoftheaddresstoMMCARGL.
2.ReadthecardCSDtodeterminethecard'smaximumblocklength.
3.UsetheMMCcommandregister(MMCCMD)tosendtheSET_BLOCKLENcommand(iftheblock
lengthisdifferentthanthelengthusedinthepreviousoperation).Theblocklengthmustbeamultiple
of512bytesandlessthenthemaximumblocklengthspecifiedintheCSD.
4.ResettheFIFO(FIFORSTbitinMMCFIFOCTL).
5.SettheFIFOdirectiontotransmit(FIFODIRbitinMMCFIFOCTL).
6.Settheaccesswidth(ACCWDbitsinMMCFIFOCTL).
7.SettheFIFOthreshold(FIFOLEVbitinMMCFIFOCTL).
8.SetuptheDMA(DMAsizemustbegreaterthanorequaltotheFIFOLEVsetting).
9.UseMMCCMDtosendtheWRITE_BLOCKcommandtothecard(settheDMATRIGbitinMMCCMD
totriggerthefirstDMA).
10.WaitfortheDMAsequencetocompleteorfortheDATADNEflagintheMMCstatusregister0
(MMCST0)tobeset.
11.UseMMCST0tocheckforerrors.
Toperformasingle-blockread,thesameblocklengthmustbesetinboththeMMC/SDcontrollerandthe
card.
Theprocedureforthisoperationisasfollows:
1.Writethecard’srelativeaddresstotheMMCargumentregisters(MMCARGHandMMCARGL).Load
thehighpartoftheaddresstoMCARGHandthelowpartoftheaddresstoMMCARGL.
2.UsetheMMCcommandregister(MMCCMD)tosendtheSELECT/DESELECT_CARDbroadcast
command.Thisselectstheaddressedcardanddeselectstheothers.
3.WritethesourcestartaddresstotheMMCargumentregisters.LoadthehighparttoMMCARGHand
thelowparttoMMCARGL.
4.ReadcardCSDtodeterminethecard'smaximumblocklength.
5.UseMMCCMDtosendtheSET_BLOCKLENcommand(iftheblocklengthisdifferentthanthelength
usedinthepreviousoperation).Theblocklengthmustbeamultipleof512bytesandlessthenthe
maximumblocklengthspecifiedintheCSD.
6.ResettheFIFO(FIFORSTbitinMMCFIFOCTL).
7.SettheFIFOdirectiontoreceive(FIFODIRbitinMMCFIFOCTL).
8.Settheaccesswidth(ACCWDbitsinMMCFIFOCTL).
9.SettheFIFOthreshold(FIFOLEVbitinMMCFIFOCTL).
10.EnabletheMMCinterrupt.
11.EnabletheDRRDYINTinterrupt.
12.UseMMCCMDtosendtheREAD_SINGLE_BLOCKcommand.
13.WaitfortheMMCinterrupt.
14.UsetheMMCstatusregister0(MMCST0)tocheckforerrorsandthestatusoftheFIFO.IftheFIFOis
notempty,gotostep15.Iftheallofthedatahasbeenread,stop.
15.Readthenextnbytesofdata(thisdependsonthesettingoftheFIFOLEVbitinMMCFIFOCTL:
0=16bytes,1=32bytes)fromtheMMCdatareceiveregister(MMCDRR)andgotostep13.
ThesequenceofeventsinthisoperationisshowninFigure15.
34MultimediaCard(MMC)/SecureDigital(SD)CardControllerSPRUE30BSeptember2006
SubmitDocumentationFeedback