Coding

GSM TS 05.03 coding. More...

## Files

file | gsm0503_amr_dtx.h
| GSM TS 05.03 coding.
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_amr_dtx_frames { AMR_OTHER , AFS_SID_FIRST , AFS_SID_UPDATE , AFS_SID_UPDATE_CN , AFS_ONSET , AHS_SID_UPDATE , AHS_SID_UPDATE_CN , AHS_SID_FIRST_P1 , AHS_SID_FIRST_P2 , AHS_ONSET , AHS_SID_FIRST_INH , AHS_SID_UPDATE_INH }
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

static const char * | gsm0503_amr_dtx_frame_name (enum gsm0503_amr_dtx_frames frame)
enum gsm0503_amr_dtx_frames | gsm0503_detect_afs_dtx_frame (int *n_errors, int *n_bits_total, const ubit_t *ubits)
| Detect FR AMR DTX frame in unmapped, deinterleaved frame bits. More...
enum gsm0503_amr_dtx_frames | gsm0503_detect_ahs_dtx_frame (int *n_errors, int *n_bits_total, const ubit_t *ubits)
| Detect HR AMR DTX frame in unmapped, deinterleaved frame bits. More...
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_afs_decode_dtx (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, uint8_t *dtx)
| 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_tch_ahs_decode_dtx (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, uint8_t *dtx)
| 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_amr_sid_update_append (ubit_t *sid_update, uint8_t sti, uint8_t mi)
static void | extract_afs_sid_update (sbit_t *sid_update, const sbit_t *sbits)
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 value_string | gsm0503_amr_dtx_frame_names []
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

#define EGPRS_DATA_C1 612

## EGPRS_DATA_C2

#define EGPRS_DATA_C2 EGPRS_DATA_C1

## EGPRS_DATA_C_MAX

#define EGPRS_DATA_C_MAX 1836

## 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_amr_dtx_frames

enum gsm0503_amr_dtx_frames

Enumerator
AMR_OTHER |
AFS_SID_FIRST |
AFS_SID_UPDATE |
AFS_SID_UPDATE_CN |
AFS_ONSET |
AHS_SID_UPDATE |
AHS_SID_UPDATE_CN |
AHS_SID_FIRST_P1 |
AHS_SID_FIRST_P2 |
AHS_ONSET |
AHS_SID_FIRST_INH |
AHS_SID_UPDATE_INH |

## gsm0503_egprs_mcs

enum 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()

static int _egprs_decode_hdr | ( | const sbit_t * | hc,
|  | int | mcs,
|  | union gprs_rlc_ul_hdr_egprs * | hdr
| ) |  |

static

References EGPRS_HDR_C_MAX, EGPRS_HDR_UPP_MAX, EGPRS_MCS5, EGPRS_MCS6, gsm0503_mcs_crc8_hdr, gsm0503_mcs_ul_codes, gsm0503_mcs_code::hdr_code_len, gsm0503_mcs_code::hdr_conv, gsm0503_mcs_code::hdr_len, gsm0503_mcs_code::hdr_punc, gsm0503_mcs_code::hdr_punc_len, gsm0503_mcs_code::mcs, osmo_conv_decode_ber(), osmo_crc8gen_check_bits(), and osmo_ubit2pbit_ext().

Referenced by 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_data | caller-allocated buffer for L2 Frame
  [in] | cB | 456 coded (soft) bits as per TS 05.03 4.1.3
  [out] | n_errors | Number of detected errors
  [out] | n_bits_total | Number of total coded bits

Returns
  0 on success; -1 on CRC error

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

Referenced by gsm0503_tch_afs_decode_dtx(), gsm0503_tch_ahs_decode_dtx(), 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] | cB | caller-allocated buffer for 456 coded bits as per TS 05.03 4.1.3
  [out] | l2_data | to-be-encoded L2 Frame

Returns
  0

References gsm0503_fire_crc40, gsm0503_xcch, 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()

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

