Chinaunix首页 | 论坛 | 博客
  • 博客访问: 962525
  • 博文数量: 109
  • 博客积分: 554
  • 博客等级: 中士
  • 技术积分: 2577
  • 用 户 组: 普通用户
  • 注册时间: 2010-03-04 12:49
文章分类

全部博文(109)

文章存档

2019年(5)

2016年(7)

2015年(9)

2014年(1)

2013年(71)

2012年(16)

分类: 嵌入式

2012-07-13 17:17:31

SD卡中block和sector的含义如下:

block :  A number of bytes, basic data transfer unit (SD中最小的读写单位)。

block length 可以被 SET_BLOCKLEN (CMD16)设置 。

SDHC and SDXC block length 是固定的512Bytes。

协议原文:

7.2.3 Data Read
The SPI mode supports single block read and Multiple Block read operations (CMD17 or CMD18 in the
SD Memory Card protocol). Upon reception of a valid read command the card will respond with a
response token followed by a data token (refer to Figure 7-3). In case of Standard Capacity Card, the
size in the data token is determined by the block length set by SET_BLOCKLEN (CMD16).  In case of
SDHC and SDXC Cards, block length is fixed to  512 Bytes regardless of the block length set by
CMD16.

sector:  A number of blocks, basic erase unit (SD擦除单位)

可以设置为N*block

协议原文:

SECTOR_SIZE
The size of an erasable sector. The content of this register is a 7-bit binary coded value, defining the
number of write blocks (see WRITE_BL_LEN). The actual size is computed by increasing this number
by one. A value of zero means one write block, 127 means 128 write blocks.

Linux内核文件系统block与硬盘sector关系:

在系统运行过程中,有时会遇到下面打印信息,报告读写某个扇区错误

kernel: end_request: I/O error, dev sdg, sector 2252148039
kernel: end_request: I/O error, dev sdc, sector 3297222879

1、这个扇区(sector)的含义是什么?和硬盘上的sector是一回事吗?

2、Sector和文件系统中的Block有什么关系?

3、而在我们上层应用读写的是文件内偏移量pos,pos与block/Sector之间有什么关系?

文件偏移量pos,是针对文件本身而言,即文件内的偏移。

Block是文件系统上的概念,一般文件系统block大小为4K。

Sector是磁介质硬盘最小单元,一般为512字节。

Block值一般与sector值是不相等的。

阅读(11091) | 评论(0) | 转发(0) |
0

上一篇:uboot 交叉编译问题

下一篇:elisp编程入门

给主人留下些什么吧!~~