spandsp 0.0.6
|
#include <inttypes.h>
#include <stdio.h>
#include <string.h>
#include "spandsp/telephony.h"
#include "spandsp/crc.h"
#include "spandsp/bit_operations.h"
Functions | |
uint32_t | crc_itu32_calc (const uint8_t *buf, int len, uint32_t crc) |
Calculate the ITU/CCITT CRC-32 value in buffer. More... | |
int | crc_itu32_append (uint8_t *buf, int len) |
Append an ITU/CCITT CRC-32 value to a frame. More... | |
int | crc_itu32_check (const uint8_t *buf, int len) |
Check the ITU/CCITT CRC-32 value in a frame. More... | |
uint16_t | crc_itu16_calc (const uint8_t *buf, int len, uint16_t crc) |
Calculate the ITU/CCITT CRC-16 value in buffer by whole bytes. More... | |
uint16_t | crc_itu16_bits (uint8_t buf, int len, uint16_t crc) |
Calculate the ITU/CCITT CRC-16 value of some bits from a byte. More... | |
int | crc_itu16_append (uint8_t *buf, int len) |
Append an ITU/CCITT CRC-16 value to a frame. More... | |
int | crc_itu16_check (const uint8_t *buf, int len) |
Check the ITU/CCITT CRC-16 value in a frame. More... | |
int crc_itu16_append | ( | uint8_t * | buf, |
int | len | ||
) |
Append an ITU/CCITT CRC-16 value to a frame.
buf | The buffer containing the frame. This must be at least 2 bytes longer than the frame it contains, to allow room for the CRC value. |
len | The length of the frame. |
uint16_t crc_itu16_bits | ( | uint8_t | buf, |
int | len, | ||
uint16_t | crc | ||
) |
Calculate the ITU/CCITT CRC-16 value of some bits from a byte.
buf | The buffer containing the byte of data. |
len | The number of bits, starting from the LSB. |
crc | The initial CRC value. This is usually 0xFFFF, or 0 for a new block (it depends on the application). It is previous returned CRC value for the continuation of a block. |
uint16_t crc_itu16_calc | ( | const uint8_t * | buf, |
int | len, | ||
uint16_t | crc | ||
) |
Calculate the ITU/CCITT CRC-16 value in buffer by whole bytes.
buf | The buffer containing the data. |
len | The length of the frame. |
crc | The initial CRC value. This is usually 0xFFFF, or 0 for a new block (it depends on the application). It is previous returned CRC value for the continuation of a block. |
int crc_itu16_check | ( | const uint8_t * | buf, |
int | len | ||
) |
Check the ITU/CCITT CRC-16 value in a frame.
buf | The buffer containing the frame. |
len | The length of the frame. |
int crc_itu32_append | ( | uint8_t * | buf, |
int | len | ||
) |
Append an ITU/CCITT CRC-32 value to a frame.
buf | The buffer containing the frame. This must be at least 2 bytes longer than the frame it contains, to allow room for the CRC value. |
len | The length of the frame. |
uint32_t crc_itu32_calc | ( | const uint8_t * | buf, |
int | len, | ||
uint32_t | crc | ||
) |
Calculate the ITU/CCITT CRC-32 value in buffer.
buf | The buffer containing the data. |
len | The length of the frame. |
crc | The initial CRC value. This is usually 0xFFFFFFFF, or 0 for a new block (it depends on the application). It is previous returned CRC value for the continuation of a block. |
int crc_itu32_check | ( | const uint8_t * | buf, |
int | len | ||
) |
Check the ITU/CCITT CRC-32 value in a frame.
buf | The buffer containing the frame. |
len | The length of the frame. |