libosmogsm 1.9.0.196-9975
Osmocom GSM library
gprs_rlc.c File Reference

helper functions for (E)GPRS RLC according to 3GPP TS 44.060. More...

#include <errno.h>
#include <string.h>
#include <osmocom/core/utils.h>
#include <osmocom/coding/gsm0503_coding.h>
#include <osmocom/gsm/protocol/gsm_44_060.h>

Data Structures

struct  gprs_cs_desc
 

Macros

#define EGPRS_CPS_TYPE1_TBL_SZ   29
 
#define EGPRS_CPS_TYPE2_TBL_SZ   8
 
#define EGPRS_CPS_TYPE3_TBL_SZ   16
 

Functions

int egprs_get_cps (struct egprs_cps *cps, uint8_t type, uint8_t bits)
 
int osmo_gprs_ul_block_size_bits (enum osmo_gprs_cs cs)
 Return size of (E)GPRS uplink block for given coding scheme in bits. More...
 
int osmo_gprs_dl_block_size_bits (enum osmo_gprs_cs cs)
 Return size of (E)GPRS downlink block for given coding scheme in bits. More...
 
int osmo_gprs_ul_block_size_bytes (enum osmo_gprs_cs cs)
 Return size of (E)GPRS uplink block for given coding scheme in bytes. More...
 
int osmo_gprs_dl_block_size_bytes (enum osmo_gprs_cs cs)
 Return size of (E)GPRS downlink block for given coding scheme in bytes. More...
 
enum osmo_gprs_cs osmo_gprs_ul_cs_by_block_bytes (uint8_t block_size)
 Return coding scheme for given (E)GPRS uplink block size. More...
 
enum osmo_gprs_cs osmo_gprs_dl_cs_by_block_bytes (uint8_t block_size)
 Return coding scheme for given (E)GPRS downlink block size. More...
 

Variables

static const struct egprs_cps egprs_cps_table_type1 [EGPRS_CPS_TYPE1_TBL_SZ]
 
static const struct egprs_cps egprs_cps_table_type2 [EGPRS_CPS_TYPE2_TBL_SZ]
 
static const struct egprs_cps egprs_cps_table_type3 [EGPRS_CPS_TYPE3_TBL_SZ]
 
const struct gprs_cs_desc gprs_cs_desc [_NUM_OSMO_GPRS_CS]
 

Detailed Description

helper functions for (E)GPRS RLC according to 3GPP TS 44.060.

(C) 2016 by Thomas Thou (C) 2016-2017 by sysmocom - s.f.m.c. GmbH (C) 2017 by Harald Welte lafor.nosp@m.ge@g.nosp@m.numon.nosp@m.ks.o.nosp@m.rg All Rights Reserved.

SPDX-License-Identifier: GPL-2.0+

Macro Definition Documentation

◆ EGPRS_CPS_TYPE1_TBL_SZ

#define EGPRS_CPS_TYPE1_TBL_SZ   29

◆ EGPRS_CPS_TYPE2_TBL_SZ

#define EGPRS_CPS_TYPE2_TBL_SZ   8

◆ EGPRS_CPS_TYPE3_TBL_SZ

#define EGPRS_CPS_TYPE3_TBL_SZ   16

Function Documentation

◆ egprs_get_cps()

◆ osmo_gprs_dl_block_size_bits()

int osmo_gprs_dl_block_size_bits ( enum osmo_gprs_cs  cs)

Return size of (E)GPRS downlink block for given coding scheme in bits.

References ARRAY_SIZE, gprs_cs_desc::bits, gprs_cs_desc::bytes, and gprs_cs_desc::downlink.

◆ osmo_gprs_dl_block_size_bytes()

int osmo_gprs_dl_block_size_bytes ( enum osmo_gprs_cs  cs)

Return size of (E)GPRS downlink block for given coding scheme in bytes.

References ARRAY_SIZE, gprs_cs_desc::bytes, and gprs_cs_desc::downlink.

Referenced by osmo_gprs_dl_cs_by_block_bytes().

◆ osmo_gprs_dl_cs_by_block_bytes()