References blk, c, gsm0503_mcs_code::data_code_len, gsm0503_mcs_code::data_conv, gsm0503_mcs_code::data_len, gsm0503_mcs_code::data_punc, gsm0503_mcs_code::data_punc_len, EGPRS_DATA_C_MAX, EGPRS_DATA_U_MAX, EGPRS_MCS7, gsm0503_mcs_crc12, gsm0503_mcs_ul_codes, gsm0503_mcs_code::hdr_len, gsm0503_mcs_code::mcs, OSMO_BYTES_FOR_BITS, osmo_conv_decode_ber_punctured(), osmo_crc16gen_check_bits(), osmo_ubit2pbit_ext(), and u.

Referenced by gsm0503_pdtch_egprs_decode().

## egprs_decode_hdr()

static int egprs_decode_hdr | ( | union gprs_rlc_ul_hdr_egprs * | hdr,
|  | const sbit_t * | bursts,
|  | uint16_t | nbits
| ) |  |

static

References _egprs_decode_hdr(), EGPRS_HDR_HC_MAX, EGPRS_HDR_TYPE1, EGPRS_HDR_TYPE2, EGPRS_HDR_TYPE3, EGPRS_MCS1, EGPRS_MCS5, EGPRS_MCS7, egprs_type1_unmap(), egprs_type2_unmap(), egprs_type3_unmap(), GSM0503_EGPRS_BURSTS_NBITS, and GSM0503_GPRS_BURSTS_NBITS.

Referenced by gsm0503_pdtch_egprs_decode().

## egprs_encode_data()

static int egprs_encode_data | ( | ubit_t * | c,
|  | const uint8_t * | l2_data,
|  | int | mcs,
|  | int | p,
|  | int | blk
| ) |  |

static

References blk, c, gsm0503_mcs_code::data_code_len, gsm0503_mcs_code::data_conv, gsm0503_mcs_code::data_len, gsm0503_mcs_code::data_punc, EGPRS_DATA_C_MAX, EGPRS_DATA_U_MAX, EGPRS_MCS7, gsm0503_mcs_crc12, gsm0503_mcs_dl_codes, gsm0503_mcs_code::hdr_len, gsm0503_mcs_code::mcs, osmo_conv_encode(), osmo_crc16gen_set_bits(), osmo_pbit2ubit_ext(), u, and gsm0503_mcs_code::usf_len.

Referenced by gsm0503_pdtch_egprs_encode().

## egprs_encode_hdr()

static int egprs_encode_hdr | ( | ubit_t * | hc,
|  | const uint8_t * | l2_data,
|  | int | mcs
| ) |  |

static

References EGPRS_HDR_C_MAX, EGPRS_HDR_UPP_MAX, EGPRS_MCS5, EGPRS_MCS6, gsm0503_mcs_crc8_hdr, gsm0503_mcs_dl_codes, gsm0503_mcs_code::hdr_code_len, gsm0503_mcs_code::hdr_conv, gsm0503_mcs_code::hdr_len, gsm0503_mcs_code::hdr_punc, gsm0503_mcs_code::mcs, osmo_conv_encode(), osmo_crc8gen_set_bits(), osmo_pbit2ubit_ext(), and gsm0503_mcs_code::usf_len.

Referenced by gsm0503_pdtch_egprs_encode().

## 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

References egprs_get_cps(), EGPRS_HDR_TYPE1, EGPRS_HDR_TYPE2, EGPRS_HDR_TYPE3, type, gprs_rlc_dl_hdr_egprs::type1, gprs_rlc_dl_hdr_egprs::type2, and gprs_rlc_dl_hdr_egprs::type3.

Referenced by gsm0503_pdtch_egprs_encode().

## egprs_parse_ul_cps()

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

static

References egprs_get_cps(), EGPRS_HDR_TYPE1, EGPRS_HDR_TYPE2, EGPRS_HDR_TYPE3, type, gprs_rlc_ul_hdr_egprs::type1, gprs_rlc_ul_hdr_egprs::type2, and gprs_rlc_ul_hdr_egprs::type3.

Referenced by gsm0503_pdtch_egprs_decode().

## 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

References EGPRS_DATA_C1, EGPRS_HDR_HC_MAX, EGPRS_MCS7, gsm0503_mcs5_burst_swap(), gsm0503_mcs5_usf_precode_table, gsm0503_mcs7_dl_burst_map(), gsm0503_mcs7_dl_interleave(), and gsm0503_mcs8_dl_interleave().

