FreeCalypso > hg > sipout-test-utils
comparison libutil/osmo_bits.h @ 0:35c0d9f03c0a
beginning with sipout-test-voice,
a copy of sip-manual-out from themwi-system-sw
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sun, 03 Mar 2024 23:20:19 -0800 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:35c0d9f03c0a |
---|---|
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); | |
28 | |
29 /* | |
30 * Themyscira-added (not Osmocom-originating) functions | |
31 * that use the ubit_t defined type that (to our knowledge) | |
32 * was invented by Osmocom. | |
33 */ | |
34 | |
35 void uint16_to_bits(uint16_t word, ubit_t *out, unsigned nbits); |