|
贴一段代码出来,对上面的6,7,12,28...等数字不理解,请大家帮忙解释下.谢谢
int IssueCommand_CH0( U16 uCmd, U32 uArg, U32 uIsAcmd)
{
U32 uSfr;
while ((rHM0_PRNSTS&0x1)); // Check CommandInhibit_CMD
if (!uIsAcmd)//R1b type commands have to check CommandInhibit_DAT bit
{
if((uCmd==6&&ThisIsMmc_ch0)||uCmd==7||uCmd==12||uCmd==28||uCmd==29||uCmd==38||((uCmd==42||uCmd==56)&&(!ThisIsMmc_ch0)))
{
do {
uSfr = rHM0_PRNSTS;
} while((uSfr&0x2)); // Check CommandInhibit_DAT
}
}
// Argument Setting
if (!uIsAcmd)// <------------------- Normal Command (CMD)
{
if(uCmd==3||uCmd==4||uCmd==7||uCmd==9||uCmd==10||uCmd==13||uCmd==15||uCmd==55)
rHM0_ARGUMENT = uArg<<16;
else
rHM0_ARGUMENT = uArg;
}
else// <--------------------------- APP.Commnad (ACMD)
rHM0_ARGUMENT = uArg;
SetCommandReg_CH0(uCmd,uIsAcmd);
if (!WaitForCommandComplete_CH0())
{
printf(("Command NOT Complete\n"));
}
else
ClearCommandCompleteStatus_CH0();
if (!(rHM0_NORINTSTS&0x8000))
{
if(((rHM0_CMDREG>>8) == 0x8) &&(ThisIsMmc_ch0 !=1))
{
printf("\nCMD8 Support");
SDSpecVer_ch0 = 2;
}
return 1;
}
else
{
if(OCRcheck_ch0 == 1)
return 0;
else
{
printf("Command = %d, Error Stat = %x\n",(rHM0_CMDREG>>8),rHM0_ERRINTSTS);
rHM0_ERRINTSTS = rHM0_ERRINTSTS;
rHM0_NORINTSTS =rHM0_NORINTSTS;
if((rHM0_CMDREG>>8) == 0x8)
{
printf("\nThis Card version is NOT SD 2.0\n");
}
return 0;
}
}
}
|
|