libosmocoding  0.12.0.55-9540
Osmocom GSM/GPRS/EGPRS L1 channel coding library
Coding

GSM TS 05.03 coding. More...

Files

file  gsm0503_coding.h
 GSM TS 05.03 coding.
 
file  gsm0503_coding.c
 

Data Structures

union  gprs_rlc_ul_hdr_egprs
 union across the three different EGPRS Uplink header types More...
 
union  gprs_rlc_dl_hdr_egprs
 union across the three different EGPRS Downlink header types More...
 
struct  gsm0503_mcs_code
 Structure describing a Modulation and Coding Scheme. More...
 

Macros

#define GSM0503_GPRS_BURSTS_NBITS   (116 * 4)
 
#define GSM0503_EGPRS_BURSTS_NBITS   (348 * 4)
 
#define EGPRS_HDR_UPP_MAX   54
 
#define EGPRS_HDR_C_MAX   162
 
#define EGPRS_HDR_HC_MAX   160
 
#define EGPRS_DATA_U_MAX   612
 
#define EGPRS_DATA_C_MAX   1836
 
#define EGPRS_DATA_DC_MAX   1248
 
#define EGPRS_DATA_C1   612
 
#define EGPRS_DATA_C2   EGPRS_DATA_C1
 

Enumerations

enum  gsm0503_egprs_mcs {
  EGPRS_MCS0,
  EGPRS_MCS1,
  EGPRS_MCS2,
  EGPRS_MCS3,
  EGPRS_MCS4,
  EGPRS_MCS5,
  EGPRS_MCS6,
  EGPRS_MCS7,
  EGPRS_MCS8,
  EGPRS_MCS9,
  EGPRS_NUM_MCS
}
 

Functions

int gsm0503_xcch_encode (ubit_t *bursts, const uint8_t *l2_data)
 Encoding of xCCH data from L2 frame to bursts. More...
 
int gsm0503_xcch_decode (uint8_t *l2_data, const sbit_t *bursts, int *n_errors, int *n_bits_total)
 Decoding of xCCH data from bursts to L2 frame. More...
 
int gsm0503_pdtch_encode (ubit_t *bursts, const uint8_t *l2_data, uint8_t l2_len)
 GPRS DL message encoding. More...
 
int gsm0503_pdtch_decode (uint8_t *l2_data, const sbit_t *bursts, uint8_t *usf_p, int *n_errors, int *n_bits_total)
 Decode GPRS PDTCH. More...
 
int gsm0503_pdtch_egprs_encode (ubit_t *bursts, const uint8_t *l2_data, uint8_t l2_len)
 EGPRS DL message encoding. More...
 
int gsm0503_pdtch_egprs_decode (uint8_t *l2_data, const sbit_t *bursts, uint16_t nbits, uint8_t *usf_p, int *n_errors, int *n_bits_total)
 Decode EGPRS UL message. More...
 
int gsm0503_tch_fr_encode (ubit_t *bursts, const uint8_t *tch_data, int len, int net_order)
 Perform channel encoding on a TCH/FS channel according to TS 05.03. More...
 
int gsm0503_tch_fr_decode (uint8_t *tch_data, const sbit_t *bursts, int net_order, int efr, int *n_errors, int *n_bits_total)
 Perform channel decoding of a FR/EFR channel according TS 05.03. More...
 
int gsm0503_tch_hr_encode (ubit_t *bursts, const uint8_t *tch_data, int len)
 Perform channel encoding on a TCH/HS channel according to TS 05.03. More...
 
int gsm0503_tch_hr_decode (uint8_t *tch_data, const sbit_t *bursts, int odd, int *n_errors, int *n_bits_total)
 Perform channel decoding of a HR(v1) channel according TS 05.03. More...
 
int gsm0503_tch_afs_encode (ubit_t *bursts, const uint8_t *tch_data, int len, int codec_mode_req, uint8_t *codec, int codecs, uint8_t ft, uint8_t cmr)
 Perform channel encoding on a TCH/AFS channel according to TS 05.03. More...
 
int gsm0503_tch_afs_decode (uint8_t *tch_data, const sbit_t *bursts, int codec_mode_req, uint8_t *codec, int codecs, uint8_t *ft, uint8_t *cmr, int *n_errors, int *n_bits_total)
 Perform channel decoding of a TCH/AFS channel according TS 05.03. More...
 
int gsm0503_tch_ahs_encode (ubit_t *bursts, const uint8_t *tch_data, int len, int codec_mode_req, uint8_t *codec, int codecs, uint8_t ft, uint8_t cmr)
 Perform channel encoding on a TCH/AHS channel according to TS 05.03. More...
 
int gsm0503_tch_ahs_decode (uint8_t *tch_data, const sbit_t *bursts, int odd, int codec_mode_req, uint8_t *codec, int codecs, uint8_t *ft, uint8_t *cmr, int *n_errors, int *n_bits_total)
 Perform channel decoding of a TCH/AFS channel according TS 05.03. More...
 
int gsm0503_rach_ext_encode (ubit_t *burst, uint16_t ra11, uint8_t bsic, bool is_11bit)
 Encode the Extended (11-bit) or regular (8-bit) RACH according to 3GPP TS 45.003. More...
 
int gsm0503_rach_encode (ubit_t *burst, const uint8_t *ra, uint8_t bsic)
 Encode the (8-bit) RACH according to TS 05.03. More...
 