Referenced by gsm0503_pdtch_egprs_encode().

## egprs_type1_unmap()

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

static

References EGPRS_DATA_C1, EGPRS_HDR_HC_MAX, EGPRS_MCS7, gsm0503_mcs5_burst_swap(), gsm0503_mcs7_ul_burst_unmap(), gsm0503_mcs7_ul_deinterleave(), and gsm0503_mcs8_ul_deinterleave().

Referenced by egprs_decode_hdr(), and gsm0503_pdtch_egprs_decode().

## egprs_type2_map()

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

static

References EGPRS_DATA_DC_MAX, EGPRS_HDR_HC_MAX, gsm0503_mcs5_burst_swap(), gsm0503_mcs5_dl_burst_map(), gsm0503_mcs5_dl_interleave(), and gsm0503_mcs5_usf_precode_table.

Referenced by gsm0503_pdtch_egprs_encode().

## egprs_type2_unmap()

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

static

References EGPRS_DATA_DC_MAX, EGPRS_HDR_HC_MAX, gsm0503_mcs5_burst_swap(), gsm0503_mcs5_ul_burst_unmap(), and gsm0503_mcs5_ul_deinterleave().

Referenced by egprs_decode_hdr(), and gsm0503_pdtch_egprs_decode().

## egprs_type3_map()

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

static

References gsm0503_mcs1_dl_interleave(), gsm0503_pdtch_hl_hn_ubit, gsm0503_usf2twelve_ubit, and gsm0503_xcch_burst_map().

Referenced by gsm0503_pdtch_egprs_encode().

## egprs_type3_unmap()

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

static

References gsm0503_mcs1_ul_deinterleave(), and gsm0503_xcch_burst_unmap().

Referenced by egprs_decode_hdr(), and gsm0503_pdtch_egprs_decode().

## extract_afs_sid_update()

static void extract_afs_sid_update | ( | sbit_t * | sid_update,
|  | const sbit_t * | sbits
| ) |  |

static

Referenced by gsm0503_tch_afs_decode_dtx().

## gsm0503_amr_dtx_frame_name()

static const char* gsm0503_amr_dtx_frame_name | ( | enum gsm0503_amr_dtx_frames | frame | ) |

inline static

References get_value_string(), and gsm0503_amr_dtx_frame_names.

## gsm0503_detect_afs_dtx_frame()

enum gsm0503_amr_dtx_frames gsm0503_detect_afs_dtx_frame | ( | int * | n_errors,
|  | int * | n_bits_total,
|  | const ubit_t * | ubits
| ) |  |

Detect FR AMR DTX frame in unmapped, deinterleaved frame bits.

Parameters

  [in] | ubits | input bits (456 bit).
  [out] | n_errors | number of errornous bits.
  [out] | n_bits_total | number of checked bits.

Returns
  dtx frame type.

Referenced by gsm0503_tch_afs_decode_dtx().

## gsm0503_detect_ahs_dtx_frame()

enum gsm0503_amr_dtx_frames gsm0503_detect_ahs_dtx_frame | ( | int * | n_errors,
|  | int * | n_bits_total,
|  | const ubit_t * | ubits
| ) |  |

Detect HR AMR DTX frame in unmapped, deinterleaved frame bits.

Parameters

  [in] | ubits | input bits (456 bit).
  [out] | n_errors | number of errornous bits.
  [out] | n_bits_total | number of checked bits.

Returns
  dtx frame type,

Referenced by gsm0503_tch_ahs_decode_dtx().

## 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_data | caller-allocated buffer for L2 Frame
  [in] | bursts | burst input data as soft unpacked bits
  [out] | usf_p | uplink stealing flag
  [out] | n_errors | number of detected bit-errors
  [out] | n_bits_total | total number of dcoded bits

Returns
  0 on success; negative on error

