annotate trau-decode/osmo_bits.h @ 14:98c0881c2af0

tfo/find-is-hdr: move here from freecalypso-reveng This little program was developed in freecalypso-reveng Hg repository in 2023-03, when we didn't have a separate repository for network-side reverse eng, but now that we do have separate repositories for FreeCalypso (mobile side) vs network side reverse eng, move TFO RE work to the proper place.
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 24 May 2024 21:18:22 +0000
parents d9c095357c32
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4
d9c095357c32 trau-parse: check and report EFR CRC
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 /*
d9c095357c32 trau-parse: check and report EFR CRC
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 * This include file has been put together from Osmocom (specifically
d9c095357c32 trau-parse: check and report EFR CRC
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 * libosmocore) header files, containing definitions for bit vector
d9c095357c32 trau-parse: check and report EFR CRC
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4 * manipulation and CRC functions.
d9c095357c32 trau-parse: check and report EFR CRC
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5 */
d9c095357c32 trau-parse: check and report EFR CRC
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6
d9c095357c32 trau-parse: check and report EFR CRC
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 /* from bits.h */
d9c095357c32 trau-parse: check and report EFR CRC
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8
d9c095357c32 trau-parse: check and report EFR CRC
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 /*! unpacked bit (0 or 1): 1 bit per byte */
d9c095357c32 trau-parse: check and report EFR CRC
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 typedef uint8_t ubit_t;
d9c095357c32 trau-parse: check and report EFR CRC
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11
d9c095357c32 trau-parse: check and report EFR CRC
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12 /* from crc8gen.h */
d9c095357c32 trau-parse: check and report EFR CRC
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13
d9c095357c32 trau-parse: check and report EFR CRC
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14 /*! structure describing a given CRC code of max 8 bits */
d9c095357c32 trau-parse: check and report EFR CRC
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15 struct osmo_crc8gen_code {
d9c095357c32 trau-parse: check and report EFR CRC
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16 int bits; /*!< Actual number of bits of the CRC */
d9c095357c32 trau-parse: check and report EFR CRC
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17 uint8_t poly; /*!< Polynom (normal representation, MSB omitted */
d9c095357c32 trau-parse: check and report EFR CRC
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 uint8_t init; /*!< Initialization value of the CRC state */
d9c095357c32 trau-parse: check and report EFR CRC
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 uint8_t remainder; /*!< Remainder of the CRC (final XOR) */
d9c095357c32 trau-parse: check and report EFR CRC
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20 };
d9c095357c32 trau-parse: check and report EFR CRC
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21
d9c095357c32 trau-parse: check and report EFR CRC
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 uint8_t osmo_crc8gen_compute_bits(const struct osmo_crc8gen_code *code,
d9c095357c32 trau-parse: check and report EFR CRC
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23 const ubit_t *in, int len);
d9c095357c32 trau-parse: check and report EFR CRC
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 int osmo_crc8gen_check_bits(const struct osmo_crc8gen_code *code,
d9c095357c32 trau-parse: check and report EFR CRC
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25 const ubit_t *in, int len, const ubit_t *crc_bits);
d9c095357c32 trau-parse: check and report EFR CRC
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26 void osmo_crc8gen_set_bits(const struct osmo_crc8gen_code *code,
d9c095357c32 trau-parse: check and report EFR CRC
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27 const ubit_t *in, int len, ubit_t *crc_bits);