int gsm0503_rach_decode (uint8_t *ra, const sbit_t *burst, uint8_t bsic)
 Decode the (8-bit) RACH according to TS 05.03. More...
 
int gsm0503_rach_decode_ber (uint8_t *ra, const sbit_t *burst, uint8_t bsic, int *n_errors, int *n_bits_total)
 Decode the (8-bit) RACH according to TS 05.03. More...
 
int gsm0503_rach_ext_decode (uint16_t *ra, const sbit_t *burst, uint8_t bsic)
 Decode the Extended (11-bit) RACH according to 3GPP TS 45.003. More...
 
int gsm0503_rach_ext_decode_ber (uint16_t *ra, const sbit_t *burst, uint8_t bsic, int *n_errors, int *n_bits_total)
 Decode the Extended (11-bit) RACH according to 3GPP TS 45.003. More...
 
int gsm0503_sch_encode (ubit_t *burst, const uint8_t *sb_info)
 Encode the SCH according to TS 05.03. More...
 
int gsm0503_sch_decode (uint8_t *sb_info, const sbit_t *burst)
 Decode the SCH according to TS 05.03. More...
 
static int osmo_conv_decode_ber_punctured (const struct osmo_conv_code *code, const sbit_t *input, ubit_t *output, int *n_errors, int *n_bits_total, const uint8_t *data_punc)
 Convolutional Decode + compute BER for punctured codes. More...
 
static int osmo_conv_decode_ber (const struct osmo_conv_code *code, const sbit_t *input, ubit_t *output, int *n_errors, int *n_bits_total)
 Convolutional Decode + compute BER for non-punctured codes. More...
 
static int _xcch_decode_cB (uint8_t *l2_data, const sbit_t *cB, int *n_errors, int *n_bits_total)
 convenience wrapper for decoding coded bits More...
 
static int _xcch_encode_cB (ubit_t *cB, const uint8_t *l2_data)
 convenience wrapper for encoding to coded bits More...
 
static int egprs_type3_unmap (const sbit_t *bursts, sbit_t *hc, sbit_t *dc)
 
static int egprs_type2_unmap (const sbit_t *bursts, sbit_t *hc, sbit_t *dc)
 
static int egprs_type1_unmap (const sbit_t *bursts, sbit_t *hc, sbit_t *c1, sbit_t *c2, int msc)
 
static int _egprs_decode_hdr (const sbit_t *hc, int mcs, union gprs_rlc_ul_hdr_egprs *hdr)
 
static int egprs_decode_hdr (union gprs_rlc_ul_hdr_egprs *hdr, const sbit_t *bursts, uint16_t nbits)
 
static int egprs_parse_ul_cps (struct egprs_cps *cps, union gprs_rlc_ul_hdr_egprs *hdr, int type)
 
static int egprs_decode_data (uint8_t *l2_data, const sbit_t *c, int mcs, int p, int blk, int *n_errors, int *n_bits_total)
 
static int egprs_type3_map (ubit_t *bursts, const ubit_t *hc, const ubit_t *dc, int usf)
 
static int egprs_type2_map (ubit_t *bursts, const ubit_t *hc, const ubit_t *dc, int usf)
 
static int egprs_type1_map (ubit_t *bursts, const ubit_t *hc, const ubit_t *c1, const ubit_t *c2, int usf, int mcs)
 
static int egprs_encode_hdr (ubit_t *hc, const uint8_t *l2_data, int mcs)
 
static int egprs_encode_data (ubit_t *c, const uint8_t *l2_data, int mcs, int p, int blk)
 
static int egprs_parse_dl_cps (struct egprs_cps *cps, const union gprs_rlc_dl_hdr_egprs *hdr, int type)
 
static void tch_fr_reassemble (uint8_t *tch_data, const ubit_t *b_bits, int net_order)
 assemble a FR codec frame in format as used inside RTP More...
 
static void tch_fr_disassemble (ubit_t *b_bits, const uint8_t *tch_data, int net_order)
 
static void tch_hr_reassemble (uint8_t *tch_data, const ubit_t *b_bits)
 
static void tch_hr_disassemble (ubit_t *b_bits, const uint8_t *tch_data)
 
static void tch_efr_reassemble (uint8_t *tch_data, const ubit_t *b_bits)
 
static void tch_efr_disassemble (ubit_t *b_bits, const uint8_t *tch_data)
 
static void tch_amr_reassemble (uint8_t *tch_data, const ubit_t *d_bits, int len)
 
static void tch_amr_disassemble (ubit_t *d_bits, const uint8_t *tch_data, int len)
 
static void tch_fr_d_to_b (ubit_t *b_bits, const ubit_t *d_bits)
 
static void tch_fr_b_to_d (ubit_t *d_bits, const ubit_t *b_bits)
 
static void tch_hr_d_to_b (ubit_t *b_bits, const ubit_t *d_bits)
 
static void tch_hr_b_to_d (ubit_t *d_bits, const ubit_t *b_bits)
 
static void tch_efr_d_to_w (ubit_t *b_bits, const ubit_t *d_bits)
 
static void tch_efr_w_to_d (ubit_t *d_bits, const ubit_t *b_bits)
 
static void tch_efr_protected (const ubit_t *s_bits, ubit_t *b_bits)
 
static void tch_fr_unreorder (ubit_t *d, ubit_t *p, const ubit_t *u)
 
static void tch_fr_reorder (ubit_t *u, const ubit_t *d, const ubit_t *p)
 
