mirror of
https://github.com/apache/nuttx.git
synced 2026-09-22 14:41:29 +08:00
libs/libc/crc16: add some comments for crc16ccitt
The search table of ccitt should describe more algorithm details: - CRC-16/CCITT, CRC-16/CCITT-TRUE, CRC-16/KERMIT initial seed: 0x0000, xor output: 0x0000 : width=16 : poly=0x1021 : init=0x0000 : refin=true : refout=true : xorout=0x0000 : check=0x2189 : residue=0x0000 : name="CRC-16/KERMIT" https://reveng.sourceforge.io/crc-catalogue/16.htm#crc.cat.crc-16-kermit Signed-off-by: chao an <anchao.archer@bytedance.com>
This commit is contained in:
@@ -77,6 +77,16 @@ uint16_t crc16(FAR const uint8_t *src, size_t len);
|
||||
* Continue 16-bit CRC-CCITT calculation on a part of the buffer using the
|
||||
* polynomial x^16+x^12+x^5+1.
|
||||
*
|
||||
* This function is able to calculate any CRC that uses 0x1021 as it
|
||||
* polynomial and requires reflecting both the input and the output.
|
||||
* The following checksums can, among others, be calculated by this
|
||||
* function, depending on the value provided for the initial seed and the
|
||||
* value the final calculated CRC is XORed with:
|
||||
*
|
||||
* - CRC-16/CCITT, CRC-16/CCITT-TRUE, CRC-16/KERMIT
|
||||
* https://reveng.sourceforge.io/crc-catalogue/16.htm#crc.cat.crc-16-kermit
|
||||
* initial seed: 0x0000, xor output: 0x0000
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
uint16_t crc16ccittpart(FAR const uint8_t *src, size_t len,
|
||||
@@ -89,6 +99,16 @@ uint16_t crc16ccittpart(FAR const uint8_t *src, size_t len,
|
||||
* Return a 16-bit CRC-CCITT of the contents of the 'src' buffer, length
|
||||
* 'len' using the polynomial x^16+x^12+x^5+1.
|
||||
*
|
||||
* This function is able to calculate any CRC that uses 0x1021 as it
|
||||
* polynomial and requires reflecting both the input and the output.
|
||||
* The following checksums can, among others, be calculated by this
|
||||
* function, depending on the value provided for the initial seed and the
|
||||
* value the final calculated CRC is XORed with:
|
||||
*
|
||||
* - CRC-16/CCITT, CRC-16/CCITT-TRUE, CRC-16/KERMIT
|
||||
* https://reveng.sourceforge.io/crc-catalogue/16.htm#crc.cat.crc-16-kermit
|
||||
* initial seed: 0x0000, xor output: 0x0000
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
uint16_t crc16ccitt(FAR const uint8_t *src, size_t len);
|
||||
|
||||
@@ -82,6 +82,16 @@ static uint16_t crc16ccitt_tab[256] =
|
||||
* Continue 16-bit CRC-CCITT calculation on a part of the buffer using the
|
||||
* polynomial x^16+x^12+x^5+1.
|
||||
*
|
||||
* This function is able to calculate any CRC that uses 0x1021 as it
|
||||
* polynomial and requires reflecting both the input and the output.
|
||||
* The following checksums can, among others, be calculated by this
|
||||
* function, depending on the value provided for the initial seed and the
|
||||
* value the final calculated CRC is XORed with:
|
||||
*
|
||||
* - CRC-16/CCITT, CRC-16/CCITT-TRUE, CRC-16/KERMIT
|
||||
* https://reveng.sourceforge.io/crc-catalogue/16.htm#crc.cat.crc-16-kermit
|
||||
* initial seed: 0x0000, xor output: 0x0000
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
uint16_t crc16ccittpart(FAR const uint8_t *src, size_t len,
|
||||
@@ -105,6 +115,16 @@ uint16_t crc16ccittpart(FAR const uint8_t *src, size_t len,
|
||||
* Return a 16-bit CRC-CCITT of the contents of the 'src' buffer, length
|
||||
* 'len' using the polynomial x^16+x^12+x^5+1.
|
||||
*
|
||||
* This function is able to calculate any CRC that uses 0x1021 as it
|
||||
* polynomial and requires reflecting both the input and the output.
|
||||
* The following checksums can, among others, be calculated by this
|
||||
* function, depending on the value provided for the initial seed and the
|
||||
* value the final calculated CRC is XORed with:
|
||||
*
|
||||
* - CRC-16/CCITT, CRC-16/CCITT-TRUE, CRC-16/KERMIT
|
||||
* https://reveng.sourceforge.io/crc-catalogue/16.htm#crc.cat.crc-16-kermit
|
||||
* initial seed: 0x0000, xor output: 0x0000
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
uint16_t crc16ccitt(FAR const uint8_t *src, size_t len)
|
||||
|
||||
Reference in New Issue
Block a user