libosmocore 1.11.0.26-c59d.202505092026
Osmocom core library
|
Osmocom generic CRC routines (for max 16 bits poly). More...
Files | |
file | crc16.h |
This was copied from the linux kernel and adjusted for our types. | |
file | crcgen.h |
Osmocom generic CRC routines global header. | |
file | crc16.c |
This was copied from the linux kernel and adjusted for our types. | |
Data Structures | |
struct | osmo_crc16gen_code |
structure describing a given CRC code of max 16 bits More... | |
struct | osmo_crc32gen_code |
structure describing a given CRC code of max 32 bits More... | |
struct | osmo_crc64gen_code |
structure describing a given CRC code of max 64 bits More... | |
struct | osmo_crc8gen_code |
structure describing a given CRC code of max 8 bits More... | |
Variables | |
uint16_t const | osmo_crc16_table [256] |
CRC table for the CRC-16. | |
uint16_t const | osmo_crc16_ccitt_table [256] |
CRC table for the CCITT CRC-6. | |
uint16_t const | osmo_crc16_table [256] |
CRC table for the CRC-16. | |
uint16_t const | osmo_crc16_ccitt_table [256] |
CRC table for the CCITT CRC-6. | |
Osmocom generic CRC routines (for max 16 bits poly).
Osmocom generic CRC routines (for max 8 bits poly).
Osmocom generic CRC routines (for max 64 bits poly).
Osmocom generic CRC routines (for max 32 bits poly).
Compute 16bit CCITT polynome 0x8408 (x^0 + x^5 + x^12) over given buffer.
crc[in] | previous CRC value |
buffer[in] | data pointer |
len[in] | number of bytes in input buffer |
References len, and osmo_crc16_byte().
CRC-16 polynome 0x8005 (x^16 + x^15 + x^2 + 1)
References data, and osmo_crc16_table.
Referenced by osmo_crc16().
Compute 16bit CCITT polynome 0x8408 (x^0 + x^5 + x^12) over given buffer.
[in] | crc | initial value of CRC |
[in] | buffer | pointer to buffer of input data |
[in] | len | length of buffer in bytes |
References len, and osmo_crc16_ccitt_byte().
CCITT polynome 0x8408 (x^0 + x^5 + x^12)
References data, and osmo_crc16_ccitt_table.
Referenced by osmo_crc16_ccitt().
int osmo_crc16gen_check_bits | ( | const struct osmo_crc16gen_code * | code, |
const ubit_t * | in, | ||
int | len, | ||
const ubit_t * | crc_bits | ||
) |
Checks the CRC value of a given array of hard-bits.
[in] | code | The CRC code description to apply |
[in] | in | Array of hard bits |
[in] | len | Length of the array of hard bits |
[in] | crc_bits | Array of hard bits with the alleged CRC |
The crc_bits array must have a length of code->len
References osmo_crc16gen_code::bits, len, and osmo_crc16gen_compute_bits().
uint16_t osmo_crc16gen_compute_bits | ( | const struct osmo_crc16gen_code * | code, |
const ubit_t * | in, | ||
int | len | ||
) |
Compute the CRC value of a given array of hard-bits.
[in] | code | The CRC code description to apply |
[in] | in | Array of hard bits |
[in] | len | Length of the array of hard bits |
References osmo_crc16gen_code::bits, osmo_crc16gen_code::init, len, n, osmo_crc16gen_code::poly, and osmo_crc16gen_code::remainder.
Referenced by osmo_crc16gen_check_bits(), and osmo_crc16gen_set_bits().
void osmo_crc16gen_set_bits | ( | const struct osmo_crc16gen_code * | code, |
const ubit_t * | in, | ||
int | len, | ||
ubit_t * | crc_bits | ||
) |
Computes and writes the CRC value of a given array of bits.
[in] | code | The CRC code description to apply |
[in] | in | Array of hard bits |
[in] | len | Length of the array of hard bits |
[in] | crc_bits | Array of hard bits to write the computed CRC to |
The crc_bits array must have a length of code->len
References osmo_crc16gen_code::bits, len, and osmo_crc16gen_compute_bits().
int osmo_crc32gen_check_bits | ( | const struct osmo_crc32gen_code * | code, |
const ubit_t * | in, | ||
int | len, | ||
const ubit_t * | crc_bits | ||
) |
Checks the CRC value of a given array of hard-bits.
[in] | code | The CRC code description to apply |
[in] | in | Array of hard bits |
[in] | len | Length of the array of hard bits |
[in] | crc_bits | Array of hard bits with the alleged CRC |
The crc_bits array must have a length of code->len
References osmo_crc32gen_code::bits, len, and osmo_crc32gen_compute_bits().
uint32_t osmo_crc32gen_compute_bits | ( | const struct osmo_crc32gen_code * | code, |
const ubit_t * | in, | ||
int | len | ||
) |
Compute the CRC value of a given array of hard-bits.
[in] | code | The CRC code description to apply |
[in] | in | Array of hard bits |
[in] | len | Length of the array of hard bits |
References osmo_crc32gen_code::bits, osmo_crc32gen_code::init, len, n, osmo_crc32gen_code::poly, and osmo_crc32gen_code::remainder.
Referenced by osmo_crc32gen_check_bits(), and osmo_crc32gen_set_bits().
void osmo_crc32gen_set_bits | ( | const struct osmo_crc32gen_code * | code, |
const ubit_t * | in, | ||
int | len, | ||
ubit_t * | crc_bits | ||
) |
Computes and writes the CRC value of a given array of bits.
[in] | code | The CRC code description to apply |
[in] | in | Array of hard bits |
[in] | len | Length of the array of hard bits |
[in] | crc_bits | Array of hard bits to write the computed CRC to |
The crc_bits array must have a length of code->len
References osmo_crc32gen_code::bits, len, and osmo_crc32gen_compute_bits().
int osmo_crc64gen_check_bits | ( | const struct osmo_crc64gen_code * | code, |
const ubit_t * | in, | ||
int | len, | ||
const ubit_t * | crc_bits | ||
) |
Checks the CRC value of a given array of hard-bits.
[in] | code | The CRC code description to apply |
[in] | in | Array of hard bits |
[in] | len | Length of the array of hard bits |
[in] | crc_bits | Array of hard bits with the alleged CRC |
The crc_bits array must have a length of code->len
References osmo_crc64gen_code::bits, len, and osmo_crc64gen_compute_bits().
uint64_t osmo_crc64gen_compute_bits | ( | const struct osmo_crc64gen_code * | code, |
const ubit_t * | in, | ||
int | len | ||
) |
Compute the CRC value of a given array of hard-bits.
[in] | code | The CRC code description to apply |
[in] | in | Array of hard bits |
[in] | len | Length of the array of hard bits |
References osmo_crc64gen_code::bits, osmo_crc64gen_code::init, len, n, osmo_crc64gen_code::poly, and osmo_crc64gen_code::remainder.
Referenced by osmo_crc64gen_check_bits(), and osmo_crc64gen_set_bits().
void osmo_crc64gen_set_bits | ( | const struct osmo_crc64gen_code * | code, |
const ubit_t * | in, | ||
int | len, | ||
ubit_t * | crc_bits | ||
) |
Computes and writes the CRC value of a given array of bits.
[in] | code | The CRC code description to apply |
[in] | in | Array of hard bits |
[in] | len | Length of the array of hard bits |
[in] | crc_bits | Array of hard bits to write the computed CRC to |
The crc_bits array must have a length of code->len
References osmo_crc64gen_code::bits, len, and osmo_crc64gen_compute_bits().
int osmo_crc8gen_check_bits | ( | const struct osmo_crc8gen_code * | code, |
const ubit_t * | in, | ||
int | len, | ||
const ubit_t * | crc_bits | ||
) |
Checks the CRC value of a given array of hard-bits.
[in] | code | The CRC code description to apply |
[in] | in | Array of hard bits |
[in] | len | Length of the array of hard bits |
[in] | crc_bits | Array of hard bits with the alleged CRC |
The crc_bits array must have a length of code->len
References osmo_crc8gen_code::bits, len, and osmo_crc8gen_compute_bits().
uint8_t osmo_crc8gen_compute_bits | ( | const struct osmo_crc8gen_code * | code, |
const ubit_t * | in, | ||
int | len | ||
) |
Compute the CRC value of a given array of hard-bits.
[in] | code | The CRC code description to apply |
[in] | in | Array of hard bits |
[in] | len | Length of the array of hard bits |
References osmo_crc8gen_code::bits, osmo_crc8gen_code::init, len, n, osmo_crc8gen_code::poly, and osmo_crc8gen_code::remainder.
Referenced by osmo_crc8gen_check_bits(), and osmo_crc8gen_set_bits().
void osmo_crc8gen_set_bits | ( | const struct osmo_crc8gen_code * | code, |
const ubit_t * | in, | ||
int | len, | ||
ubit_t * | crc_bits | ||
) |
Computes and writes the CRC value of a given array of bits.
[in] | code | The CRC code description to apply |
[in] | in | Array of hard bits |
[in] | len | Length of the array of hard bits |
[in] | crc_bits | Array of hard bits to write the computed CRC to |
The crc_bits array must have a length of code->len
References osmo_crc8gen_code::bits, len, and osmo_crc8gen_compute_bits().
CRC table for the CCITT CRC-6.
The poly is 0x8408 (x^0 + x^5 + x^12)
Referenced by osmo_crc16_ccitt_byte().
CRC table for the CCITT CRC-6.
The poly is 0x8408 (x^0 + x^5 + x^12)
Referenced by osmo_crc16_ccitt_byte().
CRC table for the CRC-16.
The poly is 0x8005 (x^16 + x^15 + x^2 + 1)
Referenced by osmo_crc16_byte().
CRC table for the CRC-16.
The poly is 0x8005 (x^16 + x^15 + x^2 + 1)
Referenced by osmo_crc16_byte().