static void tch_hr_unreorder (ubit_t *d, ubit_t *p, const ubit_t *u)
 
static void tch_hr_reorder (ubit_t *u, const ubit_t *d, const ubit_t *p)
 
static void tch_efr_reorder (ubit_t *w, const ubit_t *s, const ubit_t *p)
 
static void tch_efr_unreorder (ubit_t *s, ubit_t *p, const ubit_t *w)
 
static void tch_amr_merge (ubit_t *u, const ubit_t *d, const ubit_t *p, int len, int prot)
 
static void tch_amr_unmerge (ubit_t *d, ubit_t *p, const ubit_t *u, int len, int prot)
 
static void rach_apply_bsic (ubit_t *d, uint8_t bsic, uint8_t start)
 
static int16_t rach_decode_ber (const sbit_t *burst, uint8_t bsic, bool is_11bit, int *n_errors, int *n_bits_total)
 

Variables

const struct gsm0503_mcs_code gsm0503_mcs_ul_codes [EGPRS_NUM_MCS]
 
const struct gsm0503_mcs_code gsm0503_mcs_dl_codes [EGPRS_NUM_MCS]
 

Detailed Description

GSM TS 05.03 coding.

This module is the "master module" of libosmocoding. It uses the various other modules (mapping, parity, interleaving) in order to implement the complete channel coding (and decoding) chain for the various channel types as defined in TS 05.03 / 45.003.

Macro Definition Documentation

◆ EGPRS_DATA_C1

◆ EGPRS_DATA_C2

#define EGPRS_DATA_C2   EGPRS_DATA_C1

◆ EGPRS_DATA_C_MAX

◆ EGPRS_DATA_DC_MAX

#define EGPRS_DATA_DC_MAX   1248

◆ EGPRS_DATA_U_MAX

#define EGPRS_DATA_U_MAX   612

◆ EGPRS_HDR_C_MAX

#define EGPRS_HDR_C_MAX   162

◆ EGPRS_HDR_HC_MAX

#define EGPRS_HDR_HC_MAX   160

◆ EGPRS_HDR_UPP_MAX

#define EGPRS_HDR_UPP_MAX   54

◆ GSM0503_EGPRS_BURSTS_NBITS

#define GSM0503_EGPRS_BURSTS_NBITS   (348 * 4)

◆ GSM0503_GPRS_BURSTS_NBITS

#define GSM0503_GPRS_BURSTS_NBITS   (116 * 4)

Enumeration Type Documentation

◆ gsm0503_egprs_mcs

Enumerator
EGPRS_MCS0 
EGPRS_MCS1 
EGPRS_MCS2 
EGPRS_MCS3 
EGPRS_MCS4 
EGPRS_MCS5 
EGPRS_MCS6 
EGPRS_MCS7 
EGPRS_MCS8 
EGPRS_MCS9 
EGPRS_NUM_MCS 

Function Documentation

◆ _egprs_decode_hdr()

◆ _xcch_decode_cB()

static int _xcch_decode_cB ( uint8_t *  l2_data,
const sbit_t cB,
int *  n_errors,
int *  n_bits_total 
)
static

convenience wrapper for decoding coded bits

Parameters
[out]l2_datacaller-allocated buffer for L2 Frame
[in]cB456 coded (soft) bits as per TS 05.03 4.1.3
[out]n_errorsNumber of detected errors
[out]n_bits_totalNumber of total coded bits
Returns
0 on success; -1 on CRC error

References gsm0503_fire_crc40, osmo_conv_decode_ber(), osmo_crc64gen_check_bits(), and osmo_ubit2pbit_ext().

Referenced by gsm0503_tch_afs_decode(), gsm0503_tch_ahs_decode(), gsm0503_tch_fr_decode(), gsm0503_tch_hr_decode(), and gsm0503_xcch_decode().

◆ _xcch_encode_cB()

static int _xcch_encode_cB ( ubit_t cB,
const uint8_t *  l2_data 
)
static

convenience wrapper for encoding to coded bits

Parameters
[out]cBcaller-allocated buffer for 456 coded bits as per TS 05.03 4.1.3
[out]l2_datato-be-encoded L2 Frame
Returns
0

References gsm0503_fire_crc40, osmo_conv_encode(), osmo_crc64gen_set_bits(), and osmo_pbit2ubit_ext().

Referenced by gsm0503_tch_afs_encode(), gsm0503_tch_ahs_encode(), gsm0503_tch_fr_encode(), gsm0503_tch_hr_encode(), and gsm0503_xcch_encode().

◆ egprs_decode_data()

◆ egprs_decode_hdr()

◆ egprs_encode_data()

◆ egprs_encode_hdr()

◆ egprs_parse_dl_cps()

static int egprs_parse_dl_cps ( struct egprs_cps *  cps,
const union gprs_rlc_dl_hdr_egprs hdr,
int  type 
)
static

◆ egprs_parse_ul_cps()

static int egprs_parse_ul_cps ( struct egprs_cps *  cps,
union gprs_rlc_ul_hdr_egprs hdr,
int  type 
)
static

◆ egprs_type1_map()

static int egprs_type1_map ( ubit_t bursts,
const ubit_t hc,
const ubit_t c1,
const ubit_t c2,
int  usf,
int  mcs 
)
static

◆ egprs_type1_unmap()

