研究生
最后登录1970-1-1
在线时间 小时
注册时间2018-7-14
|
第一个问题:
在"SD_Error SD_GetCardInfo(SD_CardInfo *cardinfo)"函数中
................
/*!< Byte 12 */
tmp = (uint8_t)((CSD_Tab[3] & 0xFF000000) >> 24);
cardinfo->SD_csd.WrProtectGrEnable = (tmp & 0x80) >> 7;
cardinfo->SD_csd.ManDeflECC = (tmp & 0x60) >> 5;
cardinfo->SD_csd.WrSpeedFact = (tmp & 0x1C) >> 2;
cardinfo->SD_csd.MaxWrBlockLen = (tmp & 0x03) << 2;
/*!< Byte 13 */
tmp = (uint8_t)((CSD_Tab[3] & 0x00FF0000) >> 16);
cardinfo->SD_csd.MaxWrBlockLen |= (tmp & 0xC0) >> 6;
cardinfo->SD_csd.WriteBlockPaPartial = (tmp & 0x20) >> 5;
cardinfo->SD_csd.Reserved3 = 0;
cardinfo->SD_csd.ContentProtectAppli = (tmp & 0x01);//关注这一句
/*!< Byte 14 */
tmp = (uint8_t)((CSD_Tab[3] & 0x0000FF00) >> 8);
cardinfo->SD_csd.FileFormatGrouop = (tmp & 0x80) >> 7;
cardinfo->SD_csd.CopyFlag = (tmp & 0x40) >> 6;
cardinfo->SD_csd.PermWrProtect = (tmp & 0x20) >> 5;
cardinfo->SD_csd.TempWrProtect = (tmp & 0x10) >> 4;
cardinfo->SD_csd.FileFormat = (tmp & 0x0C) >> 2;
cardinfo->SD_csd.ECC = (tmp & 0x03);
......................
" Byte 13 "已经用完了8位,(tmp & 0x01)又是什么?
[img][/img]
Reserved3 已经占5bits,这个字节已处理完,何来(tmp & 0x01).
有哪位老师能回答我?
第二个问题:
函数
static SD_Error FindSCR(uint16_t rca, uint32_t *pscr)
{
uint32_t tempscr[2] = {0, 0};
.............................
*(pscr + 1) = ((tempscr[0] & SD_0TO7BITS) << 24) | ((tempscr[0] & SD_8TO15BITS) << 8) | ((tempscr[0] & SD_16TO23BITS) >> 8) | ((tempscr[0] & SD_24TO31BITS) >> 24);
*(pscr) = ((tempscr[1] & SD_0TO7BITS) << 24) | ((tempscr[1] & SD_8TO15BITS) << 8) | ((tempscr[1] & SD_16TO23BITS) >> 8) | ((tempscr[1] & SD_24TO31BITS) >> 24);
.......................................
}
这两句又是什么操作?
scr 是调用函数的变量定义,
uint32_t scr[2] = {0, 0};
.............
errorstatus = FindSCR(RCA, scr);
.............
经过这样调用后,为什么把tempscrt和scr交叉赋值?为什么又要在赋值过程中将字节顺序也交换了?
请教在上,不胜感激.
|
|