SD卡CSD version2解析
2016-02-26 10:44
204 查看
<pre name="code" class="plain">花半天写的解析,供以后需要使用
typedef unsigned int UINT32; int main(int argc, char *argv[]) { //UINT32 csd_arr[4]={0x400e0032,0x5b590001,0xd0df7f80,0xa4000f7}; UINT32 csd_arr[4]={0x400e0032,0x5b590001,0xd87d7f80,0xa40005d}; UINT32 CSD_Structure=(csd_arr[0]&0xc0000000)>>30; UINT32 reserved=(csd_arr[0]&0x3f000000)>>24; UINT32 time=(csd_arr[0]&0x00ff0000)>>16; UINT32 timeclk=(csd_arr[0]&0x0000ff00)>>8; UINT32 max_rate=csd_arr[0]&0x000000ff; UINT32 cmd_class=(csd_arr[1]&0xfff00000)>>20; UINT32 rdata_len=(csd_arr[1]&0x000f0000)>>16; UINT32 pbra=(csd_arr[1]&0x00008000)>>15; UINT32 wbm=(csd_arr[1]&0x00004000)>>14; UINT32 rbm=(csd_arr[1]&0x00002000)>>13; UINT32 dsr_imp=(csd_arr[1]&0x00001000)>>12; UINT32 reserved2=(csd_arr[1]&0x00000fc0)>>4; UINT32 device_size=(csd_arr[1]&0x0000003f)<<16|((csd_arr[2]&0xffff0000)>>16); UINT32 reserved3=(csd_arr[2]&0x00008000)>>15; UINT32 esbe=(csd_arr[2]&0x00004000)>>14;//erase single block enable UINT32 ess=(csd_arr[2]&0x00003f80)>>7;//erase sector size UINT32 write_protect_group_size=(csd_arr[2]&0x0000007f); UINT32 write_protect_group_enable=(csd_arr[3]&0x80000000)>>31; UINT32 reserved4=(csd_arr[3]&0x60000000)>>29; UINT32 write_speed_factor=(csd_arr[3]&0x1c000000)>>26; UINT32 max_write_data_block_len=(csd_arr[3]&0x03c00000)>>22; UINT32 partial_blocks_for_write=(csd_arr[3]&0x00200000)>>21; UINT32 reserved5=(csd_arr[3]&0x001f0000)>>16; UINT32 file_format_group=(csd_arr[3]&0x00008000)>>15; UINT32 copy_flag=(csd_arr[3]&0x00004000)>>14; UINT32 permanent_write_protection=(csd_arr[3]&0x00002000)>>13; UINT32 temporary_write_protection=(csd_arr[3]&0x00001000)>>12; UINT32 file_format=(csd_arr[3]&0x00000c00)>>10; UINT32 reserved6=(csd_arr[3]&0x00000300)>>8; UINT32 crc=(csd_arr[3]&0xfe)>>1; UINT32 nouse=csd_arr[3]&0x1;//'1' printf("CSD_Structure:%d\r\n", CSD_Structure); printf("reserved:%d\r\n", reserved); printf("time:%d\r\n", time); printf("timeclk:%d\r\n", timeclk); printf("max_rate:%d\r\n", max_rate); printf("cmd_class:%d\r\n", cmd_class); printf("rdata_len:%d\r\n", rdata_len); printf("pbra:%d\r\n", pbra); printf("wbm:%d\r\n", wbm); printf("rbm:%d\r\n", rbm); printf("dsr_imp:%d\r\n", dsr_imp); printf("reserved2:%d\r\n", reserved2); printf("device_size:%d\r\n", device_size); printf("reserved3:%d\r\n", reserved3); printf("esbe:%d\r\n", esbe); printf("ess:%d\r\n", ess); printf("write_protect_group_size:%d\r\n", write_protect_group_size); printf("write_protect_group_enable:%d\r\n", write_protect_group_enable); printf("reserved4:%d\r\n", reserved4); printf("write_speed_factor:%d\r\n", write_speed_factor); printf("max_write_data_block_len:%d\r\n", max_write_data_block_len); printf("partial_blocks_for_write:%d\r\n", partial_blocks_for_write); printf("reserved5:%d\r\n", reserved5); printf("file_format_group:%d\r\n", file_format_group); printf("copy_flag:%d\r\n", copy_flag); printf("permanent_write_protection:%d\r\n", permanent_write_protection); printf("temporary_write_protection:%d\r\n", temporary_write_protection); printf("file_format:%d\r\n", file_format); printf("reserved6:%d\r\n", reserved6); printf("crc:%d\r\n", crc); printf("nouse:%d\r\n", nouse); return 0; }
相关文章推荐
- MMC提示不能打开文件SQLServerEnterpriseManager.MSC的解决方法
- Android获取assets文件夹中的数据并写入SD卡示例
- 基于Android如何实现将数据库保存到SD卡
- android获取监听SD Card状态的方法
- Linux MMC/SD/SDIO体系结构
- linux mmc sd卡启动过程详解
- linux2.6内核SD Card Driver详细解析之一
- S3C2440上MMC/SD卡驱动实例开发讲解(一)
- MMC/SD 分析
- linux的mmc_spi学习笔记
- eMMC的MMC模式与SPI模式
- MMC卡原理和操作分析
- 面向程序员的数据库访问性能优化法
- 大于2T硬盘分区
- 顶部浮层
- C51 CD卡
- mmc 無法建立嵌入式管理單元
- 存储之—SD卡接口规范定义
- SylixOS基于Nuc970平台的SD驱动移植