static int egprs_type1_unmap ( const sbit_t bursts,
sbit_t hc,
sbit_t c1,
sbit_t c2,
int  msc 
)
static

◆ egprs_type2_map()

static int egprs_type2_map ( ubit_t bursts,
const ubit_t hc,
const ubit_t dc,
int  usf 
)
static

◆ egprs_type2_unmap()

static int egprs_type2_unmap ( const sbit_t bursts,
sbit_t hc,
sbit_t dc 
)
static

◆ egprs_type3_map()

static int egprs_type3_map ( ubit_t bursts,
const ubit_t hc,
const ubit_t dc,
int  usf 
)
static

◆ egprs_type3_unmap()

static int egprs_type3_unmap ( const sbit_t bursts,
sbit_t hc,
sbit_t dc 
)
static

◆ gsm0503_pdtch_decode()

int gsm0503_pdtch_decode ( uint8_t *  l2_data,
const sbit_t bursts,
uint8_t *  usf_p,
int *  n_errors,
int *  n_bits_total 
)

Decode GPRS PDTCH.

Parameters
[out]l2_datacaller-allocated buffer for L2 Frame
[in]burstsburst input data as soft unpacked bits
[out]usf_puplink stealing flag
[out]n_errorsnumber of detected bit-errors
[out]n_bits_totaltotal number of dcoded bits
Returns
0 on success; negative on error

References gsm0503_cs234_crc16, gsm0503_fire_crc40, gsm0503_pdtch_hl_hn_sbit, gsm0503_puncture_cs2, gsm0503_puncture_cs3, gsm0503_usf2six, gsm0503_usf2twelve_sbit, gsm0503_xcch_burst_unmap(), gsm0503_xcch_deinterleave(), osmo_conv_decode_ber(), osmo_crc16gen_check_bits(), osmo_crc64gen_check_bits(), and osmo_ubit2pbit_ext().

◆ gsm0503_pdtch_egprs_decode()

int gsm0503_pdtch_egprs_decode ( uint8_t *  l2_data,
const sbit_t bursts,
uint16_t  nbits,
uint8_t *  usf_p,
int *  n_errors,
int *  n_bits_total 
)

Decode EGPRS UL message.

  1. Header section decoding
  2. Extract CPS settings
  3. Burst unmapping and deinterleaving
  4. Data section decoding
    Parameters
    [out]l2_datacaller-allocated buffer for L2 Frame
    [in]burstsburst input data as soft unpacked bits
    [in]nbitsnumber of bits in bursts
    usf_punused argument ?!?
    [out]n_errorsnumber of detected bit-errors
    [out]n_bits_totaltotal number of decoded bits
    Returns
    0 on success; negative on error

References EGPRS_DATA_C1, EGPRS_DATA_C2, EGPRS_DATA_DC_MAX, egprs_decode_data(), egprs_decode_hdr(), EGPRS_MCS0, EGPRS_MCS1, EGPRS_MCS2, EGPRS_MCS3, EGPRS_MCS4, EGPRS_MCS5, EGPRS_MCS6, EGPRS_MCS7, EGPRS_MCS8, EGPRS_MCS9, egprs_parse_ul_cps(), egprs_type1_unmap(), egprs_type2_unmap(), egprs_type3_unmap(), GSM0503_EGPRS_BURSTS_NBITS, GSM0503_GPRS_BURSTS_NBITS, and type.

◆ gsm0503_pdtch_egprs_encode()

int gsm0503_pdtch_egprs_encode ( ubit_t bursts,
const uint8_t *  l2_data,
uint8_t  l2_len 
)

EGPRS DL message encoding.

Parameters
[out]burstscaller-allocated buffer for unpacked burst bits
[in]l2_dataL2 (MAC) block to be encoded
[in]l2_lenlength of l2_data in bytes, used to determine MCS
Returns
0 on success; negative on error

References EGPRS_DATA_C1, EGPRS_DATA_C2, EGPRS_DATA_C_MAX, EGPRS_DATA_DC_MAX, egprs_encode_data(), egprs_encode_hdr(), EGPRS_MCS1, EGPRS_MCS2, EGPRS_MCS3, EGPRS_MCS4, EGPRS_MCS5, EGPRS_MCS6, EGPRS_MCS7, EGPRS_MCS8, EGPRS_MCS9, egprs_parse_dl_cps(), egprs_type1_map(), egprs_type2_map(), egprs_type3_map(), GSM0503_EGPRS_BURSTS_NBITS, GSM0503_GPRS_BURSTS_NBITS, gsm0503_mcs_code::mcs, gprs_rlc_dl_hdr_egprs::type1, gprs_rlc_dl_hdr_egprs::type2, and gprs_rlc_dl_hdr_egprs::type3.

◆ gsm0503_pdtch_encode()

int gsm0503_pdtch_encode ( ubit_t bursts,
const uint8_t *  l2_data,
uint8_t  l2_len 
)

GPRS DL message encoding.

Parameters
[out]burstscaller-allocated buffer for unpacked burst bits
[in]l2_dataL2 (MAC) block to be encoded
[in]l2_lenlength of l2_data in bytes, used to determine CS
Returns
0 on success; negative on error

References gsm0503_cs234_crc16, gsm0503_fire_crc40, GSM0503_GPRS_BURSTS_NBITS, gsm0503_pdtch_hl_hn_ubit, gsm0503_puncture_cs2, gsm0503_puncture_cs3, gsm0503_usf2six, gsm0503_usf2twelve_ubit, gsm0503_xcch_burst_map(), gsm0503_xcch_interleave(), osmo_conv_encode(), osmo_crc16gen_set_bits(), osmo_crc64gen_set_bits(), and osmo_pbit2ubit_ext().

