SatCat5
crc16_checksum.h File Reference

Detailed Description

Inline CRC16 Checksum insertion and verification.

This file defines two commonly-used formats for "CCITT" CRC16 checksums. Both are commonly used variants of the "CRC16-CCITT" standard defined in ITU-T Recommendation V.41. "KERMIT" is the LSB-first variant and "XMODEM" is the MSB-first variant.

For more information, see discussion from Greg Cook: https://reveng.sourceforge.io/crc-catalogue/16.htm#crc.cat.crc-16-ibm-3740 https://reveng.sourceforge.io/crc-catalogue/16.htm#crc.cat.crc-16-kermit https://reveng.sourceforge.io/crc-catalogue/16.htm#crc.cat.crc-16-xmodem

The blocks below transmit or receive sequences where the the CRC16 appears at the end of the encoded frame. The KermitTx and XmodemTx classes accept the frame contents and append the designated CRC16 variant. The KermitRx and XmodemRx classes verify the checksum of incoming frames, calling write_finalize() or write_abort() appropriately.

Note that the CRC16 used in the CCSDS "AOS Space Data Link Protocol" (Blue Book 732.0-B-4) is equivalent to "IBM-3740" (link above), which is the "XMODEM" variant with an initial value of 0xFFFF instead of zero.

Definition in file crc16_checksum.h.

Include dependency graph for crc16_checksum.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  satcat5::crc16::KermitTx
 Append FCS to each outgoing frame ("KERMIT" variant). More...
 
class  satcat5::crc16::KermitRx
 Check and remove FCS from each incoming frame ("KERMIT" variant). More...
 
class  satcat5::crc16::XmodemTx
 Append FCS to each outgoing frame ("XMODEM" variant). More...
 
class  satcat5::crc16::XmodemRx
 Check and remove FCS from each incoming frame ("XMODEM" variant). More...
 

Functions

u16 satcat5::crc16::kermit (unsigned nbytes, const void *data)
 Directly calculate CRC16 on a block of data. More...
 
u16 satcat5::crc16::xmodem (unsigned nbytes, const void *data)
 Directly calculate CRC16 on a block of data. More...
 

Function Documentation

◆ kermit()

u16 satcat5::crc16::kermit ( unsigned  nbytes,
const void *  data 
)

Directly calculate CRC16 on a block of data.

This is the "KERMIT" variant,

See also
crc16_checksum.h.

Definition at line 151 of file crc16_checksum.cc.

◆ xmodem()

u16 satcat5::crc16::xmodem ( unsigned  nbytes,
const void *  data 
)

Directly calculate CRC16 on a block of data.

This is the "XMODEM" variant,

See also
crc16_checksum.h.

Definition at line 160 of file crc16_checksum.cc.