Loading...
Searching...
No Matches
gsm0503_coding.c File Reference
Coding
`#include <stdio.h>`
`#include <stdint.h>`
`#include <string.h>`
`#include <stdlib.h>`
`#include <errno.h>`
`#include <osmocom/core/bits.h>`
`#include <osmocom/core/conv.h>`
`#include <osmocom/core/utils.h>`
`#include <osmocom/core/crcgen.h>`
`#include <osmocom/core/endian.h>`
`#include <osmocom/gsm/protocol/gsm_44_060.h>`
`#include <osmocom/gsm/protocol/gsm_04_08.h>`
`#include <osmocom/gsm/gsm0503.h>`
`#include <osmocom/codec/codec.h>`
`#include <osmocom/coding/gsm0503_interleaving.h>`
`#include <osmocom/coding/gsm0503_mapping.h>`
`#include <osmocom/coding/gsm0503_tables.h>`
`#include <osmocom/coding/gsm0503_coding.h>`
`#include <osmocom/coding/gsm0503_parity.h>`
`#include <osmocom/coding/gsm0503_amr_dtx.h>`

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

## Functions

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.
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.
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
static int | _xcch_encode_cB (ubit_t *cB, const uint8_t *l2_data)
| convenience wrapper for encoding to coded bits
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.
int | gsm0503_xcch_encode (ubit_t *bursts, const uint8_t *l2_data)
| Encoding of xCCH data from L2 frame to bursts.
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)
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.
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.
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)
int | gsm0503_pdtch_egprs_encode (ubit_t *bursts, const uint8_t *l2_data, uint8_t l2_len)
| EGPRS DL message encoding.
int | gsm0503_pdtch_encode (ubit_t *bursts, const uint8_t *l2_data, uint8_t l2_len)
| GPRS DL message encoding.
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
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)
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.
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.
int | gsm0503_tch_hr_decode2 (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.
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, deprecated legacy API.
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.
static uint8_t | gsm0503_tch_afs_decode_inband (const sbit_t *cB)
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.
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.
int | gsm0503_tch_afs_encode (ubit_t *bursts, const uint8_t *tch_data, int len, int codec_mode_req, const uint8_t *codec, int codecs, uint8_t ft, uint8_t cmr)
| Perform channel encoding on a TCH/AFS channel according to TS 05.03.
static uint8_t | gsm0503_tch_ahs_decode_inband (const sbit_t *cB)
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/AHS channel according TS 05.03.
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/AHS channel according TS 05.03.
int | gsm0503_tch_ahs_encode (ubit_t *bursts, const uint8_t *tch_data, int len, int codec_mode_req, const uint8_t *codec, int codecs, uint8_t ft, uint8_t cmr)
| Perform channel encoding on a TCH/AHS channel according to TS 05.03.
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)
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.
int | gsm0503_rach_decode (uint8_t *ra, const sbit_t *burst, uint8_t bsic)
| Decode the (8-bit) RACH according to TS 05.03.
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.
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.
int | gsm0503_rach_encode (ubit_t *burst, const uint8_t *ra, uint8_t bsic)
| Encode the (8-bit) RACH according to TS 05.03.
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.
int | gsm0503_sch_decode (uint8_t *sb_info, const sbit_t *burst)
| Decode the SCH according to TS 05.03.
int | gsm0503_sch_encode (ubit_t *burst, const uint8_t *sb_info)
| Encode the SCH according to TS 05.03.
static void | _tch_csd_burst_map (ubit_t *burst, const ubit_t *iB)
int | gsm0503_tch_fr96_encode (ubit_t *bursts, const ubit_t *data)
| Perform channel encoding of a TCH/F9.6 channel as per section 3.3.
int | gsm0503_tch_fr96_decode (ubit_t *data, const sbit_t *bursts, int *n_errors, int *n_bits_total)
| Perform channel decoding of a TCH/F9.6 channel as per section 3.3.
int | gsm0503_tch_fr48_encode (ubit_t *bursts, const ubit_t *data)
| Perform channel encoding of a TCH/F4.8 channel as per section 3.4.
int | gsm0503_tch_fr48_decode (ubit_t *data, const sbit_t *bursts, int *n_errors, int *n_bits_total)
| Perform channel decoding of a TCH/F4.8 channel as per section 3.4.
int | gsm0503_tch_hr48_encode (ubit_t *bursts, const ubit_t *data)
| Perform channel encoding of a TCH/H4.8 channel as per section 3.5.
int | gsm0503_tch_hr48_decode (ubit_t *data, const sbit_t *bursts, int *n_errors, int *n_bits_total)
| Perform channel decoding of a TCH/H4.8 channel as per section 3.5.
int | gsm0503_tch_fr24_encode (ubit_t *bursts, const ubit_t *data)
| Perform channel encoding of a TCH/F2.4 channel as per section 3.6.
int | gsm0503_tch_fr24_decode (ubit_t *data, const sbit_t *bursts, int *n_errors, int *n_bits_total)
| Perform channel decoding of a TCH/F2.4 channel as per section 3.6.
int | gsm0503_tch_hr24_encode (ubit_t *bursts, const ubit_t *data)
| Perform channel encoding of a TCH/H2.4 channel as per section 3.7.
int | gsm0503_tch_hr24_decode (ubit_t *data, const sbit_t *bursts, int *n_errors, int *n_bits_total)
| Perform channel decoding of a TCH/H2.4 channel as per section 3.7.
int | gsm0503_tch_fr144_encode (ubit_t *bursts, const ubit_t *data)
| Perform channel encoding of a TCH/F14.4 channel as per section 3.8.
int | gsm0503_tch_fr144_decode (ubit_t *data, const sbit_t *bursts, int *n_errors, int *n_bits_total)
| Perform channel decoding of a TCH/14.4 channel as per section 3.8.
int | gsm0503_tch_fr_facch_encode (ubit_t *bursts, const uint8_t *data)
| Perform channel encoding of a FACCH/F data as per section 4.2.
int | gsm0503_tch_fr_facch_decode (uint8_t *data, const sbit_t *bursts, int *n_errors, int *n_bits_total)
| Perform channel decoding of a FACCH/F data as per section 4.2.
int | gsm0503_tch_hr_facch_encode (ubit_t *bursts, const uint8_t *data)
| Perform channel encoding of a FACCH/H data as per section 4.3.
int | gsm0503_tch_hr_facch_decode (uint8_t *data, const sbit_t *bursts, int *n_errors, int *n_bits_total)
| Perform channel decoding of a FACCH/H data as per section 4.3.

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