CRC: Cyclic redundancy check 循环冗余校验
具体的计算原理与方法参考:http://en.wikipedia.org/wiki/Cyclic_redundancy_check
内核中使用的crc16计算方法位于代码树/lib/crc16.c文件中
crc32的计算方法位于代码树/lib/crc32.c文件中
均采用了查表法
其中crc32的表由代码树/lib/gen_crc32table.c中的主机小程序计算而来
生成的冗余表保存在文件/lib/crc32table.h中
具体的计算方法可以参考gen_crc32table.c中的代码
/lib/crc16.c中的crc16_table是直接定义的,没有提供计算代码
在学习了wiki上介绍的原理后,参考内核中crc32的计算方法,写了个crc16的代码
生成crc16_table表
/*
* crc16gen.c - CRC-16 table gen routine
*
* Generate the standard CRC-16 table:
* Width 16
* Poly 0x8005 (x^16 + x^15 + x^2 + 1)
* Init 0
*
* <kernel.digger@gmail.com>
*
* This source code is licensed under the GN