References gsm0503_cs234_crc16, gsm0503_cs2_np, gsm0503_cs3_np, gsm0503_fire_crc40, gsm0503_pdtch_hl_hn_sbit, gsm0503_puncture_cs2, gsm0503_puncture_cs3, gsm0503_usf2six, gsm0503_usf2twelve_sbit, gsm0503_xcch, gsm0503_xcch_burst_unmap(), gsm0503_xcch_deinterleave(), k, 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_data | caller-allocated buffer for L2 Frame
     [in] | bursts | burst input data as soft unpacked bits
     [in] | nbits | number of bits in bursts
     | usf_p | unused argument ?!?
     [out] | n_errors | number of detected bit-errors
     [out] | n_bits_total | total 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(), ENOTSUP, GSM0503_EGPRS_BURSTS_NBITS, GSM0503_GPRS_BURSTS_NBITS, egprs_cps::mcs, egprs_cps::p, 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] | bursts | caller-allocated buffer for unpacked burst bits
  [in] | l2_data | L2 (MAC) block to be encoded
  [in] | l2_len | length of l2_data in bytes, used to determine MCS

Returns
  number of bits encoded; 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_HDR_TYPE1, EGPRS_HDR_TYPE2, EGPRS_HDR_TYPE3, 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, egprs_cps::mcs, gsm0503_mcs_code::mcs, egprs_cps::p, 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] | bursts | caller-allocated buffer for unpacked burst bits
  [in] | l2_data | L2 (MAC) block to be encoded
  [in] | l2_len | length of l2_data in bytes, used to determine CS

Returns
  number of bits encoded; negative on error

References gsm0503_cs234_crc16, gsm0503_cs2_np, gsm0503_cs3_np, 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, 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] | ra | output buffer for RACH data
  [in] | burst | Input burst data
  [in] | bsic | BSIC 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] | ra | output buffer for RACH data
  [in] | burst | Input burst data
  [in] | bsic | BSIC used in this cell
  [out] | n_errors | Number of detected bit errors
  [out] | n_bits_total | Total 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] | burst | Caller-allocated output burst buffer
  [in] | ra | Input RACH data
  [in] | bsic | BSIC 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] | ra | output buffer for RACH data
  [in] | burst | Input burst data
  [in] | bsic | BSIC 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] | ra | output buffer for RACH data
  [in] | burst | Input burst data
  [in] | bsic | BSIC used in this cell
  [out] | n_errors | Number of detected bit errors
  [out] | n_bits_total | Total 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] | burst | Caller-allocated output burst buffer
  [in] | ra11 | Input RACH data
  [in] | bsic | BSIC used in this cell
  [in] | is_11bit | whether given RA is 11 bit or not

Returns
  0 on success; negative on error

References gsm0503_rach, gsm0503_rach_crc6, gsm0503_rach_ext, 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_info | output buffer for SCH data
  [in] | burst | Input burst data

Returns
  0 on success; negative on error (e.g. CRC error)

References gsm0503_sch, 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] | burst | Caller-allocated output burst buffer
  [in] | sb_info | Input SCH data

Returns
  0 on success; negative on error

## 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_data | Codec frame in RTP payload format
  [in] | bursts | buffer containing the symbols of 8 bursts
  [in] | codec_mode_req | is this CMR (1) or CMC (0)
  [in] | codec | array of active codecs (active codec set)
  [in] | codecs | number of codecs in codec
  | ft | Frame Type; Input if codec_mode_req = 1, Output * otherwise
  [out] | cmr | Output in codec_mode_req = 1
  [out] | n_errors | Number of detected bit errors
  [out] | n_bits_total | Total number of bits

Returns
  (>=4) length of bytes used in tch_data output buffer; ([0,3]) codec out of range; negative on error

References gsm0503_tch_afs_decode_dtx().

## gsm0503_tch_afs_decode_dtx()

int gsm0503_tch_afs_decode_dtx | ( | 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,
|  | uint8_t * | dtx
| ) |  |

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