◆ gsm0503_rach_decode()

int gsm0503_rach_decode ( uint8_t *  ra,
const sbit_t burst,
uint8_t  bsic 
)

Decode the (8-bit) RACH according to TS 05.03.

Parameters
[out]raoutput buffer for RACH data
[in]burstInput burst data
[in]bsicBSIC used in this cell
Returns
0 on success; negative on error (e.g. CRC error)

References rach_decode_ber().

◆ gsm0503_rach_decode_ber()

int gsm0503_rach_decode_ber ( uint8_t *  ra,
const sbit_t burst,
uint8_t  bsic,
int *  n_errors,
int *  n_bits_total 
)

Decode the (8-bit) RACH according to TS 05.03.

Parameters
[out]raoutput buffer for RACH data
[in]burstInput burst data
[in]bsicBSIC used in this cell
[out]n_errorsNumber of detected bit errors
[out]n_bits_totalTotal number of bits
Returns
0 on success; negative on error (e.g. CRC error)

References rach_decode_ber().

◆ gsm0503_rach_encode()

int gsm0503_rach_encode ( ubit_t burst,
const uint8_t *  ra,
uint8_t  bsic 
)

Encode the (8-bit) RACH according to TS 05.03.

Parameters
[out]burstCaller-allocated output burst buffer
[in]raInput RACH data
[in]bsicBSIC used in this cell
Returns
0 on success; negative on error

References gsm0503_rach_ext_encode().

◆ gsm0503_rach_ext_decode()

int gsm0503_rach_ext_decode ( uint16_t *  ra,
const sbit_t burst,
uint8_t  bsic 
)

Decode the Extended (11-bit) RACH according to 3GPP TS 45.003.

Parameters
[out]raoutput buffer for RACH data
[in]burstInput burst data
[in]bsicBSIC used in this cell
Returns
0 on success; negative on error (e.g. CRC error)

References rach_decode_ber().

◆ gsm0503_rach_ext_decode_ber()

int gsm0503_rach_ext_decode_ber ( uint16_t *  ra,
const sbit_t burst,
uint8_t  bsic,
int *  n_errors,
int *  n_bits_total 
)

Decode the Extended (11-bit) RACH according to 3GPP TS 45.003.

Parameters
[out]raoutput buffer for RACH data
[in]burstInput burst data
[in]bsicBSIC used in this cell
[out]n_errorsNumber of detected bit errors
[out]n_bits_totalTotal number of bits
Returns
0 on success; negative on error (e.g. CRC error)

References rach_decode_ber().

◆ gsm0503_rach_ext_encode()

int gsm0503_rach_ext_encode ( ubit_t burst,
uint16_t  ra11,
uint8_t  bsic,
bool  is_11bit 
)

Encode the Extended (11-bit) or regular (8-bit) RACH according to 3GPP TS 45.003.

Parameters
[out]burstCaller-allocated output burst buffer
[in]ra11Input RACH data
[in]bsicBSIC used in this cell
[in]is_11bitwhether given RA is 11 bit or not
Returns
0 on success; negative on error

References gsm0503_rach_crc6, osmo_conv_encode(), osmo_crc8gen_set_bits(), osmo_pbit2ubit_ext(), and rach_apply_bsic().

Referenced by gsm0503_rach_encode().

◆ gsm0503_sch_decode()

int gsm0503_sch_decode ( uint8_t *  sb_info,
const sbit_t burst 
)

Decode the SCH according to TS 05.03.

Parameters
[out]sb_infooutput buffer for SCH data
[in]burstInput burst data
Returns
0 on success; negative on error (e.g. CRC error)

References gsm0503_sch_crc10, osmo_conv_decode(), osmo_crc16gen_check_bits(), and osmo_ubit2pbit_ext().

◆ gsm0503_sch_encode()

int gsm0503_sch_encode ( ubit_t burst,
const uint8_t *  sb_info 
)

Encode the SCH according to TS 05.03.

Parameters
[out]burstCaller-allocated output burst buffer
[in]sb_infoInput SCH data
Returns
0 on success; negative on error

References gsm0503_sch_crc10, osmo_conv_encode(), osmo_crc16gen_set_bits(), and osmo_pbit2ubit_ext().

◆ gsm0503_tch_afs_decode()

int gsm0503_tch_afs_decode ( uint8_t *  tch_data,
const sbit_t bursts,
int  codec_mode_req,
uint8_t *  codec,
int  codecs,
uint8_t *  ft,
uint8_t *  cmr,
int *  n_errors,
int *  n_bits_total 
)

Perform channel decoding of a TCH/AFS channel according TS 05.03.

Parameters
[out]tch_dataCodec frame in RTP payload format
[in]burstsbuffer containing the symbols of 8 bursts
[in]codec_mode_reqis this CMR (1) or CMC (0)
[in]codecarray of active codecs (active codec set)
[in]codecsnumber of codecs in codec
ftFrame Type; Input if codec_mode_req = 1, Output * otherwise
[out]cmrOutput in codec_mode_req = 1
[out]n_errorsNumber of detected bit errors
[out]n_bits_totalTotal number of bits
Returns
(>=4) length of bytes used in tch_data output buffer; ([0,3]) codec out of range; negative on error