enum osmo_gprs_cs osmo_gprs_dl_cs_by_block_bytes ( uint8_t  block_size)

Return coding scheme for given (E)GPRS downlink block size.

References ARRAY_SIZE, OSMO_GPRS_CS_NONE, and osmo_gprs_dl_block_size_bytes().

◆ osmo_gprs_ul_block_size_bits()

int osmo_gprs_ul_block_size_bits ( enum osmo_gprs_cs  cs)

Return size of (E)GPRS uplink block for given coding scheme in bits.

References ARRAY_SIZE, gprs_cs_desc::bits, gprs_cs_desc::bytes, and gprs_cs_desc::uplink.

◆ osmo_gprs_ul_block_size_bytes()

int osmo_gprs_ul_block_size_bytes ( enum osmo_gprs_cs  cs)

Return size of (E)GPRS uplink block for given coding scheme in bytes.

References ARRAY_SIZE, gprs_cs_desc::bytes, and gprs_cs_desc::uplink.

Referenced by osmo_gprs_ul_cs_by_block_bytes().

◆ osmo_gprs_ul_cs_by_block_bytes()

enum osmo_gprs_cs osmo_gprs_ul_cs_by_block_bytes ( uint8_t  block_size)

Return coding scheme for given (E)GPRS uplink block size.

References ARRAY_SIZE, OSMO_GPRS_CS_NONE, and osmo_gprs_ul_block_size_bytes().

Variable Documentation

◆ egprs_cps_table_type1

const struct egprs_cps egprs_cps_table_type1[EGPRS_CPS_TYPE1_TBL_SZ]
static

Referenced by egprs_get_cps().

◆ egprs_cps_table_type2

const struct egprs_cps egprs_cps_table_type2[EGPRS_CPS_TYPE2_TBL_SZ]
static
Initial value:
= {
{ .bits = 0, .mcs = EGPRS_MCS6, .p = { EGPRS_CPS_P1, EGPRS_CPS_NONE } },
{ .bits = 1, .mcs = EGPRS_MCS6, .p = { EGPRS_CPS_P2, EGPRS_CPS_NONE } },
{ .bits = 2, .mcs = EGPRS_MCS6, .p = { EGPRS_CPS_P1, EGPRS_CPS_NONE } },
{ .bits = 3, .mcs = EGPRS_MCS6, .p = { EGPRS_CPS_P2, EGPRS_CPS_NONE } },
{ .bits = 4, .mcs = EGPRS_MCS5, .p = { EGPRS_CPS_P1, EGPRS_CPS_NONE } },
{ .bits = 5, .mcs = EGPRS_MCS5, .p = { EGPRS_CPS_P2, EGPRS_CPS_NONE } },
{ .bits = 6, .mcs = EGPRS_MCS6, .p = { EGPRS_CPS_P1, EGPRS_CPS_NONE } },
{ .bits = 7, .mcs = EGPRS_MCS6, .p = { EGPRS_CPS_P2, EGPRS_CPS_NONE } },
}
EGPRS_MCS6
EGPRS_MCS5
@ EGPRS_CPS_NONE
Definition: gsm_44_060.h:217
@ EGPRS_CPS_P2
Definition: gsm_44_060.h:215
@ EGPRS_CPS_P1
Definition: gsm_44_060.h:214

Referenced by egprs_get_cps().

◆ egprs_cps_table_type3