Parameters

  [out] | tch_data | Codec frame in RTP payload format
  [in] | bursts | buffer containing the symbols of 8 bursts
  [in] | codec_mode_req | is this CMR (1) or CMC (0)
  [in] | codec | array of active codecs (active codec set)
  [in] | codecs | number of codecs in codec
  | ft | Frame Type; Input if codec_mode_req = 1, Output * otherwise
  [out] | cmr | Output in codec_mode_req = 1
  [out] | n_errors | Number of detected bit errors
  [out] | n_bits_total | Total number of bits
  [in,out] | dtx | DTX frame type output, previous DTX frame type input

Returns
  (>=4) length of bytes used in tch_data output buffer; ([0,3]) codec out of range; negative on error

References _xcch_decode_cB(), AFS_ONSET, AFS_SID_FIRST, AFS_SID_UPDATE, AFS_SID_UPDATE_CN, AMR_OTHER, extract_afs_sid_update(), gsm0503_afs_ic_sbit, gsm0503_amr_crc14, gsm0503_amr_crc6, gsm0503_detect_afs_dtx_frame(), gsm0503_tch_afs_10_2, gsm0503_tch_afs_12_2, gsm0503_tch_afs_4_75, gsm0503_tch_afs_5_15, gsm0503_tch_afs_5_9, gsm0503_tch_afs_6_7, gsm0503_tch_afs_7_4, gsm0503_tch_afs_7_95, gsm0503_tch_axs_sid_update, gsm0503_tch_burst_unmap(), gsm0503_tch_fr_deinterleave(), GSM_MACBLOCK_LEN, h, k, len(), osmo_conv_decode_ber(), osmo_crc16gen_check_bits(), osmo_crc8gen_check_bits(), osmo_sbit2ubit(), tch_amr_reassemble(), tch_amr_sid_update_append(), and tch_amr_unmerge().

Referenced by gsm0503_tch_afs_decode().

## 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] | bursts | caller-allocated output buffer for bursts bits
  [in] | tch_data | Codec input data in RTP payload format
  [in] | len | Length of tch_data in bytes
  [in] | codec_mode_req | Use CMR (1) or FT (0)
  [in] | codec | Array of codecs (active codec set)
  [in] | codecs | Number of entries in codec
  [in] | ft | Frame Type to be used for encoding (index to codec)
  [in] | cmr | Codec 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_afs_10_2, gsm0503_tch_afs_12_2, gsm0503_tch_afs_4_75, gsm0503_tch_afs_5_15, gsm0503_tch_afs_5_9, gsm0503_tch_afs_6_7, gsm0503_tch_afs_7_4, gsm0503_tch_afs_7_95, gsm0503_tch_burst_map(), gsm0503_tch_fr_interleave(), GSM_MACBLOCK_LEN, h, len(), 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_data | Codec frame in RTP payload format
  [in] | bursts | buffer containing the symbols of 8 bursts
  [in] | odd | Is this an odd (1) or even (0) frame number?
  [in] | codec_mode_req | is this CMR (1) or CMC (0)
  [in] | codec | array of active codecs (active codec set)
  [in] | codecs | number of codecs in codec
  | ft | Frame Type; Input if codec_mode_req = 1, Output * otherwise
  [out] | cmr | Output in codec_mode_req = 1
  [out] | n_errors | Number of detected bit errors
  [out] | n_bits_total | Total number of bits

Returns
  (>=4) length of bytes used in tch_data output buffer; ([0,3]) codec out of range; negative on error

References gsm0503_tch_ahs_decode_dtx().

## gsm0503_tch_ahs_decode_dtx()

int gsm0503_tch_ahs_decode_dtx | ( | 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,
|  | uint8_t * | dtx
| ) |  |

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

Parameters

  [out] | tch_data | Codec frame in RTP payload format
  [in] | bursts | buffer containing the symbols of 8 bursts
  [in] | odd | Is this an odd (1) or even (0) frame number?
  [in] | codec_mode_req | is this CMR (1) or CMC (0)
  [in] | codec | array of active codecs (active codec set)
  [in] | codecs | number of codecs in codec
  | ft | Frame Type; Input if codec_mode_req = 1, Output * otherwise
  [out] | cmr | Output in codec_mode_req = 1
  [out] | n_errors | Number of detected bit errors
  [out] | n_bits_total | Total number of bits
  [in,out] | dtx | DTX frame type output, previous DTX frame type input

