comparison trau-decode/osmo_bits.h @ 4:d9c095357c32

trau-parse: check and report EFR CRC
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 24 May 2024 09:16:35 +0000
parents
children
comparison
equal deleted inserted replaced
3:64b15810dc4c 4:d9c095357c32
1 /*
2 * This include file has been put together from Osmocom (specifically
3 * libosmocore) header files, containing definitions for bit vector
4 * manipulation and CRC functions.
5 */
6
7 /* from bits.h */
8
9 /*! unpacked bit (0 or 1): 1 bit per byte */
10 typedef uint8_t ubit_t;
11
12 /* from crc8gen.h */
13
14 /*! structure describing a given CRC code of max 8 bits */
15 struct osmo_crc8gen_code {
16 int bits; /*!< Actual number of bits of the CRC */
17 uint8_t poly; /*!< Polynom (normal representation, MSB omitted */
18 uint8_t init; /*!< Initialization value of the CRC state */
19 uint8_t remainder; /*!< Remainder of the CRC (final XOR) */
20 };
21
22 uint8_t osmo_crc8gen_compute_bits(const struct osmo_crc8gen_code *code,
23 const ubit_t *in, int len);
24 int osmo_crc8gen_check_bits(const struct osmo_crc8gen_code *code,
25 const ubit_t *in, int len, const ubit_t *crc_bits);
26 void osmo_crc8gen_set_bits(const struct osmo_crc8gen_code *code,
27 const ubit_t *in, int len, ubit_t *crc_bits);