const struct egprs_cps egprs_cps_table_type3[EGPRS_CPS_TYPE3_TBL_SZ]
static
Initial value:
= {
{ .bits = 0, .mcs = EGPRS_MCS4, .p = { EGPRS_CPS_P1, EGPRS_CPS_NONE } },
{ .bits = 1, .mcs = EGPRS_MCS4, .p = { EGPRS_CPS_P2, EGPRS_CPS_NONE } },
{ .bits = 2, .mcs = EGPRS_MCS4, .p = { EGPRS_CPS_P3, EGPRS_CPS_NONE } },
{ .bits = 3, .mcs = EGPRS_MCS3, .p = { EGPRS_CPS_P1, EGPRS_CPS_NONE } },
{ .bits = 4, .mcs = EGPRS_MCS3, .p = { EGPRS_CPS_P2, EGPRS_CPS_NONE } },
{ .bits = 5, .mcs = EGPRS_MCS3, .p = { EGPRS_CPS_P3, EGPRS_CPS_NONE } },
{ .bits = 6, .mcs = EGPRS_MCS3, .p = { EGPRS_CPS_P1, EGPRS_CPS_NONE } },
{ .bits = 7, .mcs = EGPRS_MCS3, .p = { EGPRS_CPS_P2, EGPRS_CPS_NONE } },
{ .bits = 8, .mcs = EGPRS_MCS3, .p = { EGPRS_CPS_P3, EGPRS_CPS_NONE } },
{ .bits = 9, .mcs = EGPRS_MCS2, .p = { EGPRS_CPS_P1, EGPRS_CPS_NONE } },
{ .bits = 10, .mcs = EGPRS_MCS2, .p = { EGPRS_CPS_P2, EGPRS_CPS_NONE } },
{ .bits = 11, .mcs = EGPRS_MCS1, .p = { EGPRS_CPS_P1, EGPRS_CPS_NONE } },
{ .bits = 12, .mcs = EGPRS_MCS1, .p = { EGPRS_CPS_P2, EGPRS_CPS_NONE } },
{ .bits = 13, .mcs = EGPRS_MCS2, .p = { EGPRS_CPS_P1, EGPRS_CPS_NONE } },
{ .bits = 14, .mcs = EGPRS_MCS2, .p = { EGPRS_CPS_P2, EGPRS_CPS_NONE } },
{ .bits = 15, .mcs = EGPRS_MCS0, .p = { EGPRS_CPS_NONE, EGPRS_CPS_NONE } },
}
EGPRS_MCS3
EGPRS_MCS2
EGPRS_MCS4
EGPRS_MCS1
EGPRS_MCS0
@ EGPRS_CPS_P3
Definition: gsm_44_060.h:216

Referenced by egprs_get_cps().

◆ gprs_cs_desc

Initial value:
= {
[OSMO_GPRS_CS1] = { {23, 0}, {23, 0} },
[OSMO_GPRS_CS2] = { {33, 7}, {33, 7} },
[OSMO_GPRS_CS3] = { {39, 3}, {39, 3} },
[OSMO_GPRS_CS4] = { {53, 7}, {53, 7} },
[OSMO_GPRS_MCS1] = { {26, 1}, {26, 1} },
[OSMO_GPRS_MCS2] = { {32, 1}, {32, 1} },
[OSMO_GPRS_MCS3] = { {41, 1}, {41, 1} },
[OSMO_GPRS_MCS4] = { {48, 1}, {48, 1} },
[OSMO_GPRS_MCS5] = { {60, 7}, {59, 6} },
[OSMO_GPRS_MCS6] = { {78, 7}, {77, 6} },
[OSMO_GPRS_MCS7] = { {118, 2}, {117, 4} },
[OSMO_GPRS_MCS8] = { {142, 2}, {141, 4} },
[OSMO_GPRS_MCS9] = { {154, 2}, {153, 4} },
}
@ OSMO_GPRS_MCS3
Definition: gsm_44_060.h:235
@ OSMO_GPRS_MCS4
Definition: gsm_44_060.h:236
@ OSMO_GPRS_CS4
Definition: gsm_44_060.h:232
@ OSMO_GPRS_MCS6
Definition: gsm_44_060.h:238
@ OSMO_GPRS_MCS9
Definition: gsm_44_060.h:241
@ OSMO_GPRS_CS3
Definition: gsm_44_060.h:231
@ OSMO_GPRS_MCS2
Definition: gsm_44_060.h:234
@ OSMO_GPRS_CS1
Definition: gsm_44_060.h:229
@ OSMO_GPRS_MCS5
Definition: gsm_44_060.h:237
@ OSMO_GPRS_MCS7
Definition: gsm_44_060.h:239
@ OSMO_GPRS_CS2
Definition: gsm_44_060.h:230
@ OSMO_GPRS_MCS8
Definition: gsm_44_060.h:240
@ OSMO_GPRS_MCS1
Definition: gsm_44_060.h:233