Returns
  (>=4) length of bytes used in tch_data output buffer; ([0,3]) codec out of range; negative on error

References _xcch_decode_cB(), AHS_ONSET, AHS_SID_FIRST_INH, AHS_SID_FIRST_P1, AHS_SID_FIRST_P2, AHS_SID_UPDATE, AHS_SID_UPDATE_CN, AHS_SID_UPDATE_INH, AMR_OTHER, gsm0503_ahs_ic_sbit, gsm0503_amr_crc14, gsm0503_amr_crc6, gsm0503_detect_ahs_dtx_frame(), gsm0503_tch_ahs_4_75, gsm0503_tch_ahs_5_15, gsm0503_tch_ahs_5_9, gsm0503_tch_ahs_6_7, gsm0503_tch_ahs_7_4, gsm0503_tch_ahs_7_95, gsm0503_tch_axs_sid_update, gsm0503_tch_burst_unmap(), gsm0503_tch_fr_deinterleave(), gsm0503_tch_hr_deinterleave(), GSM_MACBLOCK_LEN, h, k, len(), osmo_conv_decode_ber(), osmo_crc16gen_check_bits(), osmo_crc8gen_check_bits(), osmo_sbit2ubit(), tch_amr_reassemble(), tch_amr_sid_update_append(), and tch_amr_unmerge().

Referenced by gsm0503_tch_ahs_decode().

## 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] | bursts | caller-allocated output buffer for bursts bits
  [in] | tch_data | Codec input data in RTP payload format
  [in] | len | Length of tch_data in bytes
  [in] | codec_mode_req | Use CMR (1) or FT (0)
  [in] | codec | Array of codecs (active codec set)
  [in] | codecs | Number of entries in codec
  [in] | ft | Frame Type to be used for encoding (index to codec)
  [in] | cmr | Codec Mode Request (used in codec_mode_req = 1 only)

Returns
  0 in case of success; negative on error

References _xcch_encode_cB(), gsm0503_ahs_ic_ubit, gsm0503_amr_crc6, gsm0503_tch_ahs_4_75, gsm0503_tch_ahs_5_15, gsm0503_tch_ahs_5_9, gsm0503_tch_ahs_6_7, gsm0503_tch_ahs_7_4, gsm0503_tch_ahs_7_95, gsm0503_tch_burst_map(), gsm0503_tch_fr_interleave(), gsm0503_tch_hr_interleave(), GSM_MACBLOCK_LEN, h, len(), 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_data | Codec frame in RTP payload format
  [in] | bursts | buffer containing the symbols of 8 bursts
  [in] | net_order | FIXME
  [in] | efr | Is this channel using EFR (1) or FR (0)
  [out] | n_errors | Number of detected bit errors
  [out] | n_bits_total | Total 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, gsm0503_tch_fr_crc3, gsm0503_tch_fr_deinterleave(), GSM_EFR_BYTES, GSM_FR_BYTES, h, len(), 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] | bursts | caller-allocated output buffer for bursts bits
  [in] | tch_data | Codec input data in RTP payload format
  [in] | len | Length of tch_data in bytes
  [in] | net_order | FIXME

Returns
  0 in case of success; negative on error

References _xcch_encode_cB(), gsm0503_tch_burst_map(), gsm0503_tch_efr_crc8, gsm0503_tch_fr, gsm0503_tch_fr_crc3, gsm0503_tch_fr_interleave(), GSM_EFR_BYTES, GSM_FR_BYTES, GSM_MACBLOCK_LEN, h, len(), 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_data | Codec frame in RTP payload format
  [in] | bursts | buffer containing the symbols of 8 bursts
  [in] | odd | Odd (1) or even (0) frame number
  [out] | n_errors | Number of detected bit errors
  [out] | n_bits_total | Total 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, gsm0503_tch_hr_deinterleave(), GSM_MACBLOCK_LEN, h, 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] | bursts | caller-allocated output buffer for bursts bits
  [in] | tch_data | Codec input data in RTP payload format
  [in] | len | Length 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, gsm0503_tch_hr_interleave(), GSM_MACBLOCK_LEN, h, len(), 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_data | caller-allocated output data buffer
  [in] | bursts | four GSM bursts in soft-bits
  [out] | n_errors | Number of detected errors
  [out] | n_bits_total | Number 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] | bursts | caller-allocated burst data (unpacked bits)
  [in] | l2_data | L2 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] | code | Description of Convolutional Code
  [in] | input | Input soft-bits (-127...127)
  [out] | output | bits
  [out] | n_errors | Number of bit-errors
  [out] | n_bits_total | Number of bits

