Harald Welte | 065dab8 | 2022-11-29 23:13:06 +0100 | [diff] [blame] | 1 | #pragma once |
| 2 | |
| 3 | #include <osmocom/core/bits.h> |
| 4 | |
| 5 | /* See Section 5.1.2.1 of ITU-T V.110 */ |
| 6 | #define MAX_D_BITS 48 |
| 7 | #define MAX_E_BITS 7 |
| 8 | #define MAX_S_BITS 9 |
| 9 | #define MAX_X_BITS 2 |
| 10 | |
| 11 | /*! a 'decoded' representation of a single V.110 frame. contains unpacket D, E, S and X bits */ |
| 12 | struct osmo_v110_decoded_frame { |
| 13 | ubit_t d_bits[MAX_D_BITS]; |
| 14 | ubit_t e_bits[MAX_E_BITS]; |
| 15 | ubit_t s_bits[MAX_S_BITS]; |
| 16 | ubit_t x_bits[MAX_X_BITS]; |
| 17 | }; |
| 18 | |
| 19 | int osmo_v110_decode_frame(struct osmo_v110_decoded_frame *fr, const ubit_t *ra_bits, size_t n_bits); |
| 20 | int osmo_v110_encode_frame(ubit_t *ra_bits, size_t n_bits, const struct osmo_v110_decoded_frame *fr); |
| 21 | |
| 22 | void osmo_v110_ubit_dump(FILE *outf, const ubit_t *fr, size_t in_len); |
| 23 | |
| 24 | |
| 25 | /*! enum for each supported V.110 synchronous RA1 function (one for each user bitrate) */ |
| 26 | enum osmo_v100_sync_ra1_rate { |
| 27 | OSMO_V110_SYNC_RA1_600, |
| 28 | OSMO_V110_SYNC_RA1_1200, |
| 29 | OSMO_V110_SYNC_RA1_2400, |
| 30 | OSMO_V110_SYNC_RA1_4800, |
| 31 | OSMO_V110_SYNC_RA1_7200, |
| 32 | OSMO_V110_SYNC_RA1_9600, |
| 33 | OSMO_V110_SYNC_RA1_12000, |
| 34 | OSMO_V110_SYNC_RA1_14400, |
| 35 | OSMO_V110_SYNC_RA1_19200, |
| 36 | OSMO_V110_SYNC_RA1_24000, |
| 37 | OSMO_V110_SYNC_RA1_28800, |
| 38 | OSMO_V110_SYNC_RA1_38400, |
| 39 | _NUM_OSMO_V110_SYNC_RA1 |
| 40 | }; |
| 41 | |
| 42 | int osmo_v110_sync_ra1_get_user_data_chunk_bitlen(enum osmo_v100_sync_ra1_rate rate); |
| 43 | int osmo_v110_sync_ra1_get_user_data_rate(enum osmo_v100_sync_ra1_rate rate); |
| 44 | int osmo_v110_sync_ra1_get_intermediate_rate(enum osmo_v100_sync_ra1_rate rate); |
| 45 | |
| 46 | int osmo_v110_sync_ra1_user_to_ir(enum osmo_v100_sync_ra1_rate rate, struct osmo_v110_decoded_frame *fr, |
| 47 | const ubit_t *d_in, size_t in_len); |
| 48 | |
| 49 | int osmo_v110_sync_ra1_ir_to_user(enum osmo_v100_sync_ra1_rate rate, ubit_t *d_out, size_t out_len, |
| 50 | const struct osmo_v110_decoded_frame *fr); |