libosmoisdn 1.13.1.1-afb4 Osmocom ISDN library

v110.h
Go to the documentation of this file.
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
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
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 extern const ubit_t osmo_v110_e1e2e3[_NUM_OSMO_V110_SYNC_RA1][3];
43
44#define osmo_v110_e1e2e3_set(e_bits, rate) \
45 memcpy(e_bits, osmo_v110_e1e2e3[rate], 3)
46#define osmo_v110_e1e2e3_cmp(e_bits, rate) \
47 memcmp(e_bits, osmo_v110_e1e2e3[rate], 3)
48
49 int osmo_v110_sync_ra1_get_user_data_chunk_bitlen(enum osmo_v100_sync_ra1_rate rate);
50 int osmo_v110_sync_ra1_get_user_data_rate(enum osmo_v100_sync_ra1_rate rate);
51 int osmo_v110_sync_ra1_get_intermediate_rate(enum osmo_v100_sync_ra1_rate rate);
52
53 int osmo_v110_sync_ra1_user_to_ir(enum osmo_v100_sync_ra1_rate rate, struct osmo_v110_decoded_frame *fr,
54 const ubit_t *d_in, size_t in_len);
55
56 int osmo_v110_sync_ra1_ir_to_user(enum osmo_v100_sync_ra1_rate rate, ubit_t *d_out, size_t out_len,
57 const struct osmo_v110_decoded_frame *fr);
bits.h
ubit_t
uint8_t ubit_t
osmo_v110_decoded_frame
a 'decoded' representation of a single V.110 frame.
Definition: v110.h:12
osmo_v110_decoded_frame::s_bits
ubit_t s_bits[MAX_S_BITS]
Definition: v110.h:15
osmo_v110_decoded_frame::x_bits
ubit_t x_bits[MAX_X_BITS]
Definition: v110.h:16
osmo_v110_decoded_frame::d_bits
ubit_t d_bits[MAX_D_BITS]
Definition: v110.h:13
osmo_v110_decoded_frame::e_bits
ubit_t e_bits[MAX_E_BITS]
Definition: v110.h:14
osmo_v110_sync_ra1_get_intermediate_rate
int osmo_v110_sync_ra1_get_intermediate_rate(enum osmo_v100_sync_ra1_rate rate)
obtain the intermediate rate (in bits/s) for specified RA1 rate
Definition: v110.c:554
MAX_E_BITS
#define MAX_E_BITS
Definition: v110.h:7
osmo_v110_ubit_dump
void osmo_v110_ubit_dump(FILE *outf, const ubit_t *fr, size_t in_len)
Print a encoded V.110 frame in the same table-like structure as the spec.
Definition: v110.c:127
MAX_S_BITS
#define MAX_S_BITS
Definition: v110.h:8
osmo_v110_e1e2e3
const ubit_t osmo_v110_e1e2e3[_NUM_OSMO_V110_SYNC_RA1][3]
E1/E2/E3 bit values as per Table 5/V.110.
Definition: v110.c:147
osmo_v110_sync_ra1_user_to_ir
int osmo_v110_sync_ra1_user_to_ir(enum osmo_v100_sync_ra1_rate rate, struct osmo_v110_decoded_frame *fr, const ubit_t *d_in, size_t in_len)
perform V.110 RA1 function in user rate -> intermediate rate direction.
Definition: v110.c:568
osmo_v100_sync_ra1_rate
osmo_v100_sync_ra1_rate
enum for each supported V.110 synchronous RA1 function (one for each user bitrate)
Definition: v110.h:26
OSMO_V110_SYNC_RA1_14400
@ OSMO_V110_SYNC_RA1_14400
Definition: v110.h:34
OSMO_V110_SYNC_RA1_9600
@ OSMO_V110_SYNC_RA1_9600
Definition: v110.h:32
OSMO_V110_SYNC_RA1_28800
@ OSMO_V110_SYNC_RA1_28800
Definition: v110.h:37
OSMO_V110_SYNC_RA1_1200
@ OSMO_V110_SYNC_RA1_1200
Definition: v110.h:28
OSMO_V110_SYNC_RA1_4800
@ OSMO_V110_SYNC_RA1_4800
Definition: v110.h:30
OSMO_V110_SYNC_RA1_2400
@ OSMO_V110_SYNC_RA1_2400
Definition: v110.h:29
OSMO_V110_SYNC_RA1_12000
@ OSMO_V110_SYNC_RA1_12000
Definition: v110.h:33
_NUM_OSMO_V110_SYNC_RA1
@ _NUM_OSMO_V110_SYNC_RA1
Definition: v110.h:39
OSMO_V110_SYNC_RA1_7200
@ OSMO_V110_SYNC_RA1_7200
Definition: v110.h:31
OSMO_V110_SYNC_RA1_38400
@ OSMO_V110_SYNC_RA1_38400
Definition: v110.h:38
OSMO_V110_SYNC_RA1_600
@ OSMO_V110_SYNC_RA1_600
Definition: v110.h:27
OSMO_V110_SYNC_RA1_19200
@ OSMO_V110_SYNC_RA1_19200
Definition: v110.h:35
OSMO_V110_SYNC_RA1_24000
@ OSMO_V110_SYNC_RA1_24000
Definition: v110.h:36
osmo_v110_sync_ra1_get_user_data_chunk_bitlen
int osmo_v110_sync_ra1_get_user_data_chunk_bitlen(enum osmo_v100_sync_ra1_rate rate)
obtain the size (in number of bits) of the user data bits in one V.110 frame for specified RA1 rate
Definition: v110.c:536
MAX_X_BITS
#define MAX_X_BITS
Definition: v110.h:9
osmo_v110_decode_frame
int osmo_v110_decode_frame(struct osmo_v110_decoded_frame *fr, const ubit_t *ra_bits, size_t n_bits)
Decode a 80-bit V.110 frame present as 80 ubits into a struct osmo_v110_decoded_frame.
Definition: v110.c:45
MAX_D_BITS
#define MAX_D_BITS
Definition: v110.h:6
osmo_v110_sync_ra1_ir_to_user
int osmo_v110_sync_ra1_ir_to_user(enum osmo_v100_sync_ra1_rate rate, ubit_t *d_out, size_t out_len, const struct osmo_v110_decoded_frame *fr)
perform V.110 RA1 function in intermediate rate -> user rate direction.
Definition: v110.c:583
osmo_v110_sync_ra1_get_user_data_rate
int osmo_v110_sync_ra1_get_user_data_rate(enum osmo_v100_sync_ra1_rate rate)
obtain the user data rate (in bits/s) for specified RA1 rate
Definition: v110.c:545
osmo_v110_encode_frame
int osmo_v110_encode_frame(ubit_t *ra_bits, size_t n_bits, const struct osmo_v110_decoded_frame *fr)
Encode a struct osmo_v110_decoded_frame into an 80-bit V.110 frame as ubits.
Definition: v110.c:84