References osmo_conv_decode_ber_punctured().

Referenced by _egprs_decode_hdr(), _xcch_decode_cB(), gsm0503_pdtch_decode(), gsm0503_tch_afs_decode_dtx(), gsm0503_tch_ahs_decode_dtx(), 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] | code | Description of Convolutional Code
  [in] | input | Input soft-bits (-127...127)
  [out] | output | bits
  [out] | n_errors | Number of bit-errors
  [out] | n_bits_total | Number of bits
  [in] | data_punc | Puncturing mask array. Can be NULL.

References gsm0503_mcs_code::data_punc, 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
| ) |  |

inline static

References start.

Referenced by gsm0503_rach_ext_encode(), and rach_decode_ber().

## 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
| ) |  |

inline static

References gsm0503_rach, gsm0503_rach_crc6, gsm0503_rach_ext, osmo_conv_decode_ber(), osmo_crc8gen_check_bits(), osmo_ubit2pbit_ext(), and rach_apply_bsic().

Referenced by gsm0503_rach_decode(), gsm0503_rach_decode_ber(), gsm0503_rach_ext_decode(), and gsm0503_rach_ext_decode_ber().

## tch_amr_disassemble()

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

static

References len().

Referenced by gsm0503_tch_afs_encode(), and gsm0503_tch_ahs_encode().

## tch_amr_merge()

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

static

References len(), and u.

Referenced by gsm0503_tch_afs_encode(), and gsm0503_tch_ahs_encode().

## tch_amr_reassemble()

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

static

References len().

Referenced by gsm0503_tch_afs_decode_dtx(), and gsm0503_tch_ahs_decode_dtx().

## tch_amr_sid_update_append()

static void tch_amr_sid_update_append | ( | ubit_t * | sid_update,
|  | uint8_t | sti,
|  | uint8_t | mi
| ) |  |

static

References mi.

Referenced by gsm0503_tch_afs_decode_dtx(), and gsm0503_tch_ahs_decode_dtx().

## tch_amr_unmerge()

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

static

References len(), and u.

Referenced by gsm0503_tch_afs_decode_dtx(), and gsm0503_tch_ahs_decode_dtx().

## tch_efr_d_to_w()

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

static

References gsm660_bitorder.

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

References gsm0503_gsm_efr_protected_bits.

Referenced by gsm0503_tch_fr_decode(), and gsm0503_tch_fr_encode().

## 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

References gsm660_bitorder.

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

References gsm610_bitorder.

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

References gsm610_bitorder.

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, k, and l.

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_data | Codec frame in RTP format
  [in] | b_bits | Codec frame in 'native' format
  [in] | net_order | FIXME

References gsm0503_gsm_fr_map, k, and l.

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

References u.

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

References u.

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

References gsm620_unvoiced_bitorder, and gsm620_voiced_bitorder.

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

References gsm620_unvoiced_bitorder, and gsm620_voiced_bitorder.

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

References u.

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

References u.

Referenced by gsm0503_tch_hr_decode().

## Variable Documentation

## gsm0503_amr_dtx_frame_names

const struct value_string gsm0503_amr_dtx_frame_names[]

extern

Referenced by gsm0503_amr_dtx_frame_name().

## gsm0503_mcs_dl_codes

const struct gsm0503_mcs_code gsm0503_mcs_dl_codes[EGPRS_NUM_MCS]

Referenced by egprs_encode_data(), and egprs_encode_hdr().

## gsm0503_mcs_ul_codes

const struct gsm0503_mcs_code gsm0503_mcs_ul_codes[EGPRS_NUM_MCS]

Referenced by _egprs_decode_hdr(), and egprs_decode_data().