References _xcch_decode_cB(), gsm0503_afs_ic_sbit, gsm0503_amr_crc6, gsm0503_tch_burst_unmap(), gsm0503_tch_fr_deinterleave(), osmo_conv_decode_ber(), osmo_crc8gen_check_bits(), tch_amr_reassemble(), and tch_amr_unmerge().

◆ gsm0503_tch_afs_encode()

int gsm0503_tch_afs_encode ( ubit_t bursts,
const uint8_t *  tch_data,
int  len,
int  codec_mode_req,
uint8_t *  codec,
int  codecs,
uint8_t  ft,
uint8_t  cmr 
)

Perform channel encoding on a TCH/AFS channel according to TS 05.03.

Parameters
[out]burstscaller-allocated output buffer for bursts bits
[in]tch_dataCodec input data in RTP payload format
[in]lenLength of tch_data in bytes
[in]codec_mode_reqUse CMR (1) or FT (0)
[in]codecArray of codecs (active codec set)
[in]codecsNumber of entries in codec
[in]ftFrame Type to be used for encoding (index to codec)
[in]cmrCodec Mode Request (used in codec_mode_req = 1 only)
Returns
0 in case of success; negative on error

References _xcch_encode_cB(), gsm0503_afs_ic_ubit, gsm0503_amr_crc6, gsm0503_tch_burst_map(), gsm0503_tch_fr_interleave(), osmo_conv_encode(), osmo_crc8gen_set_bits(), tch_amr_disassemble(), and tch_amr_merge().

◆ gsm0503_tch_ahs_decode()

int gsm0503_tch_ahs_decode ( uint8_t *  tch_data,
const sbit_t bursts,
int  odd,
int  codec_mode_req,
uint8_t *  codec,
int  codecs,
uint8_t *  ft,
uint8_t *  cmr,
int *  n_errors,
int *  n_bits_total 
)

Perform channel decoding of a TCH/AFS channel according TS 05.03.

Parameters
[out]tch_dataCodec frame in RTP payload format
[in]burstsbuffer containing the symbols of 8 bursts
[in]oddIs this an odd (1) or even (0) frame number?
[in]codec_mode_reqis this CMR (1) or CMC (0)
[in]codecarray of active codecs (active codec set)
[in]codecsnumber of codecs in codec
ftFrame Type; Input if codec_mode_req = 1, Output * otherwise
[out]cmrOutput in codec_mode_req = 1
[out]n_errorsNumber of detected bit errors
[out]n_bits_totalTotal number of bits
Returns
(>=4) length of bytes used in tch_data output buffer; ([0,3]) codec out of range; negative on error

References _xcch_decode_cB(), gsm0503_ahs_ic_sbit, gsm0503_amr_crc6, gsm0503_tch_burst_unmap(), gsm0503_tch_fr_deinterleave(), gsm0503_tch_hr_deinterleave(), osmo_conv_decode_ber(), osmo_crc8gen_check_bits(), tch_amr_reassemble(), and tch_amr_unmerge().

◆ gsm0503_tch_ahs_encode()

int gsm0503_tch_ahs_encode ( ubit_t bursts,
const uint8_t *  tch_data,
int  len,
int  codec_mode_req,
uint8_t *  codec,
int  codecs,
uint8_t  ft,
uint8_t  cmr 
)

Perform channel encoding on a TCH/AHS channel according to TS 05.03.

Parameters
[out]burstscaller-allocated output buffer for bursts bits
[in]tch_dataCodec input data in RTP payload format
[in]lenLength of tch_data in bytes
[in]codec_mode_reqUse CMR (1) or FT (0)
[in]codecArray of codecs (active codec set)
[in]codecsNumber of entries in codec
[in]ftFrame Type to be used for encoding (index to codec)
[in]cmrCodec Mode Request (used in codec_mode_req = 1 only)
Returns
0 in case of success; negative on error

References _xcch_encode_cB(), gsm0503_afs_ic_ubit, gsm0503_amr_crc6, gsm0503_tch_burst_map(), gsm0503_tch_fr_interleave(), gsm0503_tch_hr_interleave(), osmo_conv_encode(), osmo_crc8gen_set_bits(), tch_amr_disassemble(), and tch_amr_merge().

◆ gsm0503_tch_fr_decode()

int gsm0503_tch_fr_decode ( uint8_t *  tch_data,
const sbit_t bursts,
int  net_order,
int  efr,
int *  n_errors,
int *  n_bits_total 
)

Perform channel decoding of a FR/EFR channel according TS 05.03.

Parameters
[out]tch_dataCodec frame in RTP payload format
[in]burstsbuffer containing the symbols of 8 bursts
[in]net_orderFIXME
[in]efrIs this channel using EFR (1) or FR (0)
[out]n_errorsNumber of detected bit errors
[out]n_bits_totalTotal number of bits
Returns
length of bytes used in tch_data output buffer; negative on error

References _xcch_decode_cB(), gsm0503_tch_burst_unmap(), gsm0503_tch_efr_crc8, gsm0503_tch_fr_crc3, gsm0503_tch_fr_deinterleave(), osmo_conv_decode_ber(), osmo_crc8gen_check_bits(), tch_efr_d_to_w(), tch_efr_protected(), tch_efr_reassemble(), tch_efr_unreorder(), tch_fr_d_to_b(), tch_fr_reassemble(), and tch_fr_unreorder().

