|
![](static/image/common/ico_lz.png)
楼主 |
发表于 2008-4-6 12:10:34
|
显示全部楼层
引用:
#start
1 ,奇怪,SD的datasheet上说CSD的最后一位常为1,可我手上的3张SD卡读出来的CSD最后一个字节都是0x00h,但是用这些数据算出来的卡的容量都对,想不通啊。
2 ,还有怎样判定sd卡有没有MBR?我看了datasheet后想到的是通过CSD的FILE_FORMAT 和 FILE_FIRMAT_GRP 来判定,不知道有没有更好的办法。
3 ,我用WINHEX看sd卡、u盘、我的电脑的硬盘时,发现u盘和硬盘的第一个sector 前439个字节的有很多数据,但sd卡的对应位置却全0x00,这怎么解释?
elefan、bozai两位高手指点下,谢谢。
#end
我是这样判断DPT的:看第一个字节是否是0xEB
//---------------------------------------------
//Start to Read MBR sector
//---------------------------------------------
readPos=0; sectorPos=0;
MMC_set_blocklen(128);
MMC_Read_Sector_Bytes(0,0,128,sectorBuffer.data); //try to read 128 bytes of MBR
if(sectorBuffer.data[0] == 0xeb)
{ //If first byte is a instruction of JMP,no DPT.
//---------------------------------------------
// debug info here
//---------------------------------------------
}
else
{ MMC_set_blocklen(64);
//skipping boot code in first 445 bytes. Read 64 bytes partition table record
MMC_Read_Sector_Bytes(0,446,64,sectorBuffer.data);
pr = (struct partRec *) sectorBuffer.data;
startSector = pr->startLBA;
readPos=0; sectorPos=0;
MMC_set_blocklen(128);
MMC_Read_Sector_Bytes(startSector,0,128,sectorBuffer.data); //read boot record
} |
|