FreeCalypso > hg > gsm-net-reveng
annotate trau-decode/osmo_bits.h @ 30:19039ffbe605
tfo-trace-msg: higher level of decoding for TFO_REQ
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Wed, 28 Aug 2024 03:03:46 +0000 |
parents | d9c095357c32 |
children |
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); |