mirror of
https://github.com/apache/nuttx.git
synced 2026-08-01 20:28:58 +00: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:
parent
c061bb08c4
commit
4e2f6eabb3
2 changed files with 40 additions and 0 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue