没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
Draft
1
CYCLIC REDUNDANCY CHECKS IN USB
Introduction
The USB specification calls for the use of Cyclic Redundancy Checksums (CRC) to
protect all non-PID fields in token and data packets from errors during transmission. This
paper describes the mathematical basis behind CRC in an intuitive fashion and then
explains the specific implementation called for in USB. Perl programs to generate these
CRCs are provided and several examples are used to clear up possible ambiguous areas.
Two-minute mathematical background
The well-known concept of integer division forms the basis for the use of CRCs. When a
dividend is divided by a divisor, a quotient and a remainder (which may be 0) result. If
the remainder is subtracted from the dividend and this is divided by the divisor, the
remainder is always zero. e.g. when 629 is divided by 25, the remainder is 4. If the
dividend (629) and the remainder (4) are transmitted from a source to a target, the
integrity of the transmission can be verified at the target by recomputing the remainder and
verifying that the remainder matches the transmitted remainder. Alternatively, the target
could divide the difference between the transmitted dividend and remainder and expect to
see a zero remainder if there were no errors.
The concept of integer division can also be applied to division of polynomials. (An
intuitive way to understand this is by considering that the digits which make up an integer
can be considered the coefficients of a polynomial in base 10 e.g. 629 = 6*10
2
+ 2* 10
1
+
9*10
0
.). A binary bitstream (which is a pattern of 1s and 0s) can be considered to
represent the coefficients of a (dividend) polynomial. When this polynomial is divided by
a generator (divisor) polynomial (which is another binary bitstream) a remainder
polynomial (CRC) will result. The arithmetic is especially simplified if 1 and 0 are
considered to be elements of a finite field (the Galois field of order 2 or GF(2)) . The
arithmetic is sometimes referred to as modulo 2 arithmetic. For the purposes of CRC
computation, it is sufficient to understand that addition and subtraction in this field reduce
to simple XOR operations. This is the basis of the technique used for generating and
checking CRC for USB packets.
CRCs are useful because they are capable of detecting all single and double errors and
many multiple errors with a small number of bits. Communications protocols often use
two CRCs in a packet - one to protect the header of the packet and another to protect the
data portion of the packet. In USB the header of the packet is the PID field. Since this
field is only 4 bits long it is protected by a 4 bit check field derived by simple bitwise
inversion of the PID field. This provides adequate single-bit and burst error protection
资源评论
- xecho1152012-11-25根据这程序理解了USB的CRC
- greenhomeshen2011-11-08好东西,最近在分析USB协议,对CRC的算法一直没有很好的理解,看了此文档,终于搞清楚了,谢谢作者!
hello_wangtp
- 粉丝: 1
- 资源: 2
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功