◆ gsm0503_tch_fr_encode()

int gsm0503_tch_fr_encode ( ubit_t bursts,
const uint8_t *  tch_data,
int  len,
int  net_order 
)

Perform channel encoding on a TCH/FS channel according to TS 05.03.

Parameters
[out]burstscaller-allocated output buffer for bursts bits
[in]tch_dataCodec input data in RTP payload format
[in]lenLength of tch_data in bytes
[in]net_orderFIXME
Returns
0 in case of success; negative on error

References _xcch_encode_cB(), gsm0503_tch_burst_map(), gsm0503_tch_efr_crc8, gsm0503_tch_fr_crc3, gsm0503_tch_fr_interleave(), osmo_conv_encode(), osmo_crc8gen_set_bits(), tch_efr_disassemble(), tch_efr_protected(), tch_efr_reorder(), tch_efr_w_to_d(), tch_fr_b_to_d(), tch_fr_disassemble(), and tch_fr_reorder().

◆ gsm0503_tch_hr_decode()

int gsm0503_tch_hr_decode ( uint8_t *  tch_data,
const sbit_t bursts,
int  odd,
int *  n_errors,
int *  n_bits_total 
)

Perform channel decoding of a HR(v1) channel according TS 05.03.

Parameters
[out]tch_dataCodec frame in RTP payload format
[in]burstsbuffer containing the symbols of 8 bursts
[in]oddOdd (1) or even (0) frame number
[out]n_errorsNumber of detected bit errors
[out]n_bits_totalTotal number of bits
Returns
length of bytes used in tch_data output buffer; negative on error

References _xcch_decode_cB(), gsm0503_tch_burst_unmap(), gsm0503_tch_fr_crc3, gsm0503_tch_fr_deinterleave(), gsm0503_tch_hr_deinterleave(), osmo_conv_decode_ber(), osmo_crc8gen_check_bits(), tch_hr_d_to_b(), tch_hr_reassemble(), and tch_hr_unreorder().

◆ gsm0503_tch_hr_encode()

int gsm0503_tch_hr_encode ( ubit_t bursts,
const uint8_t *  tch_data,
int  len 
)

Perform channel encoding on a TCH/HS channel according to TS 05.03.

Parameters
[out]burstscaller-allocated output buffer for bursts bits
[in]tch_dataCodec input data in RTP payload format
[in]lenLength of tch_data in bytes
Returns
0 in case of success; negative on error

References _xcch_encode_cB(), gsm0503_tch_burst_map(), gsm0503_tch_fr_crc3, gsm0503_tch_fr_interleave(), gsm0503_tch_hr_interleave(), osmo_conv_encode(), osmo_crc8gen_set_bits(), tch_hr_b_to_d(), tch_hr_disassemble(), and tch_hr_reorder().

◆ gsm0503_xcch_decode()

int gsm0503_xcch_decode ( uint8_t *  l2_data,
const sbit_t bursts,
int *  n_errors,
int *  n_bits_total 
)

Decoding of xCCH data from bursts to L2 frame.

Parameters
[out]l2_datacaller-allocated output data buffer
[in]burstsfour GSM bursts in soft-bits
[out]n_errorsNumber of detected errors
[out]n_bits_totalNumber of total coded bits

References _xcch_decode_cB(), gsm0503_xcch_burst_unmap(), and gsm0503_xcch_deinterleave().

◆ gsm0503_xcch_encode()

int gsm0503_xcch_encode ( ubit_t bursts,
const uint8_t *  l2_data 
)

Encoding of xCCH data from L2 frame to bursts.

Parameters
[out]burstscaller-allocated burst data (unpacked bits)
[in]l2_dataL2 input data (MAC block)
Returns
0

References _xcch_encode_cB(), gsm0503_xcch_burst_map(), and gsm0503_xcch_interleave().

◆ osmo_conv_decode_ber()

static int osmo_conv_decode_ber ( const struct osmo_conv_code code,
const sbit_t input,
ubit_t output,
int *  n_errors,
int *  n_bits_total 
)
static

Convolutional Decode + compute BER for non-punctured codes.

Parameters
[in]codeDescription of Convolutional Code
[in]inputInput soft-bits (-127...127)
[out]outputbits
[out]n_errorsNumber of bit-errors
[out]n_bits_totalNumber of bits

References osmo_conv_decode_ber_punctured().

Referenced by _egprs_decode_hdr(), _xcch_decode_cB(), gsm0503_pdtch_decode(), gsm0503_tch_afs_decode(), gsm0503_tch_ahs_decode(), gsm0503_tch_fr_decode(), gsm0503_tch_hr_decode(), and rach_decode_ber().

◆ osmo_conv_decode_ber_punctured()

static int osmo_conv_decode_ber_punctured ( const struct osmo_conv_code code,
const sbit_t input,
ubit_t output,
int *  n_errors,
int *  n_bits_total,
const uint8_t *  data_punc 
)
static

Convolutional Decode + compute BER for punctured codes.

Parameters
[in]codeDescription of Convolutional Code
[in]inputInput soft-bits (-127...127)
[out]outputbits
[out]n_errorsNumber of bit-errors
[out]n_bits_totalNumber of bits
[in]data_puncPuncturing mask array. Can be NULL.

References EGPRS_DATA_C_MAX, OSMO_ASSERT, osmo_conv_decode(), osmo_conv_encode(), and res.

Referenced by egprs_decode_data(), and osmo_conv_decode_ber().

◆ rach_apply_bsic()

static void rach_apply_bsic ( ubit_t d,
uint8_t  bsic,
uint8_t  start 
)
inlinestatic

◆ rach_decode_ber()

static int16_t rach_decode_ber ( const sbit_t burst,
uint8_t  bsic,
bool  is_11bit,
int *  n_errors,
int *  n_bits_total 
)
inlinestatic

◆ tch_amr_disassemble()

static void tch_amr_disassemble ( ubit_t d_bits,
const uint8_t *  tch_data,
int  len 
)
static

◆ tch_amr_merge()

static void tch_amr_merge ( ubit_t u,
const ubit_t d,
const ubit_t p,
int  len,
int  prot 
)
static

◆ tch_amr_reassemble()

static void tch_amr_reassemble ( uint8_t *  tch_data,
const ubit_t d_bits,
int  len 
)
static

◆ tch_amr_unmerge()

static void tch_amr_unmerge ( ubit_t d,
ubit_t p,
const ubit_t u,
int  len,
int  prot 
)
static

◆ tch_efr_d_to_w()

static void tch_efr_d_to_w ( ubit_t b_bits,
const ubit_t d_bits 
)
static

Referenced by gsm0503_tch_fr_decode().

◆ tch_efr_disassemble()

static void tch_efr_disassemble ( ubit_t b_bits,
const uint8_t *  tch_data 
)
static

Referenced by gsm0503_tch_fr_encode().

◆ tch_efr_protected()

static void tch_efr_protected ( const ubit_t s_bits,
ubit_t b_bits 
)
static

◆ tch_efr_reassemble()

static void tch_efr_reassemble ( uint8_t *  tch_data,
const ubit_t b_bits 
)
static

Referenced by gsm0503_tch_fr_decode().

◆ tch_efr_reorder()

static void tch_efr_reorder ( ubit_t w,
const ubit_t s,
const ubit_t p 
)
static

Referenced by gsm0503_tch_fr_encode().

◆ tch_efr_unreorder()

static void tch_efr_unreorder ( ubit_t s,
ubit_t p,
const ubit_t w 
)
static

Referenced by gsm0503_tch_fr_decode().

◆ tch_efr_w_to_d()

static void tch_efr_w_to_d ( ubit_t d_bits,
const ubit_t b_bits 
)
static

Referenced by gsm0503_tch_fr_encode().

◆ tch_fr_b_to_d()

static void tch_fr_b_to_d ( ubit_t d_bits,
const ubit_t b_bits 
)
static

Referenced by gsm0503_tch_fr_encode().

◆ tch_fr_d_to_b()

static void tch_fr_d_to_b ( ubit_t b_bits,
const ubit_t d_bits 
)
static

Referenced by gsm0503_tch_fr_decode().

◆ tch_fr_disassemble()

static void tch_fr_disassemble ( ubit_t b_bits,
const uint8_t *  tch_data,
int  net_order 
)
static

References gsm0503_gsm_fr_map.

Referenced by gsm0503_tch_fr_encode().

◆ tch_fr_reassemble()

static void tch_fr_reassemble ( uint8_t *  tch_data,
const ubit_t b_bits,
int  net_order 
)
static

assemble a FR codec frame in format as used inside RTP

Parameters
[out]tch_dataCodec frame in RTP format
[in]b_bitsCodec frame in 'native' format
[in]net_orderFIXME

References gsm0503_gsm_fr_map.

Referenced by gsm0503_tch_fr_decode().

◆ tch_fr_reorder()

static void tch_fr_reorder ( ubit_t u,
const ubit_t d,
const ubit_t p 
)
static

Referenced by gsm0503_tch_fr_encode().

◆ tch_fr_unreorder()

static void tch_fr_unreorder ( ubit_t d,
ubit_t p,
const ubit_t u 
)
static

Referenced by gsm0503_tch_fr_decode().

◆ tch_hr_b_to_d()

static void tch_hr_b_to_d ( ubit_t d_bits,
const ubit_t b_bits 
)
static

Referenced by gsm0503_tch_hr_encode().

◆ tch_hr_d_to_b()

static void tch_hr_d_to_b ( ubit_t b_bits,
const ubit_t d_bits 
)
static

Referenced by gsm0503_tch_hr_decode().

◆ tch_hr_disassemble()

static void tch_hr_disassemble ( ubit_t b_bits,
const uint8_t *  tch_data 
)
static

Referenced by gsm0503_tch_hr_encode().

◆ tch_hr_reassemble()

static void tch_hr_reassemble ( uint8_t *  tch_data,
const ubit_t b_bits 
)
static

Referenced by gsm0503_tch_hr_decode().

◆ tch_hr_reorder()

static void tch_hr_reorder ( ubit_t u,
const ubit_t d,
const ubit_t p 
)
static

Referenced by gsm0503_tch_hr_encode().

◆ tch_hr_unreorder()

static void tch_hr_unreorder ( ubit_t d,
ubit_t p,
const ubit_t u 
)
static

Referenced by gsm0503_tch_hr_decode().

Variable Documentation

◆ gsm0503_mcs_dl_codes

const struct gsm0503_mcs_code gsm0503_mcs_dl_codes[EGPRS_NUM_MCS]

◆ gsm0503_mcs_ul_codes

const struct gsm0503_mcs_code gsm0503_mcs_ul_codes[EGPRS